/**!
 * IMPORTANT NOTE:
 *    This file is licensed only for use in providing the iCloud
 *    service or any part thereof, and is subject to the iCloud
 *    Terms and Conditions. You may not port this file to another
 *    platform without Apple's written consent.
 *
 *    Portions of this Apple Software may utilize copyrighted material under open source licenses.
 *    Please see the file at https://www.icloud.com/system/icloud.com/2608Build39/en-us/acknowledgements.txt for licensing information.
 */
!function(e){const t="object"==typeof globalThis&&globalThis||"object"==typeof window&&window||"object"==typeof self&&self;try{const{performance:o,Promise:n,MessageChannel:s,requestAnimationFrame:r}=t;if(!(o&&o.mark&&n&&s&&r))return;const a=t=>o.mark("chunk-"+e+"-"+t);let c=!1,f=!1,i=n.resolve();a("exec-start");for(let e=0;e<5;e++)i=i.then();i.then((()=>{a("exec-sync-end")}));if("undefined"!=typeof window){let e=()=>{c&&!f&&(a("after-paint"),f=!0)},t=new s;t.port1.onmessage=e,t.port2.postMessage(null),setTimeout(e),r((()=>{c=!0,a("raf"),t.port2.postMessage(null),setTimeout(e)}))}}catch(e){t.__jsPerformanceMarksError=e}}("RootComponentRoute");(window["__LOADABLE_LOADED_CHUNKS__"] = window["__LOADABLE_LOADED_CHUNKS__"] || []).push([[2],{

/***/ 1597:
/*!**************************************************!*\
  !*** ./src/Legacy/Routes/RootComponentRoute.tsx ***!
  \**************************************************/
/*! exports provided: default */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is referenced from these modules with unsupported syntax: ./src/Legacy/Routes/ModularizedRoutes.tsx (referenced with import(), require.resolve) */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return RootComponentRoute; });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 870);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _Components_RootComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Components/RootComponent */ 1598);


function RootComponentRoute(props) {
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_Components_RootComponent__WEBPACK_IMPORTED_MODULE_1__[/* RootComponent */ "a"], props);
}

/***/ }),

/***/ 1598:
/*!*************************************************!*\
  !*** ./src/Legacy/Components/RootComponent.tsx ***!
  \*************************************************/
/*! exports provided: RootComponent */
/*! exports used: RootComponent */
/*! ModuleConcatenation bailout: Module uses eval() */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return RootComponent; });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 870);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _apple_ui_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @apple/ui-components */ 2262);
/* harmony import */ var _Resources_Styles_RootComponent_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Resources/Styles/RootComponent.scss */ 1599);
/* harmony import */ var _Components_LoadChildApplicationRoute_LoadChildApplicationRoute__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Components/LoadChildApplicationRoute/LoadChildApplicationRoute */ 2301);
/* harmony import */ var _Components_LoadChildApplicationADPBlockedRoute_LoadChildApplicationADPBlockedRoute__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Components/LoadChildApplicationADPBlockedRoute/LoadChildApplicationADPBlockedRoute */ 2300);
/* harmony import */ var _Contexts_ContactsLookupProvider__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Contexts/ContactsLookupProvider */ 1633);
/* harmony import */ var _Components_HomeLoginRoute__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Components/HomeLoginRoute */ 1683);
/* harmony import */ var _NotificationPresenter__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./NotificationPresenter */ 2247);
/* harmony import */ var _Hooks_usePreventUnloadWithUnsavedChanges__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Hooks/usePreventUnloadWithUnsavedChanges */ 1635);
/* harmony import */ var _Authentication_AuthenticationHook__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Authentication/AuthenticationHook */ 1330);
/* harmony import */ var _Hooks__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../Hooks */ 1227);
/* harmony import */ var _NavLinks_LegacyNavLinks__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../NavLinks/LegacyNavLinks */ 1262);
/* harmony import */ var _Components_TileData_AppStartupData__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../Components/TileData/AppStartupData */ 1636);
/* harmony import */ var _ChildApplication_ApplicationConfigurations_DriveApplicationConfiguration__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../ChildApplication/ApplicationConfigurations/DriveApplicationConfiguration */ 1204);
/* harmony import */ var _Banner__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./Banner */ 2304);
/* harmony import */ var _Telemetry_TelemetryCategory__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../Telemetry/TelemetryCategory */ 920);
/* harmony import */ var _Telemetry_Stat__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../Telemetry/Stat */ 919);
/* harmony import */ var _Environment_CloudOSParameters__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../Environment/CloudOSParameters */ 2241);
/* harmony import */ var _loadable_component__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! @loadable/component */ 1433);
/* harmony import */ var _Services_AuthService__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../../Services/AuthService */ 2155);
/* harmony import */ var _Utils_loadableComponentUtils__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../../Utils/loadableComponentUtils */ 1442);
/* harmony import */ var _RootComponentRoutePages__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./RootComponentRoutePages */ 2133);
/* harmony import */ var _ComponentsGeneric_ChunkLoadingPage_ChunkLoadingPage__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../../ComponentsGeneric/ChunkLoadingPage/ChunkLoadingPage */ 2302);
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
























// FIXME: add a shared function like loadableWithRetry
const HomePageRoute = Object(_loadable_component__WEBPACK_IMPORTED_MODULE_18__[/* default */ "a"])({
  resolved: {},
  chunkName() {
    return "Routes-HomePageRoute";
  },
  isReady(props) {
    const key = this.resolve(props);
    if (this.resolved[key] !== true) {
      return false;
    }
    if (true) {
      return !!__webpack_require__.m[key];
    }
    return false;
  },
  importAsync: () => Object(_Utils_loadableComponentUtils__WEBPACK_IMPORTED_MODULE_20__[/* retry */ "a"])(() => Promise.all(/*! import() | Routes-HomePageRoute */[__webpack_require__.e(4), __webpack_require__.e(1)]).then(__webpack_require__.bind(null, /*! ../Routes/HomePageRoute */ 2141))),
  requireAsync(props) {
    const key = this.resolve(props);
    this.resolved[key] = false;
    return this.importAsync(props).then(resolved => {
      this.resolved[key] = true;
      return resolved;
    });
  },
  requireSync(props) {
    const id = this.resolve(props);
    if (true) {
      return __webpack_require__(id);
    }
    return eval('module.require')(id);
  },
  resolve() {
    if (true) {
      return /*require.resolve*/(/*! ../Routes/HomePageRoute */ 2141);
    }
    return eval('require.resolve')("../Routes/HomePageRoute");
  }
});
const LegacyShareAcceptanceRoute = Object(_loadable_component__WEBPACK_IMPORTED_MODULE_18__[/* default */ "a"])({
  resolved: {},
  chunkName() {
    return "Routes-LegacyShareAcceptanceRoute";
  },
  isReady(props) {
    const key = this.resolve(props);
    if (this.resolved[key] !== true) {
      return false;
    }
    if (true) {
      return !!__webpack_require__.m[key];
    }
    return false;
  },
  importAsync: () => Object(_Utils_loadableComponentUtils__WEBPACK_IMPORTED_MODULE_20__[/* retry */ "a"])(() => Promise.all(/*! import() | Routes-LegacyShareAcceptanceRoute */[__webpack_require__.e(8), __webpack_require__.e(12)]).then(__webpack_require__.bind(null, /*! ../Routes/LegacyShareAcceptanceRoute */ 2082))),
  requireAsync(props) {
    const key = this.resolve(props);
    this.resolved[key] = false;
    return this.importAsync(props).then(resolved => {
      this.resolved[key] = true;
      return resolved;
    });
  },
  requireSync(props) {
    const id = this.resolve(props);
    if (true) {
      return __webpack_require__(id);
    }
    return eval('module.require')(id);
  },
  resolve() {
    if (true) {
      return /*require.resolve*/(/*! ../Routes/LegacyShareAcceptanceRoute */ 2082);
    }
    return eval('require.resolve')("../Routes/LegacyShareAcceptanceRoute");
  }
});
const CKShareAcceptanceRoute = Object(_loadable_component__WEBPACK_IMPORTED_MODULE_18__[/* default */ "a"])({
  resolved: {},
  chunkName() {
    return "Routes-CKShareAcceptanceRoute";
  },
  isReady(props) {
    const key = this.resolve(props);
    if (this.resolved[key] !== true) {
      return false;
    }
    if (true) {
      return !!__webpack_require__.m[key];
    }
    return false;
  },
  importAsync: () => Object(_Utils_loadableComponentUtils__WEBPACK_IMPORTED_MODULE_20__[/* retry */ "a"])(() => Promise.all(/*! import() | Routes-CKShareAcceptanceRoute */[__webpack_require__.e(8), __webpack_require__.e(13)]).then(__webpack_require__.bind(null, /*! ../Routes/CKShareAcceptanceRoute */ 2087))),
  requireAsync(props) {
    const key = this.resolve(props);
    this.resolved[key] = false;
    return this.importAsync(props).then(resolved => {
      this.resolved[key] = true;
      return resolved;
    });
  },
  requireSync(props) {
    const id = this.resolve(props);
    if (true) {
      return __webpack_require__(id);
    }
    return eval('module.require')(id);
  },
  resolve() {
    if (true) {
      return /*require.resolve*/(/*! ../Routes/CKShareAcceptanceRoute */ 2087);
    }
    return eval('require.resolve')("../Routes/CKShareAcceptanceRoute");
  }
});
const UnauthedShareRoute = Object(_loadable_component__WEBPACK_IMPORTED_MODULE_18__[/* default */ "a"])({
  resolved: {},
  chunkName() {
    return "Routes-UnauthedShareRoute";
  },
  isReady(props) {
    const key = this.resolve(props);
    if (this.resolved[key] !== true) {
      return false;
    }
    if (true) {
      return !!__webpack_require__.m[key];
    }
    return false;
  },
  importAsync: () => Object(_Utils_loadableComponentUtils__WEBPACK_IMPORTED_MODULE_20__[/* retry */ "a"])(() => __webpack_require__.e(/*! import() | Routes-UnauthedShareRoute */ 9).then(__webpack_require__.bind(null, /*! ../Routes/UnauthedShareRoute */ 2088))),
  requireAsync(props) {
    const key = this.resolve(props);
    this.resolved[key] = false;
    return this.importAsync(props).then(resolved => {
      this.resolved[key] = true;
      return resolved;
    });
  },
  requireSync(props) {
    const id = this.resolve(props);
    if (true) {
      return __webpack_require__(id);
    }
    return eval('module.require')(id);
  },
  resolve() {
    if (true) {
      return /*require.resolve*/(/*! ../Routes/UnauthedShareRoute */ 2088);
    }
    return eval('require.resolve')("../Routes/UnauthedShareRoute");
  }
});
const CalendarEventReplyRoute = Object(_loadable_component__WEBPACK_IMPORTED_MODULE_18__[/* default */ "a"])({
  resolved: {},
  chunkName() {
    return "Routes-CalendarEventReplyRoute";
  },
  isReady(props) {
    const key = this.resolve(props);
    if (this.resolved[key] !== true) {
      return false;
    }
    if (true) {
      return !!__webpack_require__.m[key];
    }
    return false;
  },
  importAsync: () => Object(_Utils_loadableComponentUtils__WEBPACK_IMPORTED_MODULE_20__[/* retry */ "a"])(() => __webpack_require__.e(/*! import() | Routes-CalendarEventReplyRoute */ 5).then(__webpack_require__.bind(null, /*! ../Routes/CalendarEventReplyRoute */ 2147))),
  requireAsync(props) {
    const key = this.resolve(props);
    this.resolved[key] = false;
    return this.importAsync(props).then(resolved => {
      this.resolved[key] = true;
      return resolved;
    });
  },
  requireSync(props) {
    const id = this.resolve(props);
    if (true) {
      return __webpack_require__(id);
    }
    return eval('module.require')(id);
  },
  resolve() {
    if (true) {
      return /*require.resolve*/(/*! ../Routes/CalendarEventReplyRoute */ 2147);
    }
    return eval('require.resolve')("../Routes/CalendarEventReplyRoute");
  }
});
function RootContent(props) {
  var _useCloudOSUser;
  const rootState = props.rootState;
  const isBeneficiary = (_useCloudOSUser = Object(_Authentication_AuthenticationHook__WEBPACK_IMPORTED_MODULE_9__[/* useCloudOSUser */ "b"])()) === null || _useCloudOSUser === void 0 || (_useCloudOSUser = _useCloudOSUser.details) === null || _useCloudOSUser === void 0 || (_useCloudOSUser = _useCloudOSUser.beneficiaryInfo) === null || _useCloudOSUser === void 0 ? void 0 : _useCloudOSUser.isBeneficiary;
  react__WEBPACK_IMPORTED_MODULE_0__["useLayoutEffect"](() => {
    // Disable scrolling on <body> in child apps, so pull down on mobile devices doesn't trigger
    // browser refresh.
    // See rdar://104674482 (Swiping down causes page reload in Photos).
    if (rootState.kind === "child-application") {
      document.body.classList.add("disable-scroll");
    } else {
      document.body.classList.remove("disable-scroll");
    }
  }, [rootState]);
  switch (rootState.kind) {
    case "load-child-application-adp-blocked":
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_Components_LoadChildApplicationADPBlockedRoute_LoadChildApplicationADPBlockedRoute__WEBPACK_IMPORTED_MODULE_4__[/* LoadChildApplicationADPBlockedRoute */ "a"], {
        className: props.className,
        applicationIdentifier: rootState.applicationIdentifier,
        pcsKeyIdentifier: rootState.pcsKeyIdentifier,
        onComplete: rootState.onComplete
      });
    case "load-child-application":
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_Components_LoadChildApplicationRoute_LoadChildApplicationRoute__WEBPACK_IMPORTED_MODULE_3__[/* LoadChildApplicationRoute */ "a"], {
        className: props.className,
        applicationIdentifier: rootState.applicationIdentifier,
        hadError: rootState.hadError
      });
    case "unauthed-share":
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](UnauthedShareRoute, {
        onSignInPressed: rootState.onSignInPressed,
        shareRecord: rootState.shareRecord,
        className: props.className,
        fallback: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_ComponentsGeneric_ChunkLoadingPage_ChunkLoadingPage__WEBPACK_IMPORTED_MODULE_22__[/* ChunkLoadingPage */ "a"], null)
      });
    case "redirect-to-domain":
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_RootComponentRoutePages__WEBPACK_IMPORTED_MODULE_21__[/* RedirectToDomainRoute */ "i"], {
        className: props.className,
        pageProps: rootState.pageProps
      });
    case "springboard":
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](HomePageRoute, {
        initiallyInCustomizeMode: rootState.initiallyInCustomizeMode,
        className: props.className
      });
    case "ck-share-acceptance":
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](CKShareAcceptanceRoute, {
        className: props.className,
        ckShareRecord: rootState.ckShareRecord,
        isAuthenticated: rootState.isAuthenticated,
        onSignInPressed: rootState.onSignInPressed,
        fallback: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_ComponentsGeneric_ChunkLoadingPage_ChunkLoadingPage__WEBPACK_IMPORTED_MODULE_22__[/* ChunkLoadingPage */ "a"], null)
      });
    case "share-acceptance":
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](LegacyShareAcceptanceRoute, {
        className: props.className,
        shareRecord: rootState.shareRecord,
        isAuthenticated: rootState.isAuthenticated,
        fallback: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_ComponentsGeneric_ChunkLoadingPage_ChunkLoadingPage__WEBPACK_IMPORTED_MODULE_22__[/* ChunkLoadingPage */ "a"], null)
      });
    case "share-acceptance-error":
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_RootComponentRoutePages__WEBPACK_IMPORTED_MODULE_21__[/* ShareAcceptanceErrorRoute */ "k"], _extends({
        className: props.className
      }, rootState));
    case "ck-reminders-template":
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_RootComponentRoutePages__WEBPACK_IMPORTED_MODULE_21__[/* CKRemindersTemplateRoute */ "b"], {
        className: props.className,
        pageProps: rootState.remindersTemplatePageProps
      });
    case "mail-email-view":
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_RootComponentRoutePages__WEBPACK_IMPORTED_MODULE_21__[/* MailEmailView */ "f"], {
        threadId: rootState.threadId
      });
    case "calendar-event-view":
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_RootComponentRoutePages__WEBPACK_IMPORTED_MODULE_21__[/* CalendarEventView */ "c"], {
        eventId: rootState.eventId,
        collectionId: rootState.collectionId
      });
    case "calendar-event-reply":
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](CalendarEventReplyRoute, {
        className: props.className,
        isAuthenticated: rootState.isAuthenticated,
        details: rootState.details,
        fallback: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_ComponentsGeneric_ChunkLoadingPage_ChunkLoadingPage__WEBPACK_IMPORTED_MODULE_22__[/* ChunkLoadingPage */ "a"], null)
      });
    case "mail-drop":
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_RootComponentRoutePages__WEBPACK_IMPORTED_MODULE_21__[/* MailDropRoute */ "e"], {
        className: props.className,
        isAuthenticated: rootState.isAuthenticated,
        details: rootState.details
      });
    case "terms-and-conditions":
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_RootComponentRoutePages__WEBPACK_IMPORTED_MODULE_21__[/* TermsAndConditionsRoute */ "n"], {
        className: props.className,
        pageProps: rootState.pageProps
      });
    case "terms-and-conditions-confirmation":
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_RootComponentRoutePages__WEBPACK_IMPORTED_MODULE_21__[/* TermsAndConditionsConfirmationRoute */ "m"], {
        wasTermsUpdatePerformed: rootState.wasTermsUpdatePerformed,
        onDismiss: rootState.onDismiss
      });
    case _NavLinks_LegacyNavLinks__WEBPACK_IMPORTED_MODULE_11__[/* LegacyNavRoutes */ "b"].plan:
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_RootComponentRoutePages__WEBPACK_IMPORTED_MODULE_21__[/* PlanPageRoute */ "g"], {
        className: props.className,
        isBeneficiary: isBeneficiary
      });
    case _NavLinks_LegacyNavLinks__WEBPACK_IMPORTED_MODULE_11__[/* LegacyNavRoutes */ "b"].storage:
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_RootComponentRoutePages__WEBPACK_IMPORTED_MODULE_21__[/* StoragePageRoute */ "l"], {
        className: props.className,
        isBeneficiary: isBeneficiary
      });
    case _NavLinks_LegacyNavLinks__WEBPACK_IMPORTED_MODULE_11__[/* LegacyNavRoutes */ "b"].recovery:
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_RootComponentRoutePages__WEBPACK_IMPORTED_MODULE_21__[/* RecoveryPageRoute */ "h"], {
        className: props.className
      });
    case _NavLinks_LegacyNavLinks__WEBPACK_IMPORTED_MODULE_11__[/* LegacyNavRoutes */ "b"].icloudplus:
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_RootComponentRoutePages__WEBPACK_IMPORTED_MODULE_21__[/* ICloudPlusPageRoute */ "d"], {
        className: props.className
      });
    case _NavLinks_LegacyNavLinks__WEBPACK_IMPORTED_MODULE_11__[/* LegacyNavRoutes */ "b"].settings:
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_RootComponentRoutePages__WEBPACK_IMPORTED_MODULE_21__[/* SettingsPageRoute */ "j"], {
        className: props.className
      });
    case "web-access-blocked":
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_RootComponentRoutePages__WEBPACK_IMPORTED_MODULE_21__[/* WebAccessBlockedPageRoute */ "p"], {
        className: props.className,
        onComplete: rootState.onComplete
      });
    case "account-maintenance":
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_RootComponentRoutePages__WEBPACK_IMPORTED_MODULE_21__[/* AccountMaintenancePageRoute */ "a"], {
        className: props.className
      });
    case "waiting-for-pcs-keys":
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_RootComponentRoutePages__WEBPACK_IMPORTED_MODULE_21__[/* WaitingForPCSKeysRoute */ "o"], {
        className: props.className
      });
    default:
      if (false) {}
      return null;
  }
}
function RootComponent(props) {
  Object(_Hooks_usePreventUnloadWithUnsavedChanges__WEBPACK_IMPORTED_MODULE_8__[/* usePreventUnloadWithUnsavedChanges */ "a"])(!!props.hasChildApplicationWithUnsavedChanges);
  const rootElementRef = react__WEBPACK_IMPORTED_MODULE_0__["useRef"](null);
  const loginProps = react__WEBPACK_IMPORTED_MODULE_0__["useRef"]();
  switch (props.rootState.kind) {
    case "home-login":
      // If there is already auth widget which is rendered, then we do not want to reload it.
      if (!loginProps.current) {
        loginProps.current = props.homeLoginProps;
      }
      break;
  }
  const remoteViewControllersRef = react__WEBPACK_IMPORTED_MODULE_0__["useRef"]([]);

  // Even if the early child is ever unmounted, we want to return the same
  // markup for the entire lifetime of the application. If instead we removed
  // the early child from the React tree in the event that the early child
  // crashes, React would try to commit the removal to DOM, which would crash
  // CloudOS since the crashed app's RVC will already have removed it.
  const [earlyChild] = react__WEBPACK_IMPORTED_MODULE_0__["useState"](() => document.getElementById("early-child"));
  const [earlyChildMarkup] = react__WEBPACK_IMPORTED_MODULE_0__["useState"](() => {
    if (!earlyChild) {
      return null;
    }
    return (
      /*#__PURE__*/
      // The title will be set in a locale-aware way after hydration.
      // The markup here has to exactly match what init.js created.
      // eslint-disable-next-line jsx-a11y/iframe-has-title -- see above
      react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("iframe", {
        id: "early-child",
        src: earlyChild.src,
        className: earlyChild.className,
        "data-name": earlyChild.getAttribute("data-name")
      })
    );
  });
  const [initialLoadState] = react__WEBPACK_IMPORTED_MODULE_0__["useState"](earlyChild ? "initial-load-with-early-child" : "initial-load");
  react__WEBPACK_IMPORTED_MODULE_0__["useEffect"](() => () => {
    // Upon unmounting RootComponent, make sure that we don't leave any
    // dangling listeners.
    earlyChild === null || earlyChild === void 0 || earlyChild.__data.onHydrate();
  }, [earlyChild]);
  const rootContentId = react__WEBPACK_IMPORTED_MODULE_0__["useRef"](1);
  const currentRootStateRef = react__WEBPACK_IMPORTED_MODULE_0__["useRef"]({
    kind: initialLoadState
  });
  const [previousRootContent, setPreviousRootContent] = react__WEBPACK_IMPORTED_MODULE_0__["useState"](null);
  if (isDifferentRootState(currentRootStateRef.current, props.rootState)) {
    var _props$hideChildAppli;
    // we need to hide any modals manually
    if ((_props$hideChildAppli = props.hideChildApplicationRef) !== null && _props$hideChildAppli !== void 0 && _props$hideChildAppli.current) {
      // Currently, there are 3 childApplication modals:
      // - 2 in icloudplus also in quick menu (HME and Custom Email Domain)
      // - 1 in recovery page w/o quick menu (Restore Files).
      // i.e. When users are leaving icloudplus, there is no possibility also opening another new childApplication modal
      // (since users can only route to recovery page then manually open restore file modal).
      // But when users are leaving recovery page to icloudplus, we can't tell the modal is old restore file or new HME/Custom Email Domain.
      // Therefore, this logic manually dismissing childApplication modals leaving these 2 routs icloudplus->XXX and recovery->XXX
      // with exception of recovery->icloudplus.
      if ((currentRootStateRef === null || currentRootStateRef === void 0 ? void 0 : currentRootStateRef.current.kind) === _NavLinks_LegacyNavLinks__WEBPACK_IMPORTED_MODULE_11__[/* LegacyNavRoutes */ "b"].icloudplus) {
        var _props$hideChildAppli2, _props$hideChildAppli3;
        (_props$hideChildAppli2 = (_props$hideChildAppli3 = props.hideChildApplicationRef).current) === null || _props$hideChildAppli2 === void 0 || _props$hideChildAppli2.call(_props$hideChildAppli3);
      } else if ((currentRootStateRef === null || currentRootStateRef === void 0 ? void 0 : currentRootStateRef.current.kind) === _NavLinks_LegacyNavLinks__WEBPACK_IMPORTED_MODULE_11__[/* LegacyNavRoutes */ "b"].recovery && props.rootState.kind !== _NavLinks_LegacyNavLinks__WEBPACK_IMPORTED_MODULE_11__[/* LegacyNavRoutes */ "b"].icloudplus) {
        var _props$hideChildAppli4, _props$hideChildAppli5;
        (_props$hideChildAppli4 = (_props$hideChildAppli5 = props.hideChildApplicationRef).current) === null || _props$hideChildAppli4 === void 0 || _props$hideChildAppli4.call(_props$hideChildAppli5);
      }
    } else {
      // for modals that are NOT child apps
      // they wont close until the page is unmounted, which happens a few seconds after the fade-out tranisition is complete
      const modals = document.querySelectorAll("ui-pane, ui-pane-backdrop");
      modals.forEach(modal => {
        const classList = modal.classList;
        classList.add("hide");
      });
    }
    setPreviousRootContent({
      content: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](RootContent, {
        key: rootContentId.current,
        rootState: currentRootStateRef.current,
        className: "fade-out"
      }),
      state: currentRootStateRef.current
    });
    ++rootContentId.current;

    // If our previous rootstate kind was "initial-load" but the new one is not (and
    // also not springboard), then this is the first
    // load and we should log this as a deeplink stat
    if (currentRootStateRef.current.kind === initialLoadState && props.rootState.kind !== initialLoadState && props.rootState.kind !== "springboard") {
      const isAuthenticated = _Services_AuthService__WEBPACK_IMPORTED_MODULE_19__[/* isAuthenticatedSignal */ "e"].value;
      const source = props.rootState.kind;
      const additionalProperties = {
        source
      };
      additionalProperties.statCategory = isAuthenticated ? _Telemetry_TelemetryCategory__WEBPACK_IMPORTED_MODULE_15__[/* TelemetryCategory */ "a"].USER : _Telemetry_TelemetryCategory__WEBPACK_IMPORTED_MODULE_15__[/* TelemetryCategory */ "a"].SESSION;
      additionalProperties.__allow_user = true;
      switch (source) {
        case "load-child-application":
          additionalProperties.childName = props.rootState.applicationIdentifier;
          break;
        case "plan":
          additionalProperties.hasCid = !!_Environment_CloudOSParameters__WEBPACK_IMPORTED_MODULE_17__[/* CloudOSParameters */ "a"].sharedInstance.applicationParameter.url.searchParams.get("cid");
          break;
        default:
      }
      _Telemetry_Stat__WEBPACK_IMPORTED_MODULE_16__[/* Stat */ "a"].withEventAndLabel("load", "deeplink", additionalProperties).record();
    }
  }
  currentRootStateRef.current = props.rootState;
  react__WEBPACK_IMPORTED_MODULE_0__["useEffect"](() => {
    const iframeContainer = rootElementRef.current;
    if (!iframeContainer) return;
    const removedRVCs = [];
    const insertedRVCs = [];
    for (const rvc of remoteViewControllersRef.current) {
      if (!props.remoteViewControllers.includes(rvc)) {
        removedRVCs.push(rvc);
      }
    }
    for (const rvc of props.remoteViewControllers) {
      if (!remoteViewControllersRef.current.includes(rvc)) {
        insertedRVCs.push(rvc);
      }
    }
    remoteViewControllersRef.current = [...props.remoteViewControllers];
    for (const rvc of insertedRVCs) {
      const iframe = rvc.iframe;
      if (iframe.id !== "early-child") {
        iframeContainer.appendChild(iframe);
      }
      rvc.isConnected = true;
    }
    for (const rvc of removedRVCs) {
      const iframe = rvc.iframe;
      // Disconnect before removing from DOM. removeChild nullifies
      // iframe.contentWindow, so the channel must be torn down first
      // to avoid postMessage calls on a null reference.
      rvc.isConnected = false;
      iframeContainer.removeChild(iframe);
    }
    const applicationIdentifier = props.rootState.kind === "child-application" ? props.rootState.applicationIdentifier : null;
    const previousApplicationIdentifier = (previousRootContent === null || previousRootContent === void 0 ? void 0 : previousRootContent.state.kind) === "child-application" ? previousRootContent.state.applicationIdentifier : null;
    for (const rvc of remoteViewControllersRef.current) {
      if (rvc.controller.applicationConfiguration.identifier === applicationIdentifier) {
        rvc.iframe.classList.add("fade-in");
        rvc.iframe.classList.remove("fade-out");
        rvc.iframe.removeAttribute("aria-hidden");
      } else if (rvc.controller.applicationConfiguration.identifier === previousApplicationIdentifier) {
        rvc.iframe.classList.add("fade-out");
        rvc.iframe.classList.remove("fade-in");
        rvc.iframe.setAttribute("aria-hidden", "");
      } else {
        rvc.iframe.classList.remove("fade-in");
        rvc.iframe.classList.remove("fade-out");
        rvc.iframe.setAttribute("aria-hidden", "");
      }
    }
  });
  const isDriveRunning = props.remoteViewControllers.some(rvc => rvc.controller.applicationConfiguration.identifier === _ChildApplication_ApplicationConfigurations_DriveApplicationConfiguration__WEBPACK_IMPORTED_MODULE_13__[/* driveApplicationConfiguration */ "b"].identifier);
  react__WEBPACK_IMPORTED_MODULE_0__["useEffect"](() => {
    if (!previousRootContent) return;
    setTimeout(() => {
      // wait a bit for the fade-out tranisition to complete before we unmount the page
      setPreviousRootContent(null);
    }, 800);
  }, [previousRootContent]);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](react__WEBPACK_IMPORTED_MODULE_0__["Fragment"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_Contexts_ContactsLookupProvider__WEBPACK_IMPORTED_MODULE_5__[/* ContactsLookupProvider */ "a"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", {
    className: "root-viewport"
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_NotificationPresenter__WEBPACK_IMPORTED_MODULE_7__[/* NotificationPresenter */ "a"], {
    to: props.notificationElement
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", {
    className: "init-spinner-container",
    suppressHydrationWarning: true
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_apple_ui_components__WEBPACK_IMPORTED_MODULE_1__[/* UIActivityIndicator */ "a"], {
    description: Object(_Hooks__WEBPACK_IMPORTED_MODULE_10__[/* getLoc */ "a"])("CloudOS.Spinner.Loading")
  })), props.bannerData && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_Banner__WEBPACK_IMPORTED_MODULE_14__[/* Banner */ "a"], {
    bannerData: props.bannerData
  }), isDriveRunning && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_Components_TileData_AppStartupData__WEBPACK_IMPORTED_MODULE_12__[/* DriveStartupData */ "a"], null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("div", {
    className: "root-component",
    ref: rootElementRef
  }, earlyChildMarkup, previousRootContent === null || previousRootContent === void 0 ? void 0 : previousRootContent.content, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](RootContent, {
    key: rootContentId.current,
    className: "fade-in",
    rootState: props.rootState
  }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_Components_HomeLoginRoute__WEBPACK_IMPORTED_MODULE_6__[/* HomeLoginRoute */ "a"], {
    loginProps: loginProps.current,
    rootState: props.rootState
  })))));
}
function isDifferentRootState(oldRootState, newRootState) {
  if (oldRootState.kind !== newRootState.kind) return true;
  if (oldRootState.kind === "child-application" && newRootState.kind === "child-application" && oldRootState.applicationIdentifier !== newRootState.applicationIdentifier) return true;
  return false;
}

/***/ }),

/***/ 1599:
/*!********************************************************!*\
  !*** ./src/Legacy/Resources/Styles/RootComponent.scss ***!
  \********************************************************/
/*! no exports provided */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
// extracted by mini-css-extract-plugin


/***/ }),

/***/ 1601:
/*!*************************************************!*\
  !*** ./src/Resources/Images/icloud_welcome.png ***!
  \*************************************************/
/*! exports provided: default */
/*! exports used: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony default export */ __webpack_exports__["a"] = ("../4162db32066c04705afd33769238e2c9.png");

/***/ }),

/***/ 1602:
/*!****************************************************!*\
  !*** ./src/Resources/Images/icloud_welcome@2x.png ***!
  \****************************************************/
/*! exports provided: default */
/*! exports used: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony default export */ __webpack_exports__["a"] = ("../41166dada6559cb93c7a4ff0ea681e52.png");

/***/ }),

/***/ 1603:
/*!****************************************************!*\
  !*** ./src/Resources/Images/icloud_welcome@3x.png ***!
  \****************************************************/
/*! exports provided: default */
/*! exports used: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony default export */ __webpack_exports__["a"] = ("../cc97674b6043ecdb1554eed74f4cb2f9.png");

/***/ }),

/***/ 1605:
/*!*******************************************!*\
  !*** ./src/Utils/convertImageCropRect.ts ***!
  \*******************************************/
/*! exports provided: convertImageCropRect, convertImageCropRectBackwards */
/*! exports used: convertImageCropRect, convertImageCropRectBackwards */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return convertImageCropRect; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return convertImageCropRectBackwards; });
// The crop rect definition used by MeCard API

// The crop rect definition used by UIImage, UIImagePicker and UIImagePickerButton

// Converts the MeCard image rect to UIImage image rect for profile image rendering
function convertImageCropRect(meCardCrop, imageSize) {
  let left = meCardCrop.x;
  let top = imageSize.height - meCardCrop.y - meCardCrop.height;
  const cropSize = Math.min(meCardCrop.width, meCardCrop.height);
  const width = cropSize;
  const height = cropSize;
  if (meCardCrop.width > meCardCrop.height) {
    left += (meCardCrop.width - meCardCrop.height) / 2;
  } else if (meCardCrop.height > meCardCrop.width) {
    top += (meCardCrop.height - meCardCrop.width) / 2;
  }
  return {
    top,
    left,
    width,
    height
  };
}

// Converts an UIImage rect to MeCard image rect for profile image uploading
function convertImageCropRectBackwards(rect, imageSize) {
  return {
    x: Math.round(rect.left),
    y: Math.round(imageSize.height - rect.top - rect.height),
    width: Math.round(rect.width),
    height: Math.round(rect.height)
  };
}

/***/ }),

/***/ 1611:
/*!*********************************!*\
  !*** ./src/ADP/useHasPCSKey.ts ***!
  \*********************************/
/*! exports provided: useHasPCSKey */
/*! exports used: useHasPCSKey */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useHasPCSKey; });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 870);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _PCSKeyManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./PCSKeyManager */ 2212);


function useHasPCSKey(pcsKeyIdentifier) {
  const [hasPCSKey, setHasPCSKey] = react__WEBPACK_IMPORTED_MODULE_0__["useState"](false);
  react__WEBPACK_IMPORTED_MODULE_0__["useEffect"](() => {
    setHasPCSKey(_PCSKeyManager__WEBPACK_IMPORTED_MODULE_1__[/* PCSKeyManager */ "a"].sharedInstance.hasPCSKey(pcsKeyIdentifier));
  }, [pcsKeyIdentifier]);
  const listener = react__WEBPACK_IMPORTED_MODULE_0__["useCallback"]((_, applicationIdentifier) => {
    if (applicationIdentifier === pcsKeyIdentifier) {
      setHasPCSKey(true);
    }
  }, [pcsKeyIdentifier]);
  react__WEBPACK_IMPORTED_MODULE_0__["useEffect"](() => {
    _PCSKeyManager__WEBPACK_IMPORTED_MODULE_1__[/* PCSKeyManager */ "a"].sharedInstance.addListener(listener);
    return () => {
      _PCSKeyManager__WEBPACK_IMPORTED_MODULE_1__[/* PCSKeyManager */ "a"].sharedInstance.removeListener(listener);
    };
  }, [listener]);
  return hasPCSKey;
}

/***/ }),

/***/ 1614:
/*!******************************************!*\
  !*** ./src/Utils/useUpdateAttributes.ts ***!
  \******************************************/
/*! exports provided: useUpdateAttributes */
/*! exports used: useUpdateAttributes */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useUpdateAttributes; });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 870);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);

function useUpdateAttributes(updates) {
  const elementRef = react__WEBPACK_IMPORTED_MODULE_0__["useRef"](null);
  react__WEBPACK_IMPORTED_MODULE_0__["useLayoutEffect"](() => {
    updates.forEach(_ref => {
      let [action, attribute, value] = _ref;
      const element = elementRef.current;
      if (!element) return;
      if (action === "set") {
        element.setAttribute(attribute, value !== null && value !== void 0 ? value : "");
      } else if (action === "remove") {
        element.removeAttribute(attribute);
      }
    });
  }, [updates]);
  return elementRef;
}

/***/ }),

/***/ 1619:
/*!***********************************************************!*\
  !*** ./src/Pages/ShareAcceptancePage/getDriveFileInfo.ts ***!
  \***********************************************************/
/*! exports provided: getDriveFileIconSize, getDriveFileDescription */
/*! exports used: getDriveFileDescription, getDriveFileIconSize */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getDriveFileIconSize; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getDriveFileDescription; });
/* harmony import */ var _Hooks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Hooks */ 1227);

const getDriveFileIconSize = fileExtension => {
  switch (fileExtension) {
    case "key":
    case "numbers":
    case "pages":
      return {
        width: 36,
        height: 40,
        viewBox: "0 0 18 20"
      };
    case "pptx":
    case "ppt":
    case "xlsx":
    case "xls":
    case "xlam":
    case "docx":
    case "doc":
      return {
        width: 40,
        height: 40,
        viewBox: "0 0 20 20"
      };
    case "jpg":
    case "jpeg":
    case "png":
    case "gif":
    case "tiff":
    case "tif":
    case "bmp":
      return {
        width: 48,
        height: 36,
        viewBox: "0 0 24 18"
      };
    case "aac":
    case "wav":
    case "m4a":
    case "m4p":
    case "aiff":
    case "midi":
    case "wave":
    case "mp3":
      return {
        width: 36,
        height: 40,
        viewBox: "0 0 22 24"
      };
    case "mp4":
    case "m4v":
    case "mov":
      return {
        width: 44,
        height: 36,
        viewBox: "0 0 22 18"
      };
    case "pdf":
    case "zip":
      return {
        width: 32,
        height: 40,
        viewBox: "0 0 16 20"
      };
    default:
      return {
        width: 32,
        height: 40,
        viewBox: "0 0 16 20"
      };
  }
};
const getDriveFileDescription = fileExtension => {
  switch (fileExtension) {
    case "key":
      return Object(_Hooks__WEBPACK_IMPORTED_MODULE_0__[/* getLoc */ "a"])("Drive.Icon.Description.Key");
    case "numbers":
      return Object(_Hooks__WEBPACK_IMPORTED_MODULE_0__[/* getLoc */ "a"])("Drive.Icon.Description.Numbers");
    case "pages":
      return Object(_Hooks__WEBPACK_IMPORTED_MODULE_0__[/* getLoc */ "a"])("Drive.Icon.Description.Pages");
    case "pptx":
    case "ppt":
      return Object(_Hooks__WEBPACK_IMPORTED_MODULE_0__[/* getLoc */ "a"])("Drive.Icon.Description.PowerPoint");
    case "xlsx":
    case "xls":
    case "xlam":
      return Object(_Hooks__WEBPACK_IMPORTED_MODULE_0__[/* getLoc */ "a"])("Drive.Icon.Description.Excel");
    case "docx":
    case "doc":
      return Object(_Hooks__WEBPACK_IMPORTED_MODULE_0__[/* getLoc */ "a"])("Drive.Icon.Description.Word");
    case "jpg":
    case "jpeg":
    case "png":
    case "gif":
    case "tiff":
    case "tif":
    case "bmp":
      return Object(_Hooks__WEBPACK_IMPORTED_MODULE_0__[/* getLoc */ "a"])("Drive.Icon.Description.Image", {
        fileExtension: fileExtension.toUpperCase()
      });
    case "aac":
    case "wav":
    case "m4a":
    case "m4p":
    case "aiff":
    case "midi":
    case "wave":
    case "mp3":
      return Object(_Hooks__WEBPACK_IMPORTED_MODULE_0__[/* getLoc */ "a"])("Drive.Icon.Description.Audio", {
        fileExtension: fileExtension.toUpperCase()
      });
    case "mp4":
    case "m4v":
    case "mov":
      return Object(_Hooks__WEBPACK_IMPORTED_MODULE_0__[/* getLoc */ "a"])("Drive.Icon.Description.Video", {
        fileExtension: fileExtension.toUpperCase()
      });
    case "zip":
      return Object(_Hooks__WEBPACK_IMPORTED_MODULE_0__[/* getLoc */ "a"])("Drive.Icon.Description.Archive");
    case "pdf":
      return Object(_Hooks__WEBPACK_IMPORTED_MODULE_0__[/* getLoc */ "a"])("Drive.Icon.Description.Pdf");
    case "folder":
      return Object(_Hooks__WEBPACK_IMPORTED_MODULE_0__[/* getLoc */ "a"])("ShareAcceptancePage.User.Description.Folder.Name");
    default:
      return fileExtension ? fileExtension : Object(_Hooks__WEBPACK_IMPORTED_MODULE_0__[/* getLoc */ "a"])("Drive.Icon.Description.Default");
  }
};

/***/ }),

/***/ 1624:
/*!*******************************************!*\
  !*** ./src/API/HideMyEmail/hme.schema.ts ***!
  \*******************************************/
/*! exports provided: EmailOrigin, hmeListResultSchema, responseSchema, wireHmeListResponseSchema */
/*! exports used: responseSchema, wireHmeListResponseSchema */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* unused harmony export EmailOrigin */
/* unused harmony export hmeListResultSchema */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return responseSchema; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return wireHmeListResponseSchema; });
/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! zod */ 888);

let EmailOrigin = /*#__PURE__*/function (EmailOrigin) {
  EmailOrigin["Safari"] = "SAFARI";
  EmailOrigin["Mail"] = "MAIL";
  EmailOrigin["News"] = "APPLE_NEWS";
  EmailOrigin["OnDemand"] = "ON_DEMAND";
  EmailOrigin["InApp"] = "IN_APP";
  return EmailOrigin;
}({});
const emailPartialSchema = zod__WEBPACK_IMPORTED_MODULE_0__["z"].object({
  anonymousId: zod__WEBPACK_IMPORTED_MODULE_0__["z"].string(),
  domain: zod__WEBPACK_IMPORTED_MODULE_0__["z"].string().optional(),
  forwardToEmail: zod__WEBPACK_IMPORTED_MODULE_0__["z"].string().optional(),
  hme: zod__WEBPACK_IMPORTED_MODULE_0__["z"].string(),
  isActive: zod__WEBPACK_IMPORTED_MODULE_0__["z"].boolean(),
  recipientMailId: zod__WEBPACK_IMPORTED_MODULE_0__["z"].string().optional(),
  label: zod__WEBPACK_IMPORTED_MODULE_0__["z"].string().optional(),
  origin: zod__WEBPACK_IMPORTED_MODULE_0__["z"].nativeEnum(EmailOrigin)
});
const hmeListResultSchema = zod__WEBPACK_IMPORTED_MODULE_0__["z"].object({
  forwardToEmails: zod__WEBPACK_IMPORTED_MODULE_0__["z"].array(zod__WEBPACK_IMPORTED_MODULE_0__["z"].string()),
  hmeEmails: zod__WEBPACK_IMPORTED_MODULE_0__["z"].array(emailPartialSchema),
  selectedForwardTo: zod__WEBPACK_IMPORTED_MODULE_0__["z"].string().optional()
});
const errorInfoSchema = zod__WEBPACK_IMPORTED_MODULE_0__["z"].object({
  errorCode: zod__WEBPACK_IMPORTED_MODULE_0__["z"].string(),
  errorMessage: zod__WEBPACK_IMPORTED_MODULE_0__["z"].string(),
  retryAfter: zod__WEBPACK_IMPORTED_MODULE_0__["z"].number().optional()
});
const responseSchema = zod__WEBPACK_IMPORTED_MODULE_0__["z"].object({
  success: zod__WEBPACK_IMPORTED_MODULE_0__["z"].boolean(),
  timestamp: zod__WEBPACK_IMPORTED_MODULE_0__["z"].number(),
  error: errorInfoSchema.optional()
});
const wireHmeListResponseSchema = responseSchema.merge(zod__WEBPACK_IMPORTED_MODULE_0__["z"].object({
  result: hmeListResultSchema.optional()
}));

/***/ }),

/***/ 1625:
/*!******************************************************************!*\
  !*** ./src/API/CustomEmailDomain/customEmailDomain.converter.ts ***!
  \******************************************************************/
/*! exports provided: checkIfAccountNeedsUpgrade, customDomainConverter */
/*! exports used: checkIfAccountNeedsUpgrade, customDomainConverter */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return checkIfAccountNeedsUpgrade; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return customDomainConverter; });
/* harmony import */ var _customEmailDomain_schema__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./customEmailDomain.schema */ 1626);
/* harmony import */ var _Hooks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Hooks */ 1227);
/* harmony import */ var _icloudweb_auth_service_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @icloudweb/auth-service/common */ 889);
/* harmony import */ var _Services_AuthService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Services/AuthService */ 2155);




function checkIfAccountNeedsUpgrade(isResponseSuccess) {
  var _userSignal$value;
  return ((_userSignal$value = _Services_AuthService__WEBPACK_IMPORTED_MODULE_3__[/* userSignal */ "h"].value) === null || _userSignal$value === void 0 || (_userSignal$value = _userSignal$value.details) === null || _userSignal$value === void 0 ? void 0 : _userSignal$value.accountType) !== _icloudweb_auth_service_common__WEBPACK_IMPORTED_MODULE_2__[/* AppleIdAccountType */ "a"].HSA2 && !isResponseSuccess;
}

/**
 * Converts custom domain list api response to array of domain names
 * @param {WireCustomDomainListResponse} response custom domain list api response
 * @returns {string[]} returns array of domain names
 * @throw Error if the api request is not success or result object is not valid
 */
function customDomainConverter(response) {
  if (checkIfAccountNeedsUpgrade(response.success)) {
    // for account needs upgrade, do not show any CED and
    // let users complete upgrade action inside the app
    return [];
  }
  if (!response.success || !response.result) {
    var _response$error;
    throw new Error((response === null || response === void 0 || (_response$error = response.error) === null || _response$error === void 0 ? void 0 : _response$error.errorMessage) || "hide my email api returns error");
  }
  return response.result.domains.map(domain => domain.status === _customEmailDomain_schema__WEBPACK_IMPORTED_MODULE_0__[/* DomainTransferStatus */ "a"].InProgress ? Object(_Hooks__WEBPACK_IMPORTED_MODULE_1__[/* getLoc */ "a"])("CustomEmailDomainTile.Status.InProgress", {
    domain: domain.name
  }) : domain.name);
}

/***/ }),

/***/ 1626:
/*!***************************************************************!*\
  !*** ./src/API/CustomEmailDomain/customEmailDomain.schema.ts ***!
  \***************************************************************/
/*! exports provided: DomainTransferStatus, wireCustomDomainListResponseSchema */
/*! exports used: DomainTransferStatus, wireCustomDomainListResponseSchema */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DomainTransferStatus; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return wireCustomDomainListResponseSchema; });
/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! zod */ 888);
/* harmony import */ var _HideMyEmail_hme_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../HideMyEmail/hme.schema */ 1624);


let DomainTransferStatus = /*#__PURE__*/function (DomainTransferStatus) {
  DomainTransferStatus["InProgress"] = "IN_PROGRESS";
  // Domain transfer is complete but user hasn't selected default email yet
  DomainTransferStatus["EmailNotSelected"] = "DEFAULT_EMAIL_NOT_SELECTED";
  // Everything is done
  DomainTransferStatus["Complete"] = "COMPLETE";
  return DomainTransferStatus;
}({});
var DomainVerificationStatus = /*#__PURE__*/function (DomainVerificationStatus) {
  DomainVerificationStatus["NotStarted"] = "NOT_STARTED";
  DomainVerificationStatus["InProgress"] = "IN_PROGRESS";
  DomainVerificationStatus["Success"] = "SUCCESS";
  DomainVerificationStatus["Failed"] = "FAILED";
  return DomainVerificationStatus;
}(DomainVerificationStatus || {});
var DomainReverificationStatus = /*#__PURE__*/function (DomainReverificationStatus) {
  DomainReverificationStatus["NotStarted"] = "NOT_STARTED";
  DomainReverificationStatus["InProgress"] = "VERIFICATION_IN_PROGRESS";
  DomainReverificationStatus["Success"] = "VERIFICATION_SUCCESS";
  DomainReverificationStatus["Failed"] = "VERIFICATION_FAILED";
  return DomainReverificationStatus;
}(DomainReverificationStatus || {});
const domainSchema = zod__WEBPACK_IMPORTED_MODULE_0__["z"].object({
  name: zod__WEBPACK_IMPORTED_MODULE_0__["z"].string(),
  owner: zod__WEBPACK_IMPORTED_MODULE_0__["z"].object({
    dsid: zod__WEBPACK_IMPORTED_MODULE_0__["z"].string(),
    firstName: zod__WEBPACK_IMPORTED_MODULE_0__["z"].string(),
    lastName: zod__WEBPACK_IMPORTED_MODULE_0__["z"].string()
  }),
  isShared: zod__WEBPACK_IMPORTED_MODULE_0__["z"].boolean(),
  isOwner: zod__WEBPACK_IMPORTED_MODULE_0__["z"].boolean(),
  status: zod__WEBPACK_IMPORTED_MODULE_0__["z"].nativeEnum(DomainTransferStatus),
  transferTimestamp: zod__WEBPACK_IMPORTED_MODULE_0__["z"].number().optional(),
  dnsRecordsGenerated: zod__WEBPACK_IMPORTED_MODULE_0__["z"].boolean().optional(),
  dnsProviderName: zod__WEBPACK_IMPORTED_MODULE_0__["z"].string().optional(),
  isDomainConnect: zod__WEBPACK_IMPORTED_MODULE_0__["z"].boolean().optional(),
  applyTemplateUrl: zod__WEBPACK_IMPORTED_MODULE_0__["z"].string().optional(),
  verificationStatus: zod__WEBPACK_IMPORTED_MODULE_0__["z"].nativeEnum(DomainVerificationStatus).optional(),
  catchAllEnabled: zod__WEBPACK_IMPORTED_MODULE_0__["z"].boolean().optional(),
  isEmailImportSupported: zod__WEBPACK_IMPORTED_MODULE_0__["z"].boolean().optional(),
  reverificationStatus: zod__WEBPACK_IMPORTED_MODULE_0__["z"].nativeEnum(DomainReverificationStatus).optional()
});
const domainListResultSchema = zod__WEBPACK_IMPORTED_MODULE_0__["z"].object({
  domains: zod__WEBPACK_IMPORTED_MODULE_0__["z"].array(domainSchema),
  maxDomainsAllowed: zod__WEBPACK_IMPORTED_MODULE_0__["z"].number()
});
const wireCustomDomainListResponseSchema = _HideMyEmail_hme_schema__WEBPACK_IMPORTED_MODULE_1__[/* responseSchema */ "a"].merge(zod__WEBPACK_IMPORTED_MODULE_0__["z"].object({
  result: domainListResultSchema.optional()
}));

/***/ }),

/***/ 1628:
/*!************************************************!*\
  !*** ./src/API/Photos/usePhotosLibraryInfo.ts ***!
  \************************************************/
/*! exports provided: usePhotosLibraryInfo */
/*! exports used: usePhotosLibraryInfo */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return usePhotosLibraryInfo; });
/* harmony import */ var _Components_HomeTiles_Photos_PhotosTileWrapper_usePhotosTile__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Components/HomeTiles/Photos/PhotosTileWrapper/usePhotosTile */ 1629);
/* harmony import */ var _Common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Common */ 2266);
/* harmony import */ var _Models_Photo__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Models/Photo */ 1428);
/* harmony import */ var _usePhotosAPIQuery__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./usePhotosAPIQuery */ 1630);




/**
 * Fetches the media type counts from your Photos library
 * @returns `react-query` `useQuery` results
 */
function usePhotosLibraryInfo(selectedLibrary, callbacks) {
  Object(_Components_HomeTiles_Photos_PhotosTileWrapper_usePhotosTile__WEBPACK_IMPORTED_MODULE_0__[/* usePhotosTile */ "a"])();
  return Object(_usePhotosAPIQuery__WEBPACK_IMPORTED_MODULE_3__[/* usePhotosAPIQuery */ "a"])({
    ...callbacks,
    // especially onError and onSuccess
    endpoint: _Common__WEBPACK_IMPORTED_MODULE_1__[/* EndpointName */ "b"].photosLibraryInfo,
    cacheKeys: [selectedLibrary],
    fetchProvider: r => Object(_Models_Photo__WEBPACK_IMPORTED_MODULE_2__[/* getLibraryCounts */ "c"])(r, selectedLibrary)
  });
}

/***/ }),

/***/ 1629:
/*!*****************************************************************************!*\
  !*** ./src/Components/HomeTiles/Photos/PhotosTileWrapper/usePhotosTile.tsx ***!
  \*****************************************************************************/
/*! exports provided: usePhotosTile */
/*! exports used: usePhotosTile */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return usePhotosTile; });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 870);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _icloudweb_photos_tile__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @icloudweb/photos-tile */ 1169);
/* harmony import */ var _icloudweb_photos_tile__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_icloudweb_photos_tile__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _Legacy_Authentication_AuthenticationHook__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../Legacy/Authentication/AuthenticationHook */ 1330);
/* harmony import */ var _Legacy_Network_CloudOSReportingURLConnection__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../../Legacy/Network/CloudOSReportingURLConnection */ 2251);
/* harmony import */ var _Legacy_Telemetry_TelemetryProxy__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../Legacy/Telemetry/TelemetryProxy */ 1427);
/* harmony import */ var _Services_Configurations__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../../Services/Configurations */ 2248);







/** Sets up `photos-tile`'s `CloudKit` with the right config */
function usePhotosTile() {
  const user = Object(_Legacy_Authentication_AuthenticationHook__WEBPACK_IMPORTED_MODULE_2__[/* useAuthenticatedUser */ "a"])();
  if (!user) throw new Error(`usePhotosTile() needs a dsid!`);
  const dsid = user.dsid;
  react__WEBPACK_IMPORTED_MODULE_0__["useEffect"](() => _icloudweb_photos_tile__WEBPACK_IMPORTED_MODULE_1__["configure"]({
    user: {
      dsid
    },
    // note: if CloudKit ever starts requiring a fetch that
    // handles a first arg Request object instead of a url,
    // we've got some work to do here:
    // TODO(rdar://102338259): Tile API: Support Request object as first arg in the CloudOS fetch function
    fetch: _Legacy_Network_CloudOSReportingURLConnection__WEBPACK_IMPORTED_MODULE_3__[/* cloudOSFetch */ "a"],
    urlForServiceName: _Services_Configurations__WEBPACK_IMPORTED_MODULE_5__[/* urlForServiceName */ "j"],
    telemetry: Object(_Legacy_Telemetry_TelemetryProxy__WEBPACK_IMPORTED_MODULE_4__[/* getTelemetryProxyForAppTile */ "a"])("photos")
  }), [dsid]);
}

/***/ }),

/***/ 1630:
/*!*********************************************!*\
  !*** ./src/API/Photos/usePhotosAPIQuery.ts ***!
  \*********************************************/
/*! exports provided: useIsPageHidden, usePhotosAPIQuery */
/*! exports used: usePhotosAPIQuery */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* unused harmony export useIsPageHidden */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return usePhotosAPIQuery; });
/* harmony import */ var _Common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Common */ 1478);

const minutes = 60e3;

/**
 * this could be a beautiful https://github.com/GoogleChromeLabs/page-lifecycle page state hook
 * for all sorts of purposes, but let's keep it simple, small, and efficient instead, for now 😁
 */
const useIsPageHidden = () => document.visibilityState === "hidden";

/**
 * Wraps `photos-tile` api calls with `react-query`.
 *
 * Pass an `onSuccess` callback if you want to capture Success<T> | Failure<E>,
 * and/or an `onError` callback if you want to capture any hard network errors.
 * All other `react-query` options `useAPIQuery` won't override, are passed on.
 */
function usePhotosAPIQuery(_ref) {
  let {
    endpoint,
    fetchProvider,
    pageActiveFetchInterval = 3 * minutes,
    pageHiddenFetchInterval = 30 * minutes,
    cacheKeys,
    ...callbacks
  } = _ref;
  return Object(_Common__WEBPACK_IMPORTED_MODULE_0__[/* useAPIQuery */ "a"])({
    ...callbacks,
    // particularly onSuccess and onError
    endpoint,
    cacheKeys,
    fetchProvider,
    refetchInterval: useIsPageHidden() ? pageActiveFetchInterval : pageHiddenFetchInterval,
    refetchIntervalInBackground: true
  });
}

/***/ }),

/***/ 1631:
/*!*****************************************************************************************!*\
  !*** ./src/Components/HomeTiles/Photos/PhotosHomeTile/usePhotosAssetCountLocString.tsx ***!
  \*****************************************************************************************/
/*! exports provided: getPhotosLibraryNameLocString, usePhotosAssetCountLocString */
/*! exports used: getPhotosLibraryNameLocString, usePhotosAssetCountLocString */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getPhotosLibraryNameLocString; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return usePhotosAssetCountLocString; });
/* harmony import */ var _Hooks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../Hooks */ 1227);
/* harmony import */ var _icloudweb_photos_tile__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @icloudweb/photos-tile */ 1169);
/* harmony import */ var _icloudweb_photos_tile__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_icloudweb_photos_tile__WEBPACK_IMPORTED_MODULE_1__);


function getPhotosLibraryNameLocString(library) {
  switch (library) {
    case _icloudweb_photos_tile__WEBPACK_IMPORTED_MODULE_1__["PhotosTileAssetListType"].Library:
      return Object(_Hooks__WEBPACK_IMPORTED_MODULE_0__[/* getLoc */ "a"])("PhotosHomeTile.TileCustomization.Library.Name");
    case _icloudweb_photos_tile__WEBPACK_IMPORTED_MODULE_1__["PhotosTileAssetListType"].Favorites:
      return Object(_Hooks__WEBPACK_IMPORTED_MODULE_0__[/* getLoc */ "a"])("PhotosHomeTile.TileCustomization.Favorites.Name");
    case _icloudweb_photos_tile__WEBPACK_IMPORTED_MODULE_1__["PhotosTileAssetListType"].Recents:
      return Object(_Hooks__WEBPACK_IMPORTED_MODULE_0__[/* getLoc */ "a"])("PhotosHomeTile.TileCustomization.Recents.Name");
    default:
      return library;
  }
}

/**
 * Return a string that describes how many assets of each type are
 * in your library. E.g.: "5 Photos, 2 Videos, 3 Other Items".
 */
function usePhotosAssetCountLocString(/** asset counts, as returned from photos-tile::getLibraryCounts */
counts, selectedLibrary) {
  const isCountBreakdownAvailable = (counts === null || counts === void 0 ? void 0 : counts.breakdown) !== undefined;
  if (!isCountBreakdownAvailable) {
    var _counts$itemsCount;
    const locCount = Object(_Hooks__WEBPACK_IMPORTED_MODULE_0__[/* getLocCount */ "b"])({
      zero: "Media.Count.Total.Zero",
      one: "Media.Count.Total.One",
      two: "Media.Count.Total.Two",
      many: "Media.Count.Total.More"
    }, (_counts$itemsCount = counts === null || counts === void 0 ? void 0 : counts.itemsCount) !== null && _counts$itemsCount !== void 0 ? _counts$itemsCount : 0);
    if (!selectedLibrary) return locCount;else {
      return Object(_Hooks__WEBPACK_IMPORTED_MODULE_0__[/* getLoc */ "a"])("Media.Count.WithListName", {
        count: locCount,
        selectedLibrary: getPhotosLibraryNameLocString(selectedLibrary)
      });
    }
  }
  const {
    photosCount = 0,
    videosCount = 0,
    othersCount = 0
  } = (counts === null || counts === void 0 ? void 0 : counts.breakdown) || {};
  const numbers = {
    photosCount: formatNumber(photosCount),
    videosCount: formatNumber(videosCount),
    otherItemsCount: formatNumber(othersCount)
  };

  // Localization strings "Media.Count.0.0.0.0": lovingly stolen
  // from Photos itself under same keys to simplify for LOC team
  // copy-pasting their prior work; each figure is Photo, Video,
  // Other, and Upload counts respectively, last always 0 in the
  // Sprinkles scenario, and the digit is {0,1,2,Many}, composed
  // for all permutations:
  let locString = Object(_Hooks__WEBPACK_IMPORTED_MODULE_0__[/* getLoc */ "a"])(`Media.Count.${locCount(photosCount)}.${locCount(videosCount)}.${locCount(othersCount)}.0`, numbers);

  // for better line breaking, make each num+space a non-breakable one,
  // so we don't get silly renditions like 10,648 Photos, 331 Videos, 1
  // Other Item, but break before the "1", so words stay together nicely
  for (let [, num] of Object.entries(numbers)) {
    locString = locString.replace(`${num} `, `${num}\xA0`);
  }
  if (!selectedLibrary) {
    return locString;
  } else {
    return Object(_Hooks__WEBPACK_IMPORTED_MODULE_0__[/* getLoc */ "a"])("Media.Count.WithListName", {
      count: locString,
      selectedLibrary: getPhotosLibraryNameLocString(selectedLibrary)
    });
  }
}

/** categorizes a count into LOC-friendlier order-of-magnitude buckets */
const locCount = n => n < 3 ? String(n) : "More";

/** formats a number to locale with the right thousands separators, et c */
const formatNumber = (n, locale) => Number(n).toLocaleString(locale).replace(/ /g, "\xA0");

/***/ }),

/***/ 1633:
/*!*************************************************!*\
  !*** ./src/Contexts/ContactsLookupProvider.tsx ***!
  \*************************************************/
/*! exports provided: ContactsLookupContext, createContactsMap, ContactsLookupProvider, useContactsLookupService */
/*! exports used: ContactsLookupProvider, useContactsLookupService */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* unused harmony export ContactsLookupContext */
/* unused harmony export createContactsMap */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ContactsLookupProvider; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return useContactsLookupService; });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 870);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _Legacy_Environment_CloudOSUser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Legacy/Environment/CloudOSUser */ 1310);
/* harmony import */ var _Services_ContactsLookup__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Services/ContactsLookup */ 2151);
/* harmony import */ var _Legacy_Authentication_AuthenticationHook__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Legacy/Authentication/AuthenticationHook */ 1330);




const ContactsLookupContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createContext"](undefined);

/**
 * Helper function to dedupe addresses.
 */
function createContactsMap(contacts) {
  const result = new Map();
  contacts.forEach(contact => {
    if (!contact || !contact.emailAddresses) return;
    contact.emailAddresses.forEach(address => {
      if (!address || result.has(address.field)) return;
      result.set(address.field, contact);
    });
  });
  return result;
}

/**
 * The context provider for fetching adressBookContact from Contacts Lookup Service
 */
function ContactsLookupProvider(_ref) {
  let {
    children
  } = _ref;
  const [contactsMap, setContactsMap] = react__WEBPACK_IMPORTED_MODULE_0__["useState"]();
  const isAuthenticated = Object(_Legacy_Authentication_AuthenticationHook__WEBPACK_IMPORTED_MODULE_3__[/* useIsAuthenticated */ "d"])();
  react__WEBPACK_IMPORTED_MODULE_0__["useEffect"](() => {
    if (Object(_Legacy_Environment_CloudOSUser__WEBPACK_IMPORTED_MODULE_1__[/* isHomePageBlocked */ "c"])()) return;
    if (!isAuthenticated) return;
    let mounted = true;
    const fetchAllContacts = async () => {
      try {
        const controller = Object(_Services_ContactsLookup__WEBPACK_IMPORTED_MODULE_2__[/* getContactsLookupController */ "b"])();
        const result = await (controller === null || controller === void 0 ? void 0 : controller.getAddressBookContacts());

        // If we don't get any data, just populate empty contacts list.
        // So it does not block any api requests.
        if (!result.ok || !result.value) {
          if (mounted) setContactsMap(new Map());
          return;
        }
        const contactsResult = result.value.items;
        if (mounted) setContactsMap(createContactsMap(contactsResult));
      } catch (err) {
        // Catch and release the error. It is not fatal.
        // TODO: log the error
        if (mounted) setContactsMap(new Map());
      }
    };
    fetchAllContacts();
    return () => {
      mounted = false;
    };
  }, [isAuthenticated]);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](ContactsLookupContext.Provider, {
    value: {
      contacts: contactsMap
    }
  }, children);
}

/**
 * The hook to consume the contacts/data from iCloud Contacts Lookup Service
 */
function useContactsLookupService() {
  const context = react__WEBPACK_IMPORTED_MODULE_0__["useContext"](ContactsLookupContext);
  if (context === undefined) {
    throw new Error("`useContactsLookupService` must be used within a ContactsLookupProvider");
  }
  return context;
}

/***/ }),

/***/ 1635:
/*!****************************************************************!*\
  !*** ./src/Legacy/Hooks/usePreventUnloadWithUnsavedChanges.ts ***!
  \****************************************************************/
/*! exports provided: usePreventUnloadWithUnsavedChanges */
/*! exports used: usePreventUnloadWithUnsavedChanges */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return usePreventUnloadWithUnsavedChanges; });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 870);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _Hooks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../Hooks */ 1227);
/* harmony import */ var _ChildApplication_ChildApplicationConfiguration__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ChildApplication/ChildApplicationConfiguration */ 1248);
/* harmony import */ var _ChildApplication_ChildApplicationsController__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../ChildApplication/ChildApplicationsController */ 1264);




function usePreventUnloadWithUnsavedChanges(hasChildApplicationWithUnsavedChanges) {
  react__WEBPACK_IMPORTED_MODULE_0__["useEffect"](() => {
    if (!hasChildApplicationWithUnsavedChanges) return;
    const handleBeforeUnload = event => {
      var _ChildApplicationsCon;
      const configuration = (_ChildApplicationsCon = _ChildApplication_ChildApplicationsController__WEBPACK_IMPORTED_MODULE_3__[/* ChildApplicationsController */ "a"].sharedInstance.hasChildApplicationWithUnsavedChanges()) === null || _ChildApplicationsCon === void 0 ? void 0 : _ChildApplicationsCon.applicationConfiguration;
      if (!configuration) return;
      event.preventDefault();

      // Modern browsers will not show the custom message, but may still
      // require a returned value or `returnValue` to be set to show a generic
      // confirmation prompt.
      const message = Object(_Hooks__WEBPACK_IMPORTED_MODULE_1__[/* getLoc */ "a"])("CloudOS.UnsavedChanges.Alert.Description", {
        applicationName: Object(_ChildApplication_ChildApplicationConfiguration__WEBPACK_IMPORTED_MODULE_2__[/* getDisplayNameForApplication */ "e"])(configuration)
      });
      event.returnValue = message;
      return message;
    };
    window.addEventListener("beforeunload", handleBeforeUnload);
    return () => {
      window.removeEventListener("beforeunload", handleBeforeUnload);
    };
  }, [hasChildApplicationWithUnsavedChanges]);
}

/***/ }),

/***/ 1636:
/*!****************************************************!*\
  !*** ./src/Components/TileData/AppStartupData.tsx ***!
  \****************************************************/
/*! exports provided: DriveStartupData, AppStartupData */
/*! exports used: DriveStartupData */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DriveStartupData; });
/* unused harmony export AppStartupData */
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 870);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _icloudweb_drive_tile__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @icloudweb/drive-tile */ 1637);
/* harmony import */ var _icloudweb_drive_tile__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_icloudweb_drive_tile__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _TileDataController__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TileDataController */ 1399);
/* harmony import */ var _Legacy_ChildApplication_ApplicationConfigurations_DriveApplicationConfiguration__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Legacy/ChildApplication/ApplicationConfigurations/DriveApplicationConfiguration */ 1204);
/* harmony import */ var _HomeTiles_Drive_useDriveFetchCallbacks__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../HomeTiles/Drive/useDriveFetchCallbacks */ 1682);





function DriveStartupData() {
  const res = Object(_icloudweb_drive_tile__WEBPACK_IMPORTED_MODULE_1__["useRecentDriveDocs"])(Object(_HomeTiles_Drive_useDriveFetchCallbacks__WEBPACK_IMPORTED_MODULE_4__[/* useDriveFetchCallbacks */ "a"])("app"));
  const tileDataController = _TileDataController__WEBPACK_IMPORTED_MODULE_2__[/* TileDataController */ "a"].sharedInstance;
  if (res.result) {
    tileDataController.setTileData(_Legacy_ChildApplication_ApplicationConfigurations_DriveApplicationConfiguration__WEBPACK_IMPORTED_MODULE_3__[/* driveApplicationConfiguration */ "b"].identifier, JSON.stringify(res.result));
  }
  tileDataController.switchDriveToAppMode = res.appIsLaunching;
  return null;
}
function AppStartupData(props) {
  const {
    appIds,
    isInAppMode
  } = props;
  const isDriveRunning = appIds.includes(_Legacy_ChildApplication_ApplicationConfigurations_DriveApplicationConfiguration__WEBPACK_IMPORTED_MODULE_3__[/* driveApplicationConfiguration */ "b"].identifier);
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](react__WEBPACK_IMPORTED_MODULE_0__["Fragment"], null, isInAppMode && isDriveRunning && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](DriveStartupData, null));
}

/***/ }),

/***/ 1682:
/*!*******************************************************************!*\
  !*** ./src/Components/HomeTiles/Drive/useDriveFetchCallbacks.tsx ***!
  \*******************************************************************/
/*! exports provided: useDriveFetchCallbacks */
/*! exports used: useDriveFetchCallbacks */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useDriveFetchCallbacks; });
/* harmony import */ var _Hooks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../Hooks */ 1479);
/* harmony import */ var _API_Drive_drive_endpoint__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../API/Drive/drive.endpoint */ 1412);



/** produces the fetch callbacks `drive-tile` needs for its fetches */
const useDriveFetchCallbacks = mode => {
  const webServices = Object(_Hooks__WEBPACK_IMPORTED_MODULE_0__[/* useWebServices */ "a"])();
  return {
    mode,
    fetchRecents: n => Object(_API_Drive_drive_endpoint__WEBPACK_IMPORTED_MODULE_1__[/* fetchRecentDriveDocs */ "i"])({
      webServices
    }, n),
    getChanges: (n, continuationMarker) => Object(_API_Drive_drive_endpoint__WEBPACK_IMPORTED_MODULE_1__[/* fetchRecentDriveDocsChanges */ "j"])({
      webServices
    }, n, continuationMarker)
  };
};

/***/ }),

/***/ 1683:
/*!**************************************************!*\
  !*** ./src/Legacy/Components/HomeLoginRoute.tsx ***!
  \**************************************************/
/*! exports provided: HomeLoginRoute */
/*! exports used: HomeLoginRoute */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return HomeLoginRoute; });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 870);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ 1215);
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _Components_FixedFlexPage_FixedFlexPage__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Components/FixedFlexPage/FixedFlexPage */ 2317);
/* harmony import */ var _Contexts_ApplicationToolbarThemeProvider__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../Contexts/ApplicationToolbarThemeProvider */ 1452);
/* harmony import */ var _Components_Toolbar_CloudOSApplicationToolbar_CloudOSApplicationToolbar__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Components/Toolbar/CloudOSApplicationToolbar/CloudOSApplicationToolbar */ 2143);
/* harmony import */ var _HomeLoginComponent__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./HomeLoginComponent */ 2172);
/* harmony import */ var _LegalFooter__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./LegalFooter */ 2272);
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }







function HomeLoginRoute(_ref) {
  let {
    loginProps,
    rootState
  } = _ref;
  if (!loginProps) return null;
  const isLoginViewActive = rootState.kind === "home-login";
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_Components_FixedFlexPage_FixedFlexPage__WEBPACK_IMPORTED_MODULE_2__[/* FixedFlexPage */ "a"], {
    className: classnames__WEBPACK_IMPORTED_MODULE_1___default()("home-login-route", {
      "fade-in": isLoginViewActive,
      "fade-out": !isLoginViewActive
    }),
    "aria-hidden": !isLoginViewActive
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_Contexts_ApplicationToolbarThemeProvider__WEBPACK_IMPORTED_MODULE_3__[/* ApplicationToolbarThemeProvider */ "b"], {
    value: _Contexts_ApplicationToolbarThemeProvider__WEBPACK_IMPORTED_MODULE_3__[/* ApplicationToolbarTheme */ "a"].LOGIN
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_Components_Toolbar_CloudOSApplicationToolbar_CloudOSApplicationToolbar__WEBPACK_IMPORTED_MODULE_4__[/* CloudOSApplicationToolbar */ "a"], null)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_HomeLoginComponent__WEBPACK_IMPORTED_MODULE_5__[/* HomeLoginComponent */ "a"], _extends({}, loginProps, {
    isLoginViewActive: isLoginViewActive
  })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("footer", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_LegalFooter__WEBPACK_IMPORTED_MODULE_6__[/* LegalFooter */ "a"], null)));
}

/***/ }),

/***/ 2133:
/*!*************************************************************************!*\
  !*** ./src/Legacy/Components/RootComponentRoutePages.tsx + 153 modules ***!
  \*************************************************************************/
/*! exports provided: WaitingForPCSKeysRoute, AccountMaintenancePageRoute, WebAccessBlockedPageRoute, SettingsPageRoute, RecoveryPageRoute, ICloudPlusPageRoute, StoragePageRoute, PlanPageRoute, MailDropRoute, ShareAcceptanceErrorRoute, RequestAccessPageRoute, CKRemindersTemplateRoute, MailEmailView, CalendarEventView, RedirectToDomainRoute, TermsAndConditionsConfirmationRoute, TermsAndConditionsRoute */
/*! exports used: AccountMaintenancePageRoute, CKRemindersTemplateRoute, CalendarEventView, ICloudPlusPageRoute, MailDropRoute, MailEmailView, PlanPageRoute, RecoveryPageRoute, RedirectToDomainRoute, SettingsPageRoute, ShareAcceptanceErrorRoute, StoragePageRoute, TermsAndConditionsConfirmationRoute, TermsAndConditionsRoute, WaitingForPCSKeysRoute, WebAccessBlockedPageRoute */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/symbols/bold/bookmark.svg */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/symbols/bold/calendar.svg */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/symbols/bold/doc.svg */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/symbols/bold/person.crop.circle.svg */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/symbols/medium/arrow.clockwise.svg */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/symbols/regular/archivebox.svg */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/symbols/regular/arrow.clockwise.svg */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/symbols/regular/calendar.svg */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/symbols/regular/chevron.down.svg */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/symbols/regular/envelope.svg */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/symbols/regular/externaldrive.svg */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/symbols/regular/folder.svg */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/symbols/regular/hand.raised.svg */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/symbols/regular/icloud.and.arrow.down.svg */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/symbols/regular/icloud.svg */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/symbols/regular/laptopcomputer.and.iphone.svg */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/symbols/regular/lock.rectangle.stack.fill.svg */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/symbols/regular/minus.svg */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/symbols/regular/person.crop.circle.svg */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/symbols/regular/plus.svg */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/symbols/regular/rotate.left.svg */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/symbols/regular/star.svg */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/symbols/regular/text.alignleft.svg */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Resources/Images/apple-id-logo.svg */
/*! ModuleConcatenation bailout: Cannot concat with ./src/ADP/PCSKeyIdentifier.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/ADP/PCSKeyManager.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/ADP/WEB_ACCESS_STATE_PUSH_TOPIC.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/ADP/useHasPCSKey.ts because of ./src/API/Invites/useEvents.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/API/Common/error.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/API/Common/paths.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/API/Common/request.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/API/Common/useAPIQuery.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/API/ContinueOnDevice/continueOnDevice.endpoint.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/API/Drive/drive.schema.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/API/Family/useFamilyDetails.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/API/MeCard/useMeCard.ts because of ./src/Components/ProfileCard/ProfileCard.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/API/PDS/BrowserNotificationManager.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/API/Photos/usePhotosLibraryInfo.ts because of ./src/API/Photos/useRecentPhotos.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/API/RecoveryInfo/CKBookmarkDatabase.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/API/StorageUsage/useStorageUsage.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/API/StorageUsage/useStorageUsageWarningType.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/API/Subscriptions/subscriptions.endpoint.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Components/ADPModal/ADPModal.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Components/ContinueOnDevice/ContinueOnDevice.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Components/ExternalLink/ExternalLink.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Components/FixedFlexPage/FixedFlexPage.tsx because of ./src/Legacy/Routes/CalendarEventReplyRoute.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Components/HomeTiles/Photos/PhotosHomeTile/usePhotosAssetCountLocString.tsx because of ./src/Components/HomeTiles/Photos/PhotosHomeTile/PhotosHomeTile.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Components/ICloudPlus/CustomEmailDomain/CustomEmailDomainTileWrapper/CustomEmailDomainTileWrapper.tsx because of ./src/Components/TileGrid/TileGridComponents.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Components/ICloudPlus/HideMyEmail/HideMyEmailTileWrapper/HideMyEmailTileWrapper.tsx because of ./src/Components/TileGrid/TileGridComponents.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Components/Menu/CloudOSMenuItem.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Components/NavigationChevron/NavigationChevron.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Components/StorageUsage/StorageUsage.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Components/Toolbar/CloudOSApplicationToolbar/CloudOSApplicationToolbar.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Components/Toolbar/StaticAvatar/StaticAvatar.tsx because of ./src/Components/ProfileCard/ProfileCard.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Components/Wallpaper/Wallpaper.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/ComponentsGeneric/AppIcon/AppIcon.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/ComponentsGeneric/CloseButton/CloseButton.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/ComponentsGeneric/CloudOSAlert/useShowCloudOSAlert.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/ComponentsGeneric/InfoTile/MixedTileGrid.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/ComponentsGeneric/ScreenreaderOnlyContent/ScreenreaderOnlyContent.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/ComponentsGeneric/ScreenreaderOnlyHeading/ScreenreaderOnlyHeading.tsx because of ./src/Pages/HomePage/HomePage.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/ComponentsGeneric/SquircledSymbol/SquircledSymbol.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/ComponentsGeneric/Tiles/ErrorHomeTileContent/ErrorHomeTileContent.tsx because of ./src/Components/TileGrid/TileGridComponents.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/ComponentsGeneric/Tiles/FileIcon/FileIcon.tsx because of ./src/Pages/ShareAcceptancePage/ShareAcceptancePage.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/ComponentsGeneric/Tiles/StaticTileContent/StaticTileContent.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/ComponentsGeneric/Tiles/Tile/Tile.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Contexts/ApplicationLaunchProvider.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Contexts/ApplicationToolbarThemeProvider.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Contexts/ContactsLookupProvider.tsx because of ./src/Components/HomeTiles/Mail/MailTileWrapper/MailTileWrapper.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Contexts/OpenModalProvider.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Contexts/TelemetryProvider.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Hooks/useCombinedPlanDetails.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Hooks/useCurrentBrowserPermission.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Hooks/useDelayedState.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Hooks/useICloudPlan.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Hooks/useLoc.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Hooks/useShouldShowPlanUpgrade.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Hooks/useSprinklesSizeClass.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Hooks/useWebServices.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Application/CloudOSApplication.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Authentication/AuthenticationHook.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/ChildApplication/ApplicationConfigurations/InvitesApplicationConfiguration.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/ChildApplication/ApplicationConfigurations/RemindersApplicationConfiguration.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/ChildApplication/ChildApplicationManager.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/ChildApplication/ChildApplicationsController.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Components/ChildApplication.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Components/LegalFooter.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Components/QuickAccess.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Environment/CloudOSParameters.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Environment/DomainManagerService.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Environment/Platform.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Environment/ValidatedDownloadManager.ts because of ./src/Pages/ShareAcceptancePage/ShareAcceptancePage.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Environment/ValidatedDownloadUrl.ts because of ./src/Pages/ShareAcceptancePage/ShareAcceptancePage.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Hooks/useAppsOrder.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Hooks/useHorizontalSizeClass.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/NavLinks/LegacyNavLinks.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Network/CloudOSURLConnection.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Network/addQueryArgs.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Preferences/PreferencesStore.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Telemetry/Stat.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Telemetry/Telemetry.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Telemetry/TelemetryCategory.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Utils/isTruthy.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Utils/uuidString.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/WebServices/ADP/requestWebAccessState.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/loc.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Pages/LandingPage/GCBDBranding.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Pages/RecoveryPage/BookmarksRecoveryTile/BookmarksRecoveryTile.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Pages/ShareAcceptancePage/getDriveFileInfo.ts because of ./src/Pages/ShareAcceptancePage/ShareAcceptancePage.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Pages/WelcomePage/ICloudHero/ICloudHero.tsx because of ./src/Pages/WelcomePage/WelcomePage.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Services/AuthService.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Services/MeCard.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Services/Push/Push.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Services/Quota.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Utils/BytesToHumanizedFormat.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Utils/checkExhaustive.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Utils/convertImageCropRect.ts because of ./src/Components/ProfileCard/ProfileCard.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Utils/debounce.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Utils/getBiDirChevron.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Utils/getErrorMessage.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Utils/getSupportLink.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Utils/getUserDisplayName.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Utils/isTallLanguage.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Utils/loadImage.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Utils/logPushMessage.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Utils/notificationsEnabled.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Utils/relativeDateTimeFormatter.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Utils/ssoRedirect.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Utils/stringFormatter.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Utils/truncateList.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Utils/useUpdateAttributes.ts because of ./src/Pages/HomePage/HomePage.tsx */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/localization/build/esm/src/cjk.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/localization/build/esm/src/core.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/localization/build/esm/src/personName.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/react-helpers/build/esm/InterpolatedString.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/react-helpers/build/esm/useHorizontalSizeClass.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/result/build/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/symbols/SVGComponent.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/ui-components/build/UIActivityIndicator.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/ui-components/build/UIButton.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/ui-components/build/UICheckbox.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/ui-components/build/UIImage.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/ui-components/build/UILabel.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/ui-components/build/UIOverlayActions/UIOverlayActions.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/ui-components/build/UIPaneContainer.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/ui-components/build/UISelectButton.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/ui-components/build/UISlider.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/ui-components/build/UISwitch.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/ui-components/build/usePopup/usePopup.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/ui-components/build/useShowAlert/useShowAlert.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/ui-components/build/utils/readFileAsDataUrl.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@icloudweb/auth-service/react/DomainRedirect/DomainRedirectPage.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@icloudweb/auth-service/server/AuthenticationController.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@icloudweb/auth-service/server/Environment/AuthenticatedUser.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@icloudweb/auth-service/server/Environment/Configurations.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@icloudweb/photos-tile/build/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@icloudweb/push-service/client/subscribeToPushNotifications.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@icloudweb/safe/build/loadUrl.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@icloudweb/subscription-service/client/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@icloudweb/subscription-service/react/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/html-react-parser/index.mjs (<- Module is referenced from these modules with unsupported syntax: /workspace/node_modules/@icloudweb/subscription-service/react/Components/PlanUpgrade/PlanUpgradePane.js (referenced with cjs require)) */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/react-query/es/index.js (<- Module exports are unknown) */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/react/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/zod/lib/index.mjs (<- Module is referenced from these modules with unsupported syntax: /workspace/node_modules/@icloudweb/mecard-service/server/MeCardLink.js (referenced with cjs require), /workspace/node_modules/@icloudweb/photos-tile/build/index.js (referenced with cjs require), /workspace/node_modules/@icloudweb/quota-service/server/QuotaLink.js (referenced with cjs require), /workspace/node_modules/@icloudweb/subscription-service/common/Interface.js (referenced with cjs require)) */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Resources/Images/hide-my-email-samples.png */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Resources/Images/icloud_welcome.png because of ./src/Pages/WelcomePage/WelcomePage.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Resources/Images/icloud_welcome@2x.png because of ./src/Pages/WelcomePage/WelcomePage.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Resources/Images/icloud_welcome@3x.png because of ./src/Pages/WelcomePage/WelcomePage.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Resources/Styles/RootComponent.scss because of ./src/Legacy/Components/RootComponent.tsx */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";

// EXPORTS
__webpack_require__.d(__webpack_exports__, "o", function() { return /* binding */ WaitingForPCSKeysRoute; });
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ AccountMaintenancePageRoute; });
__webpack_require__.d(__webpack_exports__, "p", function() { return /* binding */ WebAccessBlockedPageRoute; });
__webpack_require__.d(__webpack_exports__, "j", function() { return /* binding */ SettingsPageRoute; });
__webpack_require__.d(__webpack_exports__, "h", function() { return /* binding */ RecoveryPageRoute; });
__webpack_require__.d(__webpack_exports__, "d", function() { return /* binding */ ICloudPlusPageRoute; });
__webpack_require__.d(__webpack_exports__, "l", function() { return /* binding */ StoragePageRoute; });
__webpack_require__.d(__webpack_exports__, "g", function() { return /* binding */ PlanPageRoute; });
__webpack_require__.d(__webpack_exports__, "e", function() { return /* binding */ MailDropRoute; });
__webpack_require__.d(__webpack_exports__, "k", function() { return /* binding */ ShareAcceptanceErrorRoute; });
__webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ CKRemindersTemplateRoute; });
__webpack_require__.d(__webpack_exports__, "f", function() { return /* binding */ MailEmailView; });
__webpack_require__.d(__webpack_exports__, "c", function() { return /* binding */ CalendarEventView; });
__webpack_require__.d(__webpack_exports__, "i", function() { return /* binding */ RedirectToDomainRoute; });
__webpack_require__.d(__webpack_exports__, "m", function() { return /* binding */ TermsAndConditionsConfirmationRoute; });
__webpack_require__.d(__webpack_exports__, "n", function() { return /* binding */ TermsAndConditionsRoute; });

// UNUSED EXPORTS: RequestAccessPageRoute

// EXTERNAL MODULE: ./src/Components/FixedFlexPage/FixedFlexPage.tsx + 1 modules
var FixedFlexPage = __webpack_require__(2317);

// EXTERNAL MODULE: /workspace/node_modules/react/index.js
var react = __webpack_require__(870);
var react_default = /*#__PURE__*/__webpack_require__.n(react);

// EXTERNAL MODULE: /workspace/node_modules/classnames/index.js
var classnames = __webpack_require__(1215);
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);

// EXTERNAL MODULE: ./src/Contexts/ApplicationToolbarThemeProvider.tsx
var ApplicationToolbarThemeProvider = __webpack_require__(1452);

// EXTERNAL MODULE: ./src/Components/Toolbar/CloudOSApplicationToolbar/CloudOSApplicationToolbar.tsx + 30 modules
var CloudOSApplicationToolbar = __webpack_require__(2143);

// EXTERNAL MODULE: /workspace/node_modules/@apple/ui-components/build/UIActivityIndicator.js + 1 modules
var UIActivityIndicator = __webpack_require__(2262);

// EXTERNAL MODULE: ./src/Hooks/useLoc.ts
var useLoc = __webpack_require__(1227);

// CONCATENATED MODULE: ./src/Pages/EPLoadingPage/EPLoadingPage.scss
// extracted by mini-css-extract-plugin

// CONCATENATED MODULE: ./src/Pages/EPLoadingPage/EPLoadingPage.tsx




const EPLoadingPage = () => {
  const loadingMsg = Object(useLoc["a" /* getLoc */])("EP.Loading.Message");
  return /*#__PURE__*/react["createElement"]("div", {
    className: "parent-container-loading"
  }, /*#__PURE__*/react["createElement"](UIActivityIndicator["a" /* UIActivityIndicator */], {
    className: "ui-spinner-loading",
    description: Object(useLoc["a" /* getLoc */])("CloudOS.Spinner.Loading")
  }), /*#__PURE__*/react["createElement"]("article", {
    className: "loading-screen-text"
  }, loadingMsg));
};
// EXTERNAL MODULE: ./src/Legacy/Components/LegalFooter.tsx + 1 modules
var LegalFooter = __webpack_require__(2272);

// CONCATENATED MODULE: ./src/Pages/AccountMaintenancePage/AccountMaintenancePage.scss
// extracted by mini-css-extract-plugin

// EXTERNAL MODULE: ./src/Pages/WelcomePage/ICloudHero/ICloudHero.tsx + 1 modules
var ICloudHero = __webpack_require__(2324);

// EXTERNAL MODULE: /workspace/node_modules/@icloudweb/auth-service/server/AuthenticationController.js + 12 modules
var AuthenticationController = __webpack_require__(2155);

// EXTERNAL MODULE: ./src/Components/ExternalLink/ExternalLink.tsx + 3 modules
var ExternalLink = __webpack_require__(2201);

// EXTERNAL MODULE: ./src/Utils/getSupportLink.ts
var getSupportLink = __webpack_require__(1202);

// CONCATENATED MODULE: ./src/Pages/AccountMaintenancePage/AccountMaintenancePage.tsx








const AccountMaintenancePage = _ref => {
  let {
    className: cls
  } = _ref;
  const pageDescription = getDurationDescription();
  return /*#__PURE__*/react["createElement"]("div", {
    className: classnames_default()("account-maintenance-page", cls)
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "header-section"
  }, /*#__PURE__*/react["createElement"](ICloudHero["a" /* ICloudHero */], {
    title: Object(useLoc["a" /* getLoc */])("AccountMaintenance.Title")
  })), /*#__PURE__*/react["createElement"]("section", {
    className: "body-section description"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "item-description"
  }, pageDescription), /*#__PURE__*/react["createElement"]("div", {
    className: "learn-more-link"
  }, /*#__PURE__*/react["createElement"](ExternalLink["a" /* ExternalLink */], {
    href: Object(getSupportLink["a" /* getSupportLink */])("accountMaintenance"),
    useSemiboldArrow: true,
    statName: "accountMaintenanceLearnMoreLink"
  }, Object(useLoc["a" /* getLoc */])("AccountMaintenance.LearnMore")))));
};
function getDurationDescription() {
  const duration = Object(AuthenticationController["c" /* getAuthenticationController */])().maintenanceDuration;
  // Message & ETA Rules
  // When is the message visible: Available to all impacted users when the maintenance is started.
  // When the time estimate is available:
  // Maintenance takes less than 30 mins - Communicate it takes about 30 mins
  // Maintenance takes less than 1 hour - Communicate it takes about 1 hour
  // Maintenance takes less than 12 hours - Countdown by hours
  // Maintenance takes longer than 12 hours - Not mention time, it will be generic
  const description = Object(useLoc["a" /* getLoc */])("AccountMaintenance.Description");
  const durationString = duration > 0 && duration <= 30 * 60 * 1000 ? Object(useLoc["a" /* getLoc */])("AccountMaintenance.Description.ShortDuration") : duration > 30 * 60 * 1000 && duration <= 60 * 60 * 1000 ? Object(useLoc["a" /* getLoc */])("AccountMaintenance.Description.MediumDuration") : duration > 60 * 60 * 1000 && duration <= 12 * 60 * 60 * 1000 ? Object(useLoc["a" /* getLoc */])(`AccountMaintenance.Description.LongDuration`, {
    hours: Math.ceil(duration / (60 * 60 * 1000))
  }) : null;
  return durationString ? description + " " + durationString : description;
}
// CONCATENATED MODULE: ./src/Pages/WebAccessBlockedPage/WebAccessBlockedPage.scss
// extracted by mini-css-extract-plugin

// EXTERNAL MODULE: /workspace/node_modules/@apple/ui-components/build/UIButton.js + 1 modules
var UIButton = __webpack_require__(2259);

// EXTERNAL MODULE: /workspace/node_modules/@apple/localization/build/esm/src/cjk.js
var cjk = __webpack_require__(1000);

// EXTERNAL MODULE: /workspace/node_modules/@apple/react-helpers/build/esm/InterpolatedString.js
var InterpolatedString = __webpack_require__(1201);

// EXTERNAL MODULE: ./src/Utils/getUserDisplayName.ts
var getUserDisplayName = __webpack_require__(1481);

// EXTERNAL MODULE: ./src/Legacy/Environment/DomainManagerService.ts
var DomainManagerService = __webpack_require__(900);

// EXTERNAL MODULE: ./src/Legacy/Authentication/AuthenticationHook.ts
var AuthenticationHook = __webpack_require__(1330);

// EXTERNAL MODULE: ./src/Legacy/Components/QuickAccess.tsx + 3 modules
var QuickAccess = __webpack_require__(2198);

// EXTERNAL MODULE: /workspace/node_modules/zod/lib/index.mjs
var lib = __webpack_require__(888);

// EXTERNAL MODULE: ./src/Legacy/Telemetry/Stat.ts
var Stat = __webpack_require__(919);

// EXTERNAL MODULE: ./src/Legacy/Telemetry/Telemetry.ts + 2 modules
var Telemetry = __webpack_require__(2208);

// EXTERNAL MODULE: ./src/Legacy/Network/CloudOSURLConnection.ts
var CloudOSURLConnection = __webpack_require__(973);

// CONCATENATED MODULE: ./src/Legacy/WebServices/ADP/enableWebAccess.ts



const wireDataRecoveryDataResponseSchema = lib["z"].object({
  isWebAccessAllowed: lib["z"].boolean(),
  isWebAccessNotificationSent: lib["z"].boolean()
});
function isWireDataRecoveryDataResponse(value) {
  return wireDataRecoveryDataResponseSchema.safeParse(value).success;
}
async function enableWebAccess() {
  const servicesDomain = DomainManagerService["a" /* DomainManagerService */].sharedInstance.current.servicesDomain;
  const url = `https://setup.${servicesDomain}/setup/ws/1/enableWebAccess`;
  let response;
  try {
    response = await CloudOSURLConnection["a" /* CloudOSURLConnection */].postURL(url);
  } catch {
    return {
      ok: false
    };
  }
  if (!response || !response.ok) return {
    ok: false
  };
  const parsedResponse = await (async () => {
    try {
      const jsonBody = await response.json();
      if (!isWireDataRecoveryDataResponse(jsonBody)) return null;
      return jsonBody;
    } catch {
      return null;
    }
  })();
  if (!parsedResponse) return {
    ok: false
  };
  return {
    ok: true,
    data: parsedResponse
  };
}
// EXTERNAL MODULE: ./src/Legacy/WebServices/ADP/requestWebAccessState.ts
var requestWebAccessState = __webpack_require__(1273);

// EXTERNAL MODULE: /workspace/node_modules/@icloudweb/push-service/client/subscribeToPushNotifications.js
var subscribeToPushNotifications = __webpack_require__(1267);

// EXTERNAL MODULE: ./src/Services/AuthService.ts
var AuthService = __webpack_require__(965);

// EXTERNAL MODULE: ./src/ADP/WEB_ACCESS_STATE_PUSH_TOPIC.ts
var WEB_ACCESS_STATE_PUSH_TOPIC = __webpack_require__(1353);

// CONCATENATED MODULE: ./src/ADP/WebAccessManager.ts
var _WebAccessManager;








var RequestSource = /*#__PURE__*/function (RequestSource) {
  RequestSource["WEB_ACCESS_MANAGER"] = "WebAccessManager";
  return RequestSource;
}(RequestSource || {});
var RequestReason = /*#__PURE__*/function (RequestReason) {
  RequestReason["WEB_ACCESS_BLOCKED_PAGE"] = "Button Manage on device from web access blocked page";
  return RequestReason;
}(RequestReason || {});
var FailureDescription = /*#__PURE__*/function (FailureDescription) {
  FailureDescription["NO_DEVICE"] = "User has no iCDRS supported device.";
  FailureDescription["NOTIFICATION_NOT_SENT_WEB_ACCESS"] = "Web access notification not sent.";
  FailureDescription["USER_DECLINED"] = "User chose \"Don't allow\" from device.";
  return FailureDescription;
}(FailureDescription || {});
class WebAccessManager_DeviceCallStat {
  constructor(statName, requestSource, requestReason) {
    this.stat = void 0;
    this.requestSource = requestSource;
    this.requestReason = requestReason;
    this.stat = new Stat["a" /* Stat */](statName).time();
  }
  reportSuccess(requestCount, notificationsSentToDeviceCount) {
    this.stat.end();
    if (requestCount < 1) return;
    Telemetry["b" /* Telemetry */].sharedInstance.recordStat(this.stat.success({
      requestSource: this.requestSource,
      requestReason: this.requestReason,
      requestCount,
      notificationsSentToDeviceCount
    }));
  }
  reportFailure(failureReason, failureDescription, requestCount, notificationsSentToDeviceCount) {
    this.stat.end();
    if (requestCount < 1) return;
    Telemetry["b" /* Telemetry */].sharedInstance.recordStat(this.stat.failure({
      requestSource: this.requestSource,
      requestReason: this.requestReason,
      requestCount,
      notificationsSentToDeviceCount,
      failureReason,
      failureDescription
    }));
  }
}
const wireSetupServiceWebAccessStatePushSchema = lib["z"].object({
  // This is sometimes a number, sometimes a string. We don't
  // use it though. rdar://102158295
  // dsid: z.number(),
  apsTopic: lib["z"].string(),
  isWebAccessAllowed: lib["z"].boolean(),
  clientIdThatRequestedNotification: lib["z"].string()
});
function isWireSetupServiceWebAccessStatePush(value) {
  return wireSetupServiceWebAccessStatePushSchema.safeParse(value).success;
}
class WebAccessManager_WebAccessManager {
  /**
   * Reset enableWebAccessStat
   */
  _resetStat() {
    this._endTime = 0;
    this._requestCount = 0;
    this._notificationsSentToDeviceCount = 0;
  }
  constructor() {
    this._enableWebAccessStat = new WebAccessManager_DeviceCallStat("enableWebAccess", RequestSource.WEB_ACCESS_MANAGER, RequestReason.WEB_ACCESS_BLOCKED_PAGE);
    this._endTime = 0;
    this._requestCount = 0;
    this._notificationsSentToDeviceCount = 0;
    this.newWebAccessListeners = [];
    this.handlePush = e => {
      if (e.data.topic !== WEB_ACCESS_STATE_PUSH_TOPIC["a" /* WEB_ACCESS_STATE_PUSH_TOPIC */].hash) return;
      const payload = e.data.payload;
      if (!isWireSetupServiceWebAccessStatePush(payload)) return;
      if (typeof payload.isWebAccessAllowed === "boolean") {
        for (const listener of this.newWebAccessListeners) {
          listener(payload.isWebAccessAllowed);
        }
        this.newWebAccessListeners = [];
        const currentWebAccessAllowed = Object(AuthService["i" /* getIsWebAccessAllowed */])();

        // If there is a change in web access allowed flag then we will revalidate the user
        if (payload.isWebAccessAllowed !== currentWebAccessAllowed) {
          if (payload.isWebAccessAllowed) {
            Object(AuthService["s" /* validateUser */])();
          } else {
            // HACK
            // Although calling AuthenticationController.sharedInstance.validateUser()
            // does work in this scenario, and will cycle through back
            // to the landing page. At that point the IDMS widget just
            // shows a spinner and doesn't let the user sign in.
            //
            // rdar://102176628 (Mid-session 421 responses result in an unusable IDMS widget)
            window.location.reload();
          }
        }
      }
    };
    Object(subscribeToPushNotifications["b" /* subscribeToPushNotifications */])(this.handlePush);
  }
  async enableWebAccess(canceledRef, delegate) {
    var _delegate$sentRequest, _delegate$receivedReq4;
    if (Object(AuthService["i" /* getIsWebAccessAllowed */])()) {
      Object(AuthService["s" /* validateUser */])();
      return true;
    }
    delegate === null || delegate === void 0 || (_delegate$sentRequest = delegate.sentRequestToEnableWebAccess) === null || _delegate$sentRequest === void 0 || _delegate$sentRequest.call(delegate);
    if (this._requestCount > 0) {
      ++this._requestCount;
    } else {
      this._enableWebAccessStat = new WebAccessManager_DeviceCallStat("enableWebAccess", RequestSource.WEB_ACCESS_MANAGER, RequestReason.WEB_ACCESS_BLOCKED_PAGE);
      this._requestCount = 1;
      this._notificationsSentToDeviceCount = 0;
    }
    const response = await enableWebAccess();
    if (canceledRef !== null && canceledRef !== void 0 && canceledRef.current) {
      var _delegate$canceledEna;
      delegate === null || delegate === void 0 || (_delegate$canceledEna = delegate.canceledEnableWebAccess) === null || _delegate$canceledEna === void 0 || _delegate$canceledEna.call(delegate);
      return false;
    }
    if (!response.ok) {
      var _delegate$receivedReq;
      delegate === null || delegate === void 0 || (_delegate$receivedReq = delegate.receivedRequestToEnableWebAccesseFailure) === null || _delegate$receivedReq === void 0 || _delegate$receivedReq.call(delegate);
      this._enableWebAccessStat.reportFailure("Error", "enableWebAccess failed", this._requestCount, this._notificationsSentToDeviceCount);
      this._resetStat();
      return false;
    }
    Object(AuthService["p" /* setIsWebAccessAllowed */])(response.data.isWebAccessAllowed);
    if (response.data.isWebAccessAllowed) {
      var _delegate$receivedReq2;
      // We call validateUser to force the UI state to be updated
      // given the new web access state.
      Object(AuthService["s" /* validateUser */])();
      this._enableWebAccessStat.reportSuccess(this._requestCount, this._notificationsSentToDeviceCount);
      this._resetStat();
      delegate === null || delegate === void 0 || (_delegate$receivedReq2 = delegate.receivedRequestToEnableWebAccessNotificationGranted) === null || _delegate$receivedReq2 === void 0 || _delegate$receivedReq2.call(delegate);
      return true;
    }
    if (!response.data.isWebAccessNotificationSent) {
      var _delegate$receivedReq3;
      delegate === null || delegate === void 0 || (_delegate$receivedReq3 = delegate.receivedRequestToEnableWebAccesseFailure) === null || _delegate$receivedReq3 === void 0 || _delegate$receivedReq3.call(delegate);
      this._enableWebAccessStat.reportFailure("Error", FailureDescription.NOTIFICATION_NOT_SENT_WEB_ACCESS, this._requestCount, this._notificationsSentToDeviceCount);
      this._resetStat();
      return false;
    }
    delegate === null || delegate === void 0 || (_delegate$receivedReq4 = delegate.receivedRequestToEnableWebAccessNotificationSent) === null || _delegate$receivedReq4 === void 0 || _delegate$receivedReq4.call(delegate);
    ++this._notificationsSentToDeviceCount;
    let receivedNotification = false;
    const isSendAgain = this._endTime > 0;
    const didEnable = await Promise.race([new Promise(resolve => {
      this.newWebAccessListeners.push(enabled => {
        receivedNotification = true;
        resolve(enabled);
      });
    }), new Promise(resolve => {
      (async () => {
        this._endTime = Date.now() + 2 * 60 * 1000;
        if (!isSendAgain) {
          while (Date.now() < this._endTime) {
            await new Promise(timeoutResolve => window.setTimeout(() => timeoutResolve(), 10 * 1000));
            if (receivedNotification || canceledRef !== null && canceledRef !== void 0 && canceledRef.current) return;
            const webAccessStateResponse = await Object(requestWebAccessState["a" /* requestWebAccessState */])();
            if (receivedNotification || canceledRef !== null && canceledRef !== void 0 && canceledRef.current) return;
            if (webAccessStateResponse.ok && webAccessStateResponse.data.isWebAccessAllowed) {
              Object(AuthService["p" /* setIsWebAccessAllowed */])(webAccessStateResponse.data.isWebAccessAllowed);
              Object(AuthService["s" /* validateUser */])();
              resolve("AlreadyWebAccessEnabled");
            }
          }
          resolve("Timeout");
        }
      })();
    })]);
    if (canceledRef !== null && canceledRef !== void 0 && canceledRef.current) {
      var _delegate$canceledEna2;
      delegate === null || delegate === void 0 || (_delegate$canceledEna2 = delegate.canceledEnableWebAccess) === null || _delegate$canceledEna2 === void 0 || _delegate$canceledEna2.call(delegate);
      return false;
    }
    if (didEnable === "Timeout") {
      var _delegate$receivedReq5;
      this._enableWebAccessStat.reportFailure("Timeout", "", this._requestCount, this._notificationsSentToDeviceCount);
      this._resetStat();
      delegate === null || delegate === void 0 || (_delegate$receivedReq5 = delegate.receivedRequestToEnableWebAccessNotificationTimeout) === null || _delegate$receivedReq5 === void 0 || _delegate$receivedReq5.call(delegate);
      return false;
    }
    if (didEnable === "AlreadyWebAccessEnabled") {
      var _delegate$receivedReq6;
      delegate === null || delegate === void 0 || (_delegate$receivedReq6 = delegate.receivedRequestToEnableWebAccessNotificationGranted) === null || _delegate$receivedReq6 === void 0 || _delegate$receivedReq6.call(delegate);
      this._enableWebAccessStat.reportSuccess(this._requestCount, this._notificationsSentToDeviceCount);
      this._resetStat();
      return true;
    }
    if (!didEnable) {
      var _delegate$receivedReq7;
      delegate === null || delegate === void 0 || (_delegate$receivedReq7 = delegate.receivedRequestToEnableWebAccesseNotificationDenied) === null || _delegate$receivedReq7 === void 0 || _delegate$receivedReq7.call(delegate);
      this._enableWebAccessStat.reportFailure("Error", FailureDescription.USER_DECLINED, this._requestCount, this._notificationsSentToDeviceCount);
      this._resetStat();
      return false;
    }
    const webAccessStateResponse = await Object(requestWebAccessState["a" /* requestWebAccessState */])();
    if (canceledRef !== null && canceledRef !== void 0 && canceledRef.current) {
      var _delegate$canceledEna3;
      delegate === null || delegate === void 0 || (_delegate$canceledEna3 = delegate.canceledEnableWebAccess) === null || _delegate$canceledEna3 === void 0 || _delegate$canceledEna3.call(delegate);
      return false;
    }
    if (webAccessStateResponse.ok && webAccessStateResponse.data.isWebAccessAllowed) {
      var _delegate$receivedReq8;
      Object(AuthService["p" /* setIsWebAccessAllowed */])(webAccessStateResponse.data.isWebAccessAllowed);
      this._enableWebAccessStat.reportSuccess(this._requestCount, this._notificationsSentToDeviceCount);
      this._resetStat();
      delegate === null || delegate === void 0 || (_delegate$receivedReq8 = delegate.receivedRequestToEnableWebAccessNotificationGranted) === null || _delegate$receivedReq8 === void 0 || _delegate$receivedReq8.call(delegate);
      return true;
    } else {
      var _delegate$receivedReq9;
      delegate === null || delegate === void 0 || (_delegate$receivedReq9 = delegate.receivedRequestToEnableWebAccesseNotificationDenied) === null || _delegate$receivedReq9 === void 0 || _delegate$receivedReq9.call(delegate);
      this._enableWebAccessStat.reportFailure("Error", FailureDescription.USER_DECLINED, this._requestCount, this._notificationsSentToDeviceCount);
      this._resetStat();
      return false;
    }
  }
}
_WebAccessManager = WebAccessManager_WebAccessManager;
WebAccessManager_WebAccessManager.sharedInstance = new _WebAccessManager();
// EXTERNAL MODULE: /workspace/node_modules/@apple/symbols/regular/laptopcomputer.and.iphone.svg
var laptopcomputer_and_iphone = __webpack_require__(1571);

// EXTERNAL MODULE: /workspace/node_modules/@apple/symbols/regular/lock.rectangle.stack.fill.svg
var lock_rectangle_stack_fill = __webpack_require__(1349);

// EXTERNAL MODULE: ./src/Hooks/useDelayedState.ts
var useDelayedState = __webpack_require__(1461);

// EXTERNAL MODULE: ./src/Utils/getBiDirChevron.tsx + 4 modules
var getBiDirChevron = __webpack_require__(2186);

// CONCATENATED MODULE: ./src/Pages/WebAccessBlockedPage/WebAccessBlockedPage.tsx


















var State = /*#__PURE__*/function (State) {
  State[State["Init"] = 0] = "Init";
  State[State["Sending"] = 1] = "Sending";
  State[State["Failed"] = 2] = "Failed";
  State[State["Sent"] = 3] = "Sent";
  State[State["Granted"] = 4] = "Granted";
  State[State["Denied"] = 5] = "Denied";
  State[State["Timeout"] = 6] = "Timeout";
  State[State["Canceled"] = 7] = "Canceled";
  return State;
}(State || {});
const WebAccessBlockedPage = _ref => {
  var _user$details$firstNa, _user$details, _user$details$lastNam, _user$details2, _user$details3, _user$details$ICDRSCa, _user$details4;
  let {
    className: cls,
    onComplete
  } = _ref;
  const Chevron = Object(getBiDirChevron["a" /* getBiDirChevron */])();
  const [state, setState] = Object(useDelayedState["a" /* useDelayedState */])(State.Init, 2000);
  react["useEffect"](() => {
    return () => {
      onComplete === null || onComplete === void 0 || onComplete();
    };
  }, [onComplete]);
  const user = Object(AuthenticationHook["b" /* useCloudOSUser */])();
  const firstName = (_user$details$firstNa = user === null || user === void 0 || (_user$details = user.details) === null || _user$details === void 0 ? void 0 : _user$details.firstName) !== null && _user$details$firstNa !== void 0 ? _user$details$firstNa : "";
  const lastName = (_user$details$lastNam = user === null || user === void 0 || (_user$details2 = user.details) === null || _user$details2 === void 0 ? void 0 : _user$details2.lastName) !== null && _user$details$lastNam !== void 0 ? _user$details$lastNam : "";
  const displayName = Object(getUserDisplayName["a" /* getUserDisplayName */])(firstName, lastName);
  const fullName = Object(getUserDisplayName["a" /* getUserDisplayName */])(firstName, lastName, true);
  const currentDomain = DomainManagerService["a" /* DomainManagerService */].sharedInstance.isDomainCN ? Object(useLoc["a" /* getLoc */])("CloudOS.AccountNeedsSetup.Domain.icloud.com.cn") : Object(useLoc["a" /* getLoc */])("CloudOS.AccountNeedsSetup.Domain.icloud.com");
  const isBeneficiary = user === null || user === void 0 || (_user$details3 = user.details) === null || _user$details3 === void 0 || (_user$details3 = _user$details3.beneficiaryInfo) === null || _user$details3 === void 0 ? void 0 : _user$details3.isBeneficiary;
  if (isBeneficiary) {
    const nameIsCJK = Object(cjk["a" /* stringIsCJK */])(firstName);
    // Welcome greeting of the web access blocked page for Beneficiary
    const welcomeText = nameIsCJK ? Object(useLoc["a" /* getLoc */])(`WebAccessBlocked.Greeting.Beneficiary.NameIsCJK`, {
      firstName: displayName
    }) : Object(useLoc["a" /* getLoc */])(`WebAccessBlocked.Greeting.Beneficiary`, {
      firstName: displayName
    });
    // Title of the web access blocked page for Beneficiary
    const pageTitle = nameIsCJK ? Object(useLoc["a" /* getLoc */])(`WebAccessBlocked.Title.Beneficiary.NameIsCJK`, {
      firstName,
      currentDomain
    }) : Object(useLoc["a" /* getLoc */])(`WebAccessBlocked.Title.Beneficiary`, {
      firstName,
      currentDomain
    });
    // Description One of the web access blocked page for Beneficiary
    const pageDescription = nameIsCJK ? Object(useLoc["a" /* getLoc */])(`WebAccessBlocked.Description.Beneficiary.NameIsCJK`, {
      firstName
    }) : Object(useLoc["a" /* getLoc */])(`WebAccessBlocked.Description.Beneficiary`, {
      firstName
    });
    return /*#__PURE__*/react["createElement"]("div", {
      className: classnames_default()("web-access-blocked-page", cls)
    }, /*#__PURE__*/react["createElement"]("div", {
      className: "header-section"
    }, /*#__PURE__*/react["createElement"](ICloudHero["a" /* ICloudHero */], {
      title: welcomeText
    }), /*#__PURE__*/react["createElement"](lock_rectangle_stack_fill["a" /* default */], {
      className: "lock-image",
      width: 64,
      height: 60,
      layoutMode: "glyphBox"
    }), /*#__PURE__*/react["createElement"]("h1", null, pageTitle)), /*#__PURE__*/react["createElement"]("section", {
      className: "body-section description"
    }, /*#__PURE__*/react["createElement"]("div", {
      className: "item-description"
    }, pageDescription)));
  }
  const deviceCount = (_user$details$ICDRSCa = user === null || user === void 0 || (_user$details4 = user.details) === null || _user$details4 === void 0 ? void 0 : _user$details4.ICDRSCapableDeviceCount) !== null && _user$details$ICDRSCa !== void 0 ? _user$details$ICDRSCa : 0;
  const hasNoiCDRSSupportedDevice = deviceCount < 1;
  const hours = new Date().getHours();

  // Welcome greeting of the web access blocked page
  const welcomeTextLoc = hours < 6 ? "WebAccessBlocked.Greeting.0-6" : hours < 12 ? "WebAccessBlocked.Greeting.6-12" : hours < 18 ? "WebAccessBlocked.Greeting.12-18" : "WebAccessBlocked.Greeting.18-0";
  const welcomeText = Object(useLoc["a" /* getLoc */])(welcomeTextLoc, {
    firstName: displayName
  });
  // Description One of the web access blocked page
  const isADP = Object(AuthService["f" /* getIsICDRSDisabled */])();
  const pageTitle = isADP ? Object(useLoc["a" /* getLoc */])("WebAccessBlocked.Title.ADP") : Object(useLoc["a" /* getLoc */])("WebAccessBlocked.Title");
  const pageDescription = isADP ? Object(useLoc["a" /* getLoc */])(`WebAccessBlocked.Description.ADP`, {
    currentDomain
  }) : Object(useLoc["a" /* getLoc */])(`WebAccessBlocked.Description`, {
    currentDomain
  });
  if (hasNoiCDRSSupportedDevice) {
    return /*#__PURE__*/react["createElement"]("div", {
      className: classnames_default()("web-access-blocked-page", cls)
    }, /*#__PURE__*/react["createElement"]("div", {
      className: "header-section"
    }, /*#__PURE__*/react["createElement"](ICloudHero["a" /* ICloudHero */], {
      title: welcomeText
    }), /*#__PURE__*/react["createElement"]("h1", null, pageTitle)), /*#__PURE__*/react["createElement"]("section", {
      className: "body-section description"
    }, /*#__PURE__*/react["createElement"]("div", {
      className: "item-description"
    }, pageDescription)), /*#__PURE__*/react["createElement"]("section", {
      className: "no-device-section"
    }, /*#__PURE__*/react["createElement"]("p", {
      className: "section-no-device"
    }, /*#__PURE__*/react["createElement"]("span", null, Object(useLoc["a" /* getLoc */])("ContinueOnDevice.NoDevice.IOS.Description")), /*#__PURE__*/react["createElement"]("br", null), /*#__PURE__*/react["createElement"](InterpolatedString["a" /* InterpolatedString */], {
      interpolations: {
        "#{chevron}": /*#__PURE__*/react["createElement"](Chevron, {
          layoutMode: "glyphBox",
          desiredFontSize: 7
        })
      }
    }, Object(useLoc["a" /* getLoc */])(`WebAccessBlocked.NoDevice.Description`, {
      fullName
    }))), /*#__PURE__*/react["createElement"]("p", {
      className: "section-no-device"
    }, /*#__PURE__*/react["createElement"]("span", null, Object(useLoc["a" /* getLoc */])("ContinueOnDevice.NoDevice.Mac.Description")), /*#__PURE__*/react["createElement"]("br", null), /*#__PURE__*/react["createElement"](InterpolatedString["a" /* InterpolatedString */], {
      interpolations: {
        "#{chevron}": /*#__PURE__*/react["createElement"](Chevron, {
          layoutMode: "glyphBox",
          desiredFontSize: 7
        })
      }
    }, Object(useLoc["a" /* getLoc */])(`WebAccessBlocked.NoDevice.Description2`, {
      fullName
    }))), /*#__PURE__*/react["createElement"]("p", {
      className: "section-no-device"
    }, Object(useLoc["a" /* getLoc */])("WebAccessBlocked.NoDevice.Notice"))), !isADP && /*#__PURE__*/react["createElement"]("div", {
      className: "quick-access-container"
    }, /*#__PURE__*/react["createElement"](QuickAccess["a" /* QuickAccess */], {
      manageDevicesHidden: true
    })));
  }

  // Manage button to trigger send notification
  const manageButtonDidClick = () => {
    if (state === State.Sending) return;
    (async () => {
      const canceledRef = {
        current: false
      };
      WebAccessManager_WebAccessManager.sharedInstance.enableWebAccess(canceledRef, new class {
        sentRequestToEnableWebAccess() {
          setState(State.Sending);
        }
        receivedRequestToEnableWebAccesseFailure() {
          setState(State.Failed);
        }
        receivedRequestToEnableWebAccessNotificationSent() {
          setState(State.Sent);
        }
        receivedRequestToEnableWebAccessNotificationGranted() {
          setState(State.Granted);
        }
        receivedRequestToEnableWebAccesseNotificationDenied() {
          setState(State.Denied);
        }
        receivedRequestToEnableWebAccessNotificationTimeout() {
          setState(State.Timeout);
        }
        canceledEnableWebAccess() {
          setState(State.Canceled);
        }
      }());
    })();
  };
  switch (state) {
    case State.Init:
      return /*#__PURE__*/react["createElement"]("div", {
        className: classnames_default()("web-access-blocked-page", cls)
      }, /*#__PURE__*/react["createElement"]("div", {
        className: "header-section"
      }, /*#__PURE__*/react["createElement"](ICloudHero["a" /* ICloudHero */], {
        title: welcomeText
      }), /*#__PURE__*/react["createElement"]("h1", null, pageTitle)), /*#__PURE__*/react["createElement"]("section", {
        className: "body-section description init"
      }, /*#__PURE__*/react["createElement"]("div", {
        className: "item-description"
      }, pageDescription)), /*#__PURE__*/react["createElement"]("section", {
        className: "body-section"
      }, /*#__PURE__*/react["createElement"]("div", {
        className: "buttons-row"
      }, /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
        onActivate: manageButtonDidClick,
        variant: "block primary large"
      }, /*#__PURE__*/react["createElement"](laptopcomputer_and_iphone["a" /* default */], {
        "aria-hidden": true,
        desiredFontSize: 14,
        layoutMode: "glyphBox"
      }), "\xA0", Object(useLoc["a" /* getLoc */])("WebAccessBlocked.ManageButton.Title"))), /*#__PURE__*/react["createElement"]("div", {
        className: "item-notice"
      }, Object(useLoc["a" /* getLoc */])("WebAccessBlocked.Notice")), !isADP && /*#__PURE__*/react["createElement"]("div", {
        className: "quick-access-container"
      }, /*#__PURE__*/react["createElement"](QuickAccess["a" /* QuickAccess */], {
        manageDevicesHidden: true
      }))));
    case State.Sending:
      return /*#__PURE__*/react["createElement"]("div", {
        className: classnames_default()("web-access-blocked-page", cls)
      }, /*#__PURE__*/react["createElement"]("div", {
        className: "header-section"
      }, /*#__PURE__*/react["createElement"](ICloudHero["a" /* ICloudHero */], {
        title: welcomeText
      }), /*#__PURE__*/react["createElement"]("h1", null, Object(useLoc["a" /* getLoc */])("WebAccessBlocked.Title.Sending"))));
    case State.Failed:
      return /*#__PURE__*/react["createElement"]("div", {
        className: classnames_default()("web-access-blocked-page", cls)
      }, /*#__PURE__*/react["createElement"]("div", {
        className: "header-section"
      }, /*#__PURE__*/react["createElement"](ICloudHero["a" /* ICloudHero */], {
        title: welcomeText
      }), /*#__PURE__*/react["createElement"]("h1", null, Object(useLoc["a" /* getLoc */])("WebAccessBlocked.Title.Failed"))), /*#__PURE__*/react["createElement"]("section", {
        className: "body-section description"
      }, /*#__PURE__*/react["createElement"]("div", {
        className: "item-description failed"
      }, Object(useLoc["a" /* getLoc */])("WebAccessBlocked.Description.Failed"))), /*#__PURE__*/react["createElement"]("section", {
        className: "body-section"
      }, /*#__PURE__*/react["createElement"]("div", {
        className: "buttons-row"
      }, /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
        onActivate: manageButtonDidClick,
        variant: "push primary large"
      }, Object(useLoc["a" /* getLoc */])("WebAccessBlocked.ManageButton.Title.TryAgain")))));
    case State.Sent:
    case State.Granted:
    case State.Denied:
    case State.Timeout:
    case State.Canceled:
      return /*#__PURE__*/react["createElement"]("div", {
        className: classnames_default()("web-access-blocked-page", cls)
      }, /*#__PURE__*/react["createElement"]("div", {
        className: "header-section"
      }, /*#__PURE__*/react["createElement"](ICloudHero["a" /* ICloudHero */], {
        title: welcomeText
      }), /*#__PURE__*/react["createElement"]("h1", null, Object(useLoc["a" /* getLoc */])("WebAccessBlocked.Title.Sent"))), /*#__PURE__*/react["createElement"]("section", {
        className: "body-section description"
      }, /*#__PURE__*/react["createElement"]("div", {
        className: "item-description"
      }, Object(useLoc["a" /* getLoc */])("WebAccessBlocked.Description.Sent"))), /*#__PURE__*/react["createElement"]("section", {
        className: "body-section"
      }, /*#__PURE__*/react["createElement"]("div", {
        className: "item-description notice"
      }, Object(useLoc["a" /* getLoc */])("WebAccessBlocked.Notice.Sent")), /*#__PURE__*/react["createElement"]("div", {
        className: "buttons-row"
      }, /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
        onActivate: manageButtonDidClick,
        variant: "send-again"
      }, Object(useLoc["a" /* getLoc */])("WebAccessBlocked.ManageButton.Title.SendAgain")))), /*#__PURE__*/react["createElement"]("section", {
        className: "body-section footnote"
      }, /*#__PURE__*/react["createElement"](InterpolatedString["a" /* InterpolatedString */], {
        interpolations: {
          "#{chevron}": /*#__PURE__*/react["createElement"](Chevron, {
            layoutMode: "glyphBox",
            desiredFontSize: 7
          })
        }
      }, Object(useLoc["a" /* getLoc */])(`WebAccessBlocked.Description2.Sent`, {
        fullName
      }))));
  }
};
// EXTERNAL MODULE: ./src/Legacy/Resources/Styles/RootComponent.scss
var RootComponent = __webpack_require__(1599);

// EXTERNAL MODULE: ./src/Hooks/useICloudPlan.ts
var useICloudPlan = __webpack_require__(1329);

// CONCATENATED MODULE: ./src/Hooks/useShouldShowUpgradePlanTiles.tsx


const useShouldShowUpgradePlanTiles = () => {
  var _user$details;
  const icloudPlan = Object(useICloudPlan["c" /* useICloudPlanType */])();
  const user = Object(AuthenticationHook["b" /* useCloudOSUser */])();
  const isBeneficiary = user === null || user === void 0 || (_user$details = user.details) === null || _user$details === void 0 || (_user$details = _user$details.beneficiaryInfo) === null || _user$details === void 0 ? void 0 : _user$details.isBeneficiary;
  return icloudPlan !== useICloudPlan["a" /* UserPlan */].Plus && icloudPlan !== useICloudPlan["a" /* UserPlan */].MAID && !isBeneficiary;
};
// CONCATENATED MODULE: ./src/Components/Breadcrumbs/Breadcrumbs.scss
// extracted by mini-css-extract-plugin

// CONCATENATED MODULE: ./src/Legacy/Resources/Images/apple-icon.svg
var _excluded = ["styles"];
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }

/* harmony default export */ var apple_icon = (function (_ref) {
  var _ref$styles = _ref.styles,
    styles = _ref$styles === void 0 ? {} : _ref$styles,
    props = _objectWithoutProperties(_ref, _excluded);
  return /*#__PURE__*/react_default.a.createElement("svg", _extends({
    viewBox: "0 0 18 24",
    xmlns: "http://www.w3.org/2000/svg"
  }, props), /*#__PURE__*/react_default.a.createElement("path", {
    d: "M16.33 14.1c-.93-.87-1.41-1.95-1.42-3.26-.01-1.68.75-2.99 2.29-3.92-.86-1.23-2.16-1.91-3.88-2.04-.64-.05-1.41.08-2.33.41-.97.36-1.55.54-1.72.54-.23 0-.74-.15-1.55-.45-.81-.3-1.45-.45-1.95-.45-.9.01-1.75.25-2.52.71-.78.46-1.4 1.09-1.86 1.89C.8 8.5.5 9.69.5 11.06c0 1.2.22 2.44.66 3.72.41 1.18.93 2.22 1.57 3.12.59.84 1.09 1.43 1.48 1.78.62.58 1.24.85 1.86.83.41-.01.95-.15 1.61-.42.66-.27 1.28-.4 1.86-.4.55 0 1.16.13 1.81.4.66.27 1.22.4 1.69.4.65-.01 1.26-.28 1.82-.8.37-.32.84-.89 1.42-1.71a11.17 11.17 0 001.46-2.93c-.51-.24-.98-.55-1.41-.95zM12.32 3.28c.75-.89 1.12-1.84 1.12-2.87 0-.14-.01-.27-.02-.41-.52.03-1.07.18-1.66.47-.58.29-1.07.65-1.45 1.09-.76.86-1.19 1.91-1.19 2.9 0 .14.01.27.02.39 1.19.09 2.28-.52 3.18-1.57z"
  }));
});
// EXTERNAL MODULE: ./src/Legacy/Application/CloudOSApplication.tsx + 134 modules
var CloudOSApplication = __webpack_require__(2134);

// EXTERNAL MODULE: ./src/Components/NavigationChevron/NavigationChevron.tsx
var NavigationChevron = __webpack_require__(1570);

// CONCATENATED MODULE: ./src/Components/Breadcrumbs/Breadcrumbs.tsx






const Breadcrumbs = props => {
  const handleHomeClick = e => {
    e.preventDefault();
    e.stopPropagation();
    CloudOSApplication["a" /* CloudOSApplication */].cloudOSApplication.switchToSpringboard();
  };
  return /*#__PURE__*/react["createElement"]("section", {
    "aria-label": "Breadcrumbs",
    className: "breadcrumbs"
  }, /*#__PURE__*/react["createElement"]("ol", null, /*#__PURE__*/react["createElement"]("li", null, /*#__PURE__*/react["createElement"]("a", {
    href: "/",
    onClick: handleHomeClick
  }, /*#__PURE__*/react["createElement"](apple_icon, {
    className: "apple-logo"
  }), Object(useLoc["a" /* getLoc */])("Application.Title"))), /*#__PURE__*/react["createElement"]("li", null, /*#__PURE__*/react["createElement"](NavigationChevron["b" /* NavigationChevron */], {
    "aria-hidden": true,
    layoutMode: "glyphBox",
    desiredFontSize: 8,
    className: "chevron"
  }), /*#__PURE__*/react["createElement"]("span", {
    "aria-current": "page"
  }, props.currentPageName))));
};
// CONCATENATED MODULE: ./src/Pages/AccountPage/AccountPage.scss
// extracted by mini-css-extract-plugin

// EXTERNAL MODULE: /workspace/node_modules/@apple/localization/build/esm/src/personName.js
var personName = __webpack_require__(999);

// EXTERNAL MODULE: /workspace/node_modules/@apple/localization/build/esm/src/core.js
var core = __webpack_require__(878);

// CONCATENATED MODULE: ./src/Components/NotificationSettings/NotificationSettings.scss
// extracted by mini-css-extract-plugin

// EXTERNAL MODULE: /workspace/node_modules/@apple/ui-components/build/usePopup/usePopup.js + 1 modules
var usePopup = __webpack_require__(2264);

// EXTERNAL MODULE: /workspace/node_modules/@apple/symbols/regular/icloud.svg
var icloud = __webpack_require__(1474);

// EXTERNAL MODULE: /workspace/node_modules/@apple/symbols/regular/envelope.svg
var envelope = __webpack_require__(1609);

// EXTERNAL MODULE: /workspace/node_modules/@apple/symbols/regular/calendar.svg
var calendar = __webpack_require__(1610);

// EXTERNAL MODULE: ./src/Hooks/useCurrentBrowserPermission.ts
var useCurrentBrowserPermission = __webpack_require__(1456);

// EXTERNAL MODULE: ./src/API/PDS/BrowserNotificationManager.ts + 1 modules
var BrowserNotificationManager = __webpack_require__(2256);

// EXTERNAL MODULE: /workspace/node_modules/@apple/result/build/index.js
var build = __webpack_require__(465);

// EXTERNAL MODULE: ./src/Utils/getErrorMessage.ts
var getErrorMessage = __webpack_require__(1255);

// EXTERNAL MODULE: ./src/Utils/logPushMessage.ts
var logPushMessage = __webpack_require__(1256);

// CONCATENATED MODULE: ./src/Hooks/useBrowserSubscription.ts







/**
 *
 * UseBrowserSubscription manages the browser notification registration flow.
 *
 * It has the following responsibilities:
 * 1. Responsible for asking permission from the user
 * 2. Creating a subscription
 * 3. Sending the subscription to PDS
 */
const useBrowserSubscription = () => {
  const [userSubscription, setUserSubscription] = Object(react["useState"])();
  const [error, setError] = Object(react["useState"])(false);
  const {
    permissionState,
    setPermissionState,
    notificationsEnabled
  } = Object(useCurrentBrowserPermission["a" /* default */])("notifications");

  /**
   * define a click handler that asks the user permission,
   * it uses the setSuserConsent state, to set the consent of the user
   * If the user denies the consent, an error is created with the setError hook
   */
  const askUserPermission = async () => {
    setError(false);
    const consent = await BrowserNotificationManager["a" /* BrowserNotificationManager */].sharedInstance.requestPermission();
    setPermissionState(consent === "default" ? "prompt" : consent);
    return consent;
  };
  /**
   * Define a click handler that creates a push notification subscription.
   * Once the subscription is created, it uses the setUserSubscription hook
   */
  const subscribeToPushNotification = async () => {
    setError(false);
    let subscriptionResponse;
    try {
      subscriptionResponse = await BrowserNotificationManager["a" /* BrowserNotificationManager */].sharedInstance.createNotificationSubscription();
      if (subscriptionResponse.ok) {
        const {
          value: subscription
        } = subscriptionResponse;
        Object(logPushMessage["a" /* logPushMessage */])("Subscription Created");
        setUserSubscription(subscription);
      }
      return subscriptionResponse;
    } catch (subscribeError) {
      const errorMessage = Object(getErrorMessage["a" /* getErrorMessage */])(subscribeError);
      return build["Result"].failure(new Error(errorMessage));
    }
  };
  const unsubscribeToPushNotifications = async () => {
    setError(false);
    if (userSubscription) {
      userSubscription.unsubscribe().then(() => {
        Object(logPushMessage["a" /* logPushMessage */])("Subscription Removed");
        setUserSubscription(null);
        return true;
      }).catch(err => {
        const errorMessage = "Couldn't remove the subscription." + err;
        setError(errorMessage);
        // eslint-disable-next-line no-restricted-globals, no-restricted-syntax -- No more CW.logger
        console.error(errorMessage);
        throw new Error(errorMessage);
      });
    }
    return false;
  };
  Object(react["useEffect"])(() => {
    if (notificationsEnabled()) {
      setError(false);
      BrowserNotificationManager["a" /* BrowserNotificationManager */].sharedInstance.getBrowserSubscription().then(subscription => {
        setUserSubscription(subscription);
      }).catch(() => setUserSubscription(null));
    }
  }, [notificationsEnabled]);
  return {
    permissionState,
    askUserPermission,
    subscribeToPushNotification,
    unsubscribeToPushNotifications,
    userSubscription,
    error,
    notificationsEnabled
  };
};
/* harmony default export */ var Hooks_useBrowserSubscription = (useBrowserSubscription);
// EXTERNAL MODULE: ./src/ComponentsGeneric/CloudOSAlert/useShowCloudOSAlert.tsx
var useShowCloudOSAlert = __webpack_require__(1339);

// CONCATENATED MODULE: ./src/Hooks/useRunOnceAtUnmount.ts


/**
 * This is a more human-readable version of `useEffect(return cb, [])`,
 * running once when your component unmounts, not on every render.
 */
const useRunOnceAtUnmount = fn => {
  react["useEffect"](() => {
    return () => fn();
    // eslint-disable-next-line react-hooks/exhaustive-deps -- Only run once
  }, []);
};
// EXTERNAL MODULE: ./src/Legacy/Telemetry/TelemetryCategory.ts
var TelemetryCategory = __webpack_require__(920);

// EXTERNAL MODULE: ./src/Legacy/Preferences/PreferencesStore.ts + 4 modules
var PreferencesStore = __webpack_require__(2180);

// CONCATENATED MODULE: ./src/Hooks/useBrowserNotificationState.ts












/* 
    Handles the state of a user's browsers notification settings. 
    Includes saving preferences between sessions using KVS and 
    browser notification API. 
*/
const useBrowserNotificationState = () => {
  const {
    permissionState,
    userSubscription,
    subscribeToPushNotification,
    unsubscribeToPushNotifications,
    askUserPermission
  } = Hooks_useBrowserSubscription();
  const [error, setError] = react["useState"](null);
  const [isLoading, setIsLoading] = react["useState"](true);
  const [isSaving, setIsSaving] = react["useState"](false);
  const isMailBrowserNotificationsEnabled = react["useRef"](false);
  const isCalendarBrowserNotificationsEnabled = react["useRef"](false);
  const initialState = react["useRef"]({
    mailToggleValue: BrowserNotificationManager["a" /* BrowserNotificationManager */].sharedInstance.pushEnabledApps.has(BrowserNotificationManager["c" /* PushAppName */].mail),
    calendarToggleValue: BrowserNotificationManager["a" /* BrowserNotificationManager */].sharedInstance.pushEnabledApps.has(BrowserNotificationManager["c" /* PushAppName */].calendar)
  });
  const didUserToggle = react["useRef"](false);
  const showAlert = Object(useShowCloudOSAlert["a" /* useShowCloudOSAlert */])();
  const showUnableToSaveAlert = react["useCallback"](errorMessage => {
    new Stat["a" /* Stat */]("pushNotification.showPushErrorModal", {
      statCategory: TelemetryCategory["a" /* TelemetryCategory */].SESSION,
      error: errorMessage
    }).record();
    showAlert({
      title: Object(useLoc["a" /* getLoc */])("NotificationSettings.Error.UnableToSave.Title"),
      description: Object(useLoc["a" /* getLoc */])("NotificationSettings.Error.UnableToSave.Description"),
      buttons: [{
        title: Object(useLoc["a" /* getLoc */])("NotificationSettings.Error.UnableToSave.Acknowledge"),
        action: ""
      }],
      onActionSelected: () => {
        setError(BrowserNotificationManager["b" /* Errors */].create_subscription_failed);
      }
    });
  }, [showAlert]);
  react["useEffect"](() => {
    if (PreferencesStore["b" /* preferencesStore */].isInitialized) return;
    PreferencesStore["b" /* preferencesStore */].isReady.then(response => {
      if (response.isOK) {
        initialState.current = {
          mailToggleValue: BrowserNotificationManager["a" /* BrowserNotificationManager */].sharedInstance.pushEnabledApps.has(BrowserNotificationManager["c" /* PushAppName */].mail),
          calendarToggleValue: BrowserNotificationManager["a" /* BrowserNotificationManager */].sharedInstance.pushEnabledApps.has(BrowserNotificationManager["c" /* PushAppName */].calendar)
        };
      }
      setIsLoading(false);
    });
  }, []);
  const isExtendedSessionEnabled = () => {
    var _userSignal$value$isE, _userSignal$value;
    return (_userSignal$value$isE = (_userSignal$value = AuthenticationController["h" /* userSignal */].value) === null || _userSignal$value === void 0 ? void 0 : _userSignal$value.isExtendedLogin) !== null && _userSignal$value$isE !== void 0 ? _userSignal$value$isE : null;
  };
  useRunOnceAtUnmount(() => new Stat["a" /* Stat */]("pushNotification.closeNotificationModal", {
    statCategory: TelemetryCategory["a" /* TelemetryCategory */].USER,
    changeset: {
      initialState: initialState.current,
      endState: {
        mailToggleValue: isMailBrowserNotificationsEnabled.current,
        calendarToggleValue: isCalendarBrowserNotificationsEnabled.current
      }
    },
    browserPermission: permissionState,
    extendedSessionEnabled: isExtendedSessionEnabled(),
    userDidToggle: didUserToggle.current
  }).record());
  const sendOpenNotificationsModalSuccessStat = react["useCallback"](() => {
    new Stat["a" /* Stat */]("pushNotification.openNotificationModal", {
      statCategory: TelemetryCategory["a" /* TelemetryCategory */].USER,
      success: true,
      initialState: initialState.current,
      browserPermission: permissionState,
      extendedSessionEnabled: isExtendedSessionEnabled()
    }).record();
  }, [permissionState]);

  // Previous session data logic
  react["useEffect"](() => {
    if (!isLoading) return;
    if (!PreferencesStore["b" /* preferencesStore */].isInitialized) return;

    // if we aren't granted, we don't really care about initial data being populated in UI
    if (permissionState === "denied" || permissionState === "prompt") {
      setIsLoading(false);
      sendOpenNotificationsModalSuccessStat();
      return;
    }

    // if we are granted and have all the data we need, we should calculate the initial toggle values
    if (permissionState === "granted") {
      isMailBrowserNotificationsEnabled.current = BrowserNotificationManager["a" /* BrowserNotificationManager */].sharedInstance.pushEnabledApps.has(BrowserNotificationManager["c" /* PushAppName */].mail);
      isCalendarBrowserNotificationsEnabled.current = BrowserNotificationManager["a" /* BrowserNotificationManager */].sharedInstance.pushEnabledApps.has(BrowserNotificationManager["c" /* PushAppName */].calendar);
      setIsLoading(false);
      sendOpenNotificationsModalSuccessStat();
    }
  }, [permissionState, sendOpenNotificationsModalSuccessStat, isLoading, setIsLoading]);
  const updateSubscription = async () => {
    if (!isMailBrowserNotificationsEnabled.current && !isCalendarBrowserNotificationsEnabled.current) {
      await unsubscribeToPushNotifications();
      if (userSubscription) return build["Result"].success(userSubscription);
    } else {
      if (!userSubscription) {
        const subscriptionResponse = await subscribeToPushNotification();
        if (!subscriptionResponse.ok) {
          const {
            error: subscriptionError
          } = subscriptionResponse;
          isMailBrowserNotificationsEnabled.current = false;
          isCalendarBrowserNotificationsEnabled.current = false;
          return build["Result"].failure(new Error(subscriptionError.message));
        }
        return subscriptionResponse;
      } else {
        return build["Result"].success(userSubscription);
      }
    }
    return build["Result"].failure(new Error("Failure to update Subscription"));
  };

  // Handles saving the current toggled values to the browser and KVS.
  // *** It will throw an error if something goes wrong, so please catch it!
  const saveCurrentData = async () => {
    setIsSaving(true);
    try {
      if (permissionState === "prompt") {
        let pendingConsent = await askUserPermission();
        if (pendingConsent === "denied") {
          // reset any values that may of changed
          isMailBrowserNotificationsEnabled.current = false;
          isCalendarBrowserNotificationsEnabled.current = false;
          setIsSaving(false);
          return;
        }
      }
      const enabledApps = new Set();
      if (isMailBrowserNotificationsEnabled.current) {
        enabledApps.add(BrowserNotificationManager["c" /* PushAppName */].mail);
      }
      if (isCalendarBrowserNotificationsEnabled.current) {
        enabledApps.add(BrowserNotificationManager["c" /* PushAppName */].calendar);
      }
      const subscriptionResult = await updateSubscription();
      if (subscriptionResult.ok) {
        const {
          value: subscriptionForPDS
        } = subscriptionResult;
        const accountPreferenceUpdate = await BrowserNotificationManager["a" /* BrowserNotificationManager */].sharedInstance.updateAccountPreferences(subscriptionForPDS, enabledApps);
        if (!accountPreferenceUpdate.success) {
          var _accountPreferenceUpd;
          showUnableToSaveAlert((_accountPreferenceUpd = accountPreferenceUpdate.errorDesc) !== null && _accountPreferenceUpd !== void 0 ? _accountPreferenceUpd : "");
        }
      } else if (!subscriptionResult.ok) {
        const {
          error: subscriptionError
        } = subscriptionResult;
        const errorMessage = Object(getErrorMessage["a" /* getErrorMessage */])(subscriptionError);
        showUnableToSaveAlert(errorMessage);
      }
    } catch (pushRegistrationError) {
      const errorMessage = Object(getErrorMessage["a" /* getErrorMessage */])(pushRegistrationError);
      showUnableToSaveAlert(errorMessage);
    } finally {
      setIsSaving(false);
    }
  };
  const updatePushAppValue = async (app, newValue) => {
    didUserToggle.current = true;
    switch (app) {
      case BrowserNotificationManager["c" /* PushAppName */].mail:
        if (isMailBrowserNotificationsEnabled.current !== newValue) {
          isMailBrowserNotificationsEnabled.current = newValue;
          await saveCurrentData();
        }
        break;
      case BrowserNotificationManager["c" /* PushAppName */].calendar:
        if (isCalendarBrowserNotificationsEnabled.current !== newValue) {
          isCalendarBrowserNotificationsEnabled.current = newValue;
          await saveCurrentData();
        }
        break;
      default:
        return;
    }
  };
  return {
    isMailBrowserNotificationsEnabled: isMailBrowserNotificationsEnabled.current,
    isCalendarBrowserNotificationsEnabled: isCalendarBrowserNotificationsEnabled.current,
    updatePushAppValue,
    permissionState,
    isSaving,
    error,
    isLoading,
    saveCurrentData
  };
};
// EXTERNAL MODULE: ./src/Legacy/Environment/CloudOSParameters.ts + 1 modules
var CloudOSParameters = __webpack_require__(2241);

// EXTERNAL MODULE: ./src/Utils/notificationsEnabled.ts + 1 modules
var Utils_notificationsEnabled = __webpack_require__(2284);

// CONCATENATED MODULE: ./src/Components/NotificationSettings/NotificationToggleItem.scss
// extracted by mini-css-extract-plugin

// EXTERNAL MODULE: /workspace/node_modules/@apple/ui-components/build/UILabel.js + 1 modules
var UILabel = __webpack_require__(2260);

// EXTERNAL MODULE: /workspace/node_modules/@apple/ui-components/build/UISwitch.js + 1 modules
var UISwitch = __webpack_require__(2275);

// EXTERNAL MODULE: ./src/Utils/debounce.ts
var debounce = __webpack_require__(1322);

// CONCATENATED MODULE: ./src/Components/NotificationSettings/NotificationToggleItem.tsx




const NotificationToggleItem = _ref => {
  let {
    title,
    description,
    labelName,
    loadingDescription,
    initialCheckedValue,
    isDisabled = false,
    icon,
    isWaiting = false,
    onStateChanged,
    shouldDebounce = true
  } = _ref;
  const debounceStateChange = Object(debounce["a" /* debounce */])(onStateChanged, 1000);
  return /*#__PURE__*/react["createElement"]("div", {
    className: "notification-switch-wrapper"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "notification-switch"
  }, /*#__PURE__*/react["createElement"](UILabel["a" /* UILabel */], {
    htmlFor: `${labelName}-notifications-switch`
  }, icon, title), isWaiting ? /*#__PURE__*/react["createElement"](UIActivityIndicator["a" /* UIActivityIndicator */], {
    description: loadingDescription,
    style: {
      fontSize: 16
    }
  }) : isDisabled ? /*#__PURE__*/react["createElement"](UISwitch["a" /* UISwitch */], {
    id: `${labelName}-notifications-switch`,
    defaultChecked: false,
    disabled: isDisabled,
    ariaDescribedBy: `${labelName}-switch-description`
  }) : /*#__PURE__*/react["createElement"](UISwitch["a" /* UISwitch */], {
    id: `${labelName}-notifications-switch`,
    defaultChecked: initialCheckedValue,
    ariaDescribedBy: `${labelName}-switch-description`,
    onStateChange: shouldDebounce ? debounceStateChange : onStateChanged
  })), /*#__PURE__*/react["createElement"]("div", {
    id: `${labelName}-switch-description`,
    className: "description"
  }, /*#__PURE__*/react["createElement"]("div", null, description)));
};
// EXTERNAL MODULE: ./src/ComponentsGeneric/CloseButton/CloseButton.tsx + 1 modules
var CloseButton = __webpack_require__(2291);

// CONCATENATED MODULE: ./src/Components/NotificationSettings/NotificationSettings.tsx















// A modal that exposes the settings to configure Browser Push Notification Settings

const NotificationSettingsContent = _ref => {
  let {
    onClose
  } = _ref;
  const supportLink = "https://support.apple.com/ht213880?cid=mc-ols-icloud-article_ht213880-settings_ui-08072023";
  const {
    isMailBrowserNotificationsEnabled,
    isCalendarBrowserNotificationsEnabled,
    updatePushAppValue,
    permissionState,
    isSaving,
    error,
    isLoading
  } = useBrowserNotificationState();
  const isPermissionDenied = permissionState === "denied";
  const [isMailWaiting, setIsMailWaiting] = react["useState"](false);
  const [isCalendarWaiting, setIsCalendarWaiting] = react["useState"](false);
  react["useEffect"](() => {
    if (!isSaving) {
      setIsMailWaiting(false);
      setIsCalendarWaiting(false);
    }
  }, [isSaving]);
  react["useEffect"](() => {
    if (isPermissionDenied) {
      setIsMailWaiting(false);
      setIsCalendarWaiting(false);
    }
  }, [isPermissionDenied]);
  react["useEffect"](() => {
    if (error === BrowserNotificationManager["b" /* Errors */].create_subscription_failed) {
      onClose();
    }
  }, [error, onClose]);
  return /*#__PURE__*/react["createElement"]("div", {
    className: "notification-settings-overlay"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "close-button"
  }, /*#__PURE__*/react["createElement"](CloseButton["a" /* CloseButton */], {
    onActivate: onClose,
    className: "modal-close-button"
  })), /*#__PURE__*/react["createElement"]("div", {
    className: "content"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "title-icon"
  }, /*#__PURE__*/react["createElement"](icloud["a" /* default */], {
    layoutMode: "glyphBox",
    width: 54,
    height: 54
  })), /*#__PURE__*/react["createElement"]("h2", null, Object(useLoc["a" /* getLoc */])("NotificationSettings.ChangeNotificationSettings.Title")), /*#__PURE__*/react["createElement"]("div", {
    className: "browser-push-notifications-description"
  }, Object(useLoc["a" /* getLoc */])("NotificationSettings.ChangeNotificationSettings.Description")), isLoading ? /*#__PURE__*/react["createElement"](UIActivityIndicator["a" /* UIActivityIndicator */], {
    className: "loading-content",
    description: Object(useLoc["a" /* getLoc */])("NotificationSettings.Loading.MainContent")
  }) : /*#__PURE__*/react["createElement"](react["Fragment"], null, isPermissionDenied && /*#__PURE__*/react["createElement"]("div", {
    className: "denied-content"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "title"
  }, Object(useLoc["a" /* getLoc */])("NotificationSettings.Error.Denied.Title")), /*#__PURE__*/react["createElement"]("div", {
    className: "description"
  }, Object(useLoc["a" /* getLoc */])("NotificationSettings.Error.Denied.Description")), /*#__PURE__*/react["createElement"](ExternalLink["a" /* ExternalLink */], {
    className: "link",
    href: supportLink
  }, Object(useLoc["a" /* getLoc */])("NotificationSettings.Error.Denied.ExternalLink"))), /*#__PURE__*/react["createElement"]("div", {
    className: `notification-switches-container ${isPermissionDenied && "denied"}`
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "title"
  }, Object(useLoc["a" /* getLoc */])("NotificationSettings.Switches.Title")), /*#__PURE__*/react["createElement"](NotificationToggleItem, {
    title: Object(useLoc["a" /* getLoc */])("NotificationSettings.Mail.Title"),
    description: Object(useLoc["a" /* getLoc */])("NotificationSettings.Mail.Description"),
    labelName: BrowserNotificationManager["c" /* PushAppName */].mail,
    loadingDescription: Object(useLoc["a" /* getLoc */])("NotificationSettings.Loading.MailSwitch"),
    initialCheckedValue: isMailBrowserNotificationsEnabled,
    icon: /*#__PURE__*/react["createElement"](envelope["a" /* default */], {
      layoutMode: "glyphBox",
      width: 17,
      height: 17
    }),
    isDisabled: isPermissionDenied,
    isWaiting: isMailWaiting,
    shouldDebounce: permissionState !== "prompt",
    onStateChanged: newState => {
      if (newState.checked !== undefined) {
        if (permissionState === "prompt") setIsMailWaiting(true);
        updatePushAppValue(BrowserNotificationManager["c" /* PushAppName */].mail, newState.checked);
      }
    }
  }), /*#__PURE__*/react["createElement"](NotificationToggleItem, {
    title: Object(useLoc["a" /* getLoc */])("NotificationSettings.Calendar.Title"),
    description: Object(useLoc["a" /* getLoc */])("NotificationSettings.Calendar.Description.Title"),
    labelName: BrowserNotificationManager["c" /* PushAppName */].calendar,
    loadingDescription: Object(useLoc["a" /* getLoc */])("NotificationSettings.Loading.CalendarSwitch"),
    initialCheckedValue: isCalendarBrowserNotificationsEnabled,
    icon: /*#__PURE__*/react["createElement"](calendar["a" /* default */], {
      layoutMode: "glyphBox",
      width: 17,
      height: 17
    }),
    isDisabled: isPermissionDenied,
    isWaiting: isCalendarWaiting,
    shouldDebounce: permissionState !== "prompt",
    onStateChanged: newState => {
      if (newState.checked !== undefined) {
        if (permissionState === "prompt") setIsCalendarWaiting(true);
        updatePushAppValue(BrowserNotificationManager["c" /* PushAppName */].calendar, newState.checked);
      }
    }
  })), !isPermissionDenied && /*#__PURE__*/react["createElement"](react["Fragment"], null, /*#__PURE__*/react["createElement"]("div", {
    className: "notification-settings-note"
  }, Object(useLoc["a" /* getLoc */])("NotificationSettings.ChangeNotificationSettings.Note"), /*#__PURE__*/react["createElement"](ExternalLink["a" /* ExternalLink */], {
    className: "learn-more",
    href: supportLink
  }, Object(useLoc["a" /* getLoc */])("NotificationSettings.ChangeNotificationSettings.Note.LearnMore"))), /*#__PURE__*/react["createElement"]("div", {
    className: "calendar-note"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "divider"
  }), Object(useLoc["a" /* getLoc */])("NotificationSettings.Calendar.Note"))))));
};
function useNotificationSettingsModal() {
  var _ref2, _CloudOSParameters$sh;
  const removePane = () => {
    hideNotificationSettingsPane();
  };
  const [showNotificationSettingsPane, hideNotificationSettingsPane] = Object(usePopup["a" /* usePopup */])(/*#__PURE__*/react["createElement"](NotificationSettingsContent, {
    onClose: removePane
  }), {
    ariaLabel: Object(useLoc["a" /* getLoc */])("NotificationSettings.ChangeNotificationSettings.Title")
  });
  const relativePathAskingToShowNotifications = (_ref2 = (CloudOSParameters["a" /* CloudOSParameters */] === null || CloudOSParameters["a" /* CloudOSParameters */] === void 0 || (_CloudOSParameters$sh = CloudOSParameters["a" /* CloudOSParameters */].sharedInstance) === null || _CloudOSParameters$sh === void 0 || (_CloudOSParameters$sh = _CloudOSParameters$sh.applicationParameter) === null || _CloudOSParameters$sh === void 0 || (_CloudOSParameters$sh = _CloudOSParameters$sh.informationalPageDetails) === null || _CloudOSParameters$sh === void 0 ? void 0 : _CloudOSParameters$sh.relativePath) === "notifications") !== null && _ref2 !== void 0 ? _ref2 : false;
  react["useEffect"](() => {
    if (relativePathAskingToShowNotifications && Object(Utils_notificationsEnabled["a" /* notificationsEnabled */])()) showNotificationSettingsPane();
  }, [relativePathAskingToShowNotifications, showNotificationSettingsPane]);
  return showNotificationSettingsPane;
}
// CONCATENATED MODULE: ./src/Pages/AccountPage/PlanCard/PlanCard.scss
// extracted by mini-css-extract-plugin

// EXTERNAL MODULE: ./src/Legacy/NavLinks/LegacyNavLinks.tsx
var LegacyNavLinks = __webpack_require__(1262);

// EXTERNAL MODULE: ./src/Utils/checkExhaustive.ts
var checkExhaustive = __webpack_require__(1392);

// EXTERNAL MODULE: ./src/Utils/BytesToHumanizedFormat.ts
var BytesToHumanizedFormat = __webpack_require__(1482);

// EXTERNAL MODULE: ./src/API/StorageUsage/useStorageUsage.ts + 1 modules
var useStorageUsage = __webpack_require__(2299);

// EXTERNAL MODULE: ./src/Components/Wallpaper/Wallpaper.tsx
var Wallpaper = __webpack_require__(1448);

// CONCATENATED MODULE: ./src/Pages/AccountPage/PlanCard/PlanCard.tsx










function getDisplayContent(plan) {
  switch (plan) {
    case useICloudPlan["a" /* UserPlan */].MAID:
      return {
        title: Object(useLoc["a" /* getLoc */])("AccountPage.PlanCard.MAID.Title"),
        links: [LegacyNavLinks["b" /* LegacyNavRoutes */].plan, LegacyNavLinks["b" /* LegacyNavRoutes */].storage]
      };
    case useICloudPlan["a" /* UserPlan */].Lite:
      return {
        title: Object(useLoc["a" /* getLoc */])("AccountPage.PlanCard.WebOnly.Title"),
        description: Object(useLoc["a" /* getLoc */])("AccountPage.PlanCard.WebOnly.Description"),
        links: [LegacyNavLinks["b" /* LegacyNavRoutes */].plan, LegacyNavLinks["b" /* LegacyNavRoutes */].storage]
      };
    case useICloudPlan["a" /* UserPlan */].Standard:
      return {
        title: Object(useLoc["a" /* getLoc */])("AccountPage.PlanCard.iCloud.Title"),
        links: [LegacyNavLinks["b" /* LegacyNavRoutes */].plan, LegacyNavLinks["b" /* LegacyNavRoutes */].storage]
      };
    case useICloudPlan["a" /* UserPlan */].Plus:
      return {
        title: Object(useLoc["a" /* getLoc */])("AccountPage.PlanCard.iCloud+.Title"),
        links: [LegacyNavLinks["b" /* LegacyNavRoutes */].plan, LegacyNavLinks["b" /* LegacyNavRoutes */].storage, LegacyNavLinks["b" /* LegacyNavRoutes */].icloudplus]
      };
    default:
      Object(checkExhaustive["a" /* checkExhaustive */])(plan);
  }
}
const PlanCard = props => {
  const planType = Object(useICloudPlan["c" /* useICloudPlanType */])();
  const className = classnames_default()("plan-card", props.className, planType);
  const {
    storageUsage: storage
  } = Object(useStorageUsage["a" /* useStorageUsage */])();
  const content = getDisplayContent(planType);
  return /*#__PURE__*/react["createElement"]("article", {
    "aria-label": Object(useLoc["a" /* getLoc */])("VoiceOver.AccountPage.PlanCard"),
    className: className
  }, /*#__PURE__*/react["createElement"](Wallpaper["a" /* Wallpaper */], {
    className: "shadow"
  }), /*#__PURE__*/react["createElement"](Wallpaper["a" /* Wallpaper */], null), /*#__PURE__*/react["createElement"]("div", {
    className: `plan-card-content`
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "plan-card-title"
  }, content.title), content.description && /*#__PURE__*/react["createElement"]("div", {
    className: "plan-card-description"
  }, content.description), /*#__PURE__*/react["createElement"]("div", {
    className: "plan-card-info"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "plan-card-links"
  }, content.links.map(link => {
    const linkName = (() => {
      if (link === LegacyNavLinks["b" /* LegacyNavRoutes */].plan) {
        return Object(useLoc["a" /* getLoc */])("AccountPage.PlanCard.Plan.Link.Name");
      } else if (link === LegacyNavLinks["b" /* LegacyNavRoutes */].storage) {
        return Object(useLoc["a" /* getLoc */])("AccountPage.PlanCard.Storage.Link.Name");
      } else if (link === LegacyNavLinks["b" /* LegacyNavRoutes */].icloudplus) {
        return Object(useLoc["a" /* getLoc */])("AccountPage.PlanCard.iCloud+.Link.Name");
      } else {
        Object(checkExhaustive["a" /* checkExhaustive */])(link);
      }
    })();
    return /*#__PURE__*/react["createElement"]("div", {
      key: linkName,
      className: "link"
    }, /*#__PURE__*/react["createElement"](LegacyNavLinks["a" /* LegacyNavLink */], {
      to: link,
      name: linkName
    }, linkName, /*#__PURE__*/react["createElement"](NavigationChevron["b" /* NavigationChevron */], {
      layoutMode: "glyphBox",
      desiredFontSize: 12
    })));
  })), storage ? /*#__PURE__*/react["createElement"]("div", {
    className: "quota"
  }, Object(BytesToHumanizedFormat["a" /* bytesToHumanizedFormat */])(storage.totalBytes, 0)) : null)));
};
// CONCATENATED MODULE: ./src/Hooks/useShowSignOutModal.tsx



function useShowSignOutModal() {
  const showAlert = Object(useShowCloudOSAlert["a" /* useShowCloudOSAlert */])();
  return () => showAlert({
    title: Object(useLoc["a" /* getLoc */])("AccountPage.Settings.Access.Signout.Modal.Title"),
    description: Object(useLoc["a" /* getLoc */])("AccountPage.Settings.Access.Signout.Modal.Description"),
    buttons: [{
      title: Object(useLoc["a" /* getLoc */])("AccountPage.Settings.Access.Signout.Confirm"),
      action: "signout"
    }, {
      title: Object(useLoc["a" /* getLoc */])("AccountPage.Settings.Access.Signout.Cancel"),
      action: "cancel"
    }],
    defaultAction: "cancel",
    cancelAction: "cancel",
    onActionSelected: action => {
      if (action === "signout") {
        Object(AuthService["q" /* unauthenticateUserFromAllBrowsers */])();
      }
    },
    unmountWithPresenter: true
  });
}
// EXTERNAL MODULE: /workspace/node_modules/@apple/ui-components/build/UIPaneContainer.js + 1 modules
var UIPaneContainer = __webpack_require__(2257);

// CONCATENATED MODULE: ./src/ComponentsGeneric/ModalWithCloseButton/ModalWithCloseButton.scss
// extracted by mini-css-extract-plugin

// CONCATENATED MODULE: ./src/ComponentsGeneric/ModalWithCloseButton/useModalWithCloseButton.tsx





function withDefaults(_ref) {
  let {
    ariaLabelledBy,
    closeButtonDisabled = false,
    paneType = UIPaneContainer["d" /* PaneType */].Dismissible,
    className = "",
    modalHeader = ""
  } = _ref;
  return {
    ariaLabelledBy,
    closeButtonDisabled,
    paneType,
    className,
    modalHeader
  };
}
function useModalWithCloseButton(modalContent, props) {
  const {
    ariaLabelledBy,
    closeButtonDisabled,
    paneType,
    className,
    modalHeader
  } = withDefaults(props);
  const closeButtonLabel = Object(useLoc["a" /* getLoc */])("VoiceOver.RecoveryPage.ArchivesRecoveryModal.CloseButtonLabel");
  const [showPopup, hidePopup] = Object(usePopup["a" /* usePopup */])(/*#__PURE__*/react["createElement"](react["Fragment"], null, /*#__PURE__*/react["createElement"]("div", {
    className: "close-button-bar"
  }, /*#__PURE__*/react["createElement"](CloseButton["a" /* CloseButton */], {
    onActivate: () => hidePopup(),
    ariaLabel: closeButtonLabel,
    disabled: closeButtonDisabled,
    className: "modal-close-button"
  }), modalHeader && /*#__PURE__*/react["createElement"]("span", {
    "aria-hidden": "true",
    className: "modal-header"
  }, modalHeader)), /*#__PURE__*/react["createElement"]("div", {
    className: "modal-with-icon"
  }, modalContent)), {
    variant: "standard modal-with-close-button",
    paneType,
    ariaLabelledBy,
    className,
    animates: UIPaneContainer["b" /* PaneAnimates */].IN
  });
  return showPopup;
}
function useShowModalWithCloseButton() {
  const closeButtonLabel = Object(useLoc["a" /* getLoc */])("VoiceOver.RecoveryPage.ArchivesRecoveryModal.CloseButtonLabel");
  const [showPopup, hidePopup] = Object(usePopup["b" /* useShowPopup */])();
  return (modalContent, props) => {
    const {
      ariaLabelledBy,
      closeButtonDisabled,
      paneType,
      className,
      modalHeader
    } = withDefaults(props);
    showPopup(/*#__PURE__*/react["createElement"](react["Fragment"], null, /*#__PURE__*/react["createElement"]("div", {
      className: "close-button-bar"
    }, /*#__PURE__*/react["createElement"](CloseButton["a" /* CloseButton */], {
      onActivate: () => hidePopup(),
      ariaLabel: closeButtonLabel,
      disabled: closeButtonDisabled,
      className: "modal-close-button"
    }), modalHeader && /*#__PURE__*/react["createElement"]("span", {
      "aria-hidden": "true",
      className: "modal-header"
    }, modalHeader)), /*#__PURE__*/react["createElement"]("div", {
      className: "modal-with-icon"
    }, typeof modalContent === "function" ? modalContent(hidePopup) : modalContent)), {
      variant: "standard modal-with-close-button",
      paneType,
      ariaLabelledBy,
      className
    });
  };
}
// EXTERNAL MODULE: /workspace/node_modules/@apple/symbols/regular/hand.raised.svg
var hand_raised = __webpack_require__(1604);

// CONCATENATED MODULE: ./src/Pages/AccountPage/LookMeUpByEmailModal/LookMeUpByEmailModalContent.scss
// extracted by mini-css-extract-plugin

// EXTERNAL MODULE: /workspace/node_modules/@apple/ui-components/build/UICheckbox.js + 2 modules
var UICheckbox = __webpack_require__(2222);

// CONCATENATED MODULE: ./src/Pages/AccountPage/LookMeUpByEmailModal/findMe_default.png
/* harmony default export */ var findMe_default = ("../eec23e311e07b52d13d853f0c7746612.png");
// CONCATENATED MODULE: ./src/Pages/AccountPage/LookMeUpByEmailModal/LookMeUpByEmailModalContent.tsx









/**
 * ported from settings1 app findMe.js in models
 * Given an icon size in pixels, figure out the smallest icon that is larger than the
 * desired size, or if there are no larger icons, the largest icon
 * The motivation is that down-scaled icons look OK, but up-scaled icons don't.
 *
 * @param {Number} desiredSize in pixels of the (square) icon that we wish to retrieve
 * @param {Record<string, string>} iconURLs icon size to url map object
 * @returns {String} The URL of the best fitting icon found.
 */
function findIconURL(desiredSize, iconURLs) {
  let bestDelta, bestItem; // The best item found and it's associated error
  let largestSize, largestItem; // The largest item found and it's size

  for (let key in iconURLs) {
    // Get the size of the icon in pixels
    const iconSize = parseFloat(key);

    // Keep track of the largest icon
    if (!largestItem || !largestSize || iconSize > largestSize) {
      largestItem = iconURLs[key];
      largestSize = iconSize;
    }

    // Determine the difference between the icon's size and the desired size
    const delta = iconSize - desiredSize;

    // If the icon is larger than the desired size but smaller than anything we have seen so far
    if (bestDelta === undefined || delta >= 0 && delta < bestDelta) {
      // Remember this as the best we have seen
      bestDelta = delta;
      bestItem = iconURLs[iconSize];
    }
  }

  // Return the best icon found or if all icons are smaller then the largest item
  return bestItem || largestItem;
}
function getIconUrl(item) {
  var _findIconURL;
  const desiredIconSize = window.devicePixelRatio > 1 ? 58 : 29;
  return (_findIconURL = findIconURL(desiredIconSize, item.iconURLs)) !== null && _findIconURL !== void 0 ? _findIconURL : findMe_default;
}
function onCheckboxStateChange(checked, item, updateFunc) {
  updateFunc({
    ...item,
    isDiscoverable: checked
  });
}

// debounce it for 2 seonds, it is similar logic in settings1 app in findMeContentController.js
const debouncedOnCheckboxStateChange = Object(debounce["a" /* debounce */])(onCheckboxStateChange, 2000);
function renderListContent(items, updateFunc) {
  if (!items || items.length === 0) {
    return /*#__PURE__*/react["createElement"]("div", {
      className: "empty-list"
    }, /*#__PURE__*/react["createElement"]("div", {
      className: "title"
    }, Object(useLoc["a" /* getLoc */])("AccountPage.Settings.LookMeUpByEmail.Modal.List.Empty.Title")), /*#__PURE__*/react["createElement"]("div", {
      className: "content"
    }, Object(useLoc["a" /* getLoc */])("AccountPage.Settings.LookMeUpByEmail.Modal.List.Empty.Content")));
  } else {
    const appsCount = Object(useLoc["b" /* getLocCount */])({
      one: "AccountPage.Settings.LookMeUpByEmail.Modal.List.Title.One",
      two: "AccountPage.Settings.LookMeUpByEmail.Modal.List.Title.Two",
      zero: "AccountPage.Settings.LookMeUpByEmail.Modal.List.Title.One",
      many: "AccountPage.Settings.LookMeUpByEmail.Modal.List.Title.Many"
    }, items.length);
    return /*#__PURE__*/react["createElement"](react["Fragment"], null, /*#__PURE__*/react["createElement"]("div", {
      className: "count"
    }, appsCount), /*#__PURE__*/react["createElement"]("div", {
      className: "description"
    }, Object(useLoc["a" /* getLoc */])("AccountPage.Settings.LookMeUpByEmail.Modal.List.Description")), /*#__PURE__*/react["createElement"]("div", {
      role: "table",
      "aria-label": Object(useLoc["a" /* getLoc */])("VoiceOver.AccountPage.LookMeUpByEmail.Modal.List.AriaLabel")
    }, items.map(item => /*#__PURE__*/react["createElement"]("div", {
      key: item.id,
      role: "row"
    }, /*#__PURE__*/react["createElement"]("div", {
      role: "cell",
      className: "checkbox-cell"
    }, /*#__PURE__*/react["createElement"](UICheckbox["a" /* UICheckbox */], {
      defaultChecked: item.isDiscoverable,
      ariaLabel: Object(useLoc["a" /* getLoc */])("VoiceOver.AccountPage.LookMeUpByEmail.Modal.List.Checkbox.AriaLbel", {
        appName: item.name
      }),
      onStateChange: newState => debouncedOnCheckboxStateChange(newState.checked, item, updateFunc)
    })), /*#__PURE__*/react["createElement"]("div", {
      role: "cell",
      className: "text-cell"
    }, /*#__PURE__*/react["createElement"]("img", {
      src: getIconUrl(item),
      "aria-hidden": true,
      alt: ""
    }), /*#__PURE__*/react["createElement"]("span", null, item.name))))));
  }
}
const LookMeUpByEmailModalContent = props => {
  return /*#__PURE__*/react["createElement"]("div", {
    className: "modal-content look-me-up-by-email-modal-content"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "modal-icon",
    "data-testid": "icon"
  }, /*#__PURE__*/react["createElement"](hand_raised["a" /* default */], {
    layoutMode: "glyphBox",
    width: 39,
    height: 52
  })), /*#__PURE__*/react["createElement"]("h2", {
    className: "modal-title",
    "data-testid": "title",
    id: props.titleId
  }, Object(useLoc["a" /* getLoc */])("AccountPage.Settings.LookMeUpByEmail.Modal.Title")), /*#__PURE__*/react["createElement"]("div", {
    className: "modal-description",
    "data-testid": "description"
  }, Object(useLoc["a" /* getLoc */])("AccountPage.Settings.LookMeUpByEmail.Modal.Description"), " ", /*#__PURE__*/react["createElement"](ExternalLink["a" /* ExternalLink */], {
    href: Object(getSupportLink["a" /* getSupportLink */])("lookMeUp")
  }, Object(useLoc["a" /* getLoc */])("AccountPage.Settings.LookMeUpByEmail.Modal.LearnMore"))), /*#__PURE__*/react["createElement"]("div", {
    className: "look-me-up-by-email-list"
  }, props.isLoading ? /*#__PURE__*/react["createElement"]("div", {
    className: "loading"
  }, /*#__PURE__*/react["createElement"](UIActivityIndicator["a" /* UIActivityIndicator */], {
    description: Object(useLoc["a" /* getLoc */])("AccountPage.Settings.LookMeUpByEmail.Modal.LoadingDescription")
  })) : renderListContent(props.items, props.onUpdateLookMeUpByEmail)));
};
// CONCATENATED MODULE: ./src/Pages/AccountPage/LookMeUpByEmailModal/useLookMeUpByEmailModal.tsx
function useLookMeUpByEmailModal_extends() { return useLookMeUpByEmailModal_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, useLookMeUpByEmailModal_extends.apply(null, arguments); }



const MODAL_TITLE_ID = "look-me-up-by-email-modal-title";
function useLookMeUpByEmailModal(modalContentProps) {
  const showModal = useModalWithCloseButton(/*#__PURE__*/react["createElement"](LookMeUpByEmailModalContent, useLookMeUpByEmailModal_extends({}, modalContentProps, {
    titleId: MODAL_TITLE_ID
  })), {
    ariaLabelledBy: MODAL_TITLE_ID
  });
  return showModal;
}
// EXTERNAL MODULE: ./src/API/Common/useAPIQuery.ts
var useAPIQuery = __webpack_require__(1478);

// EXTERNAL MODULE: ./src/API/Common/paths.ts + 1 modules
var paths = __webpack_require__(2266);

// EXTERNAL MODULE: ./src/API/Common/request.ts
var Common_request = __webpack_require__(1413);

// EXTERNAL MODULE: ./src/API/Common/error.ts
var Common_error = __webpack_require__(1414);

// CONCATENATED MODULE: ./src/API/LookMeUpByEmail/lookMeUpByEmail.schema.ts

const bundleIdAndIconsSchema = lib["z"].object({
  bundleId: lib["z"].string(),
  displaySetId: lib["z"].string(),
  applicationNameLocalized: lib["z"].string(),
  applicationIconUrls: lib["z"].record(lib["z"].string())
});
const wireLookMeUpByEmailItemResponseSchema = lib["z"].object({
  isDiscoverable: lib["z"].boolean(),
  containerType: lib["z"].string(),
  containerName: lib["z"].string(),
  bundleIdAndIcons: lib["z"].record(lib["z"].array(bundleIdAndIconsSchema).or(lib["z"].null()))
});
const wireLookMeUpByEmailListResponseSchema = lib["z"].array(wireLookMeUpByEmailItemResponseSchema);
// CONCATENATED MODULE: ./src/API/LookMeUpByEmail/lookMeUpByEmail.converter.ts
/**
 * Below code is taken from settings1 app findMe.js under data_sources
 */
function _extractItemData(item) {
  // Get the bundleIdAndIcons
  const bundleIdAndIcons = item === null || item === void 0 ? void 0 : item.bundleIdAndIcons;
  if (!bundleIdAndIcons) return;
  let result = undefined;
  let fallbackId = "";

  // Iterate bundleIdAndIcons
  for (let key in bundleIdAndIcons) {
    var _bundleIdAndIcons$key;
    // Store a fallback bundleId that we can at least use if bundleIdAndIcons[key] is empty for all keys
    fallbackId = key;

    // Iterate bundleIdAndIcons subitem array. Note that subitems can be null. Any subsequent uses of subitems MUST check for this.
    const subitems = (_bundleIdAndIcons$key = bundleIdAndIcons[key]) !== null && _bundleIdAndIcons$key !== void 0 ? _bundleIdAndIcons$key : [];
    for (let i = 0; i < subitems.length; i++) {
      const subitem = subitems[i];

      // Extract required data from the subitem
      const data = {
        id: subitem.bundleId || "",
        name: subitem.applicationNameLocalized || "",
        iconURLs: subitem.applicationIconUrls,
        containerName: item.containerName,
        containerType: item.containerType,
        isDiscoverable: item.isDiscoverable
      };

      // If we have no data yet, or we have a complete item, use that
      if (!result || data.id && data.name && data.iconURLs) {
        result = data;
      }
    }
  }

  // If we found nothing but still have a fallback Id, use that
  if (!result && fallbackId) {
    result = {
      id: fallbackId,
      name: fallbackId,
      iconURLs: {},
      containerName: item.containerName,
      containerType: item.containerType,
      isDiscoverable: item.isDiscoverable
    };
  }
  return result;
}

/**
 * Converts look me up by email list api response to LookMeUpByEmail object
 * @param {WireLookMeUpByEmailListResponse} response lookMeUpByEmail list api response
 * @returns {LookMeUpByEmail[]} returns LookMeUpByEmail object
 */
function lookMeUpByEmailListConverter(response) {
  const records = [];
  for (let i = 0; i < response.length; i++) {
    const item = response[i];
    const record = _extractItemData(item);
    if (record) {
      records.push(record);
    }
  }
  return records;
}
// CONCATENATED MODULE: ./src/API/LookMeUpByEmail/lookMeUpByEmail.endpoint.ts




function getSaveLookMeUpItemPath(item) {
  return `/ws/v1/${item.containerName}/${item.containerType}/privacy/set`;
}

/**
 * Sends get api request to ck endpoint and returns list of look me up by email data
 * @param request has webServices urls
 * @returns a list of LookMeUpByEmail details
 * @throws `Error` if the webServices do not have cksharews url
 */
async function listLookMeUpByEmail(_ref) {
  let {
    webServices
  } = _ref;
  if (!(webServices !== null && webServices !== void 0 && webServices.cksharews)) throw new Error("no service url available");
  const res = await Object(Common_request["a" /* apiRequest */])({
    url: `${webServices.cksharews}/ws/v1/com.apple.cloudkit/production/privacy/getall`,
    method: "POST",
    includeCredentials: true,
    body: {
      lang: Object(core["b" /* getLocale */])(),
      platform: null
    },
    validate: {
      type: "WireLookMeUpByEmailListResponse",
      schema: wireLookMeUpByEmailListResponseSchema
    }
  });
  return lookMeUpByEmailListConverter(res);
}
async function updateLookMeUpByEmail(_ref2, item) {
  let {
    webServices
  } = _ref2;
  if (!(webServices !== null && webServices !== void 0 && webServices.cksharews)) throw new Error("no service url available");

  // throws on any failed response status
  await Object(Common_request["c" /* unvalidatedApiRequest */])({
    url: `${webServices.cksharews}${getSaveLookMeUpItemPath(item)}`,
    method: "POST",
    includeCredentials: true,
    body: {
      bundleId: item.id,
      isDiscoverable: item.isDiscoverable
    }
  }).then(Common_error["g" /* throwOnUnsuccessfulResponses */]);
  return true;
}
// CONCATENATED MODULE: ./src/API/LookMeUpByEmail/useLookMeUpByEmail.ts



/**
 * Fetches a list of {@link LookMeUpByEmail} details
 * @returns `react-query` `useQuery` results
 */
function useLookMeUpByEmailList() {
  return Object(useAPIQuery["a" /* useAPIQuery */])({
    endpoint: paths["b" /* EndpointName */].lookMeUpByEmailList,
    fetchProvider: request => () => listLookMeUpByEmail(request)
  });
}
// EXTERNAL MODULE: /workspace/node_modules/react-query/es/index.js
var es = __webpack_require__(1359);

// EXTERNAL MODULE: ./src/Hooks/useWebServices.ts
var useWebServices = __webpack_require__(1479);

// CONCATENATED MODULE: ./src/API/LookMeUpByEmail/useUpdateLookMeUpByEmail.ts




function useUpdateLookMeUpByEmail() {
  const webServices = Object(useWebServices["a" /* useWebServices */])();
  const queryClient = Object(es["useQueryClient"])();
  return Object(es["useMutation"])(updatedItem => updateLookMeUpByEmail({
    webServices
  }, updatedItem), {
    // on update success, need to update the cached lookMeUpByEmail list data
    onSuccess: (_, updatedItem) => {
      var _queryClient$getQuery;
      const cachedData = (_queryClient$getQuery = queryClient.getQueryData([paths["b" /* EndpointName */].lookMeUpByEmailList])) !== null && _queryClient$getQuery !== void 0 ? _queryClient$getQuery : [];
      const modifiedItemIndex = cachedData.findIndex(item => item.id === updatedItem.id);

      // not found and do not need update cache
      if (modifiedItemIndex < 0) {
        return;
      }
      queryClient.setQueryData([paths["b" /* EndpointName */].lookMeUpByEmailList], [...cachedData.slice(0, modifiedItemIndex), updatedItem, ...cachedData.slice(modifiedItemIndex + 1)]);
    }
  });
}
// CONCATENATED MODULE: ./src/Resources/Images/storage.svg
var storage_excluded = ["styles"];
function storage_extends() { return storage_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, storage_extends.apply(null, arguments); }
function storage_objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = storage_objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function storage_objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }

/* harmony default export */ var Images_storage = (function (_ref) {
  var _ref$styles = _ref.styles,
    styles = _ref$styles === void 0 ? {} : _ref$styles,
    props = storage_objectWithoutProperties(_ref, storage_excluded);
  return /*#__PURE__*/react_default.a.createElement("svg", storage_extends({
    width: "60",
    height: "60",
    xmlns: "http://www.w3.org/2000/svg"
  }, props), /*#__PURE__*/react_default.a.createElement("defs", null, /*#__PURE__*/react_default.a.createElement("clipPath", {
    id: "1745ae87233d84a26db476836e9c4233a"
  }, /*#__PURE__*/react_default.a.createElement("path", {
    d: "M42.053 0c6.24 0 8.503.65 10.785 1.87a12.721 12.721 0 015.292 5.292C59.35 9.444 60 11.707 60 17.947v24.106c0 6.24-.65 8.503-1.87 10.785a12.721 12.721 0 01-5.292 5.292C50.556 59.35 48.293 60 42.053 60H17.947c-6.24 0-8.503-.65-10.785-1.87a12.721 12.721 0 01-5.292-5.292C.65 50.556 0 48.293 0 42.053V17.947c0-6.24.65-8.503 1.87-10.785A12.721 12.721 0 017.162 1.87C9.444.65 11.707 0 17.947 0h24.106z"
  })), /*#__PURE__*/react_default.a.createElement("clipPath", {
    id: "1745ae87233d84a26db476836e9c4233b"
  }, /*#__PURE__*/react_default.a.createElement("path", {
    d: "M12.017 13.606c3.383 0 6.018 2.619 6.038 6.301 1.554.69 2.557 2.186 2.557 3.899 0 2.304-1.928 4.194-4.425 4.194l-11.25-.02C2.124 27.98 0 25.913 0 23.471c0-2.008 1.101-3.682 2.97-3.997.04-2.304 2.222-3.86 4.268-3.308 1.003-1.398 2.616-2.56 4.779-2.56zm26.807.236c3.698 0 6.176 2.481 6.176 6.164 0 3.662-2.478 6.143-6.176 6.143H22.461a6.214 6.214 0 00.452-2.343c0-2.245-1.003-4.056-2.655-5.277-.275-1.851-1.062-3.446-2.242-4.687zm-.275 4.135c-1.101 0-2.046.926-2.046 2.029 0 1.122.945 2.047 2.046 2.028 1.101-.02 2.026-.906 2.026-2.028a2.05 2.05 0 00-2.026-2.029zM33.416 0c2.792 0 4.936 1.32 5.9 3.741l3.5 8.684c-1.16-.571-2.517-.886-3.992-.886H15.656c-.354 0-.807 0-1.279.078a7.157 7.157 0 00-2.439-.295l3.069-7.58C15.99 1.318 18.134 0 20.927 0z"
  })), /*#__PURE__*/react_default.a.createElement("linearGradient", {
    id: "1745ae87233d84a26db476836e9c4233c",
    x1: "22.5",
    y1: "0",
    x2: "22.5",
    y2: "28",
    gradientUnits: "userSpaceOnUse"
  }, /*#__PURE__*/react_default.a.createElement("stop", {
    stopColor: "#3980FF",
    offset: "0%"
  }), /*#__PURE__*/react_default.a.createElement("stop", {
    stopColor: "#5CBEFF",
    offset: "100%"
  }))), /*#__PURE__*/react_default.a.createElement("g", {
    clipPath: "url(#1745ae87233d84a26db476836e9c4233a)"
  }, /*#__PURE__*/react_default.a.createElement("path", {
    fill: "var(--theme-color-backgroundPrimary)",
    d: "M0 0h60v60H0V0z"
  }), /*#__PURE__*/react_default.a.createElement("path", {
    d: "M17.947 0h24.106c6.24 0 8.503.65 10.785 1.87a12.721 12.721 0 015.292 5.292C59.35 9.444 60 11.707 60 17.947v24.106c0 6.24-.65 8.503-1.87 10.785a12.721 12.721 0 01-5.292 5.292C50.556 59.35 48.293 60 42.053 60H17.947c-6.24 0-8.503-.65-10.785-1.87a12.721 12.721 0 01-5.292-5.292C.65 50.556 0 48.293 0 42.053V17.947c0-6.24.65-8.503 1.87-10.785A12.721 12.721 0 017.162 1.87C9.444.65 11.707 0 17.947 0z",
    stroke: "var(--theme-color-gray6)",
    fill: "none",
    strokeMiterlimit: "5"
  })), /*#__PURE__*/react_default.a.createElement("g", {
    clipPath: "url(#1745ae87233d84a26db476836e9c4233b)",
    transform: "translate(6.5 16)"
  }, /*#__PURE__*/react_default.a.createElement("path", {
    fill: "#1C1C1F",
    d: "M0 0h45v28H0V0z"
  }), /*#__PURE__*/react_default.a.createElement("path", {
    fill: "url(#1745ae87233d84a26db476836e9c4233c)",
    d: "M0 0h45v28H0V0z"
  })));
});
// EXTERNAL MODULE: ./src/ComponentsGeneric/InfoTile/MixedTileGrid.tsx
var MixedTileGrid = __webpack_require__(1454);

// EXTERNAL MODULE: ./src/Resources/Images/hide-my-email-samples.png
var hide_my_email_samples = __webpack_require__(1200);

// CONCATENATED MODULE: ./src/Resources/Images/included_in_iCloud+@1x.png
/* harmony default export */ var included_in_iCloud_1x = ("../27118e413e14022017c5056c3c9b2a6f.png");
// CONCATENATED MODULE: ./src/Resources/Images/included_in_iCloud+@2x.png
/* harmony default export */ var included_in_iCloud_2x = ("../1376acec25c19758d863429654396a0e.png");
// CONCATENATED MODULE: ./src/Resources/Images/included_in_iCloud+@3x.png
/* harmony default export */ var included_in_iCloud_3x = ("../a656e6879dab8f4a76db6bb6cbb757ca.png");
// CONCATENATED MODULE: ./src/Components/UpgradePlanTiles/UpgradePlanTiles.scss
// extracted by mini-css-extract-plugin

// EXTERNAL MODULE: ./src/ComponentsGeneric/AppIcon/AppIcon.tsx + 205 modules
var AppIcon = __webpack_require__(2132);

// CONCATENATED MODULE: ./src/Components/UpgradePlanTiles/UpgradePlanTiles.tsx













const UpgradePlanTiles = props => {
  const isCNDomain = DomainManagerService["a" /* DomainManagerService */].sharedInstance.isDomainCN;
  const defaultUpgradePlanTiles = [{
    title: Object(useLoc["a" /* getLoc */])("UpgradePlanTiles.MoreStorage"),
    description: Object(useLoc["a" /* getLoc */])("UpgradePlanTiles.MoreStorage.Description"),
    icon: /*#__PURE__*/react["createElement"](Images_storage, {
      width: 60,
      height: 60,
      "aria-hidden": true
    }),
    contentImageSrc1x: included_in_iCloud_1x,
    contentImageSrc2x: included_in_iCloud_2x,
    contentImageSrc3x: included_in_iCloud_3x,
    linkInfo: {
      text: Object(useLoc["a" /* getLoc */])("UpgradePlanTiles.MoreStorage.LinkText"),
      href: Object(getSupportLink["a" /* getSupportLink */])("iCloudPlusPlanPricing")
    }
  }, {
    title: Object(useLoc["a" /* getLoc */])("UpgradePlanTiles.HomeKitSecureVideo"),
    description: Object(useLoc["a" /* getLoc */])("UpgradePlanTiles.HomeKitSecureVideo.Description"),
    icon: /*#__PURE__*/react["createElement"](AppIcon["a" /* AppIcon */], {
      iconSize: 60,
      applicationIdentifier: "homekit"
    }),
    linkInfo: {
      text: Object(useLoc["a" /* getLoc */])("UpgradePlanTiles.HomeKitSecureVideo.LinkText"),
      href: Object(getSupportLink["a" /* getSupportLink */])("homeKitSecureVideo")
    }
  }, {
    title: Object(useLoc["a" /* getLoc */])("UpgradePlanTiles.FamilySharing"),
    description: Object(useLoc["a" /* getLoc */])("UpgradePlanTiles.FamilySharing.Description"),
    icon: /*#__PURE__*/react["createElement"](AppIcon["a" /* AppIcon */], {
      applicationIdentifier: "plan",
      iconSize: 60
    }),
    linkInfo: {
      text: Object(useLoc["a" /* getLoc */])("UpgradePlanTiles.FamilySharing.LinkText"),
      href: Object(getSupportLink["a" /* getSupportLink */])("familySharing")
    }
  }, {
    title: Object(useLoc["a" /* getLoc */])("UpgradePlanTiles.HideMyEmail"),
    description: Object(useLoc["a" /* getLoc */])("UpgradePlanTiles.HideMyEmail.Description"),
    icon: /*#__PURE__*/react["createElement"](AppIcon["a" /* AppIcon */], {
      iconSize: 60,
      applicationIdentifier: "hidemyemail"
    }),
    contentImageSrc1x: hide_my_email_samples["a" /* default */],
    linkInfo: {
      text: Object(useLoc["a" /* getLoc */])("UpgradePlanTiles.HideMyEmail.LinkText"),
      href: Object(getSupportLink["a" /* getSupportLink */])("hideMyEmail")
    }
  }];
  const premiumMailSettingsTiles = [{
    title: Object(useLoc["a" /* getLoc */])("UpgradePlanTiles.PrivateRelay"),
    description: Object(useLoc["a" /* getLoc */])("UpgradePlanTiles.PrivateRelay.Description"),
    icon: /*#__PURE__*/react["createElement"](AppIcon["a" /* AppIcon */], {
      iconSize: 60,
      applicationIdentifier: "privaterelay"
    }),
    linkInfo: {
      text: Object(useLoc["a" /* getLoc */])("UpgradePlanTiles.PrivateRelay.LinkText"),
      href: Object(getSupportLink["a" /* getSupportLink */])("privateRelay")
    }
  }, {
    title: Object(useLoc["a" /* getLoc */])("UpgradePlanTiles.CustomEmailDomain"),
    description: Object(useLoc["a" /* getLoc */])("UpgradePlanTiles.CustomEmailDomain.Description"),
    icon: /*#__PURE__*/react["createElement"](AppIcon["a" /* AppIcon */], {
      iconSize: 60,
      applicationIdentifier: "customdomainsettings"
    }),
    linkInfo: {
      text: Object(useLoc["a" /* getLoc */])("UpgradePlanTiles.CustomEmailDomain.LinkText"),
      href: Object(getSupportLink["a" /* getSupportLink */])("customEmailDomains")
    }
  }];

  // Note: need to re-organize the orders for non-CN page, private relay and custom email domain
  // is not available in CN
  const tilesToShow = isCNDomain ? defaultUpgradePlanTiles : [defaultUpgradePlanTiles[0], premiumMailSettingsTiles[0], defaultUpgradePlanTiles[1], defaultUpgradePlanTiles[3], premiumMailSettingsTiles[1], defaultUpgradePlanTiles[2]];
  return /*#__PURE__*/react["createElement"]("div", {
    className: classnames_default()("upgrade-plan-tiles", props.className)
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "application-content"
  }, /*#__PURE__*/react["createElement"]("h2", {
    className: "upgrade-heading"
  }, Object(useLoc["a" /* getLoc */])("UpgradePlanTiles.Upgrade")), /*#__PURE__*/react["createElement"]("p", {
    className: "upgrade-description"
  }, Object(useLoc["a" /* getLoc */])("UpgradePlanTiles.Upgrade.Description")), /*#__PURE__*/react["createElement"](MixedTileGrid["a" /* MixedTileGrid */], {
    tiles: tilesToShow
  })));
};
// EXTERNAL MODULE: ./src/API/MeCard/useMeCard.ts + 1 modules
var useMeCard = __webpack_require__(2334);

// EXTERNAL MODULE: ./src/Services/MeCard.ts
var MeCard = __webpack_require__(987);

// EXTERNAL MODULE: /workspace/node_modules/@icloudweb/auth-service/server/Environment/AuthenticatedUser.js
var AuthenticatedUser = __webpack_require__(884);

// CONCATENATED MODULE: ./src/API/MeCard/useUpdateMeCard.ts



function useUpdateMeCard() {
  return Object(es["useMutation"])(newProfilePhoto => {
    const contactDetails = ((_userSignal$value$det, _userSignal$value) => {
      const details = (_userSignal$value$det = (_userSignal$value = AuthenticationController["h" /* userSignal */].value) === null || _userSignal$value === void 0 ? void 0 : _userSignal$value.details) !== null && _userSignal$value$det !== void 0 ? _userSignal$value$det : null;
      return Object(AuthenticatedUser["a" /* createMeCardContactFromAuthenticatedUser */])(details);
    })();
    const meCardController = Object(MeCard["b" /* getMeCardController */])();
    if (!contactDetails || !meCardController) return Promise.resolve(null);
    return meCardController.storePhoto(contactDetails, {
      ...newProfilePhoto
    });
  });
}
// CONCATENATED MODULE: ./src/Components/ImagePicker/Types.tsx
/**
 * Orientation of the image.
 */
let Orientation = /*#__PURE__*/function (Orientation) {
  Orientation[Orientation["Deg0"] = 0] = "Deg0";
  Orientation[Orientation["DegNeg90"] = 1] = "DegNeg90";
  Orientation[Orientation["DegNeg180"] = 2] = "DegNeg180";
  Orientation[Orientation["DegNeg270"] = 3] = "DegNeg270";
  return Orientation;
}({});

/**
 * Represents a size by height and width.
 */
// EXTERNAL MODULE: ./src/Utils/convertImageCropRect.ts
var convertImageCropRect = __webpack_require__(1605);

// EXTERNAL MODULE: /workspace/node_modules/@apple/ui-components/build/utils/readFileAsDataUrl.js
var readFileAsDataUrl = __webpack_require__(1510);

// EXTERNAL MODULE: /workspace/node_modules/@apple/ui-components/build/UIImage.js + 1 modules
var UIImage = __webpack_require__(2271);

// EXTERNAL MODULE: /workspace/node_modules/@apple/symbols/regular/person.crop.circle.svg
var person_crop_circle = __webpack_require__(1471);

// CONCATENATED MODULE: ./src/Components/ImagePicker/ImagePicker.scss
// extracted by mini-css-extract-plugin

// EXTERNAL MODULE: /workspace/node_modules/@apple/ui-components/build/UISlider.js + 1 modules
var UISlider = __webpack_require__(2274);

// EXTERNAL MODULE: /workspace/node_modules/@apple/symbols/regular/minus.svg
var minus = __webpack_require__(1606);

// EXTERNAL MODULE: /workspace/node_modules/@apple/symbols/regular/plus.svg
var plus = __webpack_require__(1607);

// CONCATENATED MODULE: ./src/Components/ImagePicker/ZoomControl.scss
// extracted by mini-css-extract-plugin

// CONCATENATED MODULE: ./src/Components/ImagePicker/ZoomControl.tsx







const MAX_ZOOM = 8;
const STEPS = 100;
function sliderValueToZoomLevel(sliderValue) {
  return sliderValue * (MAX_ZOOM - 1) / (STEPS - 1) + 1;
}
function zoomLevelToSliderValue(zoomLevel) {
  return (zoomLevel - 1) * (STEPS - 1) / (MAX_ZOOM - 1);
}
const ZoomControl = props => {
  const className = classnames_default()("zoom-control", props.className, props.disabled ? "disabled" : undefined);
  const zoomLabel = Object(useLoc["a" /* getLoc */])("ImagePicker.ZoomControl.ZoomLabel");
  const zoomControlAriaLabel = Object(useLoc["a" /* getLoc */])("VoiceOver.ImagePicker.ZoomControl.ZoomControlAriaLabel");
  const value = zoomLevelToSliderValue(props.zoomLevel);
  const onSliderChange = e => {
    if (e.value === undefined) return;
    props.onZoomLevelChange(sliderValueToZoomLevel(e.value));
  };
  return /*#__PURE__*/react["createElement"]("div", {
    className: className
  }, /*#__PURE__*/react["createElement"](UISlider["a" /* UISlider */], {
    min: 0,
    max: STEPS - 1,
    step: 1,
    value: value,
    onStateChange: onSliderChange,
    disabled: props.disabled,
    ariaLabel: zoomControlAriaLabel
  }), /*#__PURE__*/react["createElement"]("div", {
    className: "label-container"
  }, /*#__PURE__*/react["createElement"](minus["a" /* default */], {
    width: 12,
    height: 12,
    layoutMode: "glyphBox",
    "aria-hidden": "true"
  }), /*#__PURE__*/react["createElement"]("label", {
    htmlFor: "zoom-control"
  }, zoomLabel), /*#__PURE__*/react["createElement"](plus["a" /* default */], {
    width: 12,
    height: 12,
    layoutMode: "glyphBox",
    "aria-hidden": "true"
  })));
};
// EXTERNAL MODULE: /workspace/node_modules/@apple/symbols/regular/rotate.left.svg
var rotate_left = __webpack_require__(1608);

// CONCATENATED MODULE: ./src/Components/ImagePicker/RotationControl.scss
// extracted by mini-css-extract-plugin

// CONCATENATED MODULE: ./src/Components/ImagePicker/RotationControl.tsx







const orientations = [Orientation.Deg0, Orientation.DegNeg90, Orientation.DegNeg180, Orientation.DegNeg270];
const RotationControl = props => {
  const className = classnames_default()("rotation-control", props.className, props.disabled ? "disabled" : undefined);
  const rotateLabel = Object(useLoc["a" /* getLoc */])("ImagePicker.RotationControl.RotateLabel");
  const rotateAriaLabel = Object(useLoc["a" /* getLoc */])("VoiceOver.ImagePicker.RotationControl.RotateLabel");
  return /*#__PURE__*/react["createElement"]("div", {
    className: className
  }, /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
    className: "rotate-button",
    variant: "push",
    ariaLabel: rotateAriaLabel,
    onActivate: () => {
      props.onRotate(orientations[(props.orientation + 1) % 4]);
    },
    disabled: props.disabled
  }, /*#__PURE__*/react["createElement"](rotate_left["a" /* default */], {
    width: 26,
    height: 26,
    layoutMode: "glyphBox"
  })), /*#__PURE__*/react["createElement"]("div", {
    className: "rotate-label"
  }, rotateLabel));
};
// CONCATENATED MODULE: ./src/Components/ImagePicker/ImagePicker.tsx












const MASK_WIDTH = 200;
const MASK_HEIGHT = 200;
const MASK_PADDING = 42;

/**
 * `UIImagePicker` is a control for choosing and composing an image. It allows
 * the user to select an image from their device’s file system and compose a
 * crop for the image before handing it off.
 *
 * Usually you will not use this component directly. Instead, use
 * `UIImagePickerButton`, which shows a preview, handles presentation and
 * dismissal, and provides cleaner handling for the no-image case. See the
 * `UIImagePickerButton` docs for more.
 *
 * For more control over the presentation, pass `UIImagePicker` directly to
 * `usePane` or `useModalPane`, like so:
 *
 * ```ts
 * [imageURL, setImageURL] = useState(
 *     "https://www.apple.com/newsroom/images/live-action/wwdc-2019/Apple-highlights-from-wwdc19-Craig-Federighi-unveils-iOS13-06032019_big.jpg.large.jpg"
 * );
 * [meCardCrop, setMeCardCrop] = useState({
 *     x: 200,
 *     y: 400,
 *     width: 200,
 *     height: 200
 * });
 *
 * const [openImagePicker, closeImagePicker] = usePane(
 *     <UIImagePicker
 *         imageURL={imageURL}
 *         meCardCrop={meCardCrop}
 *         onUserSelectedImage={(file: File) => {
 *             const isValid = file.size < 10000000;
 *             if (isValid) {
 *                 return true;
 *             } else {
 *                 window.alert("Unacceptable file");
 *                 return false;
 *             }
 *         }}
 *         onComplete={(newImageURL, newCrop) => {
 *             // Update local state to match user chosen values
 *             setImageURL(newImageURL);
 *             setCrop(newCrop);
 *             // Close the pane
 *             closeImagePicker();
 *         }}
 *         onCancel={() => {
 *             // Close the pane
 *             closeImagePicker();
 *         }}
 *         // Provide localized user strings for display in UI.
 *         instructionsLabel="Move and Scale"
 *         changeImageButtonLabel="Change Image"
 *         cancelButtonLabel="Cancel"
 *         doneButtonLabel="Done"
 *         imageAlt="Uploaded image"
 *         loadingAriaLabel="Loading image…"
 *         errorTextForImageFailedToLoad="Unable to load image"
 *         ariaLabel="Press esc to exit"
 *         title="Change your profile image"
 *     />
 * );
 * ```
 */
const ImagePicker = /*#__PURE__*/react["forwardRef"]((props, forwardedRef) => {
  const {
    id,
    className,
    style,
    cancelButtonLabel,
    doneButtonLabel,
    compactDoneButtonLabel,
    changeImageButtonLabel,
    imageAlt,
    loadingAriaLabel,
    onComplete,
    onCancel,
    imageURL,
    meCardCrop,
    onUserSelectedImage,
    acceptType,
    instructionsLabel,
    errorTextForImageFailedToLoad,
    ariaLabel,
    title,
    dropZoneLabel
  } = props;

  /* -- Determine Size of Provided Image -------------------------------------
   *
   * Wait for the UIImage to fire its `onLoad` callback then measure it if
   * needed.
   */
  // Keep track of whether of the image loaded
  const [isImageLoaded, setIsImageLoaded] = Object(react["useState"])(!imageURL);

  // A rect representing the measured size of the image loaded
  const [nativeImgSize, setNativeImgSize] = Object(react["useState"])(null);

  // To track whether the image picker dialog is being dragged over
  const [imagePickerDragCounter, setImagePickerDragCounter] = Object(react["useState"])(0);
  // To track whether the image wrapper is being dragged over
  const [imageWrapperDragCounter, setImageWrapperDragCounter] = Object(react["useState"])(0);
  const [newImageUploaded, setNewImageUploaded] = Object(react["useState"])(false);
  const [zoomLevel, setZoomLevel] = Object(react["useState"])(1);
  const [orientation, setOrientation] = Object(react["useState"])(Orientation.Deg0);
  const rotateTransform = ["rotate(0)", "rotate(-90deg)", "rotate(-180deg)", "rotate(-270deg)"][orientation];

  // Handler for UIImage’s `onLoad` prop
  function imageOnLoad() {
    setIsImageLoaded(true);
    setNativeImgSize({
      width: imageElemRef.current.offsetWidth,
      height: imageElemRef.current.offsetHeight
    });
    // If it loaded after timing out, update internal state to reflect that
    // the image is no longer errored.
    if (imageFailedToLoad) {
      setImageFailedToLoad(false);
    }
  }

  /* -- Determine Inline Styles and Scroll Position --------------------------
   *
   * Render the provided image, respecting any provided crop rect. Generate
   * a crop rect if no crop rect was provided.
   */

  // Keep track of whether or not layout has been done
  const [finishedInitialImageLayout, setFinishedInitialImageLayout] = Object(react["useState"])(false);

  // Internal understanding of what the outputted crop rect will be.
  // This is different from the meCardCrop.
  const cropRectRef = Object(react["useRef"])(undefined);

  // Set up some element refs for measurement purposes
  const imageWrapperElemRef = Object(react["useRef"])(null);
  const svgMaskElemRef = Object(react["useRef"])(null);
  const scrollContainerElemRef = Object(react["useRef"])(null);
  const imageElemRef = Object(react["useRef"])(null);
  const fileUploadInputRef = Object(react["useRef"])(null);

  // Ratio of scaling applied to the current image
  const [defaultScale, setDefaultScale] = Object(react["useState"])(1);
  const scale = defaultScale * zoomLevel;
  Object(react["useEffect"])(() => {
    // We need to calculate the crop based on image size and the provided mecard crop
    // But we don't want to recalculate it when cropRectRef.current is already set,
    // or when a new image is uploaded so the provided mecard crop is obsolete.
    if (!nativeImgSize || !meCardCrop || cropRectRef.current || newImageUploaded) return;
    cropRectRef.current = Object(convertImageCropRect["a" /* convertImageCropRect */])(meCardCrop, nativeImgSize);
  }, [meCardCrop, nativeImgSize, newImageUploaded]);

  // Do initial image layout, getting enough state into the DOM that we can update scroll position below.
  Object(react["useEffect"])(() => {
    // Make sure layout hasn't been done already
    if (finishedInitialImageLayout) return;
    // Make sure the image has been loaded and measured
    if (!nativeImgSize) return;

    // Scale calculation
    // Update scale factor to fit shortest dimension within mask
    const defaultScaleFactor = MASK_WIDTH / Math.min(nativeImgSize.width, nativeImgSize.height);
    setDefaultScale(defaultScaleFactor);

    // If we were provided with a crop, compute the image scale factor from it.
    if (cropRectRef.current) {
      // Calculate difference in scale between crop and container
      const actualScale = MASK_WIDTH / cropRectRef.current.width;
      setZoomLevel(actualScale / defaultScaleFactor);
      // Mark that this has been done
      setFinishedInitialImageLayout(true);
    }
    // If we WEREN'T provided with a crop, compute it (and the image scale factor) based
    // on default image layout.
    else {
      // Create a crop rect to match rendering above
      cropRectRef.current = {
        top: (nativeImgSize.height * defaultScaleFactor - MASK_HEIGHT) / defaultScaleFactor / 2,
        left: (nativeImgSize.width * defaultScaleFactor - MASK_WIDTH) / defaultScaleFactor / 2,
        width: MASK_WIDTH / defaultScaleFactor,
        height: MASK_HEIGHT / defaultScaleFactor
      };
      // Mark that this has been done
      setFinishedInitialImageLayout(true);
    }
  }, [nativeImgSize, finishedInitialImageLayout, meCardCrop]);

  // After initial image layout makes it into the DOM, we can update the scroll position.
  Object(react["useLayoutEffect"])(() => {
    // (Note that cropRectRef was deterministically populated in the previous useEffect.)
    if (!finishedInitialImageLayout || !cropRectRef.current || !scrollContainerElemRef.current) {
      return;
    }

    // Figure out the 'adjusted for scale' scroll positions.
    const scrollLeft = cropRectRef.current.left * scale + (cropRectRef.current.width * scale - MASK_WIDTH) / 2;
    const scrollTop = cropRectRef.current.top * scale + (cropRectRef.current.height * scale - MASK_HEIGHT) / 2;

    // Set the values
    setScrollPosition({
      scrollLeft,
      scrollTop
    });
  }, [finishedInitialImageLayout, scale]);

  // Note that we also need to handle window resize:
  // rdar://55300927 (UIImagePicker doesn't update its internal state when resized.)

  /* -- Handle File Input ----------------------------------------------------
   *
   * When the user picks a file on their file system convert it to a URL and
   * display it in the editor.
   */
  // Internal state for the current URL passed to `UIImage`
  const [imageSrc, setImageSrc] = Object(react["useState"])(imageURL);

  // `onChange` handler
  function handleFileInputOnChange(e) {
    const files = e.target.files;
    if (files && !files.length) {
      // This can happen when user upload an image successfully, then
      // opens the upload dialog but clicks "cancel". This changes the
      // files list to empty.
      return;
    }
    handleFileListUpload(files !== null && files !== void 0 ? files : undefined);
  }
  async function handleFileListUpload(files) {
    const file = files === null || files === void 0 ? void 0 : files[0];
    // Run `onUserSelectedImage` if was provided.
    const isValid = onUserSelectedImage ? onUserSelectedImage(file) : true;
    if (file && isValid) {
      // Set imageSrc to undefined to trigger the loading state, in case it
      // takes a moment to crush the image into a dataURL
      setImageSrc(undefined);
      const dataURL = await Object(readFileAsDataUrl["a" /* readFileAsDataURL */])(file);
      setImageSrc(dataURL);
      setNewImageUploaded(true);
      setOrientation(Orientation.Deg0);
      setZoomLevel(1);
    }
  }

  // Compute padding for image
  // Position image to top left corner of mask, apply scale from
  // crop, and add padding to effectively make the mask the
  // bounding box for scroll
  const imagePadding = finishedInitialImageLayout ? MASK_PADDING / scale : 0;

  /* -- Reset Layout on New Image ---------------------------------------- */

  // Reset when image changes
  const previousImageURL = Object(react["useRef"])(imageSrc);
  Object(react["useEffect"])(() => {
    if (imageSrc !== previousImageURL.current) {
      previousImageURL.current = imageSrc;
      cropRectRef.current = undefined;
      setIsImageLoaded(false);
      setNativeImgSize(null);
      setDefaultScale(1);
      setFinishedInitialImageLayout(false);
    }
  }, [imageSrc]);

  /* -- Reset Layout on Orientation Change ------------------------------- */

  Object(react["useEffect"])(() => {
    const handler = () => {
      setDefaultScale(1);
      setFinishedInitialImageLayout(false);
      // setMaskPosition(undefined);
    };
    window.addEventListener("orientationchange", handler);
    return () => window.removeEventListener("orientationchange", handler);
  }, []);

  /* -- Handle Scrolling of Image --------------------------------------------
   *
   * When the user scrolls the image update the internal understanding of the
   * crop rect to match the new scroll positions.
   */
  function handleImageScroll(e) {
    if (isImageLoaded && finishedInitialImageLayout && cropRectRef.current) {
      const target = e.target;

      // Update Crop Ref
      e.preventDefault();
      cropRectRef.current = {
        top: target.scrollTop / scale,
        left: target.scrollLeft / scale,
        width: MASK_WIDTH / scale,
        height: MASK_WIDTH / scale
      };
    }
  }
  Object(react["useEffect"])(() => {
    const scrollEl = scrollContainerElemRef.current;
    if (scrollEl) {
      const handleScroll = e => {
        e.preventDefault();
        e.stopPropagation();
      };
      // See https://github.com/facebook/react/issues/14856
      // and https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#parameters
      // The wheel event is added with { passive: true } as the default in browsers
      // other than Safari and Internet Explorer, which prevents `preventDefault()`.
      // Because we want to cancel the wheel event and handle it ourselves, we add
      // the event listener here with { passive: false }
      scrollEl.addEventListener("wheel", handleScroll, {
        passive: false
      });

      // Clean up the event listeners when the component unmounts
      return () => {
        scrollEl.removeEventListener("wheel", handleScroll);
      };
    }
    return;
  }, []);

  /* -- Handle Scrolling By Mouse Drag, Touch and Keyboard -------------
   *
   * When the user clicks and drags on the image it should update the
   * scroll position accordingly to match the position of the dragged
   * cursor on screen.
   */
  const isScrollingRef = Object(react["useRef"])(false);
  const clickStartX = Object(react["useRef"])(0);
  const clickStartY = Object(react["useRef"])(0);
  const startScrollX = Object(react["useRef"])(0);
  const startScrollY = Object(react["useRef"])(0);
  function updateScrollPositionFromDrag(posX, posY) {
    if (!isImageLoaded) {
      return;
    }
    const scrollElem = scrollContainerElemRef.current;
    if (scrollElem) {
      if (orientation === Orientation.Deg0) {
        setScrollPosition({
          scrollLeft: startScrollX.current + clickStartX.current - posX,
          scrollTop: startScrollY.current + clickStartY.current - posY
        });
      } else if (orientation === Orientation.DegNeg90) {
        setScrollPosition({
          scrollLeft: startScrollY.current - clickStartY.current + posY,
          scrollTop: startScrollX.current + clickStartX.current - posX
        });
      } else if (orientation === Orientation.DegNeg180) {
        setScrollPosition({
          scrollLeft: startScrollX.current - clickStartX.current + posX,
          scrollTop: startScrollY.current - clickStartY.current + posY
        });
      } else {
        setScrollPosition({
          scrollLeft: startScrollY.current + clickStartY.current - posY,
          scrollTop: startScrollX.current - clickStartX.current + posX
        });
      }
    }
  }
  function handleMouseDown(e) {
    if (!isImageLoaded) {
      return;
    }
    startScroll(e.clientX, e.clientY);
  }
  function handleMouseMove(e) {
    if (isScrollingRef.current) {
      updateScrollPositionFromDrag(e.clientX, e.clientY);
    }
  }
  function handleTouchStart(e) {
    if (!isImageLoaded) {
      return;
    }
    startScroll(e.touches[0].clientX, e.touches[0].clientY);
  }
  function handleTouchMove(e) {
    if (isScrollingRef.current) {
      updateScrollPositionFromDrag(e.touches[0].clientX, e.touches[0].clientY);
    }
  }
  function endScroll() {
    isScrollingRef.current = false;
  }
  function startScroll(clientX, clientY) {
    isScrollingRef.current = true;
    clickStartX.current = clientX;
    clickStartY.current = clientY;
    const scrollElem = scrollContainerElemRef.current;
    if (scrollElem) {
      if (orientation === Orientation.Deg0 || orientation === Orientation.DegNeg180) {
        startScrollX.current = scrollElem.scrollLeft;
        startScrollY.current = scrollElem.scrollTop;
      } else {
        startScrollX.current = scrollElem.scrollTop;
        startScrollY.current = scrollElem.scrollLeft;
      }
    }
  }
  function scrollImageViaKeyboard(_ref) {
    let {
      up = 0,
      left = 0,
      down = 0,
      right = 0
    } = _ref;
    const scrollContainer = scrollContainerElemRef.current;
    if (!isImageLoaded || !scrollContainer) {
      return;
    }
    if (orientation === Orientation.Deg0) {
      scrollContainer.scrollLeft += left;
      scrollContainer.scrollTop += up;
      scrollContainer.scrollLeft -= right;
      scrollContainer.scrollTop -= down;
    } else if (orientation === Orientation.DegNeg90) {
      scrollContainer.scrollTop += left;
      scrollContainer.scrollLeft -= up;
      scrollContainer.scrollTop -= right;
      scrollContainer.scrollLeft += down;
    } else if (orientation === Orientation.DegNeg180) {
      scrollContainer.scrollLeft -= left;
      scrollContainer.scrollTop -= up;
      scrollContainer.scrollLeft += right;
      scrollContainer.scrollTop += down;
    } else {
      scrollContainer.scrollTop -= left;
      scrollContainer.scrollLeft += up;
      scrollContainer.scrollTop += right;
      scrollContainer.scrollLeft -= down;
    }
  }

  /* -- Determine Error State ------------------------------------------------
   *
   * When an image fails to load show a message to the user explaining what
   * happened.
   */
  const [imageFailedToLoad, setImageFailedToLoad] = Object(react["useState"])(false);
  function imageOnLoadFailure() {
    setImageFailedToLoad(true);
  }

  /* -- Handle Cancel / Done Buttons -------------------------------------
   *
   * Methods that fire when the Cancel or Done buttons are activated or
   * the escape or return keys are pressed
   */
  function handleCancelActivation() {
    // Close editor without saving changes
    return onCancel ? onCancel() : null;
  }
  function handleDoneActivation() {
    // Save changes and close editor
    if (!scrollContainerElemRef.current || !imageSrc || !cropRectRef.current) {
      return;
    }
    return onComplete(imageSrc, cropRectRef.current, orientation);
  }

  /* -- Drag and drop ---------------------------------------------------
   */
  function handleFileDrop(e) {
    var _e$dataTransfer$files, _e$dataTransfer;
    e.preventDefault();
    e.stopPropagation();
    setImagePickerDragCounter(0);
    setImageWrapperDragCounter(0);
    handleFileListUpload((_e$dataTransfer$files = (_e$dataTransfer = e.dataTransfer) === null || _e$dataTransfer === void 0 ? void 0 : _e$dataTransfer.files) !== null && _e$dataTransfer$files !== void 0 ? _e$dataTransfer$files : undefined);
  }
  function setScrollPosition(_ref2) {
    let {
      scrollLeft,
      scrollTop
    } = _ref2;
    const scrollContainer = scrollContainerElemRef.current;
    if (!scrollContainer) {
      return;
    }
    if (typeof scrollContainer.scrollTo === "function") {
      // Use `scrollTo` if supported
      scrollContainer.scrollTo(scrollLeft, scrollTop);
    } else {
      // Fallback to `scrollTop` / `scrollLeft`
      scrollContainer.scrollTop = scrollTop;
      scrollContainer.scrollLeft = scrollLeft;
    }
  }

  /* -- JSX --------------------------------------------------------------- */

  return /*#__PURE__*/react["createElement"]("div", {
    "aria-label": ariaLabel,
    id: id,
    style: style,
    className: classnames_default()(className, imagePickerDragCounter > 0 ? "drag-over" : undefined, "image-picker", isImageLoaded ? "is-loaded" : "is-loading", imageFailedToLoad ? "has-error" : undefined, !imageSrc ? "no-image" : undefined),
    ref: forwardedRef,
    onDragOver: e => e.preventDefault(),
    onDragEnter: () => setImagePickerDragCounter(x => x + 1),
    onDragLeave: () => setImagePickerDragCounter(x => x - 1),
    onDrop: () => {
      setImagePickerDragCounter(0);
      setImageWrapperDragCounter(0);
    }
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "close-button"
  }, /*#__PURE__*/react["createElement"](CloseButton["a" /* CloseButton */], {
    onActivate: handleCancelActivation,
    ariaLabel: Object(useLoc["a" /* getLoc */])("VoiceOver.ImagePicker.CloseButtonLabel"),
    className: "modal-close-button"
  })), /*#__PURE__*/react["createElement"]("div", {
    className: "content"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "title-icon"
  }, /*#__PURE__*/react["createElement"](person_crop_circle["a" /* default */], {
    layoutMode: "glyphBox",
    width: 48,
    height: 48
  })), /*#__PURE__*/react["createElement"]("h2", null, title), /*#__PURE__*/react["createElement"]("div", {
    className: classnames_default()("image-wrapper", imageWrapperDragCounter > 0 ? "drag-over" : undefined),
    ref: imageWrapperElemRef,
    onDragOver: e => e.preventDefault(),
    onDragEnter: () => setImageWrapperDragCounter(x => x + 1),
    onDragLeave: () => setImageWrapperDragCounter(x => x - 1),
    onDrop: handleFileDrop
  }, imagePickerDragCounter > 0 ? /*#__PURE__*/react["createElement"]("div", {
    className: "drop-zone-label"
  }, /*#__PURE__*/react["createElement"]("span", null, dropZoneLabel)) : !imageSrc ? /*#__PURE__*/react["createElement"]("div", {
    className: "empty-profile-image"
  }) : imageFailedToLoad ? /*#__PURE__*/react["createElement"]("div", {
    className: "error-message"
  }, /*#__PURE__*/react["createElement"]("span", null, errorTextForImageFailedToLoad)) : !isImageLoaded ? /*#__PURE__*/react["createElement"]("div", {
    className: "loading-indicator"
  }, /*#__PURE__*/react["createElement"](UIActivityIndicator["a" /* UIActivityIndicator */], {
    description: loadingAriaLabel
  })) : undefined, /*#__PURE__*/react["createElement"]("div", {
    className: "scroll-container"
    // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- see above
    ,
    tabIndex: 0,
    ref: scrollContainerElemRef,
    onScroll: handleImageScroll,
    onMouseDown: handleMouseDown,
    onMouseMove: handleMouseMove,
    onMouseUp: endScroll,
    onMouseLeave: endScroll,
    onTouchStart: handleTouchStart,
    onTouchEnd: endScroll,
    onTouchMove: handleTouchMove,
    style: {
      transform: rotateTransform
    },
    onKeyDown: e => {
      switch (e.key) {
        case "Enter":
          // Enter
          e.preventDefault();
          handleDoneActivation();
          break;
        case "Esc":
          // Esc
          e.preventDefault();
          handleCancelActivation();
          break;
        case "Left": // Arrow Left
        case "ArrowLeft":
          e.preventDefault();
          scrollImageViaKeyboard({
            left: 10
          });
          break;
        case "Up": // Arrow Up
        case "ArrowUp":
          e.preventDefault();
          scrollImageViaKeyboard({
            up: 10
          });
          break;
        case "Right": // Arrow Right
        case "ArrowRight":
          e.preventDefault();
          scrollImageViaKeyboard({
            right: 10
          });
          break;
        case "Down": // Arrow Down
        case "ArrowDown":
          e.preventDefault();
          scrollImageViaKeyboard({
            down: 10
          });
          break;
        default:
          return;
      }
    }
  }, /*#__PURE__*/react["createElement"](UIImage["b" /* UIImage */], {
    alt: imageAlt,
    src: imageSrc,
    style: {
      transform: `scale(${scale}) `,
      transformOrigin: "left top",
      padding: imagePadding
    },
    ref: imageElemRef,
    onLoad: imageOnLoad,
    onLoadFailure: imageOnLoadFailure
  })), /*#__PURE__*/react["createElement"](ImagePickerMask, {
    ref: svgMaskElemRef
  })), /*#__PURE__*/react["createElement"]("div", {
    className: "controls"
  }, /*#__PURE__*/react["createElement"](ZoomControl, {
    zoomLevel: zoomLevel,
    onZoomLevelChange: setZoomLevel,
    disabled: !imageSrc || !isImageLoaded
  }), /*#__PURE__*/react["createElement"](RotationControl, {
    orientation: orientation,
    onRotate: setOrientation,
    disabled: !imageSrc || !isImageLoaded
  })), /*#__PURE__*/react["createElement"]("div", {
    className: classnames_default()("instructions-label", !isImageLoaded && !imageFailedToLoad ? "muted" : undefined)
  }, instructionsLabel), /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
    onActivate: () => {
      var _fileUploadInputRef$c;
      fileUploadInputRef === null || fileUploadInputRef === void 0 || (_fileUploadInputRef$c = fileUploadInputRef.current) === null || _fileUploadInputRef$c === void 0 || _fileUploadInputRef$c.click();
    },
    variant: "push primary",
    className: "file-upload",
    disabled: !isImageLoaded && !imageFailedToLoad
  }, /*#__PURE__*/react["createElement"]("input", {
    ref: fileUploadInputRef,
    type: "file",
    title: "",
    accept: acceptType ? acceptType : "image/jpeg",
    onChange: e => {
      // Since the following function is async,
      // wrap it in a non-async function
      handleFileInputOnChange(e);
    }
  }), changeImageButtonLabel)), /*#__PURE__*/react["createElement"]("div", {
    className: "button-container"
  }, /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
    className: "compact-done-button",
    onActivate: handleDoneActivation,
    variant: "block primary large"
  }, compactDoneButtonLabel), /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
    className: "cancel-button",
    onActivate: handleCancelActivation,
    variant: "block secondary large"
  }, cancelButtonLabel), /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
    className: "regular-done-button",
    disabled: !isImageLoaded ? true : undefined,
    onActivate: handleDoneActivation,
    variant: "block primary large"
  }, doneButtonLabel)));
});
ImagePicker.displayName = "UIImagePicker";

// The gray cropping mask with a circle cut-out in the center
const ImagePickerMask = /*#__PURE__*/react["forwardRef"]((_props, forwardedRef) => /*#__PURE__*/react["createElement"]("svg", {
  viewBox: "0 0 284 284",
  xmlns: "http://www.w3.org/2000/svg",
  xmlnsXlink: "http://www.w3.org/1999/xlink",
  className: "image-picker-mask"
}, /*#__PURE__*/react["createElement"]("defs", null, /*#__PURE__*/react["createElement"]("circle", {
  id: "b",
  cx: "50%",
  cy: "50%",
  r: "100"
}), /*#__PURE__*/react["createElement"]("rect", {
  id: "a",
  rx: "8",
  width: "284",
  height: "284"
}), /*#__PURE__*/react["createElement"]("mask", {
  id: "c"
}, /*#__PURE__*/react["createElement"]("use", {
  xlinkHref: "#a",
  fill: "#fff"
}), /*#__PURE__*/react["createElement"]("use", {
  xlinkHref: "#b"
}))), /*#__PURE__*/react["createElement"]("use", {
  xlinkHref: "#a",
  mask: "url(#c)",
  fill: "rgba(73, 73, 75, 0.6)",
  className: "square"
}), /*#__PURE__*/react["createElement"]("use", {
  xlinkHref: "#b",
  fill: "none",
  stroke: "#fff",
  strokeWidth: "2px",
  ref: forwardedRef,
  className: "circle"
})));
ImagePickerMask.displayName = "ImagePickerMask";
// CONCATENATED MODULE: ./src/Components/ImagePicker/useImagePickerPane.tsx
function useImagePickerPane_extends() { return useImagePickerPane_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, useImagePickerPane_extends.apply(null, arguments); }




/**
 * Displays an image picker in a platform-appropriate pane.
 */
function useImagePickerPane(imagePickerProps) {
  const onCancel = () => {
    imagePickerProps.onCancel();
    hidePopover();
  };
  const onComplete = (newImageURL, newCrop, orientation) => {
    imagePickerProps.onComplete(newImageURL, newCrop, orientation);
    hidePopover();
  };
  const imagePickerElemRef = Object(react["useRef"])(null);
  const imagePicker = /*#__PURE__*/react["createElement"](ImagePicker, useImagePickerPane_extends({
    ref: imagePickerElemRef
  }, imagePickerProps, {
    onComplete: onComplete,
    onCancel: onCancel
  }));
  const [showPopover, hidePopover] = Object(usePopup["a" /* usePopup */])(imagePicker, {
    initialFocus: imagePickerElemRef,
    className: "for-image-picker"
  });
  return showPopover;
}
// EXTERNAL MODULE: ./src/Legacy/Utils/uuidString.ts
var uuidString = __webpack_require__(922);

// CONCATENATED MODULE: ./src/Utils/extractImageData.ts


/**
 * (Borrowed from settings2-webclient and ported from JS to TS, which was borrowed from
 * CloudKit1 and ported from SproutCore back to vanilla JS)
 *
 * Given an input image and a crop rectangle, return a dataURL corresponding to the image.
 * This is a synchronous operation.
 *
 * If the image size exceeds the specified maximum size, attempt to adjust the image's scale
 * and quality using a 2D quad search of the space of resolution and jpeg quality in order to
 * meet the required size.
 *
 * To use this class, call extractData for the image, crop rectangle and maxSize.
 * See documentation for extractData for a description of the arguments. e.g.
 *
 * const result = extractData(image, imageWidth, imageHeight, crop, maxSize, bCropOutput);
 *
 * See extractDataByScaleAndQuality() for a description of the result data hash. It will contain the
 * output dataURL, size of the image and which scale & quality parameters were finally used.
 *
 * @author Mike Taylor
 */

/**
 * Given a scale and a quality, render the image into a temporary canvas and convert it to a data URL
 * @param scale   - 0 < scale <= 1   - The scale factor to multiply the image width & height by
 * @param quality - 0 < quality <= 1 - The quality factor applied to canvas.toDataURL()
 * @return a data hash with the dataURL and other attributes representing the information that
 *     went into and out of the rescaling and dataURL extraction of the image.
 */
function extractDataByScaleAndQuality(image, crop, scale, quality) {
  const width = crop.width;
  const height = crop.height;
  const outputWidth = Math.round(width * scale);
  const outputHeight = Math.round(height * scale);
  const canvas = document.createElement("canvas");
  canvas.width = outputWidth;
  canvas.height = outputHeight;

  // Render the appropriate area of the image into the canvas
  const context = canvas.getContext("2d");
  if (!context) {
    // This should not happen
    throw new Error("extractImageData: cannot get canvas context");
  }

  // Render a white background in case there is any transparency
  context.fillStyle = "#ffffff";
  context.fillRect(0, 0, outputWidth, outputHeight);

  // Render the image
  context.drawImage(image, crop.left, crop.top, width, height, 0, 0, outputWidth, outputHeight);

  // Extract the canvas contents as a dataURL
  const dataURL = canvas.toDataURL("image/jpeg", quality);

  // Store the results
  return {
    dataURL,
    width: outputWidth,
    height: outputHeight,
    size: dataURL.length,
    scale,
    quality
  };
}

/**
 * Use a recursive quad search to find the quality and scale factors that will result in a dataURL just below the specified maxSize
 * Positional relationships within the search space of quality and scale are based on compass convention as follows:
 *
 *   0--scale--->1
 *   nw   n    ne  | 0
 *   w  center e   | quality
 *   sw   s    se  V 1
 *
 *   Axes are:
 *   x - scale (0..1)
 *   y - quality (0..1)
 *   z - size of dataURL in bytes
 *
 *   We apply a quad subdivision of the search space. Since the ideal solution will lie in a region that contains a mixture of values
 *   that are above and below the maxSize threshold, we reject regions that are entirely above or below the maxSize contour.
 *   We search the south-east quad first in order to favor higher quality and scale.
 */
function extractDataByQuadBinarySearch(image, crop, nw, ne, sw, se, maxSize) {
  // Count how many of the samples at each corner are above the maximum size
  let nAbove = 0;
  if (nw.size > maxSize) ++nAbove;
  if (ne.size > maxSize) ++nAbove;
  if (sw.size > maxSize) ++nAbove;
  if (se.size > maxSize) ++nAbove;

  // The optimal solution will only occur where there is a mixture of samples above and below maxSize
  // Discard any quads that are entirely above or below maxSize.
  // The search will then focus on the contour where size equals maxSize
  if (nAbove === 4 || nAbove === 0) {
    return null;
  }

  // The corners will now contain a mixture of samples above and below maxSize.
  // We want to recursively subdivide so that we search deeper within this area for a valid solution

  // Extract the quality & scale ranges at the outside of the quad
  const minScale = nw.scale;
  const maxScale = se.scale;
  const minQuality = nw.quality;
  const maxQuality = se.quality;

  // If we are within tolerance, return the nw result which will be the lowest value.
  const tolerance = 0.05;
  if (maxScale - minScale < tolerance || maxQuality - minQuality < tolerance) {
    return nw;
  }

  // Determine the scale & quality in the middle of the quad
  const midScale = (minScale + maxScale) / 2;
  const midQuality = (minQuality + maxQuality) / 2;

  // Calculate the unknown data in the interior of the quad
  const s = extractDataByScaleAndQuality(image, crop, midScale, maxQuality);
  const e = extractDataByScaleAndQuality(image, crop, maxScale, midQuality);
  const center = extractDataByScaleAndQuality(image, crop, midScale, midQuality);
  let result;

  // Search the bottom-right quad first as this will have the highest quality and resolution
  if (result = extractDataByQuadBinarySearch(image, crop, center, e, s, se, maxSize)) {
    return result;
  }

  // Search the top-right quad
  const n = extractDataByScaleAndQuality(image, crop, midScale, minQuality);
  if (result = extractDataByQuadBinarySearch(image, crop, n, ne, center, e, maxSize)) {
    return result;
  }

  // Search the bottom-left quad
  const w = extractDataByScaleAndQuality(image, crop, minScale, midQuality);
  if (result = extractDataByQuadBinarySearch(image, crop, w, center, sw, s, maxSize)) {
    return result;
  }

  // Search the top-left quad last as this will have the lowest quality and resolution
  result = extractDataByQuadBinarySearch(image, crop, nw, n, w, center, maxSize);
  return result;
}

/**
 * @param image - The image whose data we wish to extract
 * @param imageWidth  - The width of the input image (The image's width may have been set via style, so this should be passed in)
 * @param imageHeight - The height of the input image (The image's width may have been set via style, so this should be passed in)
 * @param orientation - The orientation of the output image
 * @param crop - The crop rectangle measured with y at the top {x,y,width,height}
 * @param maxSize - the maximum allowed size of the dataURL in bytes. If the dataURL exceeds this size its scale/quality will be adjusted to fit.
 * @param bCropOutput - If true, the output image will be cropped to the specified rectangle and the returned crop will cover the whole image.
 * @returns The result of data extraction. See extractDataByScaleAndQuality() for details.
 */
async function extractImageData(image, imageWidth, imageHeight, orientation, crop) {
  let maxSize = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 10000000;
  let bCropOutput = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
  // Decide if we want to extract a dataURL for the cropped region or the whole image
  const expectedCrop = bCropOutput ? crop : {
    left: 0,
    top: 0,
    width: imageWidth,
    height: imageHeight
  };

  // Decide the corners of the 2d search space
  const minScale = 0.1;
  const maxScale = 1;
  const minQuality = 0.1;
  const maxQuality = 1;

  // Sample the image at max scale and max quality
  let result = extractDataByScaleAndQuality(image, expectedCrop, maxScale, maxQuality);

  // If this exceeds the maximum size, then we have to use quad binary search to find a scale & quality that will fit
  if (result.size > maxSize) {
    // Sample the image at the corners of the search space
    const nw = extractDataByScaleAndQuality(image, expectedCrop, minScale, minQuality);
    const ne = extractDataByScaleAndQuality(image, expectedCrop, maxScale, minQuality);
    const sw = extractDataByScaleAndQuality(image, expectedCrop, minScale, maxQuality);
    const se = result; // Re-use the data sampled at (1,1) above

    // Extract the dataURL for the specified region
    result = extractDataByQuadBinarySearch(image, expectedCrop, nw, ne, sw, se, maxSize);
  }
  if (!result) {
    throw new Error("extractImageData: cannot convert image to data URL");
  }
  let newCrop;
  if (bCropOutput) {
    // If we are extracting only the cropped part of the image, the crop rectangle will be the whole image
    newCrop = {
      left: 0,
      top: 0,
      width: result.width,
      height: result.height
    };
  } else {
    // Otherwise, we send back the whole image with the crop rectangle specified.
    // Correct for any image resizing that was applied
    const scale = result.scale;
    const top = Math.round(crop.top * scale);
    const left = Math.round(crop.left * scale);
    const width = Math.round(crop.width * scale);
    const height = Math.round(crop.height * scale);
    newCrop = {
      top,
      left,
      width,
      height
    };
  }
  const rotatedResult = await rotateExtractedImage(result, newCrop, orientation);
  return Promise.resolve(rotatedResult);
}

// Rotate the crop by the given orientation
function rotateCrop(_ref, orientation) {
  let {
    left,
    top,
    right,
    bottom,
    width,
    height
  } = _ref;
  const a1 = [left, top, right, bottom, left];
  const a2 = [width, height, width];
  const [newLeft, newTop] = a1.slice(orientation, orientation + 2);
  const [newWidth, newHeight] = a2.slice(orientation % 2, orientation % 2 + 2);
  return {
    left: newLeft,
    top: newTop,
    width: newWidth,
    height: newHeight
  };
}
async function rotateExtractedImage(extractedImage, crop, orientation) {
  // Calculate the new crop
  const {
    width,
    height
  } = extractedImage;
  const {
    left,
    top
  } = crop;
  const right = width - crop.width - left;
  const bottom = height - crop.height - top;
  const newCrop = rotateCrop({
    ...crop,
    right,
    bottom
  }, orientation);

  // Rotate the image
  const canvas = document.createElement("canvas");
  const targetWidth = orientation === Orientation.Deg0 || orientation === Orientation.DegNeg180 ? width : height;
  const targetHeight = orientation === Orientation.Deg0 || orientation === Orientation.DegNeg180 ? height : width;
  canvas.width = targetWidth;
  canvas.height = targetHeight;
  const context = canvas.getContext("2d");
  if (!context) {
    return Promise.resolve({
      ...extractedImage,
      crop
    });
  }
  const img = new Image();
  img.src = extractedImage.dataURL;
  try {
    await img.decode();
  } catch {
    return Promise.resolve({
      ...extractedImage,
      crop
    });
  }
  context.translate(targetWidth / 2, targetHeight / 2);
  context.rotate(-Math.PI / 2 * orientation);
  context.drawImage(img, -width / 2, -height / 2);
  const dataURL = canvas.toDataURL("image/jpeg");
  return Promise.resolve({
    dataURL,
    width: targetWidth,
    height: targetHeight,
    size: dataURL.length,
    scale: extractedImage.scale,
    quality: extractedImage.quality,
    crop: newCrop
  });
}
// EXTERNAL MODULE: ./src/Utils/loadImage.ts
var loadImage = __webpack_require__(1336);

// CONCATENATED MODULE: ./src/Pages/AccountPage/useProfileImagePicker.tsx










const SUPPORTED_IMAGE_TYPES = ["image/jpeg", "image/gif", "image/png", "image/bmp"];
const MAX_IMAGE_UPLOAD_SIZE = 96256;
const MAX_IMAGE_SELECTION_SIZE = 10000000;
function useProfileImagePicker() {
  const {
    data: currentProfilePhoto,
    isLoading
  } = Object(useMeCard["a" /* useMeCard */])();
  const meCardMutation = useUpdateMeCard();
  const alertTitleUnsupportedFileType = Object(useLoc["a" /* getLoc */])("ImagePicker.Alert.Title.UnsupportedFileType");
  const alertTitleFileTooLarge = Object(useLoc["a" /* getLoc */])("ImagePicker.Alert.Title.FileTooLarge");
  const alertTitleGeneric = Object(useLoc["a" /* getLoc */])("ImagePicker.Alert.Title.Generic");
  const alertDescriptionUnsupportedFileType = Object(useLoc["a" /* getLoc */])("ImagePicker.Alert.Description.UnsupportedFileType");
  const alertDescriptionFileTooLarge = Object(useLoc["a" /* getLoc */])("ImagePicker.Alert.Description.FileTooLarge");
  const alertDescriptionGeneric = Object(useLoc["a" /* getLoc */])("ImagePicker.Alert.Description.Generic");
  const alertOk = Object(useLoc["a" /* getLoc */])("ImagePicker.Alert.Action.Ok");
  const showAlert = Object(useShowCloudOSAlert["a" /* useShowCloudOSAlert */])();
  const [imgUrl, setImgUrl] = react["useState"](currentProfilePhoto === null || currentProfilePhoto === void 0 ? void 0 : currentProfilePhoto.url);
  const prevImgUrlRef = react["useRef"](imgUrl);
  if ((currentProfilePhoto === null || currentProfilePhoto === void 0 ? void 0 : currentProfilePhoto.url) !== prevImgUrlRef.current) {
    prevImgUrlRef.current = currentProfilePhoto === null || currentProfilePhoto === void 0 ? void 0 : currentProfilePhoto.url;
    setImgUrl(currentProfilePhoto === null || currentProfilePhoto === void 0 ? void 0 : currentProfilePhoto.url);
  }
  const [isProcessingImage, setIsProcessingImage] = react["useState"](false);
  const imageSelected = file => {
    if (file) {
      const fileType = file.type;
      if (!SUPPORTED_IMAGE_TYPES.includes(fileType)) {
        showAlert({
          title: alertTitleUnsupportedFileType,
          description: alertDescriptionUnsupportedFileType,
          buttons: [alertOk]
        });
        return false;
      } else if (file.size > MAX_IMAGE_SELECTION_SIZE) {
        showAlert({
          title: alertTitleFileTooLarge,
          description: alertDescriptionFileTooLarge,
          buttons: [alertOk]
        });
        return false;
      }
      return true;
    } else {
      showAlert({
        title: alertTitleGeneric,
        description: alertDescriptionGeneric,
        buttons: [alertOk]
      });
      return false;
    }
  };

  /**
   * Processes the image selected by user via the image picker, so it can be sent to
   * the me card API to update the profile image.
   */
  const imageUpdated = async (newImgUrl, newCropRect, orientation) => {
    try {
      var _currentProfilePhoto$, _currentProfilePhoto$2, _currentProfilePhoto$3, _currentProfilePhoto$4;
      if (!currentProfilePhoto) {
        return;
      }
      setIsProcessingImage(true);
      const img = await Object(loadImage["a" /* loadImage */])(newImgUrl, undefined /** srcset */, undefined /** timeout */, "use-credentials");
      setIsProcessingImage(false);

      // Translate the image crop set by the image picker to the format used by the MeCard API.
      const translatedCrop = Object(convertImageCropRect["b" /* convertImageCropRectBackwards */])(newCropRect, {
        height: img.height,
        width: img.width
      });

      // Update MeCard if image or crop changed
      if (newImgUrl !== prevImgUrlRef.current || translatedCrop.x !== ((_currentProfilePhoto$ = currentProfilePhoto.crop) === null || _currentProfilePhoto$ === void 0 ? void 0 : _currentProfilePhoto$.x) || translatedCrop.y !== ((_currentProfilePhoto$2 = currentProfilePhoto.crop) === null || _currentProfilePhoto$2 === void 0 ? void 0 : _currentProfilePhoto$2.y) || translatedCrop.height !== ((_currentProfilePhoto$3 = currentProfilePhoto.crop) === null || _currentProfilePhoto$3 === void 0 ? void 0 : _currentProfilePhoto$3.height) || translatedCrop.width !== ((_currentProfilePhoto$4 = currentProfilePhoto.crop) === null || _currentProfilePhoto$4 === void 0 ? void 0 : _currentProfilePhoto$4.width) || orientation !== Orientation.Deg0) {
        // Converts the selected image to a data url, compressed if necessary.
        const imageData = await extractImageData(img, img.width, img.height, orientation, newCropRect, MAX_IMAGE_UPLOAD_SIZE, false);

        // Generate new contactId for new accounts
        const contactId = currentProfilePhoto.contactId !== "" ? currentProfilePhoto.contactId : Object(uuidString["a" /* uuidString */])().toUpperCase();

        // Converts the extracted image (crop + data url) to the data shape used by the MeCard API.
        const newProfilePhoto = {
          contactId,
          url: imageData.dataURL,
          crop: Object(convertImageCropRect["b" /* convertImageCropRectBackwards */])(imageData.crop, {
            width: imageData.width,
            height: imageData.height
          }),
          signature: currentProfilePhoto.signature
        };
        meCardMutation.mutate(newProfilePhoto);
      }
    } catch {
      showAlert({
        title: alertTitleGeneric,
        description: alertDescriptionGeneric,
        buttons: [alertOk]
      });
    }
  };
  const showImagePicker = useImagePickerPane({
    cancelButtonLabel: Object(useLoc["a" /* getLoc */])("ImagePicker.CancelButtonLabel"),
    compactDoneButtonLabel: Object(useLoc["a" /* getLoc */])("ImagePicker.CompactDoneButtonLabel"),
    doneButtonLabel: Object(useLoc["a" /* getLoc */])("ImagePicker.DoneButtonLabel"),
    changeImageButtonLabel: Object(useLoc["a" /* getLoc */])("ImagePicker.ChangeImageButtonLabel"),
    imageAlt: Object(useLoc["a" /* getLoc */])("Avatar.ImageAlt"),
    loadingAriaLabel: Object(useLoc["a" /* getLoc */])("VoiceOver.ImagePicker.LoadingAriaLabel"),
    instructionsLabel: Object(useLoc["a" /* getLoc */])("ImagePicker.Instructions"),
    title: Object(useLoc["a" /* getLoc */])("ImagePicker.Title"),
    errorTextForImageFailedToLoad: Object(useLoc["a" /* getLoc */])("ImagePicker.ErrorImageFailedToLoad"),
    onUserSelectedImage: imageSelected,
    onComplete: imageUpdated,
    // As of Aug 2022, specifying extensions e.g. image/png is not supported
    // by Safari on iOS and many other mobile browsers:
    // https://caniuse.com/input-file-accept
    acceptType: "image/*",
    onCancel: () => {},
    imageURL: currentProfilePhoto === null || currentProfilePhoto === void 0 ? void 0 : currentProfilePhoto.url,
    meCardCrop: currentProfilePhoto === null || currentProfilePhoto === void 0 ? void 0 : currentProfilePhoto.crop,
    dropZoneLabel: Object(useLoc["a" /* getLoc */])("ImagePicker.DropZoneLabel")
  });
  return {
    isImageLoading: isLoading || meCardMutation.isLoading || isProcessingImage,
    showImagePicker
  };
}
// EXTERNAL MODULE: ./src/Hooks/useSprinklesSizeClass.ts
var useSprinklesSizeClass = __webpack_require__(1572);

// EXTERNAL MODULE: ./src/Legacy/Utils/isTruthy.ts
var isTruthy = __webpack_require__(975);

// CONCATENATED MODULE: ./src/Components/NavLinks/SandwichMenu.scss
// extracted by mini-css-extract-plugin

// CONCATENATED MODULE: ./src/Components/NavLinks/SandwichMenuToggleIcon.scss
// extracted by mini-css-extract-plugin

// CONCATENATED MODULE: ./src/Components/NavLinks/SandwichMenuToggleIcon.tsx



const SandwichMenuToggleIcon = _ref => {
  let {
    crossed,
    onChange
  } = _ref;
  return /*#__PURE__*/react["createElement"]("button", {
    className: "sandwich-menu-toggle-icon",
    "aria-label": Object(useLoc["a" /* getLoc */])("SandwichMenu.NavLinks.ToggleIcon"),
    "data-cross-activated": crossed,
    onClick: () => onChange({
      crossed
    })
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "sandwich-menu-toggle-icon-top"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "sandwich-menu-toggle-icon-crust-top"
  })), /*#__PURE__*/react["createElement"]("div", {
    className: "sandwich-menu-toggle-icon-bottom"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "sandwich-menu-toggle-icon-crust-bottom"
  })));
};
// EXTERNAL MODULE: ./src/Legacy/Environment/Platform.ts
var Platform = __webpack_require__(903);

// EXTERNAL MODULE: ./src/Legacy/Hooks/useHorizontalSizeClass.ts
var useHorizontalSizeClass = __webpack_require__(1249);

// CONCATENATED MODULE: ./src/Components/NavLinks/SandwichMenu.tsx
function SandwichMenu_extends() { return SandwichMenu_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, SandwichMenu_extends.apply(null, arguments); }








// lovingly stolen and reworked from card.apple.com's Menu.tsx

// SandwichMenu is the sizeclass-SM rendition of the top links

const SandwichMenu = props => {
  const useSizeClass = props.useHorizontalSizeClass || useHorizontalSizeClass["c" /* useHorizontalSizeClass */];
  const sizeClass = useSizeClass();
  const collapsed = props.collapsedSizeClass || (hasDefaultSizeClass => {
    if (hasDefaultSizeClass) return Platform["e" /* SizeClass */].COMPACT;
    throw new TypeError("When bringing your own sizeClass media query, you need to set a `collapsedSizeClass`!");
  })(useSizeClass === useHorizontalSizeClass["c" /* useHorizontalSizeClass */]);
  const isCollapsed = sizeClass === collapsed;
  const [isCrossed, setIsCrossed] = react["useState"](false);
  const unCross = react["useCallback"](() => setIsCrossed(false), [setIsCrossed]);
  // reset menu when we transition out of vertical menu mode
  react["useEffect"](() => {
    if (!isCollapsed) {
      unCross();
    }
  }, [isCollapsed, unCross]);
  const [isAnimated, setIsAnimated] = react["useState"](true);
  react["useLayoutEffect"](() => {
    // use `useLayoutEffect` so that when transitioning from regular rendering
    // to collapsed mode, the initial state is set to closed without animation
    setIsAnimated(isCollapsed);
  }, [isCollapsed]);
  const menuOpen = isCollapsed && isCrossed;

  // set a root classname so our css will block scrolling when the menu is open
  react["useEffect"](() => {
    const htmlElem = document.documentElement;
    htmlElem.classList[menuOpen ? "add" : "remove"]("sandwich-menu-open");
  }, [menuOpen]);
  const onClick = unCross;
  const onKeyDown = react["useCallback"](e => {
    if (e.key === " " || e.key === "Return") onClick();
  }, [onClick]);
  const {
    liProps,
    selectedItem
  } = props;
  const items = props.menuItems.map(item => {
    const {
      key
    } = item;
    if (!key) throw new TypeError("menuItems need to set a `key` prop!");
    const selected = selectedItem && key === selectedItem ? "selected" : null;
    const className = classnames_default()(liProps === null || liProps === void 0 ? void 0 : liProps.className, selected) || undefined;
    return (
      /*#__PURE__*/
      // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- it has!
      react["createElement"]("li", SandwichMenu_extends({
        key: key,
        className: className,
        onClick: onClick,
        onKeyDown: onKeyDown
      }, liProps), item)
    );
  });
  return /*#__PURE__*/react["createElement"]("div", {
    className: classnames_default()("sandwich-menu", menuOpen ? "open" : "closed", isAnimated ? "animated" : null)
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "sandwich-menu-button-container"
  }, /*#__PURE__*/react["createElement"](SandwichMenuToggleIcon, {
    crossed: isCrossed,
    onChange: _ref => {
      let {
        crossed
      } = _ref;
      return setIsCrossed(!crossed);
    }
  })), /*#__PURE__*/react["createElement"]("div", {
    className: "sandwich-menu-header"
  }, props.compactHeader), /*#__PURE__*/react["createElement"]("section", {
    className: "sandwich-menu-items-container",
    "aria-label": Object(useLoc["a" /* getLoc */])("SandwichMenu.AriaLabel")
  }, /*#__PURE__*/react["createElement"]("ul", null, items)));
};
// CONCATENATED MODULE: ./src/Components/NavLinks/TopNavLinks.scss
// extracted by mini-css-extract-plugin

// CONCATENATED MODULE: ./src/Components/NavLinks/TopNavLinks.tsx








/** subpage links to render in rdar://99045232 (Sprinkles: Re-Visit Page Navigation) */
function useNavigationTabRoutes() {
  var _useCloudOSUser;
  const isBeneficiary = (_useCloudOSUser = Object(AuthenticationHook["b" /* useCloudOSUser */])()) === null || _useCloudOSUser === void 0 || (_useCloudOSUser = _useCloudOSUser.details) === null || _useCloudOSUser === void 0 || (_useCloudOSUser = _useCloudOSUser.beneficiaryInfo) === null || _useCloudOSUser === void 0 ? void 0 : _useCloudOSUser.isBeneficiary;
  return [LegacyNavLinks["b" /* LegacyNavRoutes */].plan, LegacyNavLinks["b" /* LegacyNavRoutes */].storage, Object(useICloudPlan["b" /* useHasICloudPlus */])() && !isBeneficiary ? LegacyNavLinks["b" /* LegacyNavRoutes */].icloudplus : null, !isBeneficiary ? LegacyNavLinks["b" /* LegacyNavRoutes */].recovery : null, !isBeneficiary ? LegacyNavLinks["b" /* LegacyNavRoutes */].settings : null].filter(isTruthy["a" /* isTruthy */]);
}
/** an individual link in the top-of-page nav */
const TopNavLink = _ref => {
  let {
    route,
    locPrefix
  } = _ref;
  const NavLink = Object(LegacyNavLinks["c" /* createLegacyNavLink */])(route, `${locPrefix}${LegacyNavLinks["g" /* routeToLoc */][route]}`, undefined, true);
  return /*#__PURE__*/react["createElement"](NavLink, null);
};

/**
 * top-of-page navigation links, differently named and spaced apart
 * based on the sprinkles size class, and whether you have iCloud+.
 */
const TopNavLinks = _ref2 => {
  var _useCloudOSUser2;
  let {
    current,
    tabs
  } = _ref2;
  const defaultTabs = useNavigationTabRoutes();
  tabs || (tabs = defaultTabs);
  const hasICloudPlus = Object(useICloudPlan["b" /* useHasICloudPlus */])();
  const isMedium = Object(useSprinklesSizeClass["b" /* useSprinklesSizeClass */])() === "MD";
  const isBeneficary = (_useCloudOSUser2 = Object(AuthenticationHook["b" /* useCloudOSUser */])()) === null || _useCloudOSUser2 === void 0 || (_useCloudOSUser2 = _useCloudOSUser2.details) === null || _useCloudOSUser2 === void 0 || (_useCloudOSUser2 = _useCloudOSUser2.beneficiaryInfo) === null || _useCloudOSUser2 === void 0 ? void 0 : _useCloudOSUser2.isBeneficiary;
  const locPrefix = isBeneficary ? "ShortName." : !hasICloudPlus || !isMedium ?
  /**
   * Design notes that few could guess, even looking at the spec:
   *
   * This Marcello hack is maybe ultra-specific to English. Goal:
   * pick names for the tabs long enough to fill the full breadth
   * of the page in the Medium size class but use slightly longer
   * names when the "iCloud+ Features" link is omitted, or in any
   * of the other size classes, that always have enough space.
   */
  "LongName." : "";
  const menuItems = tabs.map(route => /*#__PURE__*/react["createElement"](TopNavLink, {
    key: route,
    route: route,
    locPrefix: locPrefix
  }));
  return /*#__PURE__*/react["createElement"](SandwichMenu, {
    menuItems: menuItems,
    selectedItem: current,
    useHorizontalSizeClass: useSprinklesSizeClass["b" /* useSprinklesSizeClass */],
    collapsedSizeClass: "SM"
  });
};
// EXTERNAL MODULE: ./src/Legacy/ChildApplication/ChildApplicationsController.ts
var ChildApplicationsController = __webpack_require__(1264);

// EXTERNAL MODULE: ./src/Utils/ssoRedirect.ts
var ssoRedirect = __webpack_require__(1451);

// EXTERNAL MODULE: ./src/Utils/isTallLanguage.ts
var isTallLanguage = __webpack_require__(1338);

// EXTERNAL MODULE: ./src/Legacy/Hooks/useAppsOrder.tsx + 1 modules
var useAppsOrder = __webpack_require__(2292);

// CONCATENATED MODULE: ./src/Pages/AccountPage/AccountPage.tsx





























const AccountPage = _ref => {
  var _user$details, _user$details2, _CloudOSParameters$sh, _user$details3;
  let {
    className: cls,
    onPageLoaded
  } = _ref;
  const className = classnames_default()("account-page", cls);
  const showSignOutModal = useShowSignOutModal();
  const icloudPlanType = Object(useICloudPlan["c" /* useICloudPlanType */])();
  const user = Object(AuthenticationHook["b" /* useCloudOSUser */])();
  const shouldShowUpgradePlanTiles = useShouldShowUpgradePlanTiles();
  const userDisplayName = Object(personName["a" /* personName */])(Object(core["b" /* getLocale */])(), {
    givenName: user === null || user === void 0 || (_user$details = user.details) === null || _user$details === void 0 ? void 0 : _user$details.firstName,
    familyName: user === null || user === void 0 || (_user$details2 = user.details) === null || _user$details2 === void 0 ? void 0 : _user$details2.lastName
  });
  const appsOrder = Object(useAppsOrder["a" /* useAppsOrder */])();
  const isFindMyAvailable = appsOrder.find(app => app.applicationIdentifier === "find");
  const {
    data,
    isLoading
  } = useLookMeUpByEmailList();
  const updateLookMeUpByEmailMutation = useUpdateLookMeUpByEmail();
  const showLookMeUpByEmailModal = useLookMeUpByEmailModal({
    items: data,
    isLoading,
    onUpdateLookMeUpByEmail
  });
  const {
    isImageLoading,
    showImagePicker
  } = useProfileImagePicker();
  function findDevices() {
    ChildApplicationsController["a" /* ChildApplicationsController */].sharedInstance.switchToApplication("find", {
      hash: "",
      route: undefined
    });
  }
  function onUpdateLookMeUpByEmail(item) {
    updateLookMeUpByEmailMutation.mutate(item);
  }
  function customizeHomePage() {
    CloudOSApplication["a" /* CloudOSApplication */].cloudOSApplication.switchToSpringboard(false, true);
  }
  const showLookMeUpByEmail = ((_CloudOSParameters$sh = CloudOSParameters["a" /* CloudOSParameters */].sharedInstance.applicationParameter.informationalPageDetails) === null || _CloudOSParameters$sh === void 0 ? void 0 : _CloudOSParameters$sh.relativePath) === "lookmeupbyemail";
  react["useEffect"](() => {
    if (!isLoading) {
      onPageLoaded === null || onPageLoaded === void 0 || onPageLoaded();
    }
  }, [isLoading, onPageLoaded]);
  react["useEffect"](() => {
    if (showLookMeUpByEmail) showLookMeUpByEmailModal();
  }, [showLookMeUpByEmail, showLookMeUpByEmailModal]);
  const tall = Object(isTallLanguage["a" /* isTallLanguage */])();
  const standardButtonClassName = classnames_default()("standard-button", {
    tall
  });
  const isICDRSDisabled = Object(AuthService["f" /* getIsICDRSDisabled */])();
  const showNotificationSettings = useNotificationSettingsModal();
  return /*#__PURE__*/react["createElement"]("div", {
    className: className
  }, /*#__PURE__*/react["createElement"](TopNavLinks, {
    current: LegacyNavLinks["b" /* LegacyNavRoutes */].settings
  }), /*#__PURE__*/react["createElement"]("div", {
    className: "account-info-wrapper"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "application-content"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "account-page-header"
  }, /*#__PURE__*/react["createElement"]("h1", {
    className: classnames_default()({
      tall
    })
  }, userDisplayName)), /*#__PURE__*/react["createElement"]("div", {
    className: "page-content"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "content-column"
  }, /*#__PURE__*/react["createElement"](PlanCard, null), /*#__PURE__*/react["createElement"]("section", null, /*#__PURE__*/react["createElement"]("h2", null, Object(useLoc["a" /* getLoc */])("AccountPage.Settings.Title")), !isICDRSDisabled && /*#__PURE__*/react["createElement"]("section", null, /*#__PURE__*/react["createElement"]("h3", null, Object(useLoc["a" /* getLoc */])("AccountPage.Settings.Customize.Title")), /*#__PURE__*/react["createElement"]("p", null, Object(useLoc["a" /* getLoc */])("AccountPage.Settings.Customize.Description")), /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
    className: standardButtonClassName,
    onActivate: customizeHomePage
  }, Object(useLoc["a" /* getLoc */])("AccountPage.Settings.Customize.Button.Name"), /*#__PURE__*/react["createElement"](NavigationChevron["a" /* BoldNavigationChevron */], {
    layoutMode: "glyphBox",
    desiredFontSize: 8
  }))), /*#__PURE__*/react["createElement"]("section", {
    className: "notification-section"
  }, /*#__PURE__*/react["createElement"]("h3", null, " ", Object(useLoc["a" /* getLoc */])("AccountPage.Settings.ChangeNotificationSettings.Title")), /*#__PURE__*/react["createElement"]("p", null, Object(Utils_notificationsEnabled["a" /* notificationsEnabled */])() ? Object(useLoc["a" /* getLoc */])("AccountPage.Settings.ChangeNotificationSettings.Description") : Object(useLoc["a" /* getLoc */])("AccountPage.Settings.ChangeNotificationSettings.NotSupported.Description")), Object(Utils_notificationsEnabled["a" /* notificationsEnabled */])() ? /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
    className: standardButtonClassName,
    onActivate: showNotificationSettings
  }, Object(useLoc["a" /* getLoc */])("AccountPage.Settings.ChangeNotificationSettings.Button.Label"), /*#__PURE__*/react["createElement"](NavigationChevron["a" /* BoldNavigationChevron */], {
    layoutMode: "glyphBox",
    desiredFontSize: 8
  })) : /*#__PURE__*/react["createElement"](ExternalLink["a" /* ExternalLink */], {
    href: "https://support.apple.com/guide/icloud/mm3392084d5d/icloud",
    useSemiboldArrow: true
  }, Object(useLoc["a" /* getLoc */])("AccountPage.Settings.ChangeNotificationSettings.NotSupported.Button.Label"))), /*#__PURE__*/react["createElement"]("section", null, /*#__PURE__*/react["createElement"]("h3", null, Object(useLoc["a" /* getLoc */])("AccountPage.Settings.LookMeUpByEmail.Title")), /*#__PURE__*/react["createElement"]("p", null, Object(useLoc["a" /* getLoc */])("AccountPage.Settings.LookMeUpByEmail.Description")), /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
    className: standardButtonClassName,
    onActivate: showLookMeUpByEmailModal
  }, Object(useLoc["a" /* getLoc */])("AccountPage.Settings.LookMeUpByEmail.Button.Name"), /*#__PURE__*/react["createElement"](NavigationChevron["a" /* BoldNavigationChevron */], {
    layoutMode: "glyphBox",
    desiredFontSize: 8
  }))), /*#__PURE__*/react["createElement"]("section", null, /*#__PURE__*/react["createElement"]("h3", null, Object(useLoc["a" /* getLoc */])("AccountPage.Settings.Access.Title")), /*#__PURE__*/react["createElement"]("p", null, Object(useLoc["a" /* getLoc */])("AccountPage.Settings.Access.Description")), /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
    className: standardButtonClassName,
    variant: "push primary destructive",
    onActivate: showSignOutModal
  }, Object(useLoc["a" /* getLoc */])("AccountPage.Settings.Access.Button.Name"))))), /*#__PURE__*/react["createElement"]("div", {
    className: "content-column second"
  }, /*#__PURE__*/react["createElement"]("section", null, /*#__PURE__*/react["createElement"]("section", {
    className: "apple-id"
  }, /*#__PURE__*/react["createElement"]("h2", null, Object(useLoc["a" /* getLoc */])("AccountPage.AppleId.Title")), /*#__PURE__*/react["createElement"]("p", {
    className: "account-email"
  }, user === null || user === void 0 || (_user$details3 = user.details) === null || _user$details3 === void 0 ? void 0 : _user$details3.appleId)), /*#__PURE__*/react["createElement"]("section", null, /*#__PURE__*/react["createElement"]("h3", null, Object(useLoc["a" /* getLoc */])("AccountPage.Settings.Photo.Title")), /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
    className: `${standardButtonClassName} change-photo`,
    onActivate: showImagePicker,
    disabled: isImageLoading
  }, Object(useLoc["a" /* getLoc */])("AccountPage.Settings.Photo.ChangeAppleIDPhoto.Button.Name"), /*#__PURE__*/react["createElement"](NavigationChevron["a" /* BoldNavigationChevron */], {
    layoutMode: "glyphBox",
    desiredFontSize: 8
  }))), /*#__PURE__*/react["createElement"]("section", {
    className: classnames_default()(icloudPlanType === useICloudPlan["a" /* UserPlan */].Lite && "final-section")
  }, /*#__PURE__*/react["createElement"]("h3", null, Object(useLoc["a" /* getLoc */])("AccountPage.Settings.AppleID.Title")), /*#__PURE__*/react["createElement"]("p", null, Object(useLoc["a" /* getLoc */])("AccountPage.Settings.AppleID.Description")), /*#__PURE__*/react["createElement"](ExternalLink["a" /* ExternalLink */], {
    href: Object(ssoRedirect["b" /* getAppleIdUrlString */])(),
    onClick: () => Object(ssoRedirect["d" /* openRedirectPage */])(),
    useSemiboldArrow: true
  }, Object(useLoc["a" /* getLoc */])("AccountPage.Settings.AppleID.Button.Name"))), icloudPlanType !== useICloudPlan["a" /* UserPlan */].Lite && isFindMyAvailable && /*#__PURE__*/react["createElement"]("section", {
    className: "final-section"
  }, /*#__PURE__*/react["createElement"]("h3", null, Object(useLoc["a" /* getLoc */])("AccountPage.Settings.FindDevices.Title")), /*#__PURE__*/react["createElement"]("p", null, Object(useLoc["a" /* getLoc */])("AccountPage.Settings.FindDevices.Description")), /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
    className: standardButtonClassName,
    onActivate: findDevices
  }, Object(useLoc["a" /* getLoc */])("AccountPage.Settings.FindDevices.Button.Name"), /*#__PURE__*/react["createElement"](NavigationChevron["a" /* BoldNavigationChevron */], {
    layoutMode: "glyphBox",
    desiredFontSize: 8
  })))))))), shouldShowUpgradePlanTiles ? /*#__PURE__*/react["createElement"](UpgradePlanTiles, null) : null);
};
// EXTERNAL MODULE: ./src/Services/Push/Push.ts + 3 modules
var Push = __webpack_require__(2192);

// EXTERNAL MODULE: ./src/ComponentsGeneric/Tiles/Tile/Tile.tsx + 3 modules
var Tile = __webpack_require__(2200);

// CONCATENATED MODULE: ./src/ComponentsGeneric/PageHeader/PageHeader.scss
// extracted by mini-css-extract-plugin

// CONCATENATED MODULE: ./src/ComponentsGeneric/PageHeader/PageHeader.tsx



const PageHeader = props => {
  const {
    title,
    subtitle,
    subtitleDescription,
    extraSubtitle,
    description
  } = props;
  const className = classnames_default()("page-header", props.className);
  return /*#__PURE__*/react["createElement"]("div", {
    className: className
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "application-content"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "page-header-top-row"
  }, /*#__PURE__*/react["createElement"]("h1", {
    className: "page-header-title"
  }, title)), !!subtitle && /*#__PURE__*/react["createElement"]("div", {
    className: "page-header-subtitle"
  }, " ", subtitle, " "), !!subtitleDescription && /*#__PURE__*/react["createElement"]("div", {
    className: "page-header-description"
  }, subtitleDescription), !!extraSubtitle && /*#__PURE__*/react["createElement"]("div", {
    className: "page-header-subtitle"
  }, extraSubtitle), !!description && /*#__PURE__*/react["createElement"]("div", {
    className: "page-header-description"
  }, description)));
};
// CONCATENATED MODULE: ./src/Pages/RecoveryPage/RecoveryPage.scss
// extracted by mini-css-extract-plugin

// EXTERNAL MODULE: ./src/Pages/RecoveryPage/BookmarksRecoveryTile/BookmarksRecoveryTile.tsx + 1 modules
var BookmarksRecoveryTile = __webpack_require__(2308);

// EXTERNAL MODULE: ./src/API/RecoveryInfo/CKBookmarkDatabase.ts
var CKBookmarkDatabase = __webpack_require__(1312);

// CONCATENATED MODULE: ./src/API/RecoveryInfo/useDeletedBookmarks.ts



function shouldDisplayBookmark(bookmarkRecord) {
  var _bookmarkRecord$field, _bookmarkRecord$field2;
  if (bookmarkRecord.recordType !== "BookmarkLeaf") return false;

  // Only insert deleted leaves as these are the only ones visible in the UI.
  // Also skip immediate children of excluded folders as these will get pruned later.
  const filterAfterTimestamp = Date.now() - 1000 * 60 * 60 * 24 * 30;
  const isDeleted = !!((_bookmarkRecord$field = bookmarkRecord.fields.Deleted) !== null && _bookmarkRecord$field !== void 0 && _bookmarkRecord$field.value);
  const modifiedTimestamp = bookmarkRecord.modified.timestamp;
  const parentRecordName = (_bookmarkRecord$field2 = bookmarkRecord.fields.ParentFolder) === null || _bookmarkRecord$field2 === void 0 ? void 0 : _bookmarkRecord$field2.value.recordName;

  // Only insert deleted leaves as these are the only ones visible in the UI.
  // Also skip immediate children of excluded folders as these will get pruned later.
  return isDeleted && parentRecordName !== "Reading List" && modifiedTimestamp >= filterAfterTimestamp;
}
function findDeletedBookmarks(database) {
  const newDeletedBookmarks = [];
  database.forEachBookmarkRecord(record => {
    var _record$fields$Parent;
    if (!shouldDisplayBookmark(record)) return;
    const parentRecordName = (_record$fields$Parent = record.fields.ParentFolder) === null || _record$fields$Parent === void 0 ? void 0 : _record$fields$Parent.value.recordName;
    const parent = parentRecordName ? database.getBookmarkRecord(parentRecordName) : undefined;
    newDeletedBookmarks.push({
      recordName: record.recordName,
      title: getBookmarkDisplayTitle(record),
      deletionDate: new Date(record.modified.timestamp),
      url: getBookmarkDisplayURL(record),
      folder: parent ? getBookmarkDisplayTitle(parent) : "",
      isFavoritesBar: parentRecordName === "Favorites Bar"
    });
  });
  return newDeletedBookmarks;
}
function restoreDeletedBookmarks(bookmarks) {
  let database = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : CKBookmarkDatabase["a" /* CKBookmarkDatabase */].shared;
  return database.restoreBookmarkRecords(bookmarks.map(b => b.recordName));
}
function deleteDeletedBookmarks(bookmarks) {
  let database = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : CKBookmarkDatabase["a" /* CKBookmarkDatabase */].shared;
  return database.deleteBookmarkRecords(bookmarks.map(b => b.recordName));
}
function useDeletedBookmarks() {
  let database = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : CKBookmarkDatabase["a" /* CKBookmarkDatabase */].shared;
  const [deletedBookmarks, setDeletedBookmarks] = react["useState"](() => findDeletedBookmarks(database));
  const [loading, setLoading] = react["useState"](database.isLoading);
  const listener = react["useRef"]({
    bookmarksDidChange() {
      setDeletedBookmarks(findDeletedBookmarks(database));
    },
    loadingDidChange(_, isLoading) {
      setLoading(isLoading);
    }
  }).current;
  react["useEffect"](() => {
    database.addListener(listener);
    return () => {
      database.removeListener(listener);
    };
  }, [database, listener]);
  return [deletedBookmarks, loading];
}
function getBookmarkDisplayTitle(record) {
  switch (record.recordName) {
    case "Favorites Bar":
      return Object(useLoc["a" /* getLoc */])("RecoveryPage.BookmarksRecoveryModal.LocalizedName.FavoritesBar");
    case "Bookmarks Menu":
      return Object(useLoc["a" /* getLoc */])("RecoveryPage.BookmarksRecoveryModal.LocalizedName.BookmarksMenu");
    default:
      {
        var _record$fields$Title;
        const title = (_record$fields$Title = record.fields.Title) === null || _record$fields$Title === void 0 ? void 0 : _record$fields$Title.value;
        if (!title) return "";
        const asciiIn = atob(title);
        const bytesIn = new Uint8Array(asciiIn.length);
        for (let i = 0; i < asciiIn.length; ++i) {
          bytesIn[i] = asciiIn.charCodeAt(i);
        }
        return new TextDecoder().decode(bytesIn);
      }
  }
}
function getBookmarkDisplayURL(record) {
  var _record$fields$URL;
  const url = (_record$fields$URL = record.fields.URL) === null || _record$fields$URL === void 0 ? void 0 : _record$fields$URL.value;
  if (!url) return "";
  const asciiIn = atob(url);
  const bytesIn = new Uint8Array(asciiIn.length);
  for (let i = 0; i < asciiIn.length; ++i) {
    bytesIn[i] = asciiIn.charCodeAt(i);
  }
  return new TextDecoder().decode(bytesIn);
}
// EXTERNAL MODULE: ./src/ComponentsGeneric/Tiles/ErrorHomeTileContent/ErrorHomeTileContent.tsx + 1 modules
var ErrorHomeTileContent = __webpack_require__(2330);

// EXTERNAL MODULE: ./src/ComponentsGeneric/Tiles/StaticTileContent/StaticTileContent.tsx + 1 modules
var StaticTileContent = __webpack_require__(2321);

// EXTERNAL MODULE: ./src/ComponentsGeneric/SquircledSymbol/SquircledSymbol.tsx
var SquircledSymbol = __webpack_require__(1344);

// EXTERNAL MODULE: ./src/Utils/truncateList.ts
var truncateList = __webpack_require__(1314);

// EXTERNAL MODULE: ./src/Utils/relativeDateTimeFormatter.ts
var relativeDateTimeFormatter = __webpack_require__(1395);

// CONCATENATED MODULE: ./src/Pages/RecoveryPage/ArchivesRecoveryTile/ArchivesRecoveryTile.tsx









const ArchivesRecoveryTile = props => {
  const {
    deletedArchives = [],
    tileSize,
    headingText,
    iconSymbol,
    iconColor,
    isLoading,
    onTileClick,
    error
  } = props;

  // Banner description text
  const totalNumArchives = deletedArchives.length;
  const numArchivesString = Object(useLoc["b" /* getLocCount */])({
    zero: "RecoveryPage.ArchivesTile.TotalNumber.Zero",
    one: "RecoveryPage.ArchivesTile.TotalNumber.One",
    two: "RecoveryPage.ArchivesTile.TotalNumber.Two",
    many: "RecoveryPage.ArchivesTile.TotalNumber.Many"
  }, totalNumArchives);
  const descriptionText = isLoading ? Object(useLoc["a" /* getLoc */])("RecoveryPage.Loading") : numArchivesString;

  // Sort by descending date
  deletedArchives.sort((a, b) => b.deletionDate.getTime() - a.deletionDate.getTime());
  const contentListItems = Object(truncateList["a" /* truncateList */])(deletedArchives, archive => Object(relativeDateTimeFormatter["a" /* descriptionForDateTime */])(archive.deletionDate, "long"), MAX_TILE_LINES);
  return /*#__PURE__*/react["createElement"](Tile["b" /* Tile */], {
    tileIndex: -1,
    icon: /*#__PURE__*/react["createElement"](SquircledSymbol["a" /* SquircledSymbol */], {
      iconSize: 40,
      symbolSize: 20,
      symbol: iconSymbol,
      backgroundColor: iconColor
    }),
    className: "archives-recovery-tile",
    heading: headingText,
    description: descriptionText,
    tileSize: tileSize,
    isLoading: isLoading,
    onTileClick: onTileClick,
    error: error
  }, isLoading ? null : error ? /*#__PURE__*/react["createElement"](ErrorHomeTileContent["a" /* ErrorHomeTileContent */], {
    refetch: props.refetch,
    showClouds: false
  }) : /*#__PURE__*/react["createElement"](StaticTileContent["a" /* StaticTileContent */], {
    contentListItems: contentListItems.length > 0 ? contentListItems : [Object(useLoc["a" /* getLoc */])("RecoveryPage.TileContent.NoItems")],
    contentDescriptionText: ""
  }));
};
// EXTERNAL MODULE: /workspace/node_modules/@apple/symbols/bold/calendar.svg
var bold_calendar = __webpack_require__(1623);

// EXTERNAL MODULE: ./src/API/Drive/drive.schema.ts
var drive_schema = __webpack_require__(1416);

// CONCATENATED MODULE: ./src/API/RecoveryInfo/recoveryInfo.schema.ts


const archiveSchema = lib["z"].object({
  dateCreated: lib["z"].string(),
  archiveId: lib["z"].string(),
  sharedCalendars: lib["z"].boolean().optional(),
  sharedEvents: lib["z"].boolean().optional()
});
const wireListArchivesResponseSchema = lib["z"].object({
  archives: lib["z"].array(archiveSchema).optional(),
  status: lib["z"].string().optional(),
  sharedCalendars: lib["z"].boolean().optional(),
  sharedEvents: lib["z"].boolean().optional()
});
const wireDeletedDriveItemSchema = lib["z"].object({
  dateCreated: lib["z"].string(),
  drivewsid: lib["z"].string(),
  docwsid: lib["z"].string(),
  zone: lib["z"].string(),
  name: lib["z"].string(),
  extension: lib["z"].string().optional(),
  isDeleted: lib["z"].boolean(),
  parentId: lib["z"].string(),
  hierarchy: lib["z"].array(lib["z"].object({
    drivewsid: lib["z"].string(),
    name: lib["z"].string(),
    etag: lib["z"].string()
  })),
  isChainedToParent: lib["z"].boolean().optional(),
  dateModified: lib["z"].string(),
  dateChanged: lib["z"].string(),
  size: lib["z"].number(),
  etag: lib["z"].string(),
  type: lib["z"].string()
});
const wireDeletedItemDetailsResponseSchema = lib["z"].object({
  hasMoreItems: lib["z"].boolean().optional(),
  items: lib["z"].array(wireDeletedDriveItemSchema).optional(),
  jobId: lib["z"].string(),
  jobStatus: lib["z"].string(),
  retryAfterMilliseconds: lib["z"].number().optional()
});
const wireServiceStatusResponseSchema = lib["z"].object({
  status: lib["z"].union([lib["z"].literal("BUSY"), lib["z"].literal("FREE")])
});
// Status enum for pagination
const paginationStatusSchema = lib["z"].union([lib["z"].literal("CONSISTENT"), lib["z"].literal("MORE_AVAILABLE")]);
// Modified drive file schema for recovery context where item_id is required
const wireDeletedDriveFileSchema = /*#__PURE__*/drive_schema["c" /* wireDriveFileSchema */].extend({
  item_id: /*#__PURE__*/lib["z"].string() // Override to make it required
});

// PaginatedDocumentsResponse schema for deleted drive files enumeration
// Uses a modified wireDriveFileSchema that requires item_id for recovery context
const paginatedDeletedDriveFilesResponseSchema = lib["z"].object({
  continuationMarker: lib["z"].string().optional(),
  documents: lib["z"].array(wireDeletedDriveFileSchema),
  status: paginationStatusSchema
});
// Schema for restore drive files API
const restoreDriveFilesResponseSchema = lib["z"].object({
  drive_items_with_status: lib["z"].array(lib["z"].object({
    status_message: lib["z"].string(),
    drive_items: lib["z"].object({
      drive_item: lib["z"].array(lib["z"].object({
        item_id: lib["z"].string()
      }))
    })
  }))
});
// CONCATENATED MODULE: ./src/API/RecoveryInfo/recoveryInfo.converter.ts
function deletedDriveFileSchemaConverter(item) {
  if (!item.dateChanged || !item.name || !item.extension || !item.item_id) {
    return undefined;
  }
  return {
    deletionDate: new Date(item.dateChanged),
    fileName: item.name,
    extension: item.extension,
    drivewsid: item.drivewsid,
    docwsid: item.docwsid,
    size: item.size || 0,
    hierarchy: [],
    // WireDriveFile doesn't have hierarchy, so empty array
    etag: item.etag,
    zone: item.zone,
    itemid: item.item_id
  };
}
function listArchivesResponseSchemaConverter(response) {
  if (!response.archives) return [];
  return response.archives.map(archive => {
    const {
      dateCreated,
      archiveId
    } = archive;
    return {
      deletionDate: new Date(dateCreated),
      archiveId
    };
  });
}
/**
 * Converts restore drive files response into categorized item IDs
 * @param response - The response from the restore drive files API
 * @param originalItemIds - The original item IDs that were sent for restoration
 * @returns Object containing restored IDs, failed IDs, and failed IDs with storage errors
 */
function restoreDriveFilesResponseConverter(response, originalItemIds) {
  var _response$drive_items;
  const restoredIds = [];
  const failedIdsFromResponse = [];
  const failedIdsWithStorageError = [];
  const failureStatusCounts = {};

  // Process response by grouping items based on status_message
  (_response$drive_items = response.drive_items_with_status) === null || _response$drive_items === void 0 || _response$drive_items.forEach(statusGroup => {
    const itemIds = statusGroup.drive_items.drive_item.map(item => item.item_id);
    if (statusGroup.status_message === "OK") {
      // Success - add to restored list
      restoredIds.push(...itemIds);
    } else {
      var _statusGroup$status_m;
      // Failure - add to failed list
      failedIdsFromResponse.push(...itemIds);

      // Track failure status message counts
      const statusMessage = statusGroup.status_message || "UNKNOWN_ERROR";
      failureStatusCounts[statusMessage] = (failureStatusCounts[statusMessage] || 0) + itemIds.length;

      // Check if this failure is due to storage error
      if ((_statusGroup$status_m = statusGroup.status_message) !== null && _statusGroup$status_m !== void 0 && _statusGroup$status_m.includes("QUOTA_EXCEEDED")) {
        failedIdsWithStorageError.push(...itemIds);
      }
    }
  });

  // Combine failed items from response status and items not found in any response
  const allProcessedIds = new Set([...restoredIds, ...failedIdsFromResponse]);
  const notProcessedIds = originalItemIds.filter(itemId => !allProcessedIds.has(itemId));
  const failedIds = [...failedIdsFromResponse, ...notProcessedIds];
  return {
    restoredIds,
    failedIds,
    failedIdsWithStorageError,
    failureStatusCounts
  };
}
// CONCATENATED MODULE: ./src/API/RecoveryInfo/recoveryInfo.endpoint.ts



/**
 * @returns all deleted archives
 * @rejects malformed api responses
 */
const fetchDeletedArchivesFromService = (_ref, service) => {
  let {
    webServices
  } = _ref;
  if (!(webServices !== null && webServices !== void 0 && webServices.archivews)) {
    throw new Error("fetchDevices: no service url available");
  }
  return Object(Common_request["a" /* apiRequest */])({
    url: Object(paths["q" /* getListArchivesPath */])(webServices.archivews),
    method: "POST",
    includeCredentials: true,
    body: {
      service
    },
    validate: {
      type: "WireListArchivesResponse",
      schema: wireListArchivesResponseSchema
    }
  }).then(listArchivesResponseSchemaConverter);
};
const fetchDeletedContactArchives = r => fetchDeletedArchivesFromService(r, "CONTACTS");
const fetchDeletedCalendarArchives = r => fetchDeletedArchivesFromService(r, "CALENDAR-REMINDERS");

/**
 * @returns the busy/free status response
 * @rejects malformed api responses
 */
const restoreDeletedArchives = (_ref2, service, archiveId) => {
  let {
    webServices
  } = _ref2;
  if (!(webServices !== null && webServices !== void 0 && webServices.archivews)) {
    throw new Error("restoreDeletedArchives: no service url available");
  }
  return Object(Common_request["a" /* apiRequest */])({
    url: Object(paths["w" /* getRestoreDeletedArchivesPath */])(webServices.archivews),
    method: "POST",
    includeCredentials: true,
    body: {
      service,
      archiveId
    },
    validate: {
      type: "WireServiceStatusResponse",
      schema: wireServiceStatusResponseSchema
    }
  });
};
const restoreDeletedCalendarArchives = (r, archiveId) => restoreDeletedArchives(r, "CALENDAR-REMINDERS", archiveId);
const restoreDeletedContactArchives = (r, archiveId) => restoreDeletedArchives(r, "CONTACTS", archiveId);
const recoveryInfo_endpoint_purgeDeletedDriveItems = async (_ref3, items) => {
  let {
    webServices
  } = _ref3;
  if (!(webServices !== null && webServices !== void 0 && webServices.docws)) {
    throw new Error("purgeDeletedDriveItems: no service url available");
  }

  // Group the Drive files by zones
  const grouped = {};
  for (const item of items) {
    if (!grouped[item.zone]) {
      grouped[item.zone] = [item.docwsid];
    } else {
      grouped[item.zone].push(item.docwsid);
    }
  }
  return Promise.all(Object.entries(grouped).map(_ref4 => {
    let [zone, ids] = _ref4;
    return Object(Common_request["c" /* unvalidatedApiRequest */])({
      url: Object(paths["s" /* getPurgeDeletedDriveItemsPath */])(webServices.docws, zone),
      method: "POST",
      includeCredentials: true,
      body: {
        documentIds: ids
      }
    });
  }));
};

/**
 * @returns the busy/free status response
 * @rejects malformed api responses
 */
const retrieveServiceStatus = (_ref5, service) => {
  let {
    webServices
  } = _ref5;
  if (!(webServices !== null && webServices !== void 0 && webServices.archivews)) {
    throw new Error("retrieveServiceStatus: no service url available");
  }
  return Object(Common_request["a" /* apiRequest */])({
    url: Object(paths["y" /* getRetrieveServiceStatusPath */])(webServices.archivews),
    method: "POST",
    includeCredentials: true,
    body: {
      service
    },
    validate: {
      type: "WireServiceStatusResponse",
      schema: wireServiceStatusResponseSchema
    }
  });
};
const retrieveCalendarRecoveryServiceStatus = r => retrieveServiceStatus(r, "CALENDAR-REMINDERS");
const retrieveContactRecoveryServiceStatus = r => retrieveServiceStatus(r, "CONTACTS");

/**
 * Restores deleted drive files using the new v1/items API
 * @param webServices - The web services configuration
 * @param itemIds - Array of item IDs to restore
 * @returns Promise with the API response containing restored items
 */
const restoreDeletedDriveFiles = async (_ref6, itemIds) => {
  let {
    webServices
  } = _ref6;
  if (!(webServices !== null && webServices !== void 0 && webServices.docws)) {
    throw new Error("restoreDeletedDriveFiles: no service url available");
  }
  return Object(Common_request["a" /* apiRequest */])({
    url: Object(paths["x" /* getRestoreDriveFilesPath */])(webServices.docws),
    method: "PUT",
    includeCredentials: true,
    body: {
      drive_item_update_request: {
        is_recover: "true"
      },
      item_ids: itemIds
    },
    validate: {
      type: "RestoreDriveFilesResponse",
      schema: restoreDriveFilesResponseSchema
    }
  }).then(response => restoreDriveFilesResponseConverter(response, itemIds));
};

/**
 * Fetches a single page of deleted drive files from the enumerate API
 */
const fetchDeletedDriveFilesPage = async function (_ref7, continuationMarker) {
  let {
    webServices
  } = _ref7;
  let limit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 50;
  if (!(webServices !== null && webServices !== void 0 && webServices.docws)) {
    throw new Error("fetchDeletedDriveFilesPage: no service url available");
  }
  return Object(Common_request["a" /* apiRequest */])({
    url: Object(paths["l" /* getDriveEnumeratePath */])(webServices.docws, "tombstones", limit, continuationMarker),
    method: "GET",
    includeCredentials: true,
    validate: {
      type: "PaginatedDeletedDriveFilesResponse",
      schema: paginatedDeletedDriveFilesResponseSchema
    }
  });
};
// CONCATENATED MODULE: ./src/API/RecoveryInfo/useListArchives.ts



/**
 * Fetches deleted calendar archives
 * @returns `react-query` `useQuery` results
 */
function useDeletedCalendarArchives() {
  return Object(useAPIQuery["a" /* useAPIQuery */])({
    endpoint: paths["b" /* EndpointName */].listCalendarArchives,
    fetchProvider: request => () => fetchDeletedCalendarArchives(request)
  });
}

/**
 * Fetches deleted contact archives
 * @returns `react-query` `useQuery` results
 */
function useDeletedContactArchives() {
  return Object(useAPIQuery["a" /* useAPIQuery */])({
    endpoint: paths["b" /* EndpointName */].listContactArchives,
    fetchProvider: request => () => fetchDeletedContactArchives(request)
  });
}
// CONCATENATED MODULE: ./src/API/RecoveryInfo/useRestoreArchives.ts



function useRestoreDeletedCalendarArchives(onSuccess, onError) {
  const webServices = Object(useWebServices["a" /* useWebServices */])();
  return Object(es["useMutation"])(archiveId => restoreDeletedCalendarArchives({
    webServices
  }, archiveId), {
    onSuccess,
    onError
  });
}
function useRestoreDeletedContactArchives(onSuccess, onError) {
  const webServices = Object(useWebServices["a" /* useWebServices */])();
  return Object(es["useMutation"])(archiveId => restoreDeletedContactArchives({
    webServices
  }, archiveId), {
    onSuccess,
    onError
  });
}
// EXTERNAL MODULE: /workspace/node_modules/@apple/symbols/regular/archivebox.svg
var archivebox = __webpack_require__(1621);

// CONCATENATED MODULE: ./src/Pages/RecoveryPage/ArchivesRecoveryList/ArchivesRecoveryList.scss
// extracted by mini-css-extract-plugin

// CONCATENATED MODULE: ./src/Pages/RecoveryPage/ArchivesRecoveryList/ArchivesRecoveryList.tsx






const ArchivesRecoveryList = _ref => {
  let {
    items,
    listDescription,
    isLoading,
    restoringArchiveId,
    onRestoreArchive
  } = _ref;
  const archiveCount = Object(useLoc["c" /* useLocCount */])({
    zero: "RecoveryPage.ArchivesTile.TotalNumber.Zero",
    one: "RecoveryPage.ArchivesTile.TotalNumber.One",
    two: "RecoveryPage.ArchivesTile.TotalNumber.Two",
    many: "RecoveryPage.ArchivesTile.TotalNumber.Many"
  }, items.length);
  const archiveTableLabel = Object(useLoc["a" /* getLoc */])("VoiceOver.RecoveryPage.ArchivesRecoveryList.ArchiveTableLabel");
  const loadingDescription = Object(useLoc["a" /* getLoc */])("RecoveryPage.ArchivesRecoveryList.LoadingDescription");
  const emptyListText = Object(useLoc["a" /* getLoc */])("RecoveryPage.ArchivesRecoveryList.EmptyList");
  const itemsWithFormattedDate = items.map(_ref2 => {
    let {
      deletionDate,
      archiveId
    } = _ref2;
    return {
      archiveId,
      deletionDate: Object(relativeDateTimeFormatter["a" /* descriptionForDateTime */])(deletionDate, "long")
    };
  });
  const archivesList = /*#__PURE__*/react["createElement"]("div", {
    role: "table",
    "aria-label": archiveTableLabel
  }, itemsWithFormattedDate.map(item => /*#__PURE__*/react["createElement"]("div", {
    key: item.archiveId,
    role: "row"
  }, /*#__PURE__*/react["createElement"]("div", {
    role: "cell",
    className: "date-cell"
  }, /*#__PURE__*/react["createElement"](archivebox["a" /* default */], {
    "aria-hidden": true,
    desiredFontSize: 10,
    layoutMode: "glyphBox"
  }), item.deletionDate), /*#__PURE__*/react["createElement"]("div", {
    role: "cell",
    className: "restore-cell"
  }, item.archiveId === restoringArchiveId ? /*#__PURE__*/react["createElement"]("span", {
    className: "restoring"
  }, /*#__PURE__*/react["createElement"](UIActivityIndicator["a" /* UIActivityIndicator */], {
    description: Object(useLoc["a" /* getLoc */])("RecoveryPage.ArchivesRecoveryList.RestoringArchiveDescription", {
      date: item.deletionDate
    })
  }), Object(useLoc["a" /* getLoc */])("RecoveryPage.ArchivesRecoveryList.Restoring")) : /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
    className: "restore-button",
    variant: "push secondary neutral",
    ariaLabel: Object(useLoc["a" /* getLoc */])("VoiceOver.RecoveryPage.ArchivesRecoveryList.RestoreButtonLabel", {
      date: item.deletionDate
    }),
    onActivate: () => onRestoreArchive(item.archiveId),
    disabled: restoringArchiveId !== undefined
  }, Object(useLoc["a" /* getLoc */])("RecoveryPage.ArchivesRecoveryList.RestoreButton"))))));
  const emptyList = /*#__PURE__*/react["createElement"]("div", {
    className: "empty-list"
  }, emptyListText);
  return /*#__PURE__*/react["createElement"]("div", {
    className: "archives-recovery-list"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "count"
  }, archiveCount), /*#__PURE__*/react["createElement"]("div", {
    className: "description"
  }, listDescription), isLoading ? /*#__PURE__*/react["createElement"]("div", {
    className: "loading"
  }, /*#__PURE__*/react["createElement"](UIActivityIndicator["a" /* UIActivityIndicator */], {
    description: loadingDescription
  })) : items.length ? archivesList : emptyList);
};
// CONCATENATED MODULE: ./src/Pages/RecoveryPage/ArchivesRecoveryModal/ArchivesRecoveryModalContent.tsx




const ArchivesRecoveryModalContent = _ref => {
  let {
    icon,
    modalTitle,
    modalDescription,
    learnMoreLink,
    titleId,
    ...listProps
  } = _ref;
  const learnMoreText = Object(useLoc["a" /* getLoc */])("RecoveryPage.ArchivesRecoveryModalContent.LearnMore");
  return /*#__PURE__*/react["createElement"]("div", {
    className: "modal-content"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "modal-icon",
    "data-testid": "icon"
  }, icon), /*#__PURE__*/react["createElement"]("h2", {
    className: "modal-title",
    "data-testid": "title",
    id: titleId
  }, modalTitle), /*#__PURE__*/react["createElement"]("div", {
    className: "modal-description",
    "data-testid": "description"
  }, modalDescription, " ", /*#__PURE__*/react["createElement"](ExternalLink["a" /* ExternalLink */], {
    href: learnMoreLink
  }, learnMoreText)), /*#__PURE__*/react["createElement"](ArchivesRecoveryList, listProps));
};
// EXTERNAL MODULE: ./src/Legacy/ChildApplication/ChildApplicationManager.ts
var ChildApplicationManager = __webpack_require__(1247);

// EXTERNAL MODULE: ./src/Legacy/ChildApplication/ApplicationConfigurations/RemindersApplicationConfiguration.ts
var RemindersApplicationConfiguration = __webpack_require__(1209);

// CONCATENATED MODULE: ./src/Pages/RecoveryPage/ArchivesRecoveryModal/useCalendarsRecoveryModal.tsx









const useCalendarsRecoveryModal_MODAL_TITLE_ID = "calendars-recovery-modal-title";
const CalendarsRecoveryModalContent = _ref => {
  var _ChildApplicationMana;
  let {
    items,
    isLoading,
    onRestoreArchive,
    restoringArchiveId
  } = _ref;
  const icon = /*#__PURE__*/react["createElement"](SquircledSymbol["a" /* SquircledSymbol */], {
    iconSize: 54,
    symbolSize: 30,
    symbol: calendar["a" /* default */],
    backgroundColor: "#F04634"
  });
  // If Reminders is upgraded, reminders and reminders lists cannot be restored
  const isLegacyReminders = ((_ChildApplicationMana = ChildApplicationManager["a" /* ChildApplicationManager */].sharedInstance.getApplicationConfiguration(RemindersApplicationConfiguration["a" /* REMINDERS_APP_IDENTIFIER */])) === null || _ChildApplicationMana === void 0 ? void 0 : _ChildApplicationMana.applicationInfo.generation) === 1;
  const modalTitle = isLegacyReminders ? Object(useLoc["a" /* getLoc */])("RecoveryPage.CalendarsRecoveryModalContent.Reminders.Title") : Object(useLoc["a" /* getLoc */])("RecoveryPage.CalendarsRecoveryModalContent.Title");
  const modalDescription = isLegacyReminders ? Object(useLoc["a" /* getLoc */])("RecoveryPage.CalendarsRecoveryModalContent.Reminders.Description") : Object(useLoc["a" /* getLoc */])("RecoveryPage.CalendarsRecoveryModalContent.Description");
  const learnMoreLink = Object(getSupportLink["a" /* getSupportLink */])("restoreCalendars");
  const listDescription = /*#__PURE__*/react["createElement"](react["Fragment"], null, Object(useLoc["a" /* getLoc */])("RecoveryPage.CalendarsRecoveryModalContent.ListDescription.FirstLine"), /*#__PURE__*/react["createElement"]("ul", null, /*#__PURE__*/react["createElement"]("li", null, Object(useLoc["a" /* getLoc */])("RecoveryPage.CalendarsRecoveryModalContent.ListDescription.BulletPointOne")), /*#__PURE__*/react["createElement"]("li", null, Object(useLoc["a" /* getLoc */])("RecoveryPage.CalendarsRecoveryModalContent.ListDescription.BulletPointTwo")), /*#__PURE__*/react["createElement"]("li", null, Object(useLoc["a" /* getLoc */])("RecoveryPage.CalendarsRecoveryModalContent.ListDescription.BulletPointThree"))));
  return /*#__PURE__*/react["createElement"](ArchivesRecoveryModalContent, {
    icon: icon,
    modalTitle: modalTitle,
    modalDescription: modalDescription,
    learnMoreLink: learnMoreLink,
    items: items,
    listDescription: listDescription,
    isLoading: isLoading,
    onRestoreArchive: onRestoreArchive,
    titleId: useCalendarsRecoveryModal_MODAL_TITLE_ID,
    restoringArchiveId: restoringArchiveId
  });
};
function useCalendarsRecoveryModal(contentProps) {
  const showModal = useModalWithCloseButton(/*#__PURE__*/react["createElement"](CalendarsRecoveryModalContent, contentProps), {
    ariaLabelledBy: useCalendarsRecoveryModal_MODAL_TITLE_ID
  });
  return showModal;
}
// CONCATENATED MODULE: ./src/Hooks/useInterval.ts


/**
 * https://overreacted.io/making-setinterval-declarative-with-react-hooks/
 * @param delay interval delay in milliseconds. Use `null` to pause the interval.
 */
function useInterval(callback, delay) {
  const savedCallback = react["useRef"]();

  // Remember the latest callback.
  react["useEffect"](() => {
    savedCallback.current = callback;
  }, [callback]);

  // Set up the interval.
  react["useEffect"](() => {
    function tick() {
      var _savedCallback$curren;
      (_savedCallback$curren = savedCallback.current) === null || _savedCallback$curren === void 0 || _savedCallback$curren.call(savedCallback);
    }
    if (delay !== null) {
      const id = setInterval(tick, delay);
      return () => clearInterval(id);
    }
    return;
  }, [delay]);
}
// CONCATENATED MODULE: ./src/Hooks/useStatusPolling.ts


/**
 * Uses the provided `fetcher` to poll for service status. Calls the `fetcher` with the given `pollingInterval`,
 * until getting `"idle"` as the result.
 * Calls `onSuccess` when `"idle"` is received, or calls `onFailure` when the `fetcher` returns errors for `maxErrorsBeforeAbort` times.
 *
 * @param fetcher The callback function to get service status. Expected to return `"pending"` or `"idle"` in a promise.
 * @param onSuccess The callback function to call when `"idle"` is received.
 * @param onFailure The callback function to call after `maxErrorsBeforeAbort` errors are received.
 * @param pollingInterval
 * @param maxErrorsBeforeAbort
 * @returns A callback function which starts the polling when called.
 */
function useStatusPolling(fetcher, onSuccess, onFailure) {
  let pollingInterval = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 5000;
  let maxErrorsBeforeAbort = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 3;
  const numberErrorsRef = react["useRef"](0);
  const [status, setStatus] = react["useState"]("idle");
  useInterval(() => {
    fetcher().then(newStatus => {
      if (status === "pending" && newStatus === "idle") {
        setStatus("idle");
        onSuccess();
      }
    }, () => {
      numberErrorsRef.current++;
      if (numberErrorsRef.current >= maxErrorsBeforeAbort && status === "pending") {
        setStatus("idle");
        onFailure();
      }
    });
  },
  // null to turn off interval
  status === "pending" ? pollingInterval : null);
  const start = () => {
    numberErrorsRef.current = 0;
    setStatus("pending");
  };
  return start;
}
// CONCATENATED MODULE: ./src/API/RecoveryInfo/useServiceStatus.ts



function useRecoveryServiceStatus(fetcher, onSuccess, onFailure) {
  const webServices = Object(useWebServices["a" /* useWebServices */])();
  return useStatusPolling(() => {
    return fetcher({
      webServices
    }).then(response => response.status === "FREE" ? "idle" : "pending");
  }, onSuccess, onFailure);
}
function useCalendarRecoveryServiceStatus(onSuccess, onFailure) {
  return useRecoveryServiceStatus(retrieveCalendarRecoveryServiceStatus, onSuccess, onFailure);
}
function useContactRecoveryServiceStatus(onSuccess, onFailure) {
  return useRecoveryServiceStatus(retrieveContactRecoveryServiceStatus, onSuccess, onFailure);
}
// CONCATENATED MODULE: ./src/Pages/RecoveryPage/ArchivesRecoveryTile/CalendarArchivesRecoveryTileWrapper.scss
// extracted by mini-css-extract-plugin

// EXTERNAL MODULE: ./src/Contexts/TelemetryProvider.tsx
var TelemetryProvider = __webpack_require__(1321);

// EXTERNAL MODULE: ./src/Utils/stringFormatter.ts
var stringFormatter = __webpack_require__(1244);

// CONCATENATED MODULE: ./src/Pages/RecoveryPage/useRecordRecoveryStats.ts




const useRecordRecoveryStats = recoveryType => {
  /**
   * this is to record the stats when user opens the recovery modal
   */
  const recordOpenedRecovery = Object(react["useCallback"])(() => {
    Telemetry["b" /* Telemetry */].sharedInstance.recordStat(new Stat["a" /* Stat */](`openedRecover${Object(stringFormatter["a" /* capitalizeFirstLetter */])(recoveryType)}`));
  }, [recoveryType]);

  /**
   * this is to record the stats when user starts the recovery process
   */
  const recordStartedRecovery = Object(react["useCallback"])(() => {
    Telemetry["b" /* Telemetry */].sharedInstance.recordStat(new Stat["a" /* Stat */](`startedRecover${Object(stringFormatter["a" /* capitalizeFirstLetter */])(recoveryType)}`));
  }, [recoveryType]);
  return {
    recordOpenedRecovery,
    recordStartedRecovery
  };
};
/* harmony default export */ var RecoveryPage_useRecordRecoveryStats = (useRecordRecoveryStats);
// EXTERNAL MODULE: /workspace/node_modules/@apple/ui-components/build/useShowAlert/useShowAlert.js + 3 modules
var useShowAlert = __webpack_require__(2194);

// CONCATENATED MODULE: ./src/Pages/RecoveryPage/ArchivesRecoveryTile/useRecoveryAlert.tsx



const useRecoveryAlert = _ref => {
  let {
    confirmationTitle,
    confirmationDescription,
    confirmationRestore,
    confirmationCancel,
    recoveryType,
    startRestore,
    endRestore
  } = _ref;
  const [showAlert] = Object(useShowAlert["b" /* useShowAlert */])();
  const recordRecoveryStats = RecoveryPage_useRecordRecoveryStats(recoveryType);
  return Object(react["useCallback"])(archiveId => {
    showAlert({
      title: confirmationTitle,
      description: confirmationDescription,
      buttons: [{
        title: confirmationRestore,
        action: "restore"
      }, {
        title: confirmationCancel,
        action: "cancel"
      }],
      cancelAction: "cancel",
      onActionSelected: action => {
        if (action === "cancel") {
          endRestore();
        } else if (action === "restore") {
          recordRecoveryStats.recordStartedRecovery();
          startRestore(archiveId);
        }
      }
    });
  }, [confirmationTitle, confirmationDescription, confirmationRestore, confirmationCancel, startRestore, endRestore, showAlert, recordRecoveryStats]);
};
// CONCATENATED MODULE: ./src/Pages/RecoveryPage/ArchivesRecoveryTile/CalendarArchivesRecoveryTileWrapper.tsx

















const CalendarArchivesRecoveryTileWrapper = () => {
  var _calendarsResponse$da;
  const locale = Object(core["b" /* getLocale */])();
  const calendarsResponse = useDeletedCalendarArchives();
  const calendarsHeader = Object(useLoc["a" /* getLoc */])("RecoveryPage.ArchivesTile.Title.Calendars");
  const [restoringArchiveId, setRestoringArchiveId] = react["useState"](undefined);
  const confirmationTitle = Object(useLoc["a" /* getLoc */])("RecoveryPage.CalendarArchivesRecoveryTileWrapper.Confirmation.Title");
  const confirmationDescription = Object(useLoc["a" /* getLoc */])("RecoveryPage.CalendarArchivesRecoveryTileWrapper.Confirmation.Description");
  const confirmationCancel = Object(useLoc["a" /* getLoc */])("Alert.CancelButton");
  const confirmationRestore = Object(useLoc["a" /* getLoc */])("RecoveryPage.CalendarArchivesRecoveryTileWrapper.Confirmation.RestoreButton");
  const alertSuccessTitle = Object(useLoc["a" /* getLoc */])("RecoveryPage.CalendarArchivesRecoveryTileWrapper.AlertSuccess.Title");
  const alertOkButton = Object(useLoc["a" /* getLoc */])("Alert.OkButton");
  const alertFailureTitle = Object(useLoc["a" /* getLoc */])("RecoveryPage.CalendarArchivesRecoveryTileWrapper.AlertFailure.Title");
  const alertFailureDescription = Object(useLoc["a" /* getLoc */])("RecoveryPage.CalendarArchivesRecoveryTileWrapper.AlertFailure.Description");
  const alertFailureContactSupport = Object(useLoc["a" /* getLoc */])("Alert.ContactSupport");
  const recordRecoveryStats = RecoveryPage_useRecordRecoveryStats("calendar");
  const showAlert = Object(useShowCloudOSAlert["a" /* useShowCloudOSAlert */])();
  const showRestoreSuccessAlert = () => {
    showAlert({
      title: alertSuccessTitle,
      description: Object(useLoc["a" /* getLoc */])("RecoveryPage.CalendarArchivesRecoveryTileWrapper.AlertSuccess.Description", {
        // E.g. 3:14 PM
        time: new Date().toLocaleTimeString(locale, {
          hour12: true,
          hour: "numeric",
          minute: "2-digit"
        })
      }),
      buttons: [alertOkButton]
    });
  };
  const showRestoreFailedAlert = () => {
    showAlert({
      title: alertFailureTitle,
      description: alertFailureDescription,
      accessory: /*#__PURE__*/react["createElement"](ExternalLink["a" /* ExternalLink */], {
        className: "calendar-recovery-failure-alert-support-link",
        href: Object(getSupportLink["a" /* getSupportLink */])("contactAppleSupport")
      }, alertFailureContactSupport),
      buttons: [alertOkButton]
    });
  };
  const [recordWorkflowSuccess, recordWorkflowFailure] = Object(TelemetryProvider["b" /* useTelemetry */])("workflow", "restore-calendar");
  const [recordLoad, recordFailedLoad] = Object(TelemetryProvider["b" /* useTelemetry */])("load", "calendar-recovery-tile", {
    measureFromBaseline: true
  });
  react["useEffect"](() => {
    if (!calendarsResponse.isLoading) {
      if (calendarsResponse.isSuccess) {
        recordLoad();
      } else {
        recordFailedLoad();
      }
    }
  }, [calendarsResponse, recordLoad, recordFailedLoad]);
  const onRestoreSuccess = () => {
    recordWorkflowSuccess();
    showRestoreSuccessAlert();
    endRestore();
  };
  const onRestoreFailure = () => {
    recordWorkflowFailure();
    showRestoreFailedAlert();
    endRestore();
  };
  const startStatusPolling = useCalendarRecoveryServiceStatus(onRestoreSuccess, onRestoreFailure);
  const restoreCalendarArchives = useRestoreDeletedCalendarArchives(
  // onSuccess
  () => {
    startStatusPolling();
  },
  // onError
  () => {
    onRestoreFailure();
  });
  const startRestore = archiveId => {
    setRestoringArchiveId(archiveId);
    restoreCalendarArchives.mutate(archiveId);
  };
  const endRestore = () => {
    setRestoringArchiveId(undefined);
    calendarsResponse.refetch();
  };
  const showRecoveryAlert = useRecoveryAlert({
    confirmationTitle,
    confirmationDescription,
    confirmationRestore,
    confirmationCancel,
    recoveryType: "calendar",
    startRestore,
    endRestore
  });
  const openCalendarsRecoveryModal = useCalendarsRecoveryModal({
    items: (_calendarsResponse$da = calendarsResponse.data) !== null && _calendarsResponse$da !== void 0 ? _calendarsResponse$da : [],
    isLoading: calendarsResponse.isLoading,
    onRestoreArchive: archiveId => {
      showRecoveryAlert(archiveId);
    },
    restoringArchiveId
  });
  return /*#__PURE__*/react["createElement"](ArchivesRecoveryTile, {
    error: calendarsResponse.error,
    isLoading: calendarsResponse.isLoading,
    isSuccess: calendarsResponse.isSuccess,
    refetch: calendarsResponse.refetch,
    deletedArchives: calendarsResponse.data,
    tileSize: Tile["c" /* TileSize */].Small,
    headingText: calendarsHeader,
    iconColor: "#FF3B30",
    iconSymbol: bold_calendar["a" /* default */],
    onTileClick: () => {
      recordRecoveryStats.recordOpenedRecovery();
      openCalendarsRecoveryModal();
    }
  });
};
// EXTERNAL MODULE: /workspace/node_modules/@apple/symbols/bold/person.crop.circle.svg
var bold_person_crop_circle = __webpack_require__(1622);

// CONCATENATED MODULE: ./src/Pages/RecoveryPage/ArchivesRecoveryModal/useContactsRecoveryModal.tsx







const useContactsRecoveryModal_MODAL_TITLE_ID = "contacts-recovery-modal-title";
const ContactsRecoveryModalContent = _ref => {
  let {
    items,
    isLoading,
    onRestoreArchive,
    restoringArchiveId
  } = _ref;
  const icon = /*#__PURE__*/react["createElement"](SquircledSymbol["a" /* SquircledSymbol */], {
    iconSize: 54,
    symbolSize: 30,
    symbol: person_crop_circle["a" /* default */],
    backgroundColor: "#61BFF4"
  });
  const modalTitle = Object(useLoc["a" /* getLoc */])("RecoveryPage.ContactsRecoveryModalContent.Title");
  const modalDescription = Object(useLoc["a" /* getLoc */])("RecoveryPage.ContactsRecoveryModalContent.Description");
  const learnMoreLink = Object(getSupportLink["a" /* getSupportLink */])("restoreContacts");
  const listDescription = /*#__PURE__*/react["createElement"](react["Fragment"], null, Object(useLoc["a" /* getLoc */])("RecoveryPage.ContactsRecoveryModalContent.ListDescription.FirstLine"), /*#__PURE__*/react["createElement"]("ul", null, /*#__PURE__*/react["createElement"]("li", null, Object(useLoc["a" /* getLoc */])("RecoveryPage.ContactsRecoveryModalContent.ListDescription.BulletPointOne")), /*#__PURE__*/react["createElement"]("li", null, Object(useLoc["a" /* getLoc */])("RecoveryPage.ContactsRecoveryModalContent.ListDescription.BulletPointTwo"))));
  return /*#__PURE__*/react["createElement"](ArchivesRecoveryModalContent, {
    icon: icon,
    modalTitle: modalTitle,
    modalDescription: modalDescription,
    learnMoreLink: learnMoreLink,
    items: items,
    listDescription: listDescription,
    isLoading: isLoading,
    onRestoreArchive: onRestoreArchive,
    restoringArchiveId: restoringArchiveId,
    titleId: useContactsRecoveryModal_MODAL_TITLE_ID
  });
};
function useContactsRecoveryModal(contentProps) {
  let disableCloseButton = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  const showModal = useModalWithCloseButton(/*#__PURE__*/react["createElement"](ContactsRecoveryModalContent, contentProps), {
    ariaLabelledBy: useContactsRecoveryModal_MODAL_TITLE_ID,
    closeButtonDisabled: disableCloseButton
  });
  return showModal;
}
// CONCATENATED MODULE: ./src/Pages/RecoveryPage/ArchivesRecoveryTile/ContactArchivesRecoveryTileWrapper.scss
// extracted by mini-css-extract-plugin

// CONCATENATED MODULE: ./src/Pages/RecoveryPage/ArchivesRecoveryTile/ContactArchivesRecoveryTileWrapper.tsx

















const ContactArchivesRecoveryTileWrapper = () => {
  var _contactsResponse$dat;
  const locale = Object(core["b" /* getLocale */])();
  const contactsResponse = useDeletedContactArchives();
  const contactsHeader = Object(useLoc["a" /* getLoc */])("RecoveryPage.ArchivesTile.Title.Contacts");
  const [restoringArchiveId, setRestoringArchiveId] = react["useState"](undefined);
  const confirmationTitle = Object(useLoc["a" /* getLoc */])("RecoveryPage.ContactArchivesRecoveryTileWrapper.Confirmation.Title");
  const confirmationDescription = Object(useLoc["a" /* getLoc */])("RecoveryPage.ContactArchivesRecoveryTileWrapper.Confirmation.Description");
  const confirmationCancel = Object(useLoc["a" /* getLoc */])("Alert.CancelButton");
  const confirmationRestore = Object(useLoc["a" /* getLoc */])("RecoveryPage.ContactArchivesRecoveryTileWrapper.Confirmation.RestoreButton");
  const alertSuccessTitle = Object(useLoc["a" /* getLoc */])("RecoveryPage.ContactArchivesRecoveryTileWrapper.AlertSuccess.Title");
  const alertOkButton = Object(useLoc["a" /* getLoc */])("Alert.OkButton");
  const alertFailureTitle = Object(useLoc["a" /* getLoc */])("RecoveryPage.ContactArchivesRecoveryTileWrapper.AlertFailure.Title");
  const alertFailureDescription = Object(useLoc["a" /* getLoc */])("RecoveryPage.ContactArchivesRecoveryTileWrapper.AlertFailure.Description");
  const alertFailureContactSupport = Object(useLoc["a" /* getLoc */])("Alert.ContactSupport");
  const recordRecoveryStats = RecoveryPage_useRecordRecoveryStats("contact");
  const showAlert = Object(useShowCloudOSAlert["a" /* useShowCloudOSAlert */])();
  const showRestoreSuccessAlert = () => {
    showAlert({
      title: alertSuccessTitle,
      description: Object(useLoc["a" /* getLoc */])("RecoveryPage.ContactArchivesRecoveryTileWrapper.AlertSuccess.Description", {
        // E.g. 3:14 PM
        time: new Date().toLocaleTimeString(locale, {
          hour12: true,
          hour: "numeric",
          minute: "2-digit"
        })
      }),
      buttons: [alertOkButton]
    });
  };
  const showRestoreFailedAlert = () => {
    showAlert({
      title: alertFailureTitle,
      description: alertFailureDescription,
      accessory: /*#__PURE__*/react["createElement"](ExternalLink["a" /* ExternalLink */], {
        className: "contact-recovery-failure-alert-support-link",
        href: Object(getSupportLink["a" /* getSupportLink */])("contactAppleSupport")
      }, alertFailureContactSupport),
      buttons: [alertOkButton]
    });
  };
  const [recordWorkflowSuccess, recordWorkflowFailure] = Object(TelemetryProvider["b" /* useTelemetry */])("workflow", "restore-contacts");
  const [recordLoad, recordFailedLoad] = Object(TelemetryProvider["b" /* useTelemetry */])("load", "contacts-recovery-tile", {
    measureFromBaseline: true
  });
  react["useEffect"](() => {
    if (!contactsResponse.isLoading) {
      if (contactsResponse.isSuccess) {
        recordLoad();
      } else {
        recordFailedLoad();
      }
    }
  }, [contactsResponse, recordLoad, recordFailedLoad]);
  const onRestoreSuccess = () => {
    recordWorkflowSuccess();
    showRestoreSuccessAlert();
    endRestore();
  };
  const onRestoreFailure = () => {
    recordWorkflowFailure();
    showRestoreFailedAlert();
    endRestore();
  };
  const startStatusPolling = useContactRecoveryServiceStatus(onRestoreSuccess, onRestoreFailure);
  const restoreContactArchives = useRestoreDeletedContactArchives(
  // onSuccess
  () => {
    startStatusPolling();
  },
  // onError
  () => {
    onRestoreFailure();
  });
  const startRestore = archiveId => {
    setRestoringArchiveId(archiveId);
    restoreContactArchives.mutate(archiveId);
  };
  const endRestore = () => {
    setRestoringArchiveId(undefined);
    contactsResponse.refetch();
  };
  const showRecoveryAlert = useRecoveryAlert({
    confirmationTitle,
    confirmationDescription,
    confirmationRestore,
    confirmationCancel,
    recoveryType: "contact",
    startRestore,
    endRestore
  });
  const openContactsRecoveryModal = useContactsRecoveryModal({
    items: (_contactsResponse$dat = contactsResponse.data) !== null && _contactsResponse$dat !== void 0 ? _contactsResponse$dat : [],
    isLoading: contactsResponse.isLoading,
    onRestoreArchive: archiveId => {
      showRecoveryAlert(archiveId);
    },
    restoringArchiveId
  },
  // Disable the close button when restoring in progress
  restoringArchiveId !== undefined);
  return /*#__PURE__*/react["createElement"](ArchivesRecoveryTile, {
    error: contactsResponse.error,
    isLoading: contactsResponse.isLoading,
    isSuccess: contactsResponse.isSuccess,
    refetch: contactsResponse.refetch,
    deletedArchives: contactsResponse.data,
    tileSize: Tile["c" /* TileSize */].Small,
    headingText: contactsHeader,
    iconColor: "#5AC8FA",
    iconSymbol: bold_person_crop_circle["a" /* default */],
    onTileClick: () => {
      recordRecoveryStats.recordOpenedRecovery();
      openContactsRecoveryModal();
    }
  });
};
// EXTERNAL MODULE: /workspace/node_modules/@apple/symbols/bold/bookmark.svg
var bold_bookmark = __webpack_require__(1346);

// EXTERNAL MODULE: /workspace/node_modules/@apple/symbols/regular/chevron.down.svg
var chevron_down = __webpack_require__(1615);

// EXTERNAL MODULE: /workspace/node_modules/@apple/symbols/regular/star.svg
var star = __webpack_require__(1612);

// EXTERNAL MODULE: /workspace/node_modules/@apple/symbols/regular/folder.svg
var folder = __webpack_require__(1613);

// EXTERNAL MODULE: /workspace/node_modules/@apple/ui-components/build/UISelectButton.js + 3 modules
var UISelectButton = __webpack_require__(2195);

// CONCATENATED MODULE: ./src/Pages/RecoveryPage/ArchivesRecoveryModal/BookmarksRecoveryModal.scss
// extracted by mini-css-extract-plugin

// EXTERNAL MODULE: ./src/Utils/useUpdateAttributes.ts
var useUpdateAttributes = __webpack_require__(1614);

// CONCATENATED MODULE: ./src/Pages/RecoveryPage/ArchivesRecoveryModal/BookmarksRecoveryModal.tsx
















var BookmarksRecoveryModalState = /*#__PURE__*/function (BookmarksRecoveryModalState) {
  BookmarksRecoveryModalState[BookmarksRecoveryModalState["SELECTING"] = 0] = "SELECTING";
  BookmarksRecoveryModalState[BookmarksRecoveryModalState["RESTORING"] = 1] = "RESTORING";
  BookmarksRecoveryModalState[BookmarksRecoveryModalState["DELETING"] = 2] = "DELETING";
  return BookmarksRecoveryModalState;
}(BookmarksRecoveryModalState || {});
function DeletedBookmarkRow(_ref) {
  let {
    bookmark,
    checked,
    onCheck
  } = _ref;
  const deletionDate = bookmark.deletionDate;
  const deletionDaysAgo = Math.min(Math.max(0, Math.floor((Date.now() - deletionDate.getTime()) / 1000 / 60 / 60 / 24)), 30);
  const deletionDaysLeft = Math.max(30 - deletionDaysAgo, 0);
  const deletedDateText = (() => {
    switch (deletionDaysAgo) {
      case 0:
        return Object(useLoc["a" /* getLoc */])("RecoveryPage.BookmarksRecoveryModal.DeletedToday", {
          daysRemaining: deletionDaysLeft
        });
      case 1:
        return Object(useLoc["a" /* getLoc */])("RecoveryPage.BookmarksRecoveryModal.DeletedYesterday", {
          daysRemaining: deletionDaysLeft
        });
      default:
        return Object(useLoc["a" /* getLoc */])("RecoveryPage.BookmarksRecoveryModal.DeletedDaysAgo", {
          daysAgo: deletionDaysAgo,
          daysRemaining: deletionDaysLeft
        });
    }
  })();
  return /*#__PURE__*/react["createElement"]("div", {
    className: "deleted-bookmark-row"
  }, /*#__PURE__*/react["createElement"]("div", null, /*#__PURE__*/react["createElement"](UICheckbox["a" /* UICheckbox */], {
    id: bookmark.recordName,
    checked: checked,
    onStateChange: checkedState => onCheck(checkedState.checked, bookmark.recordName)
  })), /*#__PURE__*/react["createElement"]("div", {
    className: "middle-column"
  }, /*#__PURE__*/react["createElement"](UILabel["a" /* UILabel */], {
    htmlFor: bookmark.recordName
  }, bookmark.title), /*#__PURE__*/react["createElement"]("div", {
    className: "bookmark-date"
  }, deletedDateText), /*#__PURE__*/react["createElement"]("div", {
    className: "bookmark-link"
  }, /*#__PURE__*/react["createElement"](ExternalLink["a" /* ExternalLink */], {
    hideArrow: true,
    href: bookmark.url
  }, bookmark.url))), /*#__PURE__*/react["createElement"]("div", {
    className: "folder-label"
  }, bookmark.folder, "\xA0", bookmark.isFavoritesBar ? /*#__PURE__*/react["createElement"](star["a" /* default */], {
    "aria-hidden": "true",
    desiredFontSize: 8,
    layoutMode: "glyphBox"
  }) : /*#__PURE__*/react["createElement"](folder["a" /* default */], {
    "aria-hidden": "true",
    desiredFontSize: 8,
    layoutMode: "glyphBox"
  })));
}
function updateCheckedBookmarks(oldChecked, action) {
  const newChecked = {};
  if (action.newChecked) {
    for (const bookmark of action.deletedBookmarks) {
      if (action.newChecked[bookmark.recordName]) {
        newChecked[bookmark.recordName] = true;
      }
    }
  } else {
    for (const bookmark of action.deletedBookmarks) {
      if (oldChecked[bookmark.recordName]) {
        newChecked[bookmark.recordName] = true;
      }
    }
  }
  return newChecked;
}
const BookmarksRecoveryModal = () => {
  const [deletedBookmarks, isLoading] = useDeletedBookmarks();
  const recordRecoveryStats = RecoveryPage_useRecordRecoveryStats("bookmark");
  const bookmarksCount = Object(useLoc["b" /* getLocCount */])({
    zero: "RecoveryPage.BookmarksTile.TotalNumber.Zero",
    one: "RecoveryPage.BookmarksTile.TotalNumber.One",
    two: "RecoveryPage.BookmarksTile.TotalNumber.Two",
    many: "RecoveryPage.BookmarksTile.TotalNumber.Many"
  }, deletedBookmarks.length);
  const [state, setState] = react["useState"](BookmarksRecoveryModalState.SELECTING);
  const isRestoring = state === BookmarksRecoveryModalState.RESTORING;
  const isDeleting = state === BookmarksRecoveryModalState.DELETING;
  const isBlocked = state !== BookmarksRecoveryModalState.SELECTING;
  const [checked, updateChecked] = react["useReducer"](updateCheckedBookmarks, {});
  const [showAlert] = Object(useShowAlert["b" /* useShowAlert */])();
  const deleteClicked = () => {
    const deleteConfirmed = async () => {
      setState(BookmarksRecoveryModalState.DELETING);
      await deleteDeletedBookmarks(deletedBookmarks.filter(item => !!checked[item.recordName]));
      setState(BookmarksRecoveryModalState.SELECTING);
    };
    showAlert({
      title: Object(useLoc["a" /* getLoc */])("RecoveryPage.BookmarksRecoveryModal.DeletePrompt.Title"),
      description: Object(useLoc["a" /* getLoc */])("RecoveryPage.BookmarksRecoveryModal.DeletePrompt.Description"),
      buttons: [{
        title: "Delete",
        destructive: true,
        action: "delete"
      }, {
        title: Object(useLoc["a" /* getLoc */])("RecoveryPage.BookmarksRecoveryModal.DeletePrompt.Cancel"),
        action: "cancel"
      }],
      cancelAction: "cancel",
      onActionSelected: action => {
        if (action === "delete") {
          deleteConfirmed();
        }
      }
    });
  };
  const [recordWorkflowSuccess, recordWorkflowFailure] = Object(TelemetryProvider["b" /* useTelemetry */])("workflow", "restore-bookmarks");
  const restoreClicked = async () => {
    recordRecoveryStats.recordStartedRecovery();
    setState(BookmarksRecoveryModalState.RESTORING);
    const succeeded = await restoreDeletedBookmarks(deletedBookmarks.filter(item => !!checked[item.recordName]));
    if (succeeded) {
      recordWorkflowSuccess();
    } else {
      recordWorkflowFailure();
    }
    setState(BookmarksRecoveryModalState.SELECTING);
  };
  react["useEffect"](() => {
    updateChecked({
      deletedBookmarks
    });
  }, [deletedBookmarks]);
  const [sortMode, setSortMode] = react["useState"]("date");
  const onSortChange = _ref2 => {
    let {
      value
    } = _ref2;
    setSortMode(value);
  };
  const sortedItems = (() => {
    switch (sortMode) {
      case "name":
        return [...deletedBookmarks].sort((lhs, rhs) => lhs.title.localeCompare(rhs.title));
      case "folder":
        return [...deletedBookmarks].sort((lhs, rhs) => lhs.folder.localeCompare(rhs.folder));
      case "date":
      default:
        return [...deletedBookmarks].sort((lhs, rhs) => rhs.deletionDate.getTime() - lhs.deletionDate.getTime());
    }
  })();
  const allChecked = sortedItems.every(value => !!checked[value.recordName]);
  const someChecked = sortedItems.some(value => !!checked[value.recordName]);
  const onSelectAll = () => {
    const newChecked = {};
    for (const bookmark of deletedBookmarks) {
      newChecked[bookmark.recordName] = !allChecked;
    }
    updateChecked({
      deletedBookmarks,
      newChecked
    });
  };
  const onCheck = (check, recordName) => {
    const newChecked = {
      ...checked
    };
    newChecked[recordName] = check;
    updateChecked({
      deletedBookmarks,
      newChecked
    });
  };
  const attributeUpdates = react["useMemo"](() => {
    const newUpdates = [isBlocked ? ["set", "inert"] : ["remove", "inert"]];
    return newUpdates;
  }, [isBlocked]);
  const inertRef = Object(useUpdateAttributes["a" /* useUpdateAttributes */])(attributeUpdates);
  return /*#__PURE__*/react["createElement"](react["Fragment"], null, /*#__PURE__*/react["createElement"]("div", {
    className: "bookmarks-recovery-modal-content"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "bookmarks-recovery-modal-icon",
    "data-testid": "icon"
  }, /*#__PURE__*/react["createElement"](SquircledSymbol["a" /* SquircledSymbol */], {
    iconSize: 54,
    symbolSize: 30,
    symbol: bold_bookmark["a" /* default */],
    backgroundColor: "#FF9500"
  })), /*#__PURE__*/react["createElement"]("h2", {
    className: "bookmarks-recovery-modal-title",
    "data-testid": "title",
    id: "bookmarks-recovery-modal-title-id"
  }, Object(useLoc["a" /* getLoc */])("RecoveryPage.BookmarksRecoveryModal.Title")), /*#__PURE__*/react["createElement"]("div", {
    className: "bookmarks-recovery-modal-description",
    "data-testid": "description"
  }, Object(useLoc["a" /* getLoc */])("RecoveryPage.BookmarksRecoveryModal.Description"), " ", /*#__PURE__*/react["createElement"](ExternalLink["a" /* ExternalLink */], {
    href: Object(getSupportLink["a" /* getSupportLink */])("restoreBookmarks")
  }, Object(useLoc["a" /* getLoc */])("RecoveryPage.BookmarksRecoveryModal.LearnMore"))), /*#__PURE__*/react["createElement"]("div", {
    className: classnames_default()("bookmarks-recovery-list", {
      blocked: isBlocked
    }),
    ref: inertRef
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "count"
  }, bookmarksCount), /*#__PURE__*/react["createElement"]("div", {
    className: "description"
  }, Object(useLoc["a" /* getLoc */])("RecoveryPage.BookmarksRecoveryModal.ListDescription.FirstLine")), isLoading ? /*#__PURE__*/react["createElement"]("div", {
    className: "loading"
  }, /*#__PURE__*/react["createElement"](UIActivityIndicator["a" /* UIActivityIndicator */], {
    description: Object(useLoc["a" /* getLoc */])("RecoveryPage.BookmarksRecoveryModal.LoadingDescription")
  })) : sortedItems.length ? /*#__PURE__*/react["createElement"](react["Fragment"], null, /*#__PURE__*/react["createElement"]("div", {
    className: "header"
  }, /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
    variant: "standard bookmarks-recovery",
    onActivate: onSelectAll
  }, allChecked ? Object(useLoc["a" /* getLoc */])("RecoveryPage.BookmarksRecoveryModal.DeselectAll") : Object(useLoc["a" /* getLoc */])("RecoveryPage.BookmarksRecoveryModal.SelectAll")), /*#__PURE__*/react["createElement"]("div", {
    className: "flex-space"
  }), /*#__PURE__*/react["createElement"](SortSelectButton, {
    onSortChange: onSortChange
  })), sortedItems.map(item => /*#__PURE__*/react["createElement"](DeletedBookmarkRow, {
    bookmark: item,
    checked: !!checked[item.recordName],
    onCheck: onCheck,
    key: item.recordName
  }))) : /*#__PURE__*/react["createElement"]("div", null, Object(useLoc["a" /* getLoc */])("RecoveryPage.BookmarksRecoveryModal.EmptyList")))), !isBlocked && /*#__PURE__*/react["createElement"](BottomBar, {
    hidden: !someChecked
  }, /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
    variant: "block secondary large",
    disabled: !someChecked,
    onActivate: deleteClicked
  }, Object(useLoc["a" /* getLoc */])("RecoveryPage.BookmarksRecoveryModal.Delete")), /*#__PURE__*/react["createElement"]("div", {
    className: "flex-space"
  }), /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
    className: "block primary large",
    disabled: !someChecked,
    onActivate: restoreClicked
  }, Object(useLoc["a" /* getLoc */])("RecoveryPage.BookmarksRecoveryModal.Restore"))), isRestoring && /*#__PURE__*/react["createElement"](BottomSpinnerBar, {
    text: Object(useLoc["a" /* getLoc */])("RecoveryPage.BookmarksRecoveryModal.Restoring")
  }), isDeleting && /*#__PURE__*/react["createElement"](BottomSpinnerBar, {
    text: Object(useLoc["a" /* getLoc */])("RecoveryPage.BookmarksRecoveryModal.Deleting")
  }));
};
function SortSelectButton(props) {
  return /*#__PURE__*/react["createElement"](UISelectButton["a" /* UISelectButton */], {
    variant: "standard bookmarks-recovery",
    shouldUseNativeControl: true,
    defaultValue: "date",
    onStateChange: props.onSortChange,
    chevronAsset: /*#__PURE__*/react["createElement"](react["Fragment"], null, "\xA0", /*#__PURE__*/react["createElement"](chevron_down["a" /* default */], {
      layoutMode: "glyphBox",
      desiredFontSize: 9
    }))
  }, /*#__PURE__*/react["createElement"](UISelectButton["c" /* UISelectItem */], {
    value: "date"
  }, Object(useLoc["a" /* getLoc */])("RecoveryPage.BookmarksRecoveryModal.DateDeleted")), /*#__PURE__*/react["createElement"](UISelectButton["c" /* UISelectItem */], {
    value: "name"
  }, Object(useLoc["a" /* getLoc */])("RecoveryPage.BookmarksRecoveryModal.Name")), /*#__PURE__*/react["createElement"](UISelectButton["c" /* UISelectItem */], {
    value: "folder"
  }, Object(useLoc["a" /* getLoc */])("RecoveryPage.BookmarksRecoveryModal.Folder")));
}
function BottomSpinnerBar(props) {
  return /*#__PURE__*/react["createElement"](BottomBar, null, /*#__PURE__*/react["createElement"]("div", {
    className: "bottom-spinner-bar"
  }, /*#__PURE__*/react["createElement"](UIActivityIndicator["a" /* UIActivityIndicator */], {
    variant: "standard bookmarks-recovery",
    description: "",
    "aria-hidden": "true"
  }), /*#__PURE__*/react["createElement"]("span", {
    className: "status"
  }, props.text)));
}
function BottomBar(props) {
  return /*#__PURE__*/react["createElement"]("div", {
    className: classnames_default()("bottom-bar", {
      "visually-hidden": props.hidden === true
    })
  }, props.children);
}
// EXTERNAL MODULE: ./src/ADP/PCSKeyManager.ts + 2 modules
var PCSKeyManager = __webpack_require__(2212);

// EXTERNAL MODULE: ./src/Components/ADPModal/ADPModal.tsx + 1 modules
var ADPModal = __webpack_require__(2273);

// EXTERNAL MODULE: ./src/ADP/useHasPCSKey.ts
var useHasPCSKey = __webpack_require__(1611);

// EXTERNAL MODULE: /workspace/node_modules/@icloudweb/auth-service/server/Environment/Configurations.js + 1 modules
var Configurations = __webpack_require__(2248);

// EXTERNAL MODULE: /workspace/node_modules/@apple/symbols/bold/doc.svg
var doc = __webpack_require__(1616);

// EXTERNAL MODULE: ./src/ADP/PCSKeyIdentifier.ts
var PCSKeyIdentifier = __webpack_require__(1168);

// EXTERNAL MODULE: /workspace/node_modules/@apple/react-helpers/build/esm/useHorizontalSizeClass.js
var esm_useHorizontalSizeClass = __webpack_require__(1229);

// EXTERNAL MODULE: /workspace/node_modules/@apple/ui-components/build/UIOverlayActions/UIOverlayActions.js + 1 modules
var UIOverlayActions = __webpack_require__(2268);

// EXTERNAL MODULE: ./src/ComponentsGeneric/Tiles/FileIcon/FileIcon.tsx + 12 modules
var FileIcon = __webpack_require__(2156);

// CONCATENATED MODULE: ./src/Pages/RecoveryPage/DriveFileRecovery/DriveFileRecoveryModal.scss
// extracted by mini-css-extract-plugin

// CONCATENATED MODULE: ./src/API/RecoveryInfo/orderOfMagnitude.ts
/**
 * Buckets `n` to the order-of-magnitude version of it
 * (a number starting with an optional 1 and ending in
 * any number of 0s), retaining its sign, if < 0.
 *
 * @param n - The number to convert to order of magnitude
 * @returns A string representation of the order of magnitude
 *
 * @example
 * orderOfMagnitude(5)      // "10"
 * orderOfMagnitude(50)     // "100"
 * orderOfMagnitude(500)    // "100"
 * orderOfMagnitude(5000)   // "1000"
 * orderOfMagnitude(-500)   // "-100"
 * orderOfMagnitude(0.5)    // "0"
 * orderOfMagnitude(NaN)    // "0"
 * orderOfMagnitude(Infinity)  // "0"
 */
const orderOfMagnitude = n => {
  // Handle non-finite numbers (NaN, Infinity, -Infinity)
  if (!Number.isFinite(n)) return "0";
  const sign = Math.sign(n) === -1 ? "-" : "";
  n = Math.abs(n);
  if (n < 1) return `${sign}0`;
  return `${sign}1${"0".repeat(Math.floor(Math.log10(n)))}`;
};

/**
 * An integer, capped to its order of magnitude alone: a 1 or 0,
 * followed by zeroes, and potentially prefixed by a minus sign.
 */
// CONCATENATED MODULE: ./src/API/RecoveryInfo/usePurgeDeletedDriveItems.ts






function usePurgeDeletedDriveItems(onSuccess, onError) {
  const webServices = Object(useWebServices["a" /* useWebServices */])();
  return Object(es["useMutation"])(items => {
    // Log purge start
    Stat["a" /* Stat */].withEventAndLabel("workflow", "filerecovery.purgeSelectedFiles.start", {
      statCategory: TelemetryCategory["a" /* TelemetryCategory */].SESSION,
      selectedItemsCountMagnitude: orderOfMagnitude(items.length)
    }).record();
    return recoveryInfo_endpoint_purgeDeletedDriveItems({
      webServices
    }, items);
  }, {
    onSuccess: () => {
      // Log purge success
      Stat["a" /* Stat */].withEventAndLabel("workflow", "filerecovery.purgeSelectedFiles.success", {
        statCategory: TelemetryCategory["a" /* TelemetryCategory */].SESSION
      }).record();
      onSuccess();
    },
    onError: error => {
      // Log purge failure
      const errorType = error instanceof Error ? error.name : "unknown";
      const errorMessage = error instanceof Error ? error.message : "unknown";
      Stat["a" /* Stat */].withEventAndLabel("workflow", "filerecovery.purgeSelectedFiles.failure", {
        statCategory: TelemetryCategory["a" /* TelemetryCategory */].SESSION,
        errorType,
        errorMessage
      }).record();
      onError();
    }
  });
}
// CONCATENATED MODULE: ./src/API/RecoveryInfo/useRestoreDeletedDriveFiles.ts







// server supposts maximum of 100 per batch
const MAX_BATCH_SIZE = 100;

/**
 * Utility function to chunk an array into smaller arrays of specified size
 */
const chunkArray = (array, chunkSize) => {
  const chunks = [];
  for (let i = 0; i < array.length; i += chunkSize) {
    chunks.push(array.slice(i, i + chunkSize));
  }
  return chunks;
};
function useRestoreDeletedDriveFiles(onSuccess, _onError) {
  const webServices = Object(useWebServices["a" /* useWebServices */])();
  const [state, setState] = Object(react["useState"])({
    isLoading: false,
    restoredItemIds: [],
    failedItemIds: [],
    isPaused: false,
    isCancelled: false,
    isError: false,
    isSuccess: false,
    error: null,
    data: undefined
  });

  // Use refs to track pause/cancel state for safe access in async operations
  const isPausedRef = Object(react["useRef"])(false);
  const isCancelledRef = Object(react["useRef"])(false);

  // Control methods
  const pauseRestore = Object(react["useCallback"])(() => {
    isPausedRef.current = true;
    setState(prev => ({
      ...prev,
      isPaused: true
    }));
  }, []);
  const resumeRestore = Object(react["useCallback"])(() => {
    isPausedRef.current = false;
    setState(prev => ({
      ...prev,
      isPaused: false
    }));
  }, []);
  const cancelRestore = Object(react["useCallback"])(() => {
    isCancelledRef.current = true;
    setState(prev => ({
      ...prev,
      isCancelled: true
    }));
  }, []);

  // Helper function to process a single chunk
  const processChunk = Object(react["useCallback"])(async chunk => {
    // Check if cancelled before processing
    if (isCancelledRef.current) {
      return {
        shouldBreak: true,
        restoredIds: [],
        failedIds: [],
        failedIdsWithStorageError: [],
        failureStatusCounts: {}
      };
    }

    // Wait while paused (using refs for safe async access)
    while (isPausedRef.current && !isCancelledRef.current) {
      await new Promise(resolve => setTimeout(resolve, 1000));
    }

    // Check again after pause in case we were cancelled
    if (isCancelledRef.current) {
      return {
        shouldBreak: true,
        restoredIds: [],
        failedIds: [],
        failedIdsWithStorageError: [],
        failureStatusCounts: {}
      };
    }
    try {
      const result = await restoreDeletedDriveFiles({
        webServices
      }, chunk);
      return {
        shouldBreak: false,
        restoredIds: result.restoredIds,
        failedIds: result.failedIds,
        failedIdsWithStorageError: result.failedIdsWithStorageError,
        failureStatusCounts: result.failureStatusCounts || {}
      };
    } catch (error) {
      // If entire chunk fails, add all its item IDs to failed list
      return {
        shouldBreak: false,
        restoredIds: [],
        failedIds: chunk,
        failedIdsWithStorageError: [],
        failureStatusCounts: {}
      };
    }
  }, [webServices]);
  const restoreFiles = Object(react["useCallback"])(async itemIds => {
    // Log restore start
    Stat["a" /* Stat */].withEventAndLabel("workflow", "filerecovery.restoreSelectedFiles.start", {
      statCategory: TelemetryCategory["a" /* TelemetryCategory */].SESSION,
      selectedItemsCountMagnitude: orderOfMagnitude(itemIds.length)
    }).record();

    // If no items to restore, finish immediately
    if (itemIds.length === 0) {
      setState({
        isLoading: false,
        restoredItemIds: [],
        failedItemIds: [],
        isPaused: false,
        isCancelled: false,
        isError: false,
        isSuccess: true,
        error: null,
        data: []
      });
      // Call callback in next tick to avoid render phase issues
      setTimeout(() => {
        onSuccess([], []);
      }, 0);
      return;
    }

    // Reset state and start loading
    isCancelledRef.current = false;
    isPausedRef.current = false;
    setState({
      isLoading: true,
      restoredItemIds: [],
      failedItemIds: [],
      isPaused: false,
      isCancelled: false,
      isError: false,
      isSuccess: false,
      error: null,
      data: undefined
    });

    // Track accumulated results locally
    const accumulatedRestoredIds = [];
    const accumulatedFailedIds = [];
    const accumulatedFailedIdsWithStorageError = [];
    const accumulatedFailureStatusCounts = {};

    // Divide itemIds into chunks of maximum 100 IDs
    const chunks = chunkArray(itemIds, MAX_BATCH_SIZE);

    // Process chunks sequentially with progressive updates
    for (const chunk of chunks) {
      const result = await processChunk(chunk);
      if (result.shouldBreak) {
        break;
      }

      // Accumulate results locally
      accumulatedRestoredIds.push(...result.restoredIds);
      accumulatedFailedIds.push(...result.failedIds);
      accumulatedFailedIdsWithStorageError.push(...result.failedIdsWithStorageError);

      // Merge failure status counts
      Object.entries(result.failureStatusCounts).forEach(_ref => {
        let [status, count] = _ref;
        accumulatedFailureStatusCounts[status] = (accumulatedFailureStatusCounts[status] || 0) + count;
      });

      // Update state progressively after each chunk
      setState(prev => ({
        ...prev,
        restoredItemIds: [...prev.restoredItemIds, ...result.restoredIds],
        failedItemIds: [...prev.failedItemIds, ...result.failedIds]
      }));
    }

    // Final state update - processing complete
    setState({
      isLoading: false,
      restoredItemIds: accumulatedRestoredIds,
      failedItemIds: accumulatedFailedIds,
      isPaused: false,
      isCancelled: false,
      isError: false,
      isSuccess: true,
      error: null,
      data: accumulatedRestoredIds
    });

    // Log restore completion
    if (accumulatedFailedIds.length > 0) {
      // Log restore failure
      const telemetryData = {
        statCategory: TelemetryCategory["a" /* TelemetryCategory */].SESSION,
        failedItemsCountMagnitude: orderOfMagnitude(accumulatedFailedIds.length),
        totalSelectedItemsMagnitude: orderOfMagnitude(itemIds.length)
      };

      // Add failure status counts for detailed error tracking
      if (Object.keys(accumulatedFailureStatusCounts).length > 0) {
        telemetryData.failureStatusCounts = Object.fromEntries(Object.entries(accumulatedFailureStatusCounts).map(_ref2 => {
          let [status, count] = _ref2;
          return [status, orderOfMagnitude(count)];
        }));
      }
      Stat["a" /* Stat */].withEventAndLabel("workflow", "filerecovery.restoreSelectedFiles.failure", telemetryData).record();
    } else {
      // Log restore success
      Stat["a" /* Stat */].withEventAndLabel("workflow", "filerecovery.restoreSelectedFiles.success", {
        statCategory: TelemetryCategory["a" /* TelemetryCategory */].SESSION,
        restoredItemsCountMagnitude: orderOfMagnitude(accumulatedRestoredIds.length)
      }).record();
    }

    // Call callback in 500ms to show full progress in progressbar
    setTimeout(() => {
      if (!isCancelledRef.current) {
        onSuccess(accumulatedFailedIds, accumulatedFailedIdsWithStorageError);
      }
    }, 500);
  }, [onSuccess, processChunk]);

  // Reset function for backward compatibility
  const reset = Object(react["useCallback"])(() => {
    setState({
      isLoading: false,
      restoredItemIds: [],
      failedItemIds: [],
      isPaused: false,
      isCancelled: false,
      isError: false,
      isSuccess: false,
      error: null,
      data: undefined
    });
  }, []);

  // Return object that matches both old useMutation interface and new progressive interface
  return {
    // New progressive interface
    ...state,
    restoreFiles,
    // Control methods for pause/resume/cancel
    pause: pauseRestore,
    resume: resumeRestore,
    cancel: cancelRestore,
    // Old useMutation interface for backward compatibility
    mutate: restoreFiles,
    isLoading: state.isLoading,
    reset
  };
}
// CONCATENATED MODULE: ./src/ComponentsGeneric/ProgressBar/ProgressBar.scss
// extracted by mini-css-extract-plugin

// CONCATENATED MODULE: ./src/ComponentsGeneric/ProgressBar/ProgressBar.tsx



const ProgressBar = _ref => {
  let {
    percentage,
    animated = true,
    className,
    ariaLabel
  } = _ref;
  // Ensure percentage is within valid range
  const normalizedPercentage = Math.max(0, Math.min(100, percentage));
  return /*#__PURE__*/react["createElement"]("div", {
    className: classnames_default()("progress-bar", className),
    role: "progressbar",
    "aria-valuenow": normalizedPercentage,
    "aria-valuemin": 0,
    "aria-valuemax": 100,
    "aria-label": ariaLabel
  }, /*#__PURE__*/react["createElement"]("div", {
    className: classnames_default()("progress-bar-fill", {
      "no-animation": !animated
    }),
    style: {
      width: `${normalizedPercentage}%`
    }
  }));
};
// EXTERNAL MODULE: /workspace/node_modules/@apple/symbols/medium/arrow.clockwise.svg
var arrow_clockwise = __webpack_require__(1617);

// EXTERNAL MODULE: ./src/Pages/ShareAcceptancePage/getDriveFileInfo.ts
var getDriveFileInfo = __webpack_require__(1619);

// EXTERNAL MODULE: ./src/Components/Menu/CloudOSMenuItem.tsx + 2 modules
var CloudOSMenuItem = __webpack_require__(2226);

// EXTERNAL MODULE: /workspace/node_modules/@apple/symbols/regular/externaldrive.svg
var externaldrive = __webpack_require__(1475);

// EXTERNAL MODULE: /workspace/node_modules/@apple/symbols/regular/text.alignleft.svg
var text_alignleft = __webpack_require__(1618);

// EXTERNAL MODULE: /workspace/node_modules/@apple/symbols/SVGComponent.js
var SVGComponent = __webpack_require__(1260);

// CONCATENATED MODULE: ./src/Resources/InternalSFSymbols/dist/regular/arrow.trianglehead.2.clockwise.rotate.90.icloud.svg


/* harmony default export */ var arrow_trianglehead_2_clockwise_rotate_90_icloud = (function (props) {
  return Object(react["createElement"])(SVGComponent["a" /* SVGComponent */], { originalProps: props, metadata: {"name":"arrow.trianglehead.2.clockwise.rotate.90.icloud","svgPath":"M105.192 3.25674C119.912 3.25674 131.465-7.55716 131.465-21.0301C131.465-31.2556 125.571-40.1325 115.985-44.1371C116.081-65.9081 100.478-81.6491 80.5047-81.6491C67.2127-81.6491 57.8173-74.5654 51.9646-66.0277C39.964-69.5217 26.881-60.4358 26.6126-46.7001C15.5666-44.9702 8.72266-35.1099 8.72266-23.1916C8.72266-8.84446 21.2514 3.18389 37.9536 3.18389ZM105.182-4.64848L37.9431-4.66958C25.6344-4.66958 16.5761-13.2274 16.5761-23.1916C16.5761-32.9639 22.4644-40.6897 32.8482-40.6897C33.5019-40.6897 33.7923-41.053 33.7923-41.7067C33.7923-56.7055 44.572-61.1698 54.6051-57.9154C55.1965-57.7285 55.5598-57.8531 55.8607-58.3928C60.5758-66.8356 67.8453-73.7956 80.5047-73.7956C96.5065-73.7956 107.61-61.0759 108.401-46.573C108.526-44.3426 108.391-41.7182 108.184-39.3939C108.132-38.7507 108.37-38.3874 108.962-38.2628C117.85-36.3399 123.623-29.8572 123.623-21.0301C123.623-11.9085 115.54-4.64848 105.182-4.64848ZM46.0025-30.5848L60.1472-30.5848C61.9299-30.5848 62.3344-32.2947 61.329-33.694L55.0096-42.4961C53.9926-43.9492 52.1571-44.0527 51.0366-42.4961L44.8313-33.694C43.8364-32.3052 44.2409-30.5848 46.0025-30.5848ZM71.9891-12.1868C77.1307-12.1868 81.8774-14.0368 85.2429-16.7295C87.1693-18.2007 87.2105-20.2729 86.278-21.516C85.3972-22.6661 83.5838-23.0907 81.5845-21.7124C78.9657-19.6418 75.7525-18.3515 71.9891-18.3515C63.3036-18.3515 56.2391-25.416 56.2391-34.0497C56.2391-35.7385 54.8714-37.158 53.1826-37.158C51.4939-37.158 50.1262-35.7385 50.1262-34.0497C50.1262-21.9867 59.9261-12.1868 71.9891-12.1868ZM97.9239-37.5665L83.831-37.5665C81.9965-37.5665 81.592-35.8566 82.5975-34.4467L88.9581-25.6552C89.9856-24.1915 91.7693-24.0468 92.8898-25.6552L99.1364-34.4467C100.142-35.7943 99.7373-37.5665 97.9239-37.5665ZM71.9891-55.9644C66.8369-55.9644 62.0902-54.1144 58.7353-51.4112C56.7983-49.94 56.7053-47.8784 57.7002-46.6247C58.581-45.4746 60.3427-45.0606 62.3314-46.4283C64.9502-48.4989 68.2257-49.7892 71.9891-49.7892C80.664-49.7892 87.7285-42.7247 87.7285-34.0497C87.7285-32.4022 89.0962-30.9933 90.7956-30.9933C92.4843-30.9933 93.852-32.4022 93.852-34.0497C93.852-46.1645 84.0521-55.9644 71.9891-55.9644Z","layoutBox":{"viewBox":"0 0 143.4599609375 108.103759765625","width":143.4599609375,"height":108.103759765625,"translateX":1.635009765625,"translateY":89.2818603515625,"baseline":89.2818603515625,"capline":18.8218994140625},"glyphBox":{"viewBox":"0 0 122.74462890625 92.838134765625","width":122.74462890625,"height":92.838134765625,"translateX":-8.72265625,"translateY":81.6490478515625,"baseline":81.6490478515625,"capline":11.1890869140625}}});
});
// CONCATENATED MODULE: ./src/Resources/InternalSFSymbols/dist/regular/exclamationmark.icloud.svg


/* harmony default export */ var exclamationmark_icloud = (function (props) {
  return Object(react["createElement"])(SVGComponent["a" /* SVGComponent */], { originalProps: props, metadata: {"name":"exclamationmark.icloud","svgPath":"M105.192 3.25674C119.912 3.25674 131.465-7.55716 131.465-21.0301C131.465-31.2556 125.571-40.1325 115.985-44.1371C116.081-65.9081 100.478-81.6491 80.5047-81.6491C67.2127-81.6491 57.8173-74.5654 51.9646-66.0277C39.964-69.5217 26.881-60.4358 26.6126-46.7001C15.5666-44.9702 8.72266-35.1099 8.72266-23.1916C8.72266-8.84446 21.2514 3.18389 37.9536 3.18389ZM105.182-4.64848L37.9431-4.66958C25.6344-4.66958 16.5761-13.2274 16.5761-23.1916C16.5761-32.9639 22.4644-40.6897 32.8482-40.6897C33.5019-40.6897 33.7923-41.053 33.7923-41.7067C33.7923-56.7055 44.572-61.1698 54.6051-57.9154C55.1965-57.7285 55.5598-57.8531 55.8607-58.3928C60.5758-66.8356 67.8453-73.7956 80.5047-73.7956C96.5065-73.7956 107.61-61.0759 108.401-46.573C108.526-44.3426 108.391-41.7182 108.184-39.3939C108.132-38.7507 108.37-38.3874 108.962-38.2628C117.85-36.3399 123.623-29.8572 123.623-21.0301C123.623-11.9085 115.54-4.64848 105.182-4.64848ZM70.12-30.207C72.4825-30.207 73.7784-31.5239 73.8819-34.0839L74.5557-51.9719C74.6592-54.646 72.6905-56.5216 70.0682-56.5216C67.4564-56.5216 65.529-54.6977 65.6325-52.0236L66.3063-34.0839C66.4098-31.5757 67.7056-30.207 70.12-30.207ZM70.0682-14.5996C72.8996-14.5996 75.3465-16.8195 75.3465-19.6815C75.3465-22.5435 72.9513-24.7528 70.0682-24.7528C67.2474-24.7528 64.8416-22.4917 64.8416-19.6815C64.8416-16.8712 67.2991-14.5996 70.0682-14.5996Z","layoutBox":{"viewBox":"0 0 143.4599609375 108.103759765625","width":143.4599609375,"height":108.103759765625,"translateX":1.635009765625,"translateY":89.2818603515625,"baseline":89.2818603515625,"capline":18.8218994140625},"glyphBox":{"viewBox":"0 0 122.74462890625 92.838134765625","width":122.74462890625,"height":92.838134765625,"translateX":-8.72265625,"translateY":81.6490478515625,"baseline":81.6490478515625,"capline":11.1890869140625}}});
});
// CONCATENATED MODULE: ./src/Resources/InternalSFSymbols/dist/regular/checkmark.icloud.svg


/* harmony default export */ var checkmark_icloud = (function (props) {
  return Object(react["createElement"])(SVGComponent["a" /* SVGComponent */], { originalProps: props, metadata: {"name":"checkmark.icloud","svgPath":"M105.192 3.25674C119.912 3.25674 131.465-7.55716 131.465-21.0301C131.465-31.2556 125.571-40.1325 115.985-44.1371C116.081-65.9081 100.478-81.6491 80.5047-81.6491C67.2127-81.6491 57.8173-74.5654 51.9646-66.0277C39.964-69.5217 26.881-60.4358 26.6126-46.7001C15.5666-44.9702 8.72266-35.1099 8.72266-23.1916C8.72266-8.84446 21.2514 3.18389 37.9536 3.18389ZM105.182-4.64848L37.9431-4.66958C25.6344-4.66958 16.5761-13.2274 16.5761-23.1916C16.5761-32.9639 22.4644-40.6897 32.8482-40.6897C33.5019-40.6897 33.7923-41.053 33.7923-41.7067C33.7923-56.7055 44.572-61.1698 54.6051-57.9154C55.1965-57.7285 55.5598-57.8531 55.8607-58.3928C60.5758-66.8356 67.8453-73.7956 80.5047-73.7956C96.5065-73.7956 107.61-61.0759 108.401-46.573C108.526-44.3426 108.391-41.7182 108.184-39.3939C108.132-38.7507 108.37-38.3874 108.962-38.2628C117.85-36.3399 123.623-29.8572 123.623-21.0301C123.623-11.9085 115.54-4.64848 105.182-4.64848ZM66.5932-15.9814C68.2302-15.9814 69.5979-16.727 70.4893-18.2299L89.6203-49.2817C90.1178-50.1002 90.7081-51.1986 90.7081-52.3381C90.7081-54.4937 88.8737-56.0895 86.5945-56.0895C85.2163-56.0895 83.9003-55.271 83.0712-53.8822L66.3757-26.0336L57.9967-37.0178C57.1054-38.2714 55.914-38.9759 54.4217-38.9759C52.2049-38.9759 50.4633-37.2459 50.4633-34.914C50.4633-33.9086 50.8055-32.9137 51.5828-31.9188L62.4901-18.1676C63.6614-16.6235 64.9668-15.9814 66.5932-15.9814Z","layoutBox":{"viewBox":"0 0 143.4599609375 108.103759765625","width":143.4599609375,"height":108.103759765625,"translateX":1.635009765625,"translateY":89.2818603515625,"baseline":89.2818603515625,"capline":18.8218994140625},"glyphBox":{"viewBox":"0 0 122.74462890625 92.838134765625","width":122.74462890625,"height":92.838134765625,"translateX":-8.72265625,"translateY":81.6490478515625,"baseline":81.6490478515625,"capline":11.1890869140625}}});
});
// CONCATENATED MODULE: ./src/Pages/RecoveryPage/DriveFileRecovery/DriveFileRecoveryModal.tsx




























const TITLE_ID = "file-recovery-modal-title";
const STICKY_HEADER_SCROLL_THRESHOLD = 300;
function DriveFileRecoveryModalContent(props) {
  var _props$deletedDriveIt, _props$deletedDriveIt2;
  const horizontalSizeClass = Object(esm_useHorizontalSizeClass["d" /* useHorizontalSizeClass */])();
  const [itemSelectionMap, setItemSelectionMap] = react["useState"]({});
  const [sortBy, setSortBy] = react["useState"]("date");

  // Log stats for sort operations
  const handleSortChange = react["useCallback"](newSortBy => {
    // Log sort operation
    Stat["a" /* Stat */].withEventAndLabel("workflow", "filerecovery.performSortBy", {
      statCategory: TelemetryCategory["a" /* TelemetryCategory */].SESSION,
      sortBy: newSortBy,
      previousSortBy: sortBy
    }).record();
    setSortBy(newSortBy);
  }, [sortBy]);

  // Track progress popup state
  const [showProgressPopup, setShowProgressPopup] = react["useState"](false);
  const [showPurgeProgressPopup, setShowPurgeProgressPopup] = react["useState"](false);

  // Sort the deleted drive items based on the selected sort option
  const sortedItems = react["useMemo"](() => {
    if (!props.deletedDriveItems) return undefined;
    const items = [...props.deletedDriveItems];
    if (sortBy === "date") {
      // Sort by deletion date (oldest first)
      items.sort((a, b) => a.deletionDate.getTime() - b.deletionDate.getTime());
    } else if (sortBy === "name") {
      // Sort by name alphabetically
      items.sort((a, b) => a.fileName.localeCompare(b.fileName));
    } else if (sortBy === "size") {
      // Sort by file size (smallest first)
      items.sort((a, b) => a.size - b.size);
    }
    return items;
  }, [props.deletedDriveItems, sortBy]);
  const selectedItems = Object.values(itemSelectionMap).filter(x => !!x);

  // Check if all items are selected
  const allItemsSelected = sortedItems ? sortedItems.every(item => !!itemSelectionMap[item.drivewsid]) : false;

  // Handler for select all checkbox
  const handleSelectAll = () => {
    const newSelectionMap = {};
    if (!allItemsSelected) {
      // If not all are selected, select all
      sortedItems === null || sortedItems === void 0 || sortedItems.forEach(item => {
        newSelectionMap[item.drivewsid] = item;
      });
    }
    setItemSelectionMap(newSelectionMap);
  };
  const [showAlert] = Object(useShowAlert["b" /* useShowAlert */])();
  const {
    refetch
  } = props;
  const icon = /*#__PURE__*/react["createElement"](SquircledSymbol["a" /* SquircledSymbol */], {
    iconSize: 54,
    symbolSize: 30,
    symbol: doc["a" /* default */],
    backgroundColor: "#AF52DF"
  });
  const createOperationErrorHandler = react["useCallback"](operationType => {
    return (failedItemIds, failedIdsWithStorageError) => {
      // For restore operations, filter selectedItems to show only failed items
      let itemsToShow = selectedItems;
      if (operationType === "Restore" && failedItemIds) {
        itemsToShow = selectedItems.filter(item => failedItemIds.includes(item.itemid));
      }
      const titleKeys = {
        one: `FileRecovery.${operationType}.Error.Title.One`,
        two: `FileRecovery.${operationType}.Error.Title.Two`,
        many: `FileRecovery.${operationType}.Error.Title.Many`
      };
      const descriptionKey = `FileRecovery.${operationType}.Error.Description`;
      const storageErrorDescriptionKey = {
        one: `FileRecovery.Restore.Error.OutOfStorage.Description.One`,
        two: `FileRecovery.Restore.Error.OutOfStorage.Description.Two`,
        many: `FileRecovery.Restore.Error.OutOfStorage.Description.Many`
      };
      const hasStorageError = failedIdsWithStorageError && failedIdsWithStorageError.length > 0;
      showAlert({
        className: "file-recovery-alert",
        variant: "standard",
        icon: /*#__PURE__*/react["createElement"](exclamationmark_icloud, {
          height: 30,
          width: 43,
          layoutMode: "glyphBox"
        }),
        title: Object(useLoc["b" /* getLocCount */])(titleKeys, itemsToShow.length),
        description: hasStorageError ? Object(useLoc["b" /* getLocCount */])(storageErrorDescriptionKey, failedIdsWithStorageError.length) : Object(useLoc["a" /* getLoc */])(descriptionKey),
        accessory: /*#__PURE__*/react["createElement"](DeletedItemsErrorList, {
          items: itemsToShow
        }),
        buttons: [{
          title: Object(useLoc["a" /* getLoc */])("FileRecovery.Error.OK.Button"),
          action: "confirm",
          shouldCloseOnClick: true
        }],
        onActionSelected: () => {
          setItemSelectionMap({});
          refetch();
        }
      });
    };
  }, [selectedItems, showAlert, refetch]);

  // Handler for restore operation completion
  const handleRestoreCompletion = react["useCallback"]((failedItemIds, failedIdsWithStorageError) => {
    setShowProgressPopup(false);
    if (failedItemIds.length > 0) {
      // Show error alert for failed items
      createOperationErrorHandler("Restore")(failedItemIds, failedIdsWithStorageError);
    } else {
      // All items succeeded - show success alert
      showAlert({
        className: "file-recovery-alert",
        variant: "standard",
        icon: /*#__PURE__*/react["createElement"](checkmark_icloud, {
          height: 30,
          width: 43,
          layoutMode: "glyphBox"
        }),
        title: selectedItems.length === 1 ? Object(useLoc["a" /* getLoc */])("FileRecovery.Success.Title.One") : Object(useLoc["a" /* getLoc */])("FileRecovery.Success.Title.Many", {
          count: selectedItems.length
        }),
        description: selectedItems.length === 1 ? Object(useLoc["a" /* getLoc */])("FileRecovery.Success.Description.One") : Object(useLoc["a" /* getLoc */])("FileRecovery.Success.Description.Many"),
        buttons: [{
          title: Object(useLoc["a" /* getLoc */])("FileRecovery.Error.OK.Button"),
          action: "confirm",
          shouldCloseOnClick: true
        }],
        onActionSelected: () => {
          setItemSelectionMap({});
          refetch();
        }
      });
    }
  }, [createOperationErrorHandler, refetch, selectedItems.length, showAlert]);
  const restoreDeletedDriveItems = useRestoreDeletedDriveFiles(handleRestoreCompletion, createOperationErrorHandler("Restore"));

  // Progress popup content
  const progressPopupContent = react["useMemo"](() => {
    var _restoreDeletedDriveI;
    if (!showProgressPopup) return null;
    return /*#__PURE__*/react["createElement"](RestoreProgress, {
      text: Object(useLoc["b" /* getLocCount */])({
        one: "FileRecovery.Restoring.One",
        two: "FileRecovery.Restoring.Two",
        many: "FileRecovery.Restoring.Many"
      }, selectedItems.length),
      totalItemsCount: selectedItems.length,
      restoredItemsCount: ((_restoreDeletedDriveI = restoreDeletedDriveItems.restoredItemIds) === null || _restoreDeletedDriveI === void 0 ? void 0 : _restoreDeletedDriveI.length) || 0,
      onClose: () => {
        var _restoreDeletedDriveI2;
        restoreDeletedDriveItems.pause();
        // Show cancel confirmation using showAlert
        const restoredItemsCount = ((_restoreDeletedDriveI2 = restoreDeletedDriveItems.restoredItemIds) === null || _restoreDeletedDriveI2 === void 0 ? void 0 : _restoreDeletedDriveI2.length) || 0;
        const remainingItemsCount = selectedItems.length - restoredItemsCount;
        showAlert({
          className: "file-recovery-alert",
          icon: /*#__PURE__*/react["createElement"](exclamationmark_icloud, {
            height: 30,
            width: 43,
            layoutMode: "glyphBox"
          }),
          variant: "standard",
          title: Object(useLoc["a" /* getLoc */])("FileRecovery.Cancel.Title"),
          description: remainingItemsCount === 1 ? Object(useLoc["b" /* getLocCount */])({
            one: "FileRecovery.Cancel.Description.One",
            two: "FileRecovery.Cancel.Description.Two.OneRemaining",
            many: "FileRecovery.Cancel.Description.Many.OneRemaining"
          }, selectedItems.length, {
            restoredItems: restoredItemsCount.toString(),
            totalItems: selectedItems.length.toString(),
            remainingItems: remainingItemsCount.toString()
          }) : Object(useLoc["b" /* getLocCount */])({
            one: "FileRecovery.Cancel.Description.One",
            two: "FileRecovery.Cancel.Description.Two",
            many: "FileRecovery.Cancel.Description.Many"
          }, selectedItems.length, {
            restoredItems: restoredItemsCount.toString(),
            totalItems: selectedItems.length.toString(),
            remainingItems: remainingItemsCount.toString()
          }),
          buttons: [{
            title: Object(useLoc["a" /* getLoc */])("FileRecovery.Cancel.Cancel"),
            action: "confirm-cancel",
            shouldCloseOnClick: true
          }, {
            title: Object(useLoc["a" /* getLoc */])("FileRecovery.Cancel.Continue"),
            action: "continue",
            shouldCloseOnClick: true
          }],
          cancelAction: "confirm-cancel",
          defaultAction: "confirm-cancel",
          onActionSelected: cancelAction => {
            if (cancelAction === "confirm-cancel") {
              restoreDeletedDriveItems.cancel();
              setShowProgressPopup(false);
              setItemSelectionMap({});
              refetch();
            } else if (cancelAction === "continue") {
              restoreDeletedDriveItems.resume();
              // Loading popup will continue to show
            }
          }
        });
      }
    });
  }, [showProgressPopup, selectedItems.length, restoreDeletedDriveItems, showAlert, refetch]);

  // Purge progress popup content
  const purgeProgressPopupContent = react["useMemo"](() => {
    if (!showPurgeProgressPopup) return null;
    return /*#__PURE__*/react["createElement"](RestoreProgress, {
      text: Object(useLoc["b" /* getLocCount */])({
        one: "FileRecovery.Purging.One",
        two: "FileRecovery.Purging.Two",
        many: "FileRecovery.Purging.Many"
      }, selectedItems.length)
    });
  }, [showPurgeProgressPopup, selectedItems.length]);

  // Loading popup
  const [showProgressPopupFn, hideProgressPopupFn] = Object(usePopup["a" /* usePopup */])(progressPopupContent, {
    ariaLabel: Object(useLoc["a" /* getLoc */])("FileRecovery.Progress.PopupAriaLabel"),
    className: "restore-progress-popup"
  });

  // Purge progress popup
  const [showPurgeProgressPopupFn, hidePurgeProgressPopupFn] = Object(usePopup["a" /* usePopup */])(purgeProgressPopupContent, {
    ariaLabel: Object(useLoc["a" /* getLoc */])("FileRecovery.Progress.PopupAriaLabel"),
    className: "restore-progress-popup"
  });

  // Show/hide loading popup based on state
  react["useEffect"](() => {
    if (showProgressPopup) {
      showProgressPopupFn();
    } else {
      hideProgressPopupFn();
    }
  }, [showProgressPopup, showProgressPopupFn, hideProgressPopupFn]);

  // Show/hide purge progress popup based on state
  react["useEffect"](() => {
    if (showPurgeProgressPopup) {
      showPurgeProgressPopupFn();
    } else {
      hidePurgeProgressPopupFn();
    }
  }, [showPurgeProgressPopup, showPurgeProgressPopupFn, hidePurgeProgressPopupFn]);
  const handlePurgeSuccess = react["useCallback"](() => {
    setShowPurgeProgressPopup(false);
    showAlert({
      className: "file-recovery-alert",
      variant: "standard",
      icon: /*#__PURE__*/react["createElement"](checkmark_icloud, {
        height: 30,
        width: 43,
        layoutMode: "glyphBox"
      }),
      title: Object(useLoc["a" /* getLoc */])("FileRecovery.Purge.Success.Title"),
      description: Object(useLoc["a" /* getLoc */])("FileRecovery.Purge.Success.Description"),
      buttons: [{
        title: Object(useLoc["a" /* getLoc */])("FileRecovery.Error.OK.Button"),
        action: "confirm",
        shouldCloseOnClick: true
      }],
      onActionSelected: () => {
        setItemSelectionMap({});
        refetch();
      }
    });
  }, [showAlert, setItemSelectionMap, refetch, setShowPurgeProgressPopup]);
  const handlePurgeError = react["useCallback"](failedItemIds => {
    setShowPurgeProgressPopup(false);
    createOperationErrorHandler("Purge")(failedItemIds);
  }, [createOperationErrorHandler, setShowPurgeProgressPopup]);
  const purgeDeletedDriveItems = usePurgeDeletedDriveItems(handlePurgeSuccess, handlePurgeError);
  const restoreSelected = () => {
    if (!selectedItems.length) return;
    setShowProgressPopup(true);
    restoreDeletedDriveItems.mutate(selectedItems.map(item => item.itemid));
  };
  const purgeSelected = () => {
    if (!selectedItems) return;
    showAlert({
      title: Object(useLoc["a" /* getLoc */])("FileRecovery.PurgeConfirmation.Title"),
      // TODO: rdar://150399037 (File Recovery: UI Improvements)
      // Description may vary depending on the selection
      description: Object(useLoc["a" /* getLoc */])("FileRecovery.PurgeConfirmation.Description"),
      variant: "standard",
      icon: /*#__PURE__*/react["createElement"](exclamationmark_icloud, {
        height: 30,
        width: 43,
        layoutMode: "glyphBox"
      }),
      buttons: [{
        title: Object(useLoc["a" /* getLoc */])("FileRecovery.PurgeConfirmation.Cancel"),
        action: "cancel"
      }, {
        title: Object(useLoc["a" /* getLoc */])("FileRecovery.PurgeConfirmation.Purge"),
        destructive: true,
        action: "purge"
      }],
      defaultAction: "cancel",
      cancelAction: "cancel",
      onActionSelected: action => {
        if (action === "purge") {
          setShowPurgeProgressPopup(true);
          purgeDeletedDriveItems.mutate(selectedItems.map(item => ({
            docwsid: item.docwsid,
            zone: item.zone
          })));
        }
      }
    });
  };
  const modalTitle = Object(useLoc["a" /* getLoc */])("RecoveryPage.FilesRecoveryModalContent.Title");
  react["useLayoutEffect"](() => {
    const modalHeader = document.querySelector(".modal-header");
    const modalContentContainer = document.querySelector(".file-recovery-modal-content");
    const headerControlContainer = document.querySelector(".header-control-container");
    if (!modalHeader || !modalContentContainer || !headerControlContainer) {
      return;
    }
    const scrollHandler = () => {
      if (modalContentContainer.scrollTop > STICKY_HEADER_SCROLL_THRESHOLD) {
        modalHeader.classList.add("show");
        headerControlContainer.classList.add("show");
      } else {
        modalHeader.classList.remove("show");
        headerControlContainer.classList.remove("show");
      }
    };
    modalContentContainer.addEventListener("scroll", scrollHandler);
    return () => {
      modalContentContainer.removeEventListener("scroll", scrollHandler);
    };
  }, []);
  const hasItems = sortedItems && sortedItems.length > 0;
  const isLoadingInitial = (props.isLoading || props.hasNextPage) && !hasItems;
  const isComplete = !props.isLoading && !props.hasNextPage;
  return /*#__PURE__*/react["createElement"]("div", {
    className: "modal-container"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "header-control-container"
  }, /*#__PURE__*/react["createElement"](ControlButtons, {
    sortBy: sortBy,
    onSortChange: handleSortChange,
    disabled: props.isLoading || props.hasNextPage && !props.error,
    allItemsSelected: allItemsSelected,
    onSelectAll: handleSelectAll,
    deletedDriveItemsCount: (_props$deletedDriveIt = props.deletedDriveItems) === null || _props$deletedDriveIt === void 0 ? void 0 : _props$deletedDriveIt.length
  })), /*#__PURE__*/react["createElement"]("div", {
    className: "file-recovery-modal-content"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "modal-icon",
    "data-testid": "icon"
  }, icon), /*#__PURE__*/react["createElement"]("h2", {
    className: "modal-title",
    "data-testid": "title",
    id: TITLE_ID
  }, modalTitle), /*#__PURE__*/react["createElement"]("div", {
    className: "modal-description",
    "data-testid": "description"
  }, /*#__PURE__*/react["createElement"](InterpolatedString["a" /* InterpolatedString */], {
    interpolations: {
      "#{learnMoreLink}": /*#__PURE__*/react["createElement"](ExternalLink["a" /* ExternalLink */], {
        href: "https://support.apple.com/guide/icloud/recover-deleted-files-mmae56ea1ca5/icloud"
      }, Object(useLoc["a" /* getLoc */])("FileRecovery.ModalDescription.LearnMoreLink"))
    }
  }, Object(useLoc["a" /* getLoc */])("FileRecovery.ModalDescription"))), props.error && /*#__PURE__*/react["createElement"]("div", {
    className: "error-loading-all"
  }, /*#__PURE__*/react["createElement"](InterpolatedString["a" /* InterpolatedString */], {
    interpolations: {
      "#{tryAgainButton}": /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
        className: "reload-button",
        onActivate: refetch
      }, /*#__PURE__*/react["createElement"](arrow_clockwise["a" /* default */], {
        "aria-hidden": true,
        className: "arrow-clockwise",
        height: 20,
        width: 20,
        layoutMode: "glyphBox"
      }), Object(useLoc["a" /* getLoc */])("ErrorHomeTileContent.TryAgain"))
    }
  }, Object(useLoc["a" /* getLoc */])("FileRecovery.Error.LoadingAllFiles.Text"))), isLoadingInitial && !props.error && /*#__PURE__*/react["createElement"]("div", {
    className: "spinner initial-loading"
  }, /*#__PURE__*/react["createElement"](UIActivityIndicator["a" /* UIActivityIndicator */], {
    description: Object(useLoc["a" /* getLoc */])("FileRecovery.TombstonesLoading")
  })), isComplete && !hasItems && !props.error && /*#__PURE__*/react["createElement"]("div", {
    className: "file-count"
  }, Object(useLoc["a" /* getLoc */])("FileRecovery.NoFiles")), !props.error && hasItems && /*#__PURE__*/react["createElement"](react["Fragment"], null, props.hasNextPage && /*#__PURE__*/react["createElement"]("div", {
    className: "spinner"
  }, /*#__PURE__*/react["createElement"](UIActivityIndicator["a" /* UIActivityIndicator */], {
    description: Object(useLoc["a" /* getLoc */])("FileRecovery.TombstonesLoading"),
    size: 14
  }), Object(useLoc["a" /* getLoc */])("FileRecovery.TombstonesLoading")), /*#__PURE__*/react["createElement"]("div", {
    className: "file-count"
  }, selectedItems.length > 0 ? Object(useLoc["b" /* getLocCount */])({
    one: "FileRecovery.FileCount.One",
    two: "FileRecovery.FileCount.Two",
    many: "FileRecovery.FileCount.Many"
  }, selectedItems.length) : Object(useLoc["a" /* getLoc */])("FileRecovery.SelectFile")), /*#__PURE__*/react["createElement"](ControlButtons, {
    sortBy: sortBy,
    onSortChange: handleSortChange,
    disabled: props.isLoading || props.hasNextPage && !props.error,
    allItemsSelected: allItemsSelected,
    onSelectAll: handleSelectAll,
    deletedDriveItemsCount: (_props$deletedDriveIt2 = props.deletedDriveItems) === null || _props$deletedDriveIt2 === void 0 ? void 0 : _props$deletedDriveIt2.length
  }), /*#__PURE__*/react["createElement"](DeletedItemsList, {
    deletedDriveItems: sortedItems,
    itemSelectionMap: itemSelectionMap,
    setItemSelectionMap: setItemSelectionMap
  }))), /*#__PURE__*/react["createElement"]("div", {
    className: "actions-container"
  }, /*#__PURE__*/react["createElement"](UIOverlayActions["a" /* UIOverlayActions */], {
    mode: horizontalSizeClass
  }, /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
    onActivate: restoreSelected,
    variant: "push primary",
    disabled: !selectedItems.length
  }, selectedItems.length > 0 ? Object(useLoc["b" /* getLocCount */])({
    one: "FileRecovery.RestoreButton.One",
    two: "FileRecovery.RestoreButton.Two",
    many: "FileRecovery.RestoreButton.Many"
  }, selectedItems.length, {
    count: selectedItems.length.toString()
  }) : Object(useLoc["a" /* getLoc */])("FileRecovery.RestoreButton")), /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
    onActivate: purgeSelected,
    variant: "push secondary",
    disabled: !selectedItems.length
  }, selectedItems.length > 0 ? Object(useLoc["b" /* getLocCount */])({
    one: "FileRecovery.PurgeButton.One",
    two: "FileRecovery.PurgeButton.Two",
    many: "FileRecovery.PurgeButton.Many"
  }, selectedItems.length, {
    count: selectedItems.length.toString()
  }) : Object(useLoc["a" /* getLoc */])("FileRecovery.PurgeButton")))));
}
function useDriveFileRecoveryModal(props) {
  const show = useModalWithCloseButton(/*#__PURE__*/react["createElement"](DriveFileRecoveryModalContent, props), {
    ariaLabelledBy: TITLE_ID,
    className: "file-recovery-modal",
    modalHeader: Object(useLoc["a" /* getLoc */])("RecoveryPage.FilesRecoveryModalContent.Title")
  });
  return show;
}
function ControlButtons(props) {
  // Don't render if there are no items
  if (!props.deletedDriveItemsCount) {
    return null;
  }
  return /*#__PURE__*/react["createElement"]("div", {
    className: "controls-row",
    "data-testid": "controls-row"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "select-all-container"
  }, /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
    onActivate: props.onSelectAll,
    variant: "push",
    disabled: props.disabled
  }, props.allItemsSelected ? Object(useLoc["a" /* getLoc */])("FileRecovery.DeselectAll", {
    count: props.deletedDriveItemsCount
  }) : Object(useLoc["a" /* getLoc */])("FileRecovery.SelectAll", {
    count: props.deletedDriveItemsCount
  }))), /*#__PURE__*/react["createElement"]("div", {
    className: "sort-container"
  }, /*#__PURE__*/react["createElement"](UISelectButton["a" /* UISelectButton */], {
    displayForValue: value => {
      const sortLabels = {
        size: "FileRecovery.SortBySize",
        date: "FileRecovery.SortByDateDeleted",
        name: "FileRecovery.SortByName"
      };
      return sortLabels[value] ? Object(useLoc["a" /* getLoc */])(sortLabels[value]) : "";
    },
    variant: "transparent",
    shouldUseNativeControl: false,
    value: props.sortBy,
    chevronAsset: /*#__PURE__*/react["createElement"](react["Fragment"], null, /*#__PURE__*/react["createElement"](chevron_down["a" /* default */], {
      layoutMode: "glyphBox",
      desiredFontSize: 9
    }), "\xA0"),
    onStateChange: newState => {
      if (newState.value) {
        props.onSortChange(newState.value);
      }
    },
    disabled: props.disabled
  }, /*#__PURE__*/react["createElement"](UISelectButton["c" /* UISelectItem */], {
    value: "date",
    nativeText: Object(useLoc["a" /* getLoc */])("FileRecovery.DateDeleted")
  }, /*#__PURE__*/react["createElement"](CloudOSMenuItem["a" /* CloudOSMenuItem */], {
    startIcon: /*#__PURE__*/react["createElement"](CloudOSMenuItem["e" /* CloudOSMenuItemSymbolIcon */], {
      symbol: calendar["a" /* default */]
    })
  }, Object(useLoc["a" /* getLoc */])("FileRecovery.DateDeleted"))), /*#__PURE__*/react["createElement"](UISelectButton["c" /* UISelectItem */], {
    value: "name",
    nativeText: Object(useLoc["a" /* getLoc */])("FileRecovery.Name")
  }, /*#__PURE__*/react["createElement"](CloudOSMenuItem["a" /* CloudOSMenuItem */], {
    startIcon: /*#__PURE__*/react["createElement"](CloudOSMenuItem["e" /* CloudOSMenuItemSymbolIcon */], {
      symbol: text_alignleft["a" /* default */]
    })
  }, Object(useLoc["a" /* getLoc */])("FileRecovery.Name"))), /*#__PURE__*/react["createElement"](UISelectButton["c" /* UISelectItem */], {
    value: "size",
    nativeText: Object(useLoc["a" /* getLoc */])("FileRecovery.Size")
  }, /*#__PURE__*/react["createElement"](CloudOSMenuItem["a" /* CloudOSMenuItem */], {
    startIcon: /*#__PURE__*/react["createElement"](CloudOSMenuItem["e" /* CloudOSMenuItemSymbolIcon */], {
      symbol: externaldrive["a" /* default */]
    })
  }, Object(useLoc["a" /* getLoc */])("FileRecovery.Size"))))));
}
function DeletedItemsList(props) {
  var _props$deletedDriveIt3;
  const onCheckStateChange = (id, newState) => {
    props.setItemSelectionMap(current => {
      return {
        ...current,
        [id]: newState
      };
    });
  };
  if (props.deletedDriveItems.length === 0) return null;
  return /*#__PURE__*/react["createElement"]("div", {
    role: "table",
    className: "deleted-items-list"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "content"
  }, (_props$deletedDriveIt3 = props.deletedDriveItems) === null || _props$deletedDriveIt3 === void 0 ? void 0 : _props$deletedDriveIt3.map(item => /*#__PURE__*/react["createElement"](DeletedItemsListRow, {
    key: item.drivewsid,
    item: item,
    checked: !!props.itemSelectionMap[item.drivewsid],
    onCheckStateChange: newState => onCheckStateChange(item.drivewsid, newState)
  }))));
}
function RestoreProgress(props) {
  const {
    totalItemsCount,
    restoredItemsCount
  } = props;
  const hasProgressInfo = totalItemsCount !== undefined && restoredItemsCount !== undefined;
  const progressPercentage = hasProgressInfo ? Math.min(restoredItemsCount / totalItemsCount * 100, 100) : 0;
  const horizontalSizeClass = Object(esm_useHorizontalSizeClass["d" /* useHorizontalSizeClass */])();
  return /*#__PURE__*/react["createElement"]("div", {
    className: "restore-progress-container"
  }, /*#__PURE__*/react["createElement"](arrow_trianglehead_2_clockwise_rotate_90_icloud, {
    height: 30,
    width: 43,
    layoutMode: "glyphBox"
  }), /*#__PURE__*/react["createElement"]("h1", {
    className: "title"
  }, props.text), hasProgressInfo && /*#__PURE__*/react["createElement"](react["Fragment"], null, /*#__PURE__*/react["createElement"]("div", {
    className: "progress-container"
  }, /*#__PURE__*/react["createElement"](ProgressBar, {
    percentage: progressPercentage,
    ariaLabel: Object(useLoc["b" /* getLocCount */])({
      one: "FileRecovery.Progress.AriaLabel.One",
      two: "FileRecovery.Progress.AriaLabel.Two",
      many: "FileRecovery.Progress.AriaLabel.Many"
    }, restoredItemsCount, {
      restoredItems: restoredItemsCount.toString(),
      totalItems: totalItemsCount.toString()
    })
  })), /*#__PURE__*/react["createElement"]("div", {
    className: "progress-text"
  }, /*#__PURE__*/react["createElement"]("p", null, Object(useLoc["b" /* getLocCount */])({
    one: "FileRecovery.Progress.FilesRestored.One",
    two: "FileRecovery.Progress.FilesRestored.Two",
    many: "FileRecovery.Progress.FilesRestored.Many"
  }, restoredItemsCount, {
    restoredItems: restoredItemsCount.toString(),
    totalItems: totalItemsCount.toString()
  })), /*#__PURE__*/react["createElement"]("p", null, Object(useLoc["a" /* getLoc */])("FileRecovery.Progress.StayOnPage")))), props.onClose && /*#__PURE__*/react["createElement"]("div", {
    className: "cancel-button-container"
  }, /*#__PURE__*/react["createElement"](UIOverlayActions["a" /* UIOverlayActions */], {
    mode: horizontalSizeClass
  }, /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
    onActivate: props.onClose,
    variant: "push secondary"
  }, Object(useLoc["a" /* getLoc */])("FileRecovery.Cancel.Button")))));
}
function DeletedItemsErrorList(_ref) {
  let {
    items
  } = _ref;
  return /*#__PURE__*/react["createElement"]("div", null, /*#__PURE__*/react["createElement"]("div", {
    role: "table",
    className: "deleted-items-list"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "content"
  }, items === null || items === void 0 ? void 0 : items.map(item => /*#__PURE__*/react["createElement"](DeletedItemsListRow, {
    key: item.drivewsid,
    item: item
  })))));
}
function DeletedItemsListRow(_ref2) {
  var _item$extension;
  let {
    item,
    checked,
    onCheckStateChange
  } = _ref2;
  const isCompactScreen = Object(esm_useHorizontalSizeClass["d" /* useHorizontalSizeClass */])() === "compact";
  const pathSeparator = Object(useLoc["a" /* getLoc */])("FileRecovery.PathSeparator");
  const hierarchy = item.hierarchy.join(pathSeparator);
  return /*#__PURE__*/react["createElement"]("div", {
    key: item.drivewsid,
    role: "row"
  }, !!onCheckStateChange && /*#__PURE__*/react["createElement"]("div", {
    role: "cell",
    className: "checkbox"
  }, /*#__PURE__*/react["createElement"](UICheckbox["a" /* UICheckbox */], {
    checked: checked,
    onStateChange: newState => {
      onCheckStateChange(newState.checked ? item : undefined);
    }
  })), /*#__PURE__*/react["createElement"]("div", {
    role: "cell",
    className: "icon"
  }, /*#__PURE__*/react["createElement"](FileIcon["a" /* FileIcon */], {
    fileExtension: item.extension
  })), /*#__PURE__*/react["createElement"]("div", {
    className: "file-description"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "name-size-icon"
  }, /*#__PURE__*/react["createElement"]("div", {
    role: "cell",
    className: "name"
  }, item.fileName), /*#__PURE__*/react["createElement"]("div", {
    role: "cell",
    className: "size"
  }, Object(BytesToHumanizedFormat["a" /* bytesToHumanizedFormat */])(item.size))), /*#__PURE__*/react["createElement"]("div", {
    className: "file-details"
  }, /*#__PURE__*/react["createElement"]("div", {
    role: "cell",
    className: "metadata"
  }, /*#__PURE__*/react["createElement"]("span", null, Object(getDriveFileInfo["a" /* getDriveFileDescription */])((_item$extension = item.extension) !== null && _item$extension !== void 0 ? _item$extension : ""), !!onCheckStateChange && /*#__PURE__*/react["createElement"](react["Fragment"], null, Object(useLoc["a" /* getLoc */])("FileRecovery.Separator"), Object(useLoc["a" /* getLoc */])("FileRecovery.DeletedOnDate", {
    friendlyDate: Object(relativeDateTimeFormatter["a" /* descriptionForDateTime */])(item.deletionDate)
  })), !isCompactScreen && /*#__PURE__*/react["createElement"](react["Fragment"], null, Object(useLoc["a" /* getLoc */])("FileRecovery.Separator"), /*#__PURE__*/react["createElement"]("span", {
    className: classnames_default()("time-remaining", {
      warning: hasTimeRemainingWarning(item.deletionDate)
    })
  }, daysRemaining(item.deletionDate))))), isCompactScreen && /*#__PURE__*/react["createElement"]("div", {
    role: "cell",
    className: classnames_default()("metadata", {
      warning: hasTimeRemainingWarning(item.deletionDate)
    })
  }, daysRemaining(item.deletionDate))), /*#__PURE__*/react["createElement"]("div", {
    className: "hierarchy"
  }, /*#__PURE__*/react["createElement"]("div", {
    role: "cell",
    className: "hierarchy",
    title: hierarchy
  }, hierarchy))));
}
const HOUR = 1000 * 60 * 60;
const DAY = HOUR * 24;
const MAX_RECOVERY_TIME = DAY * 30;
const WARN_TIME_REMAINING_THRESHOLD = DAY * 3;
function timeRemaining(deletionDate) {
  const delta = Date.now() - deletionDate.getTime();
  return MAX_RECOVERY_TIME - delta;
}
function daysRemaining(deletionDate) {
  const time = timeRemaining(deletionDate);
  if (time > DAY) {
    return Object(useLoc["a" /* getLoc */])("FileRecovery.RemainingDays.MoreThanOne", {
      days: Math.ceil(time / DAY)
    });
  } else {
    return Object(useLoc["a" /* getLoc */])("FileRecovery.RemainingDays.One");
  }
}
function hasTimeRemainingWarning(deletionDate) {
  const time = timeRemaining(deletionDate);
  return time <= WARN_TIME_REMAINING_THRESHOLD;
}
// CONCATENATED MODULE: ./src/Pages/RecoveryPage/DriveFileRecovery/DriveFileRecoveryTile.tsx















const ICLOUD_DRIVE_PCS_IDENTIFIER = Object(PCSKeyIdentifier["a" /* toPCSKeyIdentifier */])("iclouddrive");
const DriveFileRecoveryTile = props => {
  const hasPCSKey = Object(useHasPCSKey["a" /* useHasPCSKey */])(ICLOUD_DRIVE_PCS_IDENTIFIER);
  const {
    deletedDriveItems = [],
    tileSize,
    error,
    hasNextPage
  } = props;
  const isLoading = props.isLoading && hasPCSKey;

  // Banner description text
  const headingText = Object(useLoc["a" /* getLoc */])("RecoveryPage.DriveItemsTile.Title");
  const totalNumDriveItems = deletedDriveItems.length;
  const numDriveItemsString = Object(useLoc["b" /* getLocCount */])({
    zero: "RecoveryPage.DriveItemsTile.TotalNumber.Zero",
    one: "RecoveryPage.DriveItemsTile.TotalNumber.One",
    two: "RecoveryPage.DriveItemsTile.TotalNumber.Two",
    many: "RecoveryPage.DriveItemsTile.TotalNumber.Many"
  }, totalNumDriveItems);
  const descriptionText = (() => {
    if (!hasPCSKey || error) return "";
    if (isLoading || hasNextPage) return Object(useLoc["a" /* getLoc */])("RecoveryPage.Loading");
    return numDriveItemsString;
  })();

  // Sort by descending date
  deletedDriveItems.sort((a, b) => b.deletionDate.getTime() - a.deletionDate.getTime());
  const contentListItems = Object(truncateList["a" /* truncateList */])(deletedDriveItems, driveItem => `${driveItem.fileName}.${driveItem.extension}`, MAX_TILE_LINES);
  const [recordLoad, recordFailedLoad] = Object(TelemetryProvider["b" /* useTelemetry */])("load", "iclouddrive-recovery-tile", {
    measureFromBaseline: true
  });
  react["useEffect"](() => {
    if (!props.isLoading) {
      if (props.isSuccess) {
        recordLoad();
      } else {
        recordFailedLoad();
      }
    }
  }, [props.isLoading, props.isSuccess, recordLoad, recordFailedLoad]);
  const showDataProtectionModal = Object(ADPModal["a" /* useShowADPModal */])();
  const showFileRecoveryModal = useDriveFileRecoveryModal(props);
  const handleTileClick = react["useCallback"](() => {
    if (!hasPCSKey) {
      showDataProtectionModal("iclouddrivefilerecovery", ICLOUD_DRIVE_PCS_IDENTIFIER, false, granted => {
        if (granted) {
          showFileRecoveryModal();
        }
      });
    } else {
      showFileRecoveryModal();
    }
  }, [hasPCSKey, showDataProtectionModal, showFileRecoveryModal]);
  return /*#__PURE__*/react["createElement"](Tile["b" /* Tile */], {
    tileIndex: -1,
    icon: /*#__PURE__*/react["createElement"](SquircledSymbol["a" /* SquircledSymbol */], {
      iconSize: 40,
      symbolSize: 20,
      symbol: doc["a" /* default */],
      backgroundColor: "#AF52DF"
    }),
    className: "driveitems-recovery-tile",
    heading: headingText,
    description: descriptionText,
    tileSize: tileSize,
    isLoading: isLoading,
    onTileClick: handleTileClick,
    error: error
  }, (!isLoading || hasNextPage) && hasPCSKey && !error && /*#__PURE__*/react["createElement"](StaticTileContent["a" /* StaticTileContent */], {
    contentListItems: contentListItems.length > 0 ? contentListItems : [Object(useLoc["a" /* getLoc */])("RecoveryPage.TileContent.NoItems")],
    contentDescriptionText: ""
  }), !isLoading && hasPCSKey && error && /*#__PURE__*/react["createElement"](ErrorHomeTileContent["a" /* ErrorHomeTileContent */], {
    refetch: props.refetch,
    showClouds: false
  }), !hasPCSKey && /*#__PURE__*/react["createElement"]("div", {
    className: "adp-locked-tile"
  }, /*#__PURE__*/react["createElement"](lock_rectangle_stack_fill["a" /* default */], {
    "aria-hidden": "true",
    className: "adp-icon",
    layoutMode: "glyphBox",
    desiredFontSize: 18
  }), /*#__PURE__*/react["createElement"]("div", {
    className: "title"
  }, Object(useLoc["a" /* getLoc */])("ADP.BookmarksRecoveryTile.Title"))));
};
// CONCATENATED MODULE: ./src/API/RecoveryInfo/useDeletedDriveFiles.ts








/**
 * Processes all documents and creates a deduplicated state
 * @param allDocuments - All documents from all pages
 * @returns New deduplication state with all unique items
 */
function processAllDocuments(allDocuments) {
  const itemsMap = new Map();

  // Process all documents and deduplicate by drivewsid
  for (const document of allDocuments) {
    const convertedItem = deletedDriveFileSchemaConverter(document);
    if (convertedItem && !itemsMap.has(convertedItem.drivewsid)) {
      itemsMap.set(convertedItem.drivewsid, convertedItem);
    }
  }
  return Array.from(itemsMap.values());
}

/**
 * Result interface that matches UseQueryResult but includes progressive loading information
 */

/**
 * Fetches deleted drive files with progressive loading - shows first page immediately,
 * then continues loading remaining pages in the background
 * @param limit - page size limit (default: 50)
 * @returns {UseDeletedDriveFilesResult} returns result with progressive loading capabilities
 */
function useDeletedDriveFiles() {
  var _infiniteData$pages$l, _infiniteData$pages;
  let limit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 50;
  // Track logging state
  const hasLoggedFetchStartRef = react["useRef"](false);
  const hasLoggedSuccessRef = react["useRef"](false);
  const infiniteQueryResult = Object(useAPIQuery["b" /* useInfiniteAPIQuery */])({
    endpoint: paths["b" /* EndpointName */].enumerateDeletedDriveFiles,
    fetchProvider: request => _ref => {
      let {
        pageParam
      } = _ref;
      return fetchDeletedDriveFilesPage(request, pageParam, limit);
    },
    getNextPageParam: lastPage => {
      // Continue if there's a continuation marker and status indicates more data
      if (lastPage.continuationMarker && lastPage.status === "MORE_AVAILABLE") {
        return lastPage.continuationMarker;
      }
      return undefined;
    },
    cacheTime: 0,
    onError: error => {
      // Log fetch failure when error occurs
      if (hasLoggedFetchStartRef.current) {
        Stat["a" /* Stat */].withEventAndLabel("workflow", "filerecovery.fetchAllRecoverableDocuments.failure", {
          statCategory: TelemetryCategory["a" /* TelemetryCategory */].SESSION,
          errorType: error.name,
          errorMessage: error.message
        }).record();
        hasLoggedFetchStartRef.current = false; // Reset for next fetch cycle
      }
    },
    onSuccess: data => {
      // Log success only when all pages are loaded (no more pages available)
      const lastPage = data.pages[data.pages.length - 1];
      const hasMorePages = (lastPage === null || lastPage === void 0 ? void 0 : lastPage.continuationMarker) && (lastPage === null || lastPage === void 0 ? void 0 : lastPage.status) === "MORE_AVAILABLE";
      if (!hasMorePages && hasLoggedFetchStartRef.current && !hasLoggedSuccessRef.current) {
        // Process all documents to get the count
        const allDocuments = data.pages.flatMap(page => page.documents);
        const processedItems = processAllDocuments(allDocuments);
        Stat["a" /* Stat */].withEventAndLabel("workflow", "filerecovery.fetchAllRecoverableDocuments.success", {
          statCategory: TelemetryCategory["a" /* TelemetryCategory */].SESSION,
          itemsCountMagnitude: orderOfMagnitude(processedItems.length)
        }).record();
        hasLoggedFetchStartRef.current = false; // Reset for next fetch cycle
        hasLoggedSuccessRef.current = true; // Mark success as logged
      }
    }
  });
  const {
    data: infiniteData,
    error,
    isLoading,
    isError,
    isFetching,
    isFetchingNextPage,
    hasNextPage,
    fetchNextPage
  } = infiniteQueryResult;

  // Directly memoize the final flattened data to avoid intermediate state
  const flattenedData = react["useMemo"](() => {
    if (!(infiniteData !== null && infiniteData !== void 0 && infiniteData.pages) || infiniteData.pages.length === 0) {
      return undefined;
    }

    // Process all documents from all pages directly
    const allDocuments = infiniteData.pages.flatMap(page => page.documents);

    // Process and deduplicate in one step
    return processAllDocuments(allDocuments);
  }, [infiniteData === null || infiniteData === void 0 ? void 0 : infiniteData.pages]);

  // Auto-fetch next page when previous page loads successfully
  react["useEffect"](() => {
    if (hasNextPage && !isFetchingNextPage && !error && !isLoading) {
      const timeoutId = setTimeout(() => {
        fetchNextPage();
      }, 100); // Small delay prevents immediate double call

      return () => clearTimeout(timeoutId);
    }
    return undefined;
  }, [hasNextPage, isFetchingNextPage, error, isLoading, fetchNextPage]);

  // Handle fetch start logging and success flag reset
  react["useEffect"](() => {
    if (isLoading || isFetching) {
      // Reset success flag when a new fetch cycle starts
      if (hasLoggedSuccessRef.current) {
        hasLoggedSuccessRef.current = false;
      }

      // Log fetch start (only once per fetch cycle)
      if (!hasLoggedFetchStartRef.current) {
        Stat["a" /* Stat */].withEventAndLabel("workflow", "filerecovery.fetchAllRecoverableDocuments.start", {
          statCategory: TelemetryCategory["a" /* TelemetryCategory */].SESSION
        }).record();
        hasLoggedFetchStartRef.current = true;
      }
    }
  }, [isLoading, isFetching]);

  // Calculate progressive loading metrics
  const totalPages = (_infiniteData$pages$l = infiniteData === null || infiniteData === void 0 || (_infiniteData$pages = infiniteData.pages) === null || _infiniteData$pages === void 0 ? void 0 : _infiniteData$pages.length) !== null && _infiniteData$pages$l !== void 0 ? _infiniteData$pages$l : 0;
  const currentPage = totalPages;

  // Transform infinite query result to match UseQueryResult interface
  const result = {
    data: flattenedData,
    error,
    isError,
    isLoading,
    isFetching,
    isRefetching: infiniteQueryResult.isRefetching,
    isSuccess: !!flattenedData && !error,
    isIdle: infiniteQueryResult.isIdle,
    status: infiniteQueryResult.status,
    reset: () => {
      infiniteQueryResult.remove();
      infiniteQueryResult.refetch();
    },
    // Progressive loading specific properties
    isLoadingMore: isFetchingNextPage,
    hasNextPage: !!hasNextPage,
    totalPages,
    currentPage
  };
  return result;
}
// CONCATENATED MODULE: ./src/Pages/RecoveryPage/RecoveryPage.tsx
























const MAX_TILE_LINES = 6;
function BoundBookmarksRecoveryTile(props) {
  const hasPCSKey = Object(useHasPCSKey["a" /* useHasPCSKey */])(BookmarksRecoveryTile["b" /* bookmarksPCSKeyIdentifier */]);
  const [deletedBookmarks, bookmarksLoading] = useDeletedBookmarks();
  const loading = hasPCSKey && bookmarksLoading;
  const [recordLoadSuccess] = Object(TelemetryProvider["b" /* useTelemetry */])("load", "bookmarks-recovery-tile", {
    measureFromBaseline: true
  });
  react["useEffect"](() => {
    if (!loading) {
      recordLoadSuccess();
    }
  }, [loading, recordLoadSuccess]);
  return /*#__PURE__*/react["createElement"](BookmarksRecoveryTile["a" /* BookmarksRecoveryTile */], {
    isLoading: loading,
    isLocked: !hasPCSKey,
    deletedBookmarks: deletedBookmarks !== null && deletedBookmarks !== void 0 ? deletedBookmarks : [],
    tileSize: Tile["c" /* TileSize */].Small,
    maxTileLines: MAX_TILE_LINES,
    onTileClick: props.onBookmarksRecoveryModalClicked
  });
}
const RecoveryPage = props => {
  var _configurationsSignal;
  const className = classnames_default()("recovery-page", props.className);
  const title = Object(useLoc["a" /* getLoc */])("RecoveryPage.Title");
  const description = Object(useLoc["a" /* getLoc */])("RecoveryPage.Details.Standard");
  const deletedDriveFiles = useDeletedDriveFiles();
  const recordRecoveryStats = RecoveryPage_useRecordRecoveryStats("bookmark");
  const showBookmarksRecoveryModal = useModalWithCloseButton(/*#__PURE__*/react["createElement"](BookmarksRecoveryModal, null), {
    className: "bookmarks-recovery-modal",
    paneType: UIPaneContainer["d" /* PaneType */].Modal,
    ariaLabelledBy: "bookmarks-recovery-modal-title-id"
  });
  const showDataProtectionModal = Object(ADPModal["a" /* useShowADPModal */])();
  const maybeShowBookmarksRecoveryModal = react["useCallback"](() => {
    if (!PCSKeyManager["a" /* PCSKeyManager */].sharedInstance.hasPCSKey(BookmarksRecoveryTile["b" /* bookmarksPCSKeyIdentifier */])) {
      showDataProtectionModal("bookmarks", BookmarksRecoveryTile["b" /* bookmarksPCSKeyIdentifier */], false, granted => {
        if (granted) {
          showBookmarksRecoveryModal();
          recordRecoveryStats.recordOpenedRecovery();
        }
      });
    } else {
      showBookmarksRecoveryModal();
      recordRecoveryStats.recordOpenedRecovery();
    }
  }, [showBookmarksRecoveryModal, showDataProtectionModal, recordRecoveryStats]);
  const isNotLite = Object(useICloudPlan["c" /* useICloudPlanType */])() !== useICloudPlan["a" /* UserPlan */].Lite;
  const safariBookmarksHasMigratedToCloudKit = (_configurationsSignal = Configurations["c" /* configurationsSignal */].value) === null || _configurationsSignal === void 0 ? void 0 : _configurationsSignal.safariBookmarksHasMigratedToCloudKit;
  return /*#__PURE__*/react["createElement"](TelemetryProvider["a" /* TelemetryProvider */], {
    scope: "data-recovery-page",
    baseline: true
  }, /*#__PURE__*/react["createElement"]("div", {
    className: className
  }, /*#__PURE__*/react["createElement"](TopNavLinks, {
    current: LegacyNavLinks["b" /* LegacyNavRoutes */].recovery
  }), /*#__PURE__*/react["createElement"](PageHeader, {
    title: title,
    description: description
  }), /*#__PURE__*/react["createElement"]("div", {
    className: "application-content"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "recovery-page-tiles"
  }, /*#__PURE__*/react["createElement"](DriveFileRecoveryTile, {
    error: deletedDriveFiles.error,
    isLoading: deletedDriveFiles.isLoading || deletedDriveFiles.isRefetching,
    isLoadingMore: deletedDriveFiles.isLoadingMore,
    hasNextPage: deletedDriveFiles.hasNextPage,
    isSuccess: deletedDriveFiles.isSuccess,
    deletedDriveItems: deletedDriveFiles.data,
    refetch: deletedDriveFiles.reset,
    tileSize: Tile["c" /* TileSize */].Small
  }), isNotLite && safariBookmarksHasMigratedToCloudKit && /*#__PURE__*/react["createElement"](BoundBookmarksRecoveryTile, {
    onBookmarksRecoveryModalClicked: maybeShowBookmarksRecoveryModal
  }), /*#__PURE__*/react["createElement"](ContactArchivesRecoveryTileWrapper, null), isNotLite && /*#__PURE__*/react["createElement"](CalendarArchivesRecoveryTileWrapper, null)))));
};
// CONCATENATED MODULE: ./src/Pages/ICloudPlusPage/ICloudPlusPage.scss
// extracted by mini-css-extract-plugin

// EXTERNAL MODULE: ./src/Components/ICloudPlus/HideMyEmail/HideMyEmailTileWrapper/HideMyEmailTileWrapper.tsx + 4 modules
var HideMyEmailTileWrapper = __webpack_require__(2187);

// EXTERNAL MODULE: ./src/Components/ICloudPlus/CustomEmailDomain/CustomEmailDomainTileWrapper/CustomEmailDomainTileWrapper.tsx + 3 modules
var CustomEmailDomainTileWrapper = __webpack_require__(2202);

// EXTERNAL MODULE: ./src/Components/ContinueOnDevice/ContinueOnDevice.tsx + 4 modules
var ContinueOnDevice = __webpack_require__(2184);

// CONCATENATED MODULE: ./src/Pages/ICloudPlusPage/iCloudPlusFeatureInfoModal/FeatureInfoModalContent.scss
// extracted by mini-css-extract-plugin

// CONCATENATED MODULE: ./src/Pages/ICloudPlusPage/iCloudPlusFeatureInfoModal/FeatureInfoModalContent.tsx





const FeatureInfoModalContent = _ref => {
  let {
    icon,
    modalTitle,
    modalSubTitle,
    modalSectionTitle,
    modalDescription,
    learnMoreLink,
    titleId,
    feature,
    variant
  } = _ref;
  const learnMoreText = Object(useLoc["a" /* getLoc */])("ICloudPlusPage.ModalContent.LearnMore");
  return /*#__PURE__*/react["createElement"]("div", {
    className: "modal-content feature-info"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "modal-icon",
    "data-testid": "icon"
  }, icon), /*#__PURE__*/react["createElement"]("h2", {
    className: "modal-title",
    "data-testid": "title",
    id: titleId
  }, modalTitle), /*#__PURE__*/react["createElement"]("div", {
    className: "modal-subtitle",
    "data-testid": "subtitle"
  }, modalSubTitle), modalSectionTitle && /*#__PURE__*/react["createElement"]("h3", {
    className: "modal-section-title",
    "data-testid": "sectiontitle"
  }, modalSectionTitle), /*#__PURE__*/react["createElement"]("div", {
    className: "modal-section-description",
    "data-testid": "description"
  }, modalDescription, " ", /*#__PURE__*/react["createElement"](ExternalLink["a" /* ExternalLink */], {
    href: learnMoreLink
  }, learnMoreText)), /*#__PURE__*/react["createElement"](ContinueOnDevice["b" /* ContinueOnDevice */], {
    feature: feature,
    variant: variant
  }));
};
// EXTERNAL MODULE: ./src/API/ContinueOnDevice/continueOnDevice.endpoint.ts + 1 modules
var continueOnDevice_endpoint = __webpack_require__(2315);

// CONCATENATED MODULE: ./src/Pages/ICloudPlusPage/iCloudPlusFeatureInfoModal/usePrivateRelayModal.tsx








const usePrivateRelayModal_MODAL_TITLE_ID = "private-relay-modal-title";
const PrivateRelayModalContent = () => {
  const icon = /*#__PURE__*/react["createElement"](AppIcon["a" /* AppIcon */], {
    iconSize: 54,
    applicationIdentifier: "privaterelay"
  });
  const modalTitle = Object(useLoc["a" /* getLoc */])("ICloudPlusPage.PrivateRelayModalContent.Title");
  const modalSubTitle = Object(useLoc["a" /* getLoc */])("ICloudPlusPage.PrivateRelayModalContent.SubTitle");
  const modalDescription = Object(useLoc["a" /* getLoc */])("ICloudPlusPage.PrivateRelayModalContent.Section.Description");
  const learnMoreLink = Object(getSupportLink["a" /* getSupportLink */])("privateRelay");
  return /*#__PURE__*/react["createElement"](FeatureInfoModalContent, {
    icon: icon,
    modalTitle: modalTitle,
    modalSubTitle: modalSubTitle,
    modalDescription: modalDescription,
    learnMoreLink: learnMoreLink,
    titleId: usePrivateRelayModal_MODAL_TITLE_ID,
    feature: continueOnDevice_endpoint["a" /* CONTINUE_ON_DEVICE_FEATURE */].PRIVATE_RELAY,
    variant: ContinueOnDevice["a" /* CONTINUE_ON_DEVICE_VARIANT */].PRIVATE_RELAY
  });
};
function useShowPrivateRelayModal() {
  const showModal = useModalWithCloseButton(/*#__PURE__*/react["createElement"](PrivateRelayModalContent, null), {
    ariaLabelledBy: usePrivateRelayModal_MODAL_TITLE_ID
  });
  return showModal;
}
// CONCATENATED MODULE: ./src/Components/ICloudPlus/PrivateRelay/PrivateRelayTile/PrivateRelayTile.scss
// extracted by mini-css-extract-plugin

// CONCATENATED MODULE: ./src/Components/ICloudPlus/PrivateRelay/PrivateRelayTile/PrivateRelayTile.tsx







const PrivateRelayTile = props => {
  const {
    tileSize,
    isLoading,
    tileIndex,
    ariaLevel = 3
  } = props;
  const heading = Object(useLoc["a" /* getLoc */])("PrivateRelayTile.Heading");
  const descriptionText = Object(useLoc["a" /* getLoc */])("PrivateRelayTile.Description");
  const contentDescriptionText = Object(useLoc["a" /* getLoc */])("PrivateRelayTile.Content.Description");
  const openPrivateRelayModal = useShowPrivateRelayModal();
  return /*#__PURE__*/react["createElement"](Tile["b" /* Tile */], {
    tileIndex: tileIndex,
    icon: /*#__PURE__*/react["createElement"](AppIcon["a" /* AppIcon */], {
      iconSize: 40,
      applicationIdentifier: "privaterelay"
    }),
    className: "private-relay-tile",
    heading: heading,
    description: descriptionText,
    isLoading: isLoading,
    tileSize: tileSize,
    onTileClick: () => openPrivateRelayModal(),
    ariaLevel: ariaLevel
  }, /*#__PURE__*/react["createElement"](StaticTileContent["a" /* StaticTileContent */], {
    contentDescriptionText: contentDescriptionText,
    continueOnDevice: true
  }));
};
// CONCATENATED MODULE: ./src/Components/ICloudPlus/PrivateRelay/PrivateRelayTileWrapper/PrivateRelayTileWrapper.tsx



const PrivateRelayTileWrapper = () => {
  return /*#__PURE__*/react["createElement"](PrivateRelayTile, {
    tileIndex: 0,
    error: null,
    isLoading: false,
    isSuccess: true,
    refetch: () => {},
    tileSize: Tile["c" /* TileSize */].Small
  });
};
// CONCATENATED MODULE: ./src/API/Subscriptions/subscriptions.converter.ts
function listSubscriptionFeaturesSchemaConverter(response) {
  return Object.fromEntries(response.filter(feature => feature.canUse).map(feature => [feature.featureKey, feature]));
}
// EXTERNAL MODULE: ./src/API/Subscriptions/subscriptions.endpoint.ts + 1 modules
var subscriptions_endpoint = __webpack_require__(2333);

// CONCATENATED MODULE: ./src/API/Subscriptions/useSubscriptionFeatures.ts





/**
 * Fetches pricing plan details about your iCloud subscription
 * @returns `react-query` `useQuery` results
 */
function useSubscriptionFeatures() {
  const user = Object(AuthenticationHook["b" /* useCloudOSUser */])();
  return Object(useAPIQuery["a" /* useAPIQuery */])({
    endpoint: paths["b" /* EndpointName */].listSubscriptionFeatures,
    fetchProvider: () => async () => {
      var _user$details;
      const subscriptionFeatures = await Object(subscriptions_endpoint["c" /* listSubscriptionFeatures */])(user === null || user === void 0 || (_user$details = user.details) === null || _user$details === void 0 ? void 0 : _user$details.dsid);
      return listSubscriptionFeaturesSchemaConverter(subscriptionFeatures);
    }
  });
}
// CONCATENATED MODULE: ./src/API/Subscriptions/useNumberOfSupportedCameras.ts

function useNumberOfSupportedCameras() {
  const {
    data: features
  } = useSubscriptionFeatures();
  if (!features || !features["home.cameras"]) {
    // Default to 0
    return 0;
  }
  const count = features["home.cameras"].limit;
  if (count === undefined) {
    return "unlimited";
  }
  return count;
}
// CONCATENATED MODULE: ./src/Pages/ICloudPlusPage/iCloudPlusFeatureInfoModal/useHomeKitSecureVideoModal.tsx








const useHomeKitSecureVideoModal_MODAL_TITLE_ID = "homekit-secure-video-modal-title";
const HomeKitSecureVideoModalContent = _ref => {
  let {
    numberOfCamsSupported
  } = _ref;
  const icon = /*#__PURE__*/react["createElement"](AppIcon["a" /* AppIcon */], {
    iconSize: 54,
    applicationIdentifier: "homekit"
  });
  const modalTitle = Object(useLoc["a" /* getLoc */])("ICloudPlusPage.HomeKitSecureVideoModalContent.Title");
  const modalSubTitle = (() => {
    if (numberOfCamsSupported === "unlimited") {
      return Object(useLoc["a" /* getLoc */])("ICloudPlusPage.HomeKitSecureVideoModalContent.SubTitle.Unlimited");
    } else {
      return Object(useLoc["b" /* getLocCount */])({
        one: "ICloudPlusPage.HomeKitSecureVideoModalContent.SubTitle.One",
        two: "ICloudPlusPage.HomeKitSecureVideoModalContent.SubTitle.Two",
        many: "ICloudPlusPage.HomeKitSecureVideoModalContent.SubTitle.Many"
      }, numberOfCamsSupported);
    }
  })();
  const modalDescription = Object(useLoc["a" /* getLoc */])("ICloudPlusPage.HomeKitSecureVideoModalContent.Section.Description");
  const learnMoreLink = Object(getSupportLink["a" /* getSupportLink */])("homeKitSecureVideo");
  return /*#__PURE__*/react["createElement"](FeatureInfoModalContent, {
    icon: icon,
    modalTitle: modalTitle,
    modalSubTitle: modalSubTitle,
    modalDescription: modalDescription,
    learnMoreLink: learnMoreLink,
    titleId: useHomeKitSecureVideoModal_MODAL_TITLE_ID,
    feature: continueOnDevice_endpoint["a" /* CONTINUE_ON_DEVICE_FEATURE */].HOMEKIT_SECURE_VIDEO,
    variant: ContinueOnDevice["a" /* CONTINUE_ON_DEVICE_VARIANT */].HOMEKIT_SECURE_VIDEO
  });
};
function useHomeKitSecureVideoModal(contentProps) {
  const showModal = useModalWithCloseButton(/*#__PURE__*/react["createElement"](HomeKitSecureVideoModalContent, contentProps), {
    ariaLabelledBy: useHomeKitSecureVideoModal_MODAL_TITLE_ID
  });
  return showModal;
}
// CONCATENATED MODULE: ./src/Components/ICloudPlus/HomeKitSecureVideo/HomeKitSecureVideoTile/HomeKitSecureVideoTile.scss
// extracted by mini-css-extract-plugin

// CONCATENATED MODULE: ./src/Components/ICloudPlus/HomeKitSecureVideo/HomeKitSecureVideoTile/HomeKitSecureVideoTile.tsx







const HomeKitSecureVideoTile = props => {
  const {
    tileSize,
    isLoading,
    tileIndex,
    numberOfCamsSupported,
    ariaLevel = 3
  } = props;
  const heading = Object(useLoc["a" /* getLoc */])("HomeKitSecureVideoTile.Heading");
  const descriptionText = (() => {
    if (numberOfCamsSupported === "unlimited") {
      return Object(useLoc["a" /* getLoc */])("HomeKitSecureVideoTile.Description.Unlimited");
    } else {
      return Object(useLoc["b" /* getLocCount */])({
        one: "HomeKitSecureVideoTile.Description.One",
        two: "HomeKitSecureVideoTile.Description.Two",
        many: "HomeKitSecureVideoTile.Description.Many"
      }, numberOfCamsSupported);
    }
  })();
  const contentDescriptionText = Object(useLoc["a" /* getLoc */])("HomeKitSecureVideoTile.Content.Description");
  const openHomeKitSecureVideoModal = useHomeKitSecureVideoModal({
    numberOfCamsSupported
  });
  return /*#__PURE__*/react["createElement"](Tile["b" /* Tile */], {
    tileIndex: tileIndex,
    icon: /*#__PURE__*/react["createElement"](AppIcon["a" /* AppIcon */], {
      iconSize: 40,
      applicationIdentifier: "homekit"
    }),
    className: "home-kit-secure-video-tile",
    heading: heading,
    description: descriptionText,
    isLoading: isLoading,
    tileSize: tileSize,
    ariaLevel: ariaLevel,
    onTileClick: () => openHomeKitSecureVideoModal()
  }, /*#__PURE__*/react["createElement"](StaticTileContent["a" /* StaticTileContent */], {
    contentDescriptionText: contentDescriptionText,
    continueOnDevice: true
  }));
};
// CONCATENATED MODULE: ./src/Components/ICloudPlus/HomeKitSecureVideo/HomeKitSecureVideoTileWrapper/HomeKitSecureVideoTileWrapper.tsx




const HomeKitSecureVideoTileWrapper = () => {
  const camsSupported = useNumberOfSupportedCameras();
  return /*#__PURE__*/react["createElement"](HomeKitSecureVideoTile, {
    tileIndex: 0,
    error: null,
    isLoading: false,
    isSuccess: true,
    refetch: () => {},
    tileSize: Tile["c" /* TileSize */].Small,
    numberOfCamsSupported: camsSupported
  });
};
// EXTERNAL MODULE: ./src/API/Family/useFamilyDetails.ts + 2 modules
var useFamilyDetails = __webpack_require__(2234);

// CONCATENATED MODULE: ./src/Pages/ICloudPlusPage/iCloudPlusFeatureInfoModal/useFamilySharingModal.tsx









const useFamilySharingModal_MODAL_TITLE_ID = "family-sharing-modal-title";
const FamilySharingModalContent = _ref => {
  let {
    role,
    ownerShortName,
    ownerLongName
  } = _ref;
  const isMember = role === useFamilyDetails["a" /* FamilyRole */].NonOrganizerMember;
  const isOrganizerWithNoMember = role === useFamilyDetails["a" /* FamilyRole */].OrganizerWithNoMember;
  const icon = /*#__PURE__*/react["createElement"](AppIcon["a" /* AppIcon */], {
    applicationIdentifier: "plan",
    iconSize: 54
  });
  const modalTitle = Object(useLoc["a" /* getLoc */])("ICloudPlusPage.FamilySharingModalContent.Title");
  const modalSubTitle = isMember ? Object(useLoc["a" /* getLoc */])("ICloudPlusPage.FamilySharingModalContent.SubTitle.Sharing", {
    name: ownerShortName
  }) : Object(useLoc["a" /* getLoc */])("ICloudPlusPage.FamilySharingModalContent.SubTitle.NotSharing");
  const modalDescription = isMember ? Object(useLoc["a" /* getLoc */])("ICloudPlusPage.FamilySharingModalContent.Section.Description.Sharing", {
    name: ownerLongName
  }) : Object(useLoc["a" /* getLoc */])("ICloudPlusPage.FamilySharingModalContent.Section.Description.NotSharing");
  const learnMoreLink = Object(getSupportLink["a" /* getSupportLink */])("familySharing");
  if (isMember) return /*#__PURE__*/react["createElement"](FeatureInfoModalContent, {
    icon: icon,
    modalTitle: modalTitle,
    modalSubTitle: modalSubTitle,
    modalDescription: modalDescription,
    learnMoreLink: learnMoreLink,
    titleId: useFamilySharingModal_MODAL_TITLE_ID,
    feature: continueOnDevice_endpoint["a" /* CONTINUE_ON_DEVICE_FEATURE */].FAMILY_SHARING,
    variant: ContinueOnDevice["a" /* CONTINUE_ON_DEVICE_VARIANT */].FAMILY_SHARING_MEMBER
  });
  if (isOrganizerWithNoMember) return /*#__PURE__*/react["createElement"](FeatureInfoModalContent, {
    icon: icon,
    modalTitle: modalTitle,
    modalSubTitle: modalSubTitle,
    modalDescription: modalDescription,
    learnMoreLink: learnMoreLink,
    titleId: useFamilySharingModal_MODAL_TITLE_ID,
    feature: continueOnDevice_endpoint["a" /* CONTINUE_ON_DEVICE_FEATURE */].FAMILY_SHARING,
    variant: ContinueOnDevice["a" /* CONTINUE_ON_DEVICE_VARIANT */].FAMILY_SHARING_ORGANIZER_NO_FAMILY
  });
  return /*#__PURE__*/react["createElement"](FeatureInfoModalContent, {
    icon: icon,
    modalTitle: modalTitle,
    modalSubTitle: modalSubTitle,
    modalDescription: modalDescription,
    learnMoreLink: learnMoreLink,
    titleId: useFamilySharingModal_MODAL_TITLE_ID,
    feature: continueOnDevice_endpoint["a" /* CONTINUE_ON_DEVICE_FEATURE */].FAMILY_SHARING,
    variant: ContinueOnDevice["a" /* CONTINUE_ON_DEVICE_VARIANT */].FAMILY_SHARING_ORGANIZER
  });
};
function useFamilySharingModal(contentProps) {
  const showModal = useShowModalWithCloseButton();
  return () => showModal(/*#__PURE__*/react["createElement"](FamilySharingModalContent, contentProps), {
    ariaLabelledBy: useFamilySharingModal_MODAL_TITLE_ID
  });
}
// CONCATENATED MODULE: ./src/Components/ICloudPlus/FamilySharing/FamilySharingTile/FamilySharingTile.scss
// extracted by mini-css-extract-plugin

// CONCATENATED MODULE: ./src/Components/ICloudPlus/FamilySharing/FamilySharingTile/FamilySharingTile.tsx










const FamilySharingTile = props => {
  const {
    tileSize,
    tileIndex,
    error,
    isLoading,
    role,
    organizer,
    ariaLevel = 3
  } = props;

  // Show error state if familyRole or familyOrganizerResult result is not ok
  const shouldShowError = error !== null;
  const isMember = role === useFamilyDetails["a" /* FamilyRole */].NonOrganizerMember;
  const ownerShortName = Object(getUserDisplayName["a" /* getUserDisplayName */])(organizer.firstName, organizer.lastName);
  const ownerLongName = Object(getUserDisplayName["a" /* getUserDisplayName */])(organizer.firstName, organizer.lastName, true);
  const heading = Object(useLoc["a" /* getLoc */])("FamilySharingTile.Heading");
  const descriptionText = isMember ? Object(useLoc["a" /* getLoc */])("FamilySharingTile.Description.Member", {
    name: ownerShortName
  }) : Object(useLoc["a" /* getLoc */])("FamilySharingTile.Description.Five");
  const contentDescriptionText = isMember ? Object(useLoc["a" /* getLoc */])("FamilySharingTile.Content.Description.Member", {
    name: ownerLongName
  }) : Object(useLoc["a" /* getLoc */])("FamilySharingTile.Content.Description");
  const openFamilySharingModal = useFamilySharingModal({
    role,
    ownerShortName,
    ownerLongName
  });
  return /*#__PURE__*/react["createElement"](Tile["b" /* Tile */], {
    tileIndex: tileIndex,
    icon: /*#__PURE__*/react["createElement"](AppIcon["a" /* AppIcon */], {
      applicationIdentifier: "plan",
      iconSize: 40
    }),
    className: "family-sharing-tile",
    heading: heading,
    description: descriptionText,
    isLoading: isLoading,
    tileSize: tileSize,
    onTileClick: () => openFamilySharingModal(),
    ariaLevel: ariaLevel,
    error: error
  }, shouldShowError ? /*#__PURE__*/react["createElement"](ErrorHomeTileContent["a" /* ErrorHomeTileContent */], {
    refetch: props.refetch,
    showClouds: false
  }) : /*#__PURE__*/react["createElement"](StaticTileContent["a" /* StaticTileContent */], {
    contentDescriptionText: contentDescriptionText,
    continueOnDevice: true
  }));
};
// CONCATENATED MODULE: ./src/Components/ICloudPlus/FamilySharing/FamilySharingTileWrapper/FamilySharingTileWrapper.tsx




const FamilySharingTileWrapper = () => {
  const {
    result: familyRole,
    refetch
  } = Object(useFamilyDetails["c" /* useFamilyRole */])();
  const familyOrganizerResult = Object(useFamilyDetails["b" /* useFamilyOrganizer */])();
  const isLoading = familyRole.ok && familyRole.value === undefined || familyOrganizerResult.ok && familyOrganizerResult.value === undefined;
  // The tile is in success state if
  // 1. fetching family role and fetching family organizer both are successful
  // 2. family role is successfully fetched, and user is not in a family
  const isSuccess = familyRole.ok && (familyRole.value === useFamilyDetails["a" /* FamilyRole */].None || familyOrganizerResult.ok);
  const error = !isSuccess ? new Error("Missing family data") : null;
  const role = familyRole.ok && familyRole.value ? familyRole.value : useFamilyDetails["a" /* FamilyRole */].Organizer;
  const organizer = familyOrganizerResult.ok && familyOrganizerResult.value ? familyOrganizerResult.value : {
    dsid: "",
    firstName: "",
    lastName: "",
    fullName: ""
  };
  return /*#__PURE__*/react["createElement"](FamilySharingTile, {
    tileIndex: 0,
    error: error,
    isLoading: isLoading,
    isSuccess: isSuccess,
    role: role,
    organizer: organizer,
    refetch: refetch,
    tileSize: Tile["c" /* TileSize */].Small
  });
};
// EXTERNAL MODULE: ./src/Contexts/OpenModalProvider.tsx
var OpenModalProvider = __webpack_require__(1458);

// EXTERNAL MODULE: ./src/Contexts/ApplicationLaunchProvider.tsx
var ApplicationLaunchProvider = __webpack_require__(1319);

// EXTERNAL MODULE: ./src/Legacy/ChildApplication/ApplicationConfigurations/InvitesApplicationConfiguration.tsx + 6 modules
var InvitesApplicationConfiguration = __webpack_require__(2171);

// EXTERNAL MODULE: ./src/Legacy/Components/ChildApplication.tsx
var ChildApplication = __webpack_require__(1265);

// CONCATENATED MODULE: ./src/Components/ICloudPlus/Invites/InvitesPlusTile/InvitesPlusTile.scss
// extracted by mini-css-extract-plugin

// CONCATENATED MODULE: ./src/Components/ICloudPlus/Invites/InvitesPlusTile/InvitesPlusTile.tsx








const InvitesPlusTile = _ref => {
  let {
    tileIndex
  } = _ref;
  const appLauncher = Object(ApplicationLaunchProvider["b" /* useApplicationLauncher */])();
  const heading = Object(useLoc["a" /* getLoc */])("Invites.DisplayName");
  const descriptionText = Object(useLoc["a" /* getLoc */])("InvitesPlusTile.Description");
  return /*#__PURE__*/react["createElement"](Tile["b" /* Tile */], {
    tileIndex: tileIndex !== null && tileIndex !== void 0 ? tileIndex : 0,
    icon: /*#__PURE__*/react["createElement"](AppIcon["a" /* AppIcon */], {
      applicationIdentifier: "invites",
      iconSize: 40
    }),
    className: "invites-plus-tile",
    heading: heading,
    description: descriptionText,
    isLoading: false,
    tileSize: Tile["c" /* TileSize */].Small,
    onTileClick: () => {
      appLauncher.launchApp(InvitesApplicationConfiguration["a" /* INVITES_APP_IDENTIFIER */], {
        options: {
          source: {
            reason: ChildApplication["b" /* LaunchReason */].TILE_CLICK
          }
        }
      });
    },
    ariaLevel: 3
  }, Object(useLoc["a" /* getLoc */])("InvitesPlusTile.Content"));
};
// CONCATENATED MODULE: ./src/Pages/ICloudPlusPage/ICloudPlusPage.tsx
















const ICloudPlusPage_isCNDomain = DomainManagerService["a" /* DomainManagerService */].sharedInstance.isDomainCN;
const ICloudPlusPage = _ref => {
  let {
    className: cls,
    onPageLoaded
  } = _ref;
  const className = classnames_default()("icloud-plus-page", cls);
  const title = Object(useLoc["a" /* getLoc */])("ICloudPlusPage.Title");
  const description = Object(useLoc["a" /* getLoc */])("ICloudPlusPage.Description");
  const {
    modalToOpen,
    setModalToOpen
  } = Object(OpenModalProvider["b" /* useOpenModal */])();
  const openPrivateRelayModal = useShowPrivateRelayModal();
  const numberOfCamsSupported = useNumberOfSupportedCameras();
  const openHomeKitSecureVideoModal = useHomeKitSecureVideoModal({
    numberOfCamsSupported
  });
  const [hmeTileReady, setHmeTileReady] = react["useState"](false);
  const [customDomainTileReady, setCutomDomainTileReady] = react["useState"](false);
  react["useEffect"](() => {
    if (hmeTileReady && customDomainTileReady) {
      onPageLoaded === null || onPageLoaded === void 0 || onPageLoaded();
    }
  }, [hmeTileReady, customDomainTileReady, onPageLoaded]);

  // open a modal when the page loads
  react["useEffect"](() => {
    if (modalToOpen === "") return;
    switch (modalToOpen) {
      case "private-relay":
        openPrivateRelayModal();
        break;
      case "homekit-secure-video":
        openHomeKitSecureVideoModal();
        break;
    }
    setModalToOpen("");
  }, [modalToOpen, setModalToOpen, openPrivateRelayModal, openHomeKitSecureVideoModal]);
  const appsOrder = Object(useAppsOrder["a" /* useAppsOrder */])();
  const showInvitesPlusTile = react["useMemo"](() => appsOrder.some(app => app.applicationIdentifier === InvitesApplicationConfiguration["a" /* INVITES_APP_IDENTIFIER */]), [appsOrder]);
  return /*#__PURE__*/react["createElement"]("div", {
    className: className
  }, /*#__PURE__*/react["createElement"](TopNavLinks, {
    current: LegacyNavLinks["b" /* LegacyNavRoutes */].icloudplus
  }), /*#__PURE__*/react["createElement"](PageHeader, {
    title: title,
    description: description
  }), /*#__PURE__*/react["createElement"]("div", {
    className: "application-content"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "tile-grid-content"
  }, /*#__PURE__*/react["createElement"](HideMyEmailTileWrapper["a" /* HideMyEmailTileWrapper */], {
    onSuccess: () => setHmeTileReady(true),
    onError: () => setHmeTileReady(true)
  }), ICloudPlusPage_isCNDomain ? null : /*#__PURE__*/react["createElement"](CustomEmailDomainTileWrapper["a" /* CustomEmailDomainTileWrapper */], {
    onSuccess: () => setCutomDomainTileReady(true),
    onError: () => setCutomDomainTileReady(true)
  }), showInvitesPlusTile ? /*#__PURE__*/react["createElement"](InvitesPlusTile, null) : null), /*#__PURE__*/react["createElement"]("section", {
    "aria-labelledby": "icloud-plus-device-only-header",
    className: "device-only-content"
  }, /*#__PURE__*/react["createElement"]("h2", {
    id: "icloud-plus-device-only-header",
    className: "heading"
  }, Object(useLoc["a" /* getLoc */])("ICloudPlusPage.OnlyOnDevices.Title")), /*#__PURE__*/react["createElement"]("p", null, Object(useLoc["a" /* getLoc */])("ICloudPlusPage.OnlyOnDevices.Description")), /*#__PURE__*/react["createElement"]("div", {
    className: "tile-grid-content"
  }, ICloudPlusPage_isCNDomain ? null : /*#__PURE__*/react["createElement"](PrivateRelayTileWrapper, null), /*#__PURE__*/react["createElement"](HomeKitSecureVideoTileWrapper, null), /*#__PURE__*/react["createElement"](FamilySharingTileWrapper, null)))));
};
// CONCATENATED MODULE: ./src/Pages/StoragePage/StorageUsageList/StorageUsageList.scss
// extracted by mini-css-extract-plugin

// EXTERNAL MODULE: ./src/ComponentsGeneric/ScreenreaderOnlyContent/ScreenreaderOnlyContent.tsx + 1 modules
var ScreenreaderOnlyContent = __webpack_require__(2312);

// EXTERNAL MODULE: ./src/API/Photos/usePhotosLibraryInfo.ts
var usePhotosLibraryInfo = __webpack_require__(1628);

// CONCATENATED MODULE: ./src/API/Device/device.converter.ts
function getDevicesResponseSchemaConverter(response) {
  return response.devices
  // We only care about devices with back up info for now.
  .filter(device => device.latestBackup).map(device => {
    return {
      // latestBackup is guaranteed to exist because of the filter above
      latestBackup: new Date(device.latestBackup),
      name: device.name,
      modelSmallPhotoURL1x: device.modelSmallPhotoURL1x,
      modelSmallPhotoURL2x: device.modelSmallPhotoURL2x,
      modelLargePhotoURL1x: device.modelLargePhotoURL1x,
      modelLargePhotoURL2x: device.modelLargePhotoURL2x,
      // TODO(rdar://91775332): Get per device backup size
      backupSizeBytes: 0
    };
  });
}
// CONCATENATED MODULE: ./src/API/Device/device.schema.ts

const deviceSchema = lib["z"].object({
  imei: lib["z"].string().optional(),
  // Datetime e.g. 2022-04-07T08:15:05Z
  latestBackup: lib["z"].string().optional(),
  model: lib["z"].string(),
  modelDisplayName: lib["z"].string(),
  modelLargePhotoURL1x: lib["z"].string(),
  modelLargePhotoURL2x: lib["z"].string(),
  modelSmallPhotoURL1x: lib["z"].string(),
  modelSmallPhotoURL2x: lib["z"].string(),
  name: lib["z"].string(),
  osVersion: lib["z"].string().optional(),
  // IDs of payment methods
  paymentMethods: lib["z"].array(lib["z"].string()).optional(),
  serialNumber: lib["z"].string().optional(),
  udid: lib["z"].string().optional(),
  hasActivationLock: lib["z"].boolean().optional(),
  isMissing: lib["z"].boolean().optional()
});
const paymentMethodSchema = lib["z"].object({
  // E.g. NOTAPPLICABLE
  balanceStatus: lib["z"].union([lib["z"].literal("YES"), lib["z"].literal("NO"), lib["z"].literal("NOTAPPLICABLE"), lib["z"].literal("UNAVAILABLE"), lib["z"].literal("NEGATIVE")]),
  id: lib["z"].string(),
  isCarKey: lib["z"].boolean().optional(),
  lastFourDigits: lib["z"].string().optional(),
  // E.g. ACTIVE
  suspensionReason: lib["z"].string().optional(),
  type: lib["z"].string(),
  balanceTime: lib["z"].string().optional(),
  balanceCode: lib["z"].string().optional(),
  balance: lib["z"].string().optional(),
  name: lib["z"].string().optional(),
  routeDestinationStation: lib["z"].string().optional(),
  routeOriginStation: lib["z"].string().optional()
});
const wireDevicesResponseSchema = lib["z"].object({
  devices: lib["z"].array(deviceSchema),
  paymentMethods: lib["z"].array(paymentMethodSchema).optional()
});
// CONCATENATED MODULE: ./src/API/Device/device.endpoint.ts



const fetchBackedUpDevices = _ref => {
  let {
    webServices
  } = _ref;
  if (!(webServices !== null && webServices !== void 0 && webServices.account)) {
    throw new Error("fetchDevices: no service url available");
  }
  return Object(Common_request["a" /* apiRequest */])({
    url: Object(paths["j" /* getDevicesPath */])(webServices.account),
    includeCredentials: true,
    validate: {
      type: "WireDevicesResponse",
      schema: wireDevicesResponseSchema
    }
  }).then(getDevicesResponseSchemaConverter);
};
// CONCATENATED MODULE: ./src/API/Device/useBackedUpDevices.ts



/**
 * Fetches the details about all your backup devices
 * @returns `react-query` `useQuery` results
 */
function useBackedUpDevices() {
  return Object(useAPIQuery["a" /* useAPIQuery */])({
    endpoint: paths["b" /* EndpointName */].devicesBackup,
    fetchProvider: request => () => fetchBackedUpDevices(request)
  });
}
// EXTERNAL MODULE: /workspace/node_modules/@apple/symbols/regular/arrow.clockwise.svg
var regular_arrow_clockwise = __webpack_require__(1632);

// EXTERNAL MODULE: ./src/Components/HomeTiles/Photos/PhotosHomeTile/usePhotosAssetCountLocString.tsx
var usePhotosAssetCountLocString = __webpack_require__(1631);

// EXTERNAL MODULE: /workspace/node_modules/@icloudweb/photos-tile/build/index.js
var photos_tile_build = __webpack_require__(1169);

// CONCATENATED MODULE: ./src/API/StorageUsage/storageUsage.schema.ts

const wireManageStorageSchema = lib["z"].object({
  apps: lib["z"].array(lib["z"].object({
    label: lib["z"].string(),
    detailLabel: lib["z"].string().optional(),
    iconUrls: lib["z"].object({
      "1x": lib["z"].string(),
      "2x": lib["z"].string(),
      "3x": lib["z"].string()
    })
  })),
  primaryAppsSectionCount: lib["z"].number(),
  secondaryAppsSectionLabel: lib["z"].string(),
  thermometer: lib["z"].object({
    sections: lib["z"].array(lib["z"].object({
      displayLabel: lib["z"].string(),
      storagePercentage: lib["z"].number()
    }))
  })
});
// CONCATENATED MODULE: ./src/API/StorageUsage/storageUsage.endpoint.ts




// TODO: move to apps/icloud.com/src/API/Common/paths.ts once compiler flag is rolled out
const getManageStoragePath = dsid => `${paths["d" /* SUBSCRIPTION_BASE_URL */]}/v1/accounts/${dsid}/web/settings/icloud/home/manage-storage`;
const getManageStorage = dsid => {
  if (!dsid) {
    throw new Error("getManageStorage: dsid available");
  }
  return Object(Common_request["a" /* apiRequest */])({
    url: getManageStoragePath(dsid),
    includeCredentials: true,
    validate: {
      type: "WireCloudStorageApps",
      schema: wireManageStorageSchema
    }
  });
};
// CONCATENATED MODULE: ./src/API/StorageUsage/useManageStorage.ts




/**
 * Fetches manage storage usage data for apps
 * @returns `react-query` `useQuery` results
 */
function useManageStorageDetails() {
  const user = Object(AuthenticationHook["b" /* useCloudOSUser */])();
  return Object(useAPIQuery["a" /* useAPIQuery */])({
    endpoint: paths["b" /* EndpointName */].getManageStorage,
    fetchProvider: () => () => {
      var _user$details;
      return getManageStorage(user === null || user === void 0 || (_user$details = user.details) === null || _user$details === void 0 ? void 0 : _user$details.dsid);
    }
  });
}
const useManageStorage =  false ? undefined : () => {
  return undefined;
};
// CONCATENATED MODULE: ./src/Pages/StoragePage/StorageUsageList/StorageUsageList.tsx














const getAppsLabel = mediaKey => {
  if (mediaKey === "photos") {
    return Object(useLoc["a" /* getLoc */])("Photos.DisplayName");
  } else if (mediaKey === "docs") {
    return Object(useLoc["a" /* getLoc */])("StorageUsageList.Drive.Heading");
  } else if (mediaKey === "backup") {
    return Object(useLoc["a" /* getLoc */])("DeviceBackupList.Heading");
  } else {
    return undefined;
  }
};
const PhotosStorageUsed = () => {
  const {
    data,
    isSuccess
  } = Object(usePhotosLibraryInfo["a" /* usePhotosLibraryInfo */])({
    library: photos_tile_build["GoldilocksLibrary"].Personal,
    assetListKey: photos_tile_build["PhotosTileAssetListType"].Library
  });
  const summary = Object(usePhotosAssetCountLocString["b" /* usePhotosAssetCountLocString */])(data);
  return /*#__PURE__*/react["createElement"](react["Fragment"], null, isSuccess ? summary : "…");
};
const MailStorageUsed = () => {
  return /*#__PURE__*/react["createElement"](react["Fragment"], null, Object(useLoc["a" /* getLoc */])("StoragePage.AppCounts.Mail.All"));
};
const BackupStorageUsed = () => {
  const {
    data,
    isSuccess
  } = useBackedUpDevices();
  const backedUpDevicesSummary = Object(useLoc["b" /* getLocCount */])({
    zero: "DeviceBackupList.TotalNumber.Zero",
    one: "DeviceBackupList.TotalNumber.One",
    two: "DeviceBackupList.TotalNumber.Two",
    many: "DeviceBackupList.TotalNumber.Many"
  }, (data === null || data === void 0 ? void 0 : data.length) || 0);
  return /*#__PURE__*/react["createElement"](react["Fragment"], null, isSuccess ? backedUpDevicesSummary : "…");
};
const MessagesStorageUsed = () => /*#__PURE__*/react["createElement"](react["Fragment"], null, Object(useLoc["a" /* getLoc */])("StorageUsageList.Messages.Count"));
const DriveStorageUsed = () => /*#__PURE__*/react["createElement"](react["Fragment"], null, Object(useLoc["a" /* getLoc */])("StorageUsageList.Drive.Count"));
const FamilyStorageUsed = () => /*#__PURE__*/react["createElement"](react["Fragment"], null, Object(useLoc["a" /* getLoc */])("StorageUsageList.Family.Count"));
const storageUsageComponent = {
  photos: PhotosStorageUsed,
  mail: MailStorageUsed,
  backup: BackupStorageUsed,
  messages: MessagesStorageUsed,
  docs: DriveStorageUsed,
  family: FamilyStorageUsed
};
const StorageUsageList = _ref => {
  var _storageUsage$usageBy, _storageUsage$usedByt, _storageUsage$familyS, _storageUsage$familyS2, _manageStorage$data;
  let {
    className: cls,
    isError,
    isLoading,
    refetch,
    storageUsage,
    firstName,
    isBeneficiary
  } = _ref;
  const className = classnames_default()("storage-usage-list", cls, {
    loading: isLoading,
    error: isError
  });
  const tableLabel = Object(useLoc["a" /* getLoc */])("VoiceOver.StorageUsageList.Table");
  const title = isBeneficiary && firstName ? Object(useLoc["a" /* getLoc */])("StorageUsageList.Family.Personal.TitleWithName", {
    firstName
  }) : Object(useLoc["a" /* getLoc */])("StorageUsageList.Family.Personal.Title");
  const usageByMedia = (_storageUsage$usageBy = storageUsage === null || storageUsage === void 0 ? void 0 : storageUsage.usageByMedia.filter(media => media.mediaKey !== "family")) !== null && _storageUsage$usageBy !== void 0 ? _storageUsage$usageBy : [];
  const personalUsageTotal = ((_storageUsage$usedByt = storageUsage === null || storageUsage === void 0 ? void 0 : storageUsage.usedBytes) !== null && _storageUsage$usedByt !== void 0 ? _storageUsage$usedByt : 0) - ((_storageUsage$familyS = storageUsage === null || storageUsage === void 0 || (_storageUsage$familyS2 = storageUsage.familyStorageUsage) === null || _storageUsage$familyS2 === void 0 ? void 0 : _storageUsage$familyS2.usageInBytes) !== null && _storageUsage$familyS !== void 0 ? _storageUsage$familyS : 0);
  const manageStorage = useManageStorage();
  return /*#__PURE__*/react["createElement"]("article", {
    className: className,
    "aria-labelledby": "storage-usage-heading"
  }, isError ? /*#__PURE__*/react["createElement"]("div", null, /*#__PURE__*/react["createElement"]("div", {
    className: "error-description"
  }, Object(useLoc["a" /* getLoc */])("StorageUsageList.Content.Error.Description")), /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
    className: "reload-button",
    onActivate: refetch
  }, /*#__PURE__*/react["createElement"](regular_arrow_clockwise["a" /* default */], {
    layoutMode: "glyphBox",
    width: 20,
    height: 20
  }), Object(useLoc["a" /* getLoc */])("ErrorHomeTileContent.TryAgain"))) : /*#__PURE__*/react["createElement"](react["Fragment"], null, storageUsage !== null && storageUsage !== void 0 && storageUsage.familyStorageUsage ? /*#__PURE__*/react["createElement"]("div", {
    className: "title"
  }, /*#__PURE__*/react["createElement"]("h2", {
    id: "family-storage-list"
  }, title), /*#__PURE__*/react["createElement"]("h2", null, Object(BytesToHumanizedFormat["a" /* bytesToHumanizedFormat */])(personalUsageTotal, 1))) : null,  false && /*#__PURE__*/false,  true && usageByMedia.length > 0 ? /*#__PURE__*/react["createElement"]("div", {
    role: "table",
    "aria-label": tableLabel
  }, usageByMedia.filter(usageInfo => usageInfo.usageInBytes).map((usageInfo, idx) => {
    var _storageUsage$totalBy;
    return /*#__PURE__*/react["createElement"]("div", {
      key: idx,
      role: "row"
    }, /*#__PURE__*/react["createElement"](UsageInfo, {
      usageInfo: usageInfo,
      totalBytes: (_storageUsage$totalBy = storageUsage === null || storageUsage === void 0 ? void 0 : storageUsage.totalBytes) !== null && _storageUsage$totalBy !== void 0 ? _storageUsage$totalBy : 0
    }));
  })) : null));
};

/** Pass the item description as this element's children */
const UsageInfo = _ref2 => {
  var _getAppsLabel;
  let {
    usageInfo,
    totalBytes
  } = _ref2;
  const percentage = `${(usageInfo.usageInBytes / totalBytes * 100).toFixed(1)}%`;
  const {
    mediaKey
  } = usageInfo;
  const storageUsed = Object(BytesToHumanizedFormat["a" /* bytesToHumanizedFormat */])(usageInfo.usageInBytes, 1);
  const Description = storageUsageComponent[mediaKey];
  const usedMessage = Object(useLoc["a" /* getLoc */])("VoiceOver.StorageUsageList.StorageUsed", {
    percentage
  });
  return /*#__PURE__*/react["createElement"](react["Fragment"], null, /*#__PURE__*/react["createElement"]("span", {
    className: "app-name-icon",
    role: "cell"
  }, /*#__PURE__*/react["createElement"](AppIcon["a" /* AppIcon */], {
    className: "icon",
    applicationIdentifier: mediaKey,
    iconSize: 32
  }), /*#__PURE__*/react["createElement"]("div", null, /*#__PURE__*/react["createElement"]("span", {
    className: "label"
  }, (_getAppsLabel = getAppsLabel(usageInfo.mediaKey)) !== null && _getAppsLabel !== void 0 ? _getAppsLabel : usageInfo.displayLabel), /*#__PURE__*/react["createElement"]("span", {
    className: "item-description-small"
  }, /*#__PURE__*/react["createElement"](Description, null)))), /*#__PURE__*/react["createElement"]("span", {
    className: "item-description",
    role: "cell"
  }, /*#__PURE__*/react["createElement"](Description, null)), /*#__PURE__*/react["createElement"]("span", {
    className: "usage",
    role: "cell"
  }, storageUsed, /*#__PURE__*/react["createElement"](ScreenreaderOnlyContent["a" /* ScreenreaderOnlyContent */], null, /*#__PURE__*/react["createElement"](react["Fragment"], null, ", ", usedMessage)), /*#__PURE__*/react["createElement"]("span", {
    className: "dot",
    style: {
      backgroundColor: `#${usageInfo.displayColor}`
    }
  })));
};
const Applist = _ref3 => {
  let {
    tableLabel,
    apps
  } = _ref3;
  return /*#__PURE__*/react["createElement"]("div", {
    role: "table",
    "aria-label": tableLabel
  }, apps.map((app, idx) => /*#__PURE__*/react["createElement"]("div", {
    key: idx,
    role: "row"
  }, /*#__PURE__*/react["createElement"]("span", {
    className: "app-name-icon",
    role: "cell"
  }, /*#__PURE__*/react["createElement"](UIImage["b" /* UIImage */], {
    className: "app-icon",
    alt: "",
    src: app.iconUrls["1x"],
    srcSet: `${app.iconUrls["1x"]}, ${app.iconUrls["2x"]} 2x, ${app.iconUrls["3x"]} 3x`
  }), /*#__PURE__*/react["createElement"]("div", null, /*#__PURE__*/react["createElement"]("span", {
    className: "label"
  }, app.label))), /*#__PURE__*/react["createElement"]("span", {
    className: "usage",
    role: "cell"
  }, app.detailLabel))));
};
// CONCATENATED MODULE: ./src/Pages/StoragePage/StoragePage.scss
// extracted by mini-css-extract-plugin

// CONCATENATED MODULE: ./src/Pages/StoragePage/FamilyUsageList/FamilyUsageList.scss
// extracted by mini-css-extract-plugin

// EXTERNAL MODULE: ./src/Contexts/ContactsLookupProvider.tsx
var ContactsLookupProvider = __webpack_require__(1633);

// EXTERNAL MODULE: ./src/Components/Toolbar/StaticAvatar/StaticAvatar.tsx + 2 modules
var StaticAvatar = __webpack_require__(2235);

// CONCATENATED MODULE: ./src/Pages/StoragePage/FamilyUsageList/FamilyUsageList.tsx









const PROFILE_PHOTO_SIZE = 36;
const ProfilePhotoWithCJK = props => {
  const isCJKName = Object(cjk["a" /* stringIsCJK */])(props.firstName) && Object(cjk["a" /* stringIsCJK */])(props.lastName);
  const initials = props.firstName.charAt(0) + props.lastName.charAt(0);
  const displayName = Object(getUserDisplayName["a" /* getUserDisplayName */])(props.firstName, props.lastName);
  // when string is CJK and no profile photo exists, show default profile photo
  if (isCJKName && !props.profilePhoto) {
    return /*#__PURE__*/react["createElement"](person_crop_circle["a" /* default */], {
      width: PROFILE_PHOTO_SIZE,
      height: PROFILE_PHOTO_SIZE,
      layoutMode: "glyphBox",
      className: "cjk-profile-photo"
    });
  }
  return /*#__PURE__*/react["createElement"](react["Fragment"], null, props.profilePhoto ? /*#__PURE__*/react["createElement"](react["Fragment"], null, props.profilePhoto) : /*#__PURE__*/react["createElement"]("div", {
    className: "profile-photo-placeholder",
    "aria-label": Object(useLoc["a" /* getLoc */])("StorageUsageList.Family.ImageAlt", {
      familyMemberName: displayName
    })
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "initials"
  }, initials)));
};
const ContactsProfilePhoto = _ref => {
  var _ownerContact$photo, _ownerContact$photo2;
  let {
    member
  } = _ref;
  const {
    contacts
  } = Object(ContactsLookupProvider["b" /* useContactsLookupService */])();
  const ownerContact = contacts === null || contacts === void 0 ? void 0 : contacts.get(member.appleId);
  const displayName = Object(getUserDisplayName["a" /* getUserDisplayName */])(member.firstName, member.lastName);
  const contactAvatar = /*#__PURE__*/react["createElement"](StaticAvatar["a" /* StaticAvatar */], {
    imageAlt: Object(useLoc["a" /* getLoc */])("StorageUsageList.Family.ImageAlt", {
      familyMemberName: displayName
    }),
    profilePhoto: ownerContact ? {
      contactId: ownerContact.contactId,
      url: (_ownerContact$photo = ownerContact.photo) === null || _ownerContact$photo === void 0 ? void 0 : _ownerContact$photo.url,
      crop: (_ownerContact$photo2 = ownerContact.photo) === null || _ownerContact$photo2 === void 0 ? void 0 : _ownerContact$photo2.crop
    } : undefined,
    isProfilePhotoLoading: false,
    size: PROFILE_PHOTO_SIZE
  });
  return /*#__PURE__*/react["createElement"](ProfilePhotoWithCJK, {
    firstName: member.firstName,
    lastName: member.lastName,
    profilePhoto: ownerContact && contactAvatar
  });
};
const FamilyUsageList = props => {
  const className = classnames_default()("family-usage-list", props.className);
  const familyUsageTotal = props.familyMembers.reduce((totalBytes, member) => {
    return totalBytes + member.usageInBytes;
  }, 0);
  const title = props.isBeneficiary && props.ownerFirstName ? Object(useLoc["a" /* getLoc */])("StorageUsageList.Family.TitleWithName", {
    firstName: props.ownerFirstName
  }) : Object(useLoc["a" /* getLoc */])("StorageUsageList.Family.Title");
  return /*#__PURE__*/react["createElement"]("article", {
    className: className,
    "aria-labelledby": "family-storage-list"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "title"
  }, /*#__PURE__*/react["createElement"]("h2", {
    id: "family-storage-list"
  }, title), /*#__PURE__*/react["createElement"]("h2", null, Object(BytesToHumanizedFormat["a" /* bytesToHumanizedFormat */])(familyUsageTotal, 1))), !props.isBeneficiary && /*#__PURE__*/react["createElement"]("div", {
    role: "table",
    "aria-label": Object(useLoc["a" /* getLoc */])("VoiceOver.StorageUsageList.FamilyUsageList")
  }, props.familyMembers.map(member => /*#__PURE__*/react["createElement"]("div", {
    key: member.appleId,
    role: "row"
  }, /*#__PURE__*/react["createElement"]("div", {
    role: "cell"
  }, /*#__PURE__*/react["createElement"](ContactsProfilePhoto, {
    member: member
  }), /*#__PURE__*/react["createElement"]("span", {
    className: "member-name"
  }, member.fullName)), /*#__PURE__*/react["createElement"]("div", {
    role: "cell"
  }, Object(BytesToHumanizedFormat["a" /* bytesToHumanizedFormat */])(member.usageInBytes, 1),  true && /*#__PURE__*/react["createElement"]("span", {
    className: "dot",
    style: {
      backgroundColor: `#${props.displayColor}`
    }
  }))))));
};
// CONCATENATED MODULE: ./src/Components/ContinueOnDevice/ChangePlanAddOn/ChangePlanAddOn.tsx





const ChangePlanAddOn = () => {
  return /*#__PURE__*/react["createElement"]("section", {
    className: "change-plan-section learn-more-section"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "change-plan-section-heading"
  }, /*#__PURE__*/react["createElement"](InterpolatedString["a" /* InterpolatedString */], {
    interpolations: {
      "#{iCloudPlusLink}": /*#__PURE__*/react["createElement"](ExternalLink["a" /* ExternalLink */], {
        href: Object(getSupportLink["a" /* getSupportLink */])("iCloudPlusPlanPricing")
      }, Object(useLoc["a" /* getLoc */])("PlanDetailsPage.ChangePlanSection.LearnMore.Link.Title"))
    }
  }, Object(useLoc["a" /* getLoc */])("PlanDetailsPage.ChangePlanSection.LearnMore.Text"))));
};
// EXTERNAL MODULE: ./src/API/StorageUsage/useStorageUsageWarningType.ts
var useStorageUsageWarningType = __webpack_require__(1575);

// EXTERNAL MODULE: ./src/Components/StorageUsage/StorageUsage.tsx + 1 modules
var StorageUsage = __webpack_require__(2314);

// EXTERNAL MODULE: ./src/ComponentsGeneric/ScreenreaderOnlyHeading/ScreenreaderOnlyHeading.tsx + 1 modules
var ScreenreaderOnlyHeading = __webpack_require__(2325);

// CONCATENATED MODULE: ./src/ComponentsGeneric/DualToneExclamationMark/DualToneExclamationMark.scss
// extracted by mini-css-extract-plugin

// CONCATENATED MODULE: ./src/ComponentsGeneric/DualToneExclamationMark/DualToneExclamationMark.tsx
function DualToneExclamationMark_extends() { return DualToneExclamationMark_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, DualToneExclamationMark_extends.apply(null, arguments); }



/**
 * This is a copy of exclamationmark.circle.fill but with the exclamation mark
 * filled in with white as per design spec and optimized using svgo.
 */
const DualToneExclamationMark = _ref => {
  let {
    className,
    ...props
  } = _ref;
  return /*#__PURE__*/react["createElement"]("svg", DualToneExclamationMark_extends({}, props, {
    className: classnames_default()("dual-tone-exclamation-mark", className),
    viewBox: "0 0 99.61 99.657",
    xmlns: "http://www.w3.org/2000/svg"
  }), /*#__PURE__*/react["createElement"]("path", {
    fill: "currentColor",
    d: "M49.805 99.61c27.246 0 49.805-22.608 49.805-49.805C99.61 22.559 77.002 0 49.756 0 22.56 0 0 22.559 0 49.805c0 27.197 22.608 49.804 49.805 49.804Z"
  }), /*#__PURE__*/react["createElement"]("path", {
    fill: "#fff",
    d: "M49.805 58.887c-2.54 0-3.955-1.416-4.004-4.004l-.635-26.612c-.049-2.587 1.856-4.443 4.59-4.443 2.686 0 4.688 1.904 4.639 4.492l-.684 26.563c-.049 2.636-1.465 4.004-3.906 4.004ZM49.805 75.244c-2.93 0-5.469-2.344-5.469-5.225 0-2.88 2.49-5.273 5.469-5.273 2.978 0 5.469 2.344 5.469 5.273 0 2.93-2.54 5.225-5.47 5.225Z"
  }));
};
// CONCATENATED MODULE: ./src/Pages/StoragePage/StorageHeader/StorageHeader.scss
// extracted by mini-css-extract-plugin

// CONCATENATED MODULE: ./src/Pages/StoragePage/StorageHeader/StorageHeader.tsx











const StorageHeader = _ref => {
  var _storageUsage$usedByt, _storageUsage$totalBy, _storageUsage$totalBy2, _storageUsage$usedByt2, _storageUsage$totalBy3, _storageUsage$usageBy, _storageUsage$usedByt3, _storageUsage$totalBy4;
  let {
    storageUsage,
    isLoading,
    isError,
    isBeneficiary,
    continueOnDeviceSection,
    isPlanUpgradeEligibleDataReady,
    shouldShowContinueOnDeviceUpgradePlanSection
  } = _ref;
  const usedStorage = (_storageUsage$usedByt = storageUsage === null || storageUsage === void 0 ? void 0 : storageUsage.usedBytes) !== null && _storageUsage$usedByt !== void 0 ? _storageUsage$usedByt : 0;
  const totalStorage = (_storageUsage$totalBy = storageUsage === null || storageUsage === void 0 ? void 0 : storageUsage.totalBytes) !== null && _storageUsage$totalBy !== void 0 ? _storageUsage$totalBy : 0;
  const freeStorage = ((_storageUsage$totalBy2 = storageUsage === null || storageUsage === void 0 ? void 0 : storageUsage.totalBytes) !== null && _storageUsage$totalBy2 !== void 0 ? _storageUsage$totalBy2 : 0) - usedStorage;
  const storageUsageWarningType = Object(useStorageUsageWarningType["b" /* useStorageUsageWarningType */])();
  function renderUsageDescription() {
    if (isLoading) {
      return /*#__PURE__*/react["createElement"]("div", {
        className: "loading"
      }, Object(useLoc["a" /* getLoc */])("StorageUsageList.Description.Loading"));
    } else if (isError) {
      return /*#__PURE__*/react["createElement"]("div", {
        className: "error"
      }, Object(useLoc["a" /* getLoc */])("StorageUsageList.Description.Error"));
    } else {
      return /*#__PURE__*/react["createElement"]("div", {
        className: "usage-description"
      }, /*#__PURE__*/react["createElement"](InterpolatedString["a" /* InterpolatedString */], {
        interpolations: {
          "#{freeStorage}": /*#__PURE__*/react["createElement"]("span", {
            className: "free-storage"
          }, Object(useLoc["a" /* getLoc */])("StorageUsageList.FreeStorage", {
            free: Object(BytesToHumanizedFormat["a" /* bytesToHumanizedFormat */])(freeStorage, 1)
          })),
          "#{usedStorage}": /*#__PURE__*/react["createElement"]("span", {
            className: "used-storage"
          }, Object(useLoc["a" /* getLoc */])("StorageUsageList.UsedStorage", {
            used: Object(BytesToHumanizedFormat["a" /* bytesToHumanizedFormat */])(usedStorage, 1)
          }))
        }
      }, Object(useLoc["a" /* getLoc */])("StorageUsageList.Description")));
    }
  }
  return /*#__PURE__*/react["createElement"]("div", {
    className: "meter-header"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "usage-header"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "storage-label-section"
  }, /*#__PURE__*/react["createElement"]("span", {
    className: "storage-label"
  }, isError || isLoading ? /*#__PURE__*/react["createElement"](externaldrive["a" /* default */], {
    layoutMode: "glyphBox",
    height: 26,
    width: 39,
    fill: "var(--theme-color-backgroundPrimary)"
  }) : /*#__PURE__*/react["createElement"](react["Fragment"], null, Object(BytesToHumanizedFormat["a" /* bytesToHumanizedFormat */])(totalStorage, 1))),  true && storageUsageWarningType && /*#__PURE__*/react["createElement"](DualToneExclamationMark, {
    "aria-hidden": true,
    className: "warning-icon",
    width: 24,
    height: 24
  })), /*#__PURE__*/react["createElement"](ScreenreaderOnlyHeading["a" /* ScreenreaderOnlyHeading */], {
    ariaLevel: 2,
    text: Object(useLoc["a" /* getLoc */])("StorageUsageList.Heading"),
    id: "storage-usage-heading"
  }), renderUsageDescription()),  true && /*#__PURE__*/react["createElement"](StorageUsage["a" /* StorageUsage */], {
    hideInfo: true,
    usedBytes: (_storageUsage$usedByt2 = storageUsage === null || storageUsage === void 0 ? void 0 : storageUsage.usedBytes) !== null && _storageUsage$usedByt2 !== void 0 ? _storageUsage$usedByt2 : 0,
    totalBytes: (_storageUsage$totalBy3 = storageUsage === null || storageUsage === void 0 ? void 0 : storageUsage.totalBytes) !== null && _storageUsage$totalBy3 !== void 0 ? _storageUsage$totalBy3 : 0,
    usageByMedia: (_storageUsage$usageBy = storageUsage === null || storageUsage === void 0 ? void 0 : storageUsage.usageByMedia) !== null && _storageUsage$usageBy !== void 0 ? _storageUsage$usageBy : []
  }),  false && /*#__PURE__*/false,  true && storageUsageWarningType && isPlanUpgradeEligibleDataReady && shouldShowContinueOnDeviceUpgradePlanSection && /*#__PURE__*/react["createElement"](react["Fragment"], null, /*#__PURE__*/react["createElement"](UsageWarning, {
    type: storageUsageWarningType
  }), !isBeneficiary && /*#__PURE__*/react["createElement"]("div", {
    className: "xl-no-display"
  }, continueOnDeviceSection)));
};
function UsageWarning(props) {
  switch (props.type) {
    case useStorageUsageWarningType["a" /* StorageUsageWarningType */].AlmostFull:
      return /*#__PURE__*/react["createElement"](AlmostFullUsageWarning, null);
    case useStorageUsageWarningType["a" /* StorageUsageWarningType */].Full:
      return /*#__PURE__*/react["createElement"](FullUsageWarning, null);
    case useStorageUsageWarningType["a" /* StorageUsageWarningType */].FullNoUpgrade:
      return /*#__PURE__*/react["createElement"](FullUsageNoUpgradeWarning, null);
    case useStorageUsageWarningType["a" /* StorageUsageWarningType */].AlmostFullNoUpgrade:
      return /*#__PURE__*/react["createElement"](AlmostFullUsageNoUpgradeWarning, null);
  }
}
function AlmostFullUsageWarning() {
  return /*#__PURE__*/react["createElement"](BaseUsageWarning, null, Object(useLoc["a" /* getLoc */])("StoragePage.StorageWarning.AlmostFull"));
}
function FullUsageWarning() {
  return /*#__PURE__*/react["createElement"](BaseUsageWarning, null, Object(useLoc["a" /* getLoc */])("StoragePage.StorageWarning.Full"));
}
function AlmostFullUsageNoUpgradeWarning() {
  return /*#__PURE__*/react["createElement"](BaseUsageWarning, null, Object(useLoc["a" /* getLoc */])("StoragePage.StorageWarning.AlmostFull.NoUpgrade"));
}
function FullUsageNoUpgradeWarning() {
  return /*#__PURE__*/react["createElement"](BaseUsageWarning, null, Object(useLoc["a" /* getLoc */])("StoragePage.StorageWarning.Full.NoUpgrade"));
}
function BaseUsageWarning(_ref2) {
  let {
    children
  } = _ref2;
  return /*#__PURE__*/react["createElement"]("div", {
    className: "usage-warning",
    role: "note"
  }, /*#__PURE__*/react["createElement"](DualToneExclamationMark, {
    className: "warning-icon",
    width: 17,
    height: 17
  }), children);
}
// EXTERNAL MODULE: /workspace/node_modules/@icloudweb/subscription-service/react/index.js
var subscription_service_react = __webpack_require__(1483);

// EXTERNAL MODULE: ./src/Services/Quota.ts
var Quota = __webpack_require__(980);

// EXTERNAL MODULE: ./src/Hooks/useShouldShowPlanUpgrade.tsx
var useShouldShowPlanUpgrade = __webpack_require__(1477);

// EXTERNAL MODULE: /workspace/node_modules/@icloudweb/subscription-service/client/index.js
var client = __webpack_require__(1627);

// CONCATENATED MODULE: ./src/Pages/StoragePage/StoragePage.tsx






















const StoragePage = _ref => {
  var _user$details, _user$details$firstNa, _user$details2;
  let {
    className: cls,
    onPageLoaded
  } = _ref;
  const user = Object(AuthenticationHook["b" /* useCloudOSUser */])();
  const isBeneficiary = user === null || user === void 0 || (_user$details = user.details) === null || _user$details === void 0 || (_user$details = _user$details.beneficiaryInfo) === null || _user$details === void 0 ? void 0 : _user$details.isBeneficiary;
  const firstName = (_user$details$firstNa = user === null || user === void 0 || (_user$details2 = user.details) === null || _user$details2 === void 0 ? void 0 : _user$details2.firstName) !== null && _user$details$firstNa !== void 0 ? _user$details$firstNa : "";
  const className = classnames_default()("storage-page", cls);
  const title = isBeneficiary && firstName ? Object(useLoc["a" /* getLoc */])("StoragePage.TitleWithName", {
    firstName
  }) : Object(useLoc["a" /* getLoc */])("StoragePage.Title");
  const description = isBeneficiary ? Object(useLoc["a" /* getLoc */])("StoragePage.Description.Neutral") : Object(useLoc["a" /* getLoc */])("StoragePage.Description.Standard");
  const {
    storageUsage,
    isLoading: isStorageUsageLoading
  } = Object(useStorageUsage["a" /* useStorageUsage */])();
  const manageStorage = useManageStorage();
  const isLoading = isStorageUsageLoading || manageStorage !== undefined && manageStorage.isLoading;
  const isError = storageUsage == null && !isLoading || manageStorage !== undefined && manageStorage.isError;
  const refetchStorageData = () => {
    var _getQuotaController;
    (_getQuotaController = Object(Quota["b" /* getQuotaController */])()) === null || _getQuotaController === void 0 || _getQuotaController.fetchStorageQuota();
    manageStorage === null || manageStorage === void 0 || manageStorage.refetch();
  };
  const calloutClassName = classnames_default()("callout manage-storage", {
    "has-family-storage": storageUsage === null || storageUsage === void 0 ? void 0 : storageUsage.familyStorageUsage
  });
  const storageUsageWarningType = Object(useStorageUsageWarningType["b" /* useStorageUsageWarningType */])();
  react["useEffect"](() => {
    if (!isLoading && onPageLoaded) {
      onPageLoaded();
    }
  }, [isLoading, onPageLoaded]);
  const icloudPlan = Object(useICloudPlan["c" /* useICloudPlanType */])();
  const {
    isPlanUpgradeEligibleDataReady,
    shouldShowPlanUpgrade,
    planUpgradeEligibleDeviceList,
    planUpgradeButtonTextData
  } = Object(useShouldShowPlanUpgrade["b" /* useShouldShowPlanUpgrade */])(client["EntryPoint"].StoragePage);

  /**
   * Don't show old continue on device upgrade flow for:
   *
   *  - storage is not almost full or full
   *  - Beneficiary account
   *  - MAID account
   */
  const shouldShowPlanUpgradeWithContinueOnDevice = storageUsageWarningType !== undefined && icloudPlan !== useICloudPlan["a" /* UserPlan */].MAID && !isBeneficiary && !shouldShowPlanUpgrade;
  return /*#__PURE__*/react["createElement"]("div", {
    className: className
  }, /*#__PURE__*/react["createElement"](TopNavLinks, {
    current: LegacyNavLinks["b" /* LegacyNavRoutes */].storage
  }), /*#__PURE__*/react["createElement"](PageHeader, {
    title: title,
    description: description
  }), /*#__PURE__*/react["createElement"]("div", {
    className: "application-content"
  }, /*#__PURE__*/react["createElement"](StorageHeader, {
    storageUsage: storageUsage,
    isLoading: isLoading,
    isError: isError,
    isBeneficiary: isBeneficiary,
    continueOnDeviceSection: /*#__PURE__*/react["createElement"](ContinueOnDeviceUpgradePlanSection, {
      calloutClassName: calloutClassName,
      isPlanUpgradeEligibleDataReady: isPlanUpgradeEligibleDataReady,
      shouldShowContinueOnDeviceUpgradePlanSection: shouldShowPlanUpgradeWithContinueOnDevice
    }),
    isPlanUpgradeEligibleDataReady: isPlanUpgradeEligibleDataReady,
    shouldShowContinueOnDeviceUpgradePlanSection: shouldShowPlanUpgradeWithContinueOnDevice
  }), shouldShowPlanUpgrade && /*#__PURE__*/react["createElement"](UpgradePlanSection, {
    planUpgradeEligibleDeviceList: planUpgradeEligibleDeviceList,
    icloudPlan: icloudPlan,
    planUpgradeButtonTextData: planUpgradeButtonTextData
  }), /*#__PURE__*/react["createElement"]("div", {
    className: "content-section"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "content-column"
  }, /*#__PURE__*/react["createElement"](StorageUsageList, {
    storageUsage: storageUsage,
    isError: isError,
    isLoading: isLoading,
    refetch: refetchStorageData,
    firstName: firstName,
    isBeneficiary: isBeneficiary
  }), storageUsage !== null && storageUsage !== void 0 && storageUsage.familyStorageUsage && storageUsageWarningType ? /*#__PURE__*/react["createElement"](FamilyUsageList, {
    familyMembers: storageUsage.familyStorageUsage.familyMembers,
    className: "family-usage",
    ownerFirstName: firstName,
    isBeneficiary: isBeneficiary,
    displayColor: storageUsage.familyStorageUsage.displayColor
  }) : null), /*#__PURE__*/react["createElement"]("div", {
    className: "content-column"
  }, storageUsage !== null && storageUsage !== void 0 && storageUsage.familyStorageUsage && !storageUsageWarningType ? /*#__PURE__*/react["createElement"](FamilyUsageList, {
    familyMembers: storageUsage.familyStorageUsage.familyMembers,
    className: "family-usage",
    ownerFirstName: firstName,
    isBeneficiary: isBeneficiary,
    displayColor: storageUsage.familyStorageUsage.displayColor
  }) : null, /*#__PURE__*/react["createElement"]("div", {
    className: "xl-display"
  }, /*#__PURE__*/react["createElement"](ContinueOnDeviceUpgradePlanSection, {
    calloutClassName: calloutClassName,
    isPlanUpgradeEligibleDataReady: isPlanUpgradeEligibleDataReady,
    shouldShowContinueOnDeviceUpgradePlanSection: shouldShowPlanUpgradeWithContinueOnDevice
  })), !isBeneficiary && /*#__PURE__*/react["createElement"](ContinueOnDevice["b" /* ContinueOnDevice */], {
    className: calloutClassName,
    feature: continueOnDevice_endpoint["a" /* CONTINUE_ON_DEVICE_FEATURE */].STORAGE_MANAGE,
    variant: ContinueOnDevice["a" /* CONTINUE_ON_DEVICE_VARIANT */].STORAGE_MANAGE
  })))));
};

/*
 * If there is no eligible device, we are not showing plan upgrade option
 * For Lite and Maid account, we are not showing plan upgrade option
 */
const UpgradePlanSection = _ref2 => {
  let {
    planUpgradeEligibleDeviceList,
    icloudPlan,
    planUpgradeButtonTextData
  } = _ref2;
  const [hidePlanUpgrade, setHidePlanUpgrade] = react["useState"](false);
  const refreshPlanAndStorageData = Object(useShouldShowPlanUpgrade["a" /* useRefreshPlanAndStorageData */])();
  return /*#__PURE__*/react["createElement"]("div", {
    className: classnames_default()("upgrade-plan", {
      "is-hidden": hidePlanUpgrade
    })
  }, planUpgradeEligibleDeviceList ? /*#__PURE__*/react["createElement"](subscription_service_react["StoragePageUpgradePlanSection"], {
    continueOnDeviceEligibleDevicesList: planUpgradeEligibleDeviceList,
    userPlan: icloudPlan,
    refetchPageContent: () => {
      refreshPlanAndStorageData();
      setHidePlanUpgrade(true);
    },
    buttonTextData: planUpgradeButtonTextData
  }) : undefined);
};

/*
 * If there is no eligible device, we are showing the legacy plan upgrade option
 * For Lite and Maid account, we are showing the legacy plan upgrade option
 */
const ContinueOnDeviceUpgradePlanSection = _ref3 => {
  let {
    calloutClassName,
    isPlanUpgradeEligibleDataReady,
    shouldShowContinueOnDeviceUpgradePlanSection
  } = _ref3;
  return /*#__PURE__*/react["createElement"](react["Fragment"], null, isPlanUpgradeEligibleDataReady && /*#__PURE__*/react["createElement"](react["Fragment"], null, shouldShowContinueOnDeviceUpgradePlanSection ? /*#__PURE__*/react["createElement"](react["Fragment"], null, /*#__PURE__*/react["createElement"](ContinueOnDevice["b" /* ContinueOnDevice */], {
    className: calloutClassName,
    feature: continueOnDevice_endpoint["a" /* CONTINUE_ON_DEVICE_FEATURE */].PLAN_UPGRADE,
    variant: ContinueOnDevice["a" /* CONTINUE_ON_DEVICE_VARIANT */].STORAGE_FULL
  }), /*#__PURE__*/react["createElement"](ChangePlanAddOn, null)) : undefined));
};
// EXTERNAL MODULE: ./src/Hooks/useCombinedPlanDetails.ts + 2 modules
var useCombinedPlanDetails = __webpack_require__(2230);

// CONCATENATED MODULE: ./src/Components/ContinueOnDevice/ChangePlanAddOn/ChangePlanAddOn.scss
// extracted by mini-css-extract-plugin

// CONCATENATED MODULE: ./src/Pages/PlanDetailsPage/ChangePlanSection/ChangePlanSection.tsx










const ChangePlanSection = props => {
  const className = classnames_default()("change-plan-section", props.className);
  return /*#__PURE__*/react["createElement"](react["Fragment"], null, props.plan === useICloudPlan["a" /* UserPlan */].Lite && /*#__PURE__*/react["createElement"]("section", {
    className: className
  }, /*#__PURE__*/react["createElement"]("h2", {
    className: "change-plan-section-heading"
  }, Object(useLoc["a" /* getLoc */])("PlanDetailsPage.ChangePlanSection.Title.Lite")), /*#__PURE__*/react["createElement"]("p", {
    className: "change-plan-section-body"
  }, Object(useLoc["a" /* getLoc */])("PlanDetailsPage.ChangePlanSection.Body.Lite"), " ", /*#__PURE__*/react["createElement"](ExternalLink["a" /* ExternalLink */], {
    href: Object(getSupportLink["a" /* getSupportLink */])("webOnlyPlan")
  }, Object(useLoc["a" /* getLoc */])("PlanDetailsPage.ChangePlanSection.Body.Lite.LearnMore.Title")))), props.plan !== useICloudPlan["a" /* UserPlan */].Lite && /*#__PURE__*/react["createElement"](react["Fragment"], null, /*#__PURE__*/react["createElement"](ContinueOnDevice["b" /* ContinueOnDevice */], {
    feature: continueOnDevice_endpoint["a" /* CONTINUE_ON_DEVICE_FEATURE */].PLAN_UPGRADE,
    variant: ContinueOnDevice["a" /* CONTINUE_ON_DEVICE_VARIANT */].PLAN_UPGRADE
  }), /*#__PURE__*/react["createElement"](ChangePlanAddOn, null)));
};
// CONCATENATED MODULE: ./src/Pages/PlanDetailsPage/IncludedInPlanSection/IncludedInPlanSection.scss
// extracted by mini-css-extract-plugin

// CONCATENATED MODULE: ./src/Pages/PlanDetailsPage/IncludedInPlanSection/IncludedInPlanSection.tsx










const IncludedInPlanSection_isCNDomain = DomainManagerService["a" /* DomainManagerService */].sharedInstance.isDomainCN;
function planItems(planType, planFeatures) {
  if (planType === useICloudPlan["a" /* UserPlan */].MAID) {
    return {
      storage: "",
      premium: [],
      featuresHeader: "",
      features: []
    };
  } else if (planType === useICloudPlan["a" /* UserPlan */].Lite) {
    return {
      storage: Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Lite.Storage"),
      premium: [],
      featuresHeader: Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Lite.FeaturesHeader"),
      features: [Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Features.Drive"), Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Features.Notes"), Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Features.Contacts"), Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Features.Pages"), Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Features.Numbers"), Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Features.Keynote")]
    };
  } else if (planType === useICloudPlan["a" /* UserPlan */].Standard) {
    return {
      storage: Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Standard.Storage"),
      premium: [],
      featuresHeader: Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.StandardPlus.FeaturesHeader"),
      features: [Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Features.Photos"), Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Features.Drive"), Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Features.Backup"), Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Features.Mail"), Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Features.PasswordAndKeychain")]
    };
  } else if (planType === useICloudPlan["a" /* UserPlan */].Plus) {
    const secureCamCountDescription = (() => {
      if (!planFeatures) {
        return Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Plus.Premium.HomeKitSecureCam.One");
      }
      if (planFeatures.numberOfSupportedCameras === "unlimited") {
        return Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Plus.Premium.HomeKitSecureCam.Unlimited");
      }
      return Object(useLoc["b" /* getLocCount */])({
        one: "PlanDetailsPage.Bullets.Plus.Premium.HomeKitSecureCam.One",
        two: "PlanDetailsPage.Bullets.Plus.Premium.HomeKitSecureCam.Two",
        many: "PlanDetailsPage.Bullets.Plus.Premium.HomeKitSecureCam.Many"
      }, planFeatures.numberOfSupportedCameras);
    })();
    if (IncludedInPlanSection_isCNDomain) {
      var _planFeatures$storage;
      return {
        storage: Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Plus.Storage", {
          storage: (_planFeatures$storage = planFeatures === null || planFeatures === void 0 ? void 0 : planFeatures.storageSize) !== null && _planFeatures$storage !== void 0 ? _planFeatures$storage : ""
        }),
        premium: [Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Plus.Premium.HideMyEmail"), secureCamCountDescription, Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Plus.Premium.FamilySharing")],
        featuresHeader: Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.StandardPlus.FeaturesHeader"),
        features: [Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Features.Photos"), Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Features.Drive"), Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Features.Backup"), Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Features.Mail"), Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Features.PasswordAndKeychain")]
      };
    } else {
      var _planFeatures$storage2;
      return {
        storage: Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Plus.Storage", {
          storage: (_planFeatures$storage2 = planFeatures === null || planFeatures === void 0 ? void 0 : planFeatures.storageSize) !== null && _planFeatures$storage2 !== void 0 ? _planFeatures$storage2 : ""
        }),
        premium: [Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Plus.Premium.PrivateRelay"), Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Plus.Premium.HideMyEmail"), Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Plus.Premium.CustomEmailDomain"), secureCamCountDescription, Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Plus.Premium.FamilySharing")],
        featuresHeader: Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.StandardPlus.FeaturesHeader"),
        features: [Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Features.Photos"), Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Features.Drive"), Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Features.Backup"), Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Features.Mail"), Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Features.PasswordAndKeychain")]
      };
    }
  } else {
    Object(checkExhaustive["a" /* checkExhaustive */])(planType);
  }
}
const BulletItem = _ref => {
  let {
    text
  } = _ref;
  return /*#__PURE__*/react["createElement"]("li", null, /*#__PURE__*/react["createElement"]("span", {
    className: "bullet-dot"
  }), /*#__PURE__*/react["createElement"]("span", null, text));
};
const IncludedInPlanSection = props => {
  const {
    planType,
    planFeatures,
    isBeneficiary = false
  } = props;
  const items = planItems(planType, planFeatures);
  const title = isBeneficiary ? Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Included") : Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Includes");
  const className = classnames_default()("included-in-plan-section", props.className);
  if (planType === useICloudPlan["a" /* UserPlan */].MAID) return /*#__PURE__*/react["createElement"](react["Fragment"], null);
  return /*#__PURE__*/react["createElement"]("section", {
    className: className
  }, /*#__PURE__*/react["createElement"]("h2", {
    className: "heading"
  }, title), /*#__PURE__*/react["createElement"]("ul", null, /*#__PURE__*/react["createElement"](BulletItem, {
    text: items.storage
  })), items.premium.length > 0 ? /*#__PURE__*/react["createElement"](react["Fragment"], null, /*#__PURE__*/react["createElement"]("h3", {
    className: "heading-secondary"
  }, Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Bullets.Plus.Premium.Header")), /*#__PURE__*/react["createElement"]("ul", null, items.premium.map((item, i) => /*#__PURE__*/react["createElement"](BulletItem, {
    key: i,
    text: item
  })))) : null, /*#__PURE__*/react["createElement"]("h3", {
    className: "heading-secondary"
  }, items.featuresHeader), /*#__PURE__*/react["createElement"]("ul", null, items.features.map((feature, i) => /*#__PURE__*/react["createElement"](BulletItem, {
    key: i,
    text: feature
  }))), planType !== useICloudPlan["a" /* UserPlan */].Lite && /*#__PURE__*/react["createElement"]("p", {
    className: "included-in-plan-learn-more"
  }, /*#__PURE__*/react["createElement"](InterpolatedString["a" /* InterpolatedString */], {
    interpolations: {
      "#{iCloudFeaturesLink}": /*#__PURE__*/react["createElement"](ExternalLink["a" /* ExternalLink */], {
        href: Object(getSupportLink["a" /* getSupportLink */])("iCloudAppsFeatures")
      }, Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Included.iCloudFeatures.Link.Title"))
    }
  }, Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Included.StandardPlus.LearnMore.Features"))), planType === useICloudPlan["a" /* UserPlan */].Plus && /*#__PURE__*/react["createElement"]("p", {
    className: "downgrade-or-cancel-icloudplus"
  }, /*#__PURE__*/react["createElement"](ExternalLink["a" /* ExternalLink */], {
    href: Object(getSupportLink["a" /* getSupportLink */])("downgradeICloudPlus")
  }, Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Downgrade.Link.Title"))));
};
// CONCATENATED MODULE: ./src/Pages/PlanDetailsPage/PlanDetailsPage.scss
// extracted by mini-css-extract-plugin

// CONCATENATED MODULE: ./src/Pages/PlanDetailsPage/PlanDetailsPage.tsx



















function contentForPlan(planType, planDetails) {
  if (planType === useICloudPlan["a" /* UserPlan */].MAID) {
    if (planDetails.type === "free") {
      return {
        planDetails: Object(useLoc["a" /* getLoc */])("PlanDetailsPage.MAID.Details", {
          storage: Object(useCombinedPlanDetails["b" /* describeStorageSize */])(planDetails.storageSize)
        }),
        price: Object(useLoc["a" /* getLoc */])("PlanDetailsPage.MAID.Price")
      };
    }
    return {
      price: Object(useLoc["a" /* getLoc */])("PlanDetailsPage.MAID.Price")
    };
  } else if (planType === useICloudPlan["a" /* UserPlan */].Lite) {
    return {
      planDetails: Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Lite.Details"),
      price: Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Lite.Price")
    };
  } else if (planType === useICloudPlan["a" /* UserPlan */].Standard) {
    return {
      planDetails: Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Standard.Details"),
      price: Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Standard.Price")
    };
  } else if (planType === useICloudPlan["a" /* UserPlan */].Plus) {
    const type = planDetails.type;
    if (type === "loading" || type === "error") {
      // TODO(rdar://99467347): Plan page loading state and error state.
      return {};
    } else if (type === "apple-one") {
      return {
        planDetails: Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Plus.Details", {
          storage: Object(useCombinedPlanDetails["b" /* describeStorageSize */])(planDetails.storageSize)
        }),
        planDescription: Object(useLoc["a" /* getLoc */])("PlanDetailsPage.AppleOne")
      };
    } else if (type === "apple-one-with-extra") {
      return {
        planDetails: Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Plus.Details", {
          storage: Object(useCombinedPlanDetails["b" /* describeStorageSize */])(planDetails.storageSize)
        }),
        planDescription: Object(useLoc["a" /* getLoc */])("PlanDetailsPage.AppleOne"),
        extraPlanDetails: Object(useLoc["a" /* getLoc */])("PlanDetailsPage.ExtraStorage", {
          storage: Object(useCombinedPlanDetails["b" /* describeStorageSize */])(planDetails.extraStorageSize)
        }),
        price: Object(useCombinedPlanDetails["a" /* describePlanPricing */])(planDetails.price, planDetails.renewalPeriod)
      };
    } else if (type === "icloud+") {
      return {
        planDetails: Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Plus.Details", {
          storage: Object(useCombinedPlanDetails["b" /* describeStorageSize */])(planDetails.storageSize)
        }),
        price: Object(useCombinedPlanDetails["a" /* describePlanPricing */])(planDetails.price, planDetails.renewalPeriod)
      };
    } else if (type === "family-sharing") {
      return {
        planDetails: Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Plus.Details", {
          storage: Object(useCombinedPlanDetails["b" /* describeStorageSize */])(planDetails.storageSize)
        }),
        planDescription: Object(useLoc["a" /* getLoc */])("PlanDetailsPage.SharedBy", {
          planOwnerName: planDetails.sharerName
        })
      };
    } else if (type === "free") {
      return {
        planDetails: Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Plus.Details", {
          storage: Object(useCombinedPlanDetails["b" /* describeStorageSize */])(planDetails.storageSize)
        }),
        price: Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Plus.Free")
      };
    } else {
      Object(checkExhaustive["a" /* checkExhaustive */])(type);
    }
  } else {
    Object(checkExhaustive["a" /* checkExhaustive */])(planType);
  }
}
const PlanDetailsPage = _ref => {
  var _describeStorageSizeO, _user$details, _user$details$firstNa, _user$details2, _user$details3;
  let {
    className: cls,
    onPageLoaded
  } = _ref;
  const className = classnames_default()("plan-details-page", cls);
  const icloudPlan = Object(useICloudPlan["c" /* useICloudPlanType */])();
  const shouldShowUpgradePlanTiles = useShouldShowUpgradePlanTiles();
  const combinedPlanDetails = Object(useCombinedPlanDetails["d" /* useCombinedPlanPricing */])();
  const storageSize = (_describeStorageSizeO = Object(useCombinedPlanDetails["c" /* describeStorageSizeOfPlanDetails */])(combinedPlanDetails)) !== null && _describeStorageSizeO !== void 0 ? _describeStorageSizeO : "";
  const numberOfSupportedCameras = useNumberOfSupportedCameras();
  const user = Object(AuthenticationHook["b" /* useCloudOSUser */])();
  const isBeneficiary = user === null || user === void 0 || (_user$details = user.details) === null || _user$details === void 0 || (_user$details = _user$details.beneficiaryInfo) === null || _user$details === void 0 ? void 0 : _user$details.isBeneficiary;
  const firstName = (_user$details$firstNa = user === null || user === void 0 || (_user$details2 = user.details) === null || _user$details2 === void 0 ? void 0 : _user$details2.firstName) !== null && _user$details$firstNa !== void 0 ? _user$details$firstNa : "";
  const title = isBeneficiary ? Object(useLoc["a" /* getLoc */])("PlanDetailsPage.TitleWithName", {
    firstName
  }) : Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Title");
  const {
    planDetails,
    planDescription,
    extraPlanDetails,
    price
  } = contentForPlan(icloudPlan, combinedPlanDetails);
  react["useEffect"](() => {
    if (combinedPlanDetails.type !== "loading") {
      onPageLoaded === null || onPageLoaded === void 0 || onPageLoaded();
    }
  }, [combinedPlanDetails, onPageLoaded]);
  const {
    isPlanUpgradeEligibleDataReady,
    shouldShowPlanUpgrade,
    planUpgradeEligibleDeviceList,
    planUpgradeButtonTextData
  } = Object(useShouldShowPlanUpgrade["b" /* useShouldShowPlanUpgrade */])(client["EntryPoint"].PlanPage);
  const refreshPlanAndStorageData = Object(useShouldShowPlanUpgrade["a" /* useRefreshPlanAndStorageData */])();
  const [hidePlanUpgrade, setHidePlanUpgrade] = react["useState"](false);
  return /*#__PURE__*/react["createElement"]("div", {
    className: className
  }, /*#__PURE__*/react["createElement"](TopNavLinks, {
    current: LegacyNavLinks["b" /* LegacyNavRoutes */].plan
  }), /*#__PURE__*/react["createElement"](PageHeader, {
    title: title,
    subtitle: planDetails,
    subtitleDescription: planDescription,
    extraSubtitle: extraPlanDetails,
    description: price
  }), /*#__PURE__*/react["createElement"]("div", {
    className: "plan-details-page-first-row"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "application-content plan-section-wrapper"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "plan-section"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "border-box"
  }, /*#__PURE__*/react["createElement"](IncludedInPlanSection, {
    planType: icloudPlan,
    planFeatures: {
      storageSize,
      numberOfSupportedCameras
    },
    isBeneficiary: isBeneficiary
  }))), isPlanUpgradeEligibleDataReady && /*#__PURE__*/react["createElement"](react["Fragment"], null, icloudPlan !== useICloudPlan["a" /* UserPlan */].MAID && !isBeneficiary && /*#__PURE__*/react["createElement"]("div", {
    className: "plan-section change-plan"
  }, user !== null && user !== void 0 && (_user$details3 = user.details) !== null && _user$details3 !== void 0 && _user$details3.dsid && shouldShowPlanUpgrade && planUpgradeEligibleDeviceList ? /*#__PURE__*/react["createElement"]("div", {
    className: classnames_default()("upgrade-plan", {
      "is-hidden": hidePlanUpgrade
    })
  }, /*#__PURE__*/react["createElement"](subscription_service_react["PlanPageUpgradePlanSection"], {
    continueOnDeviceEligibleDevicesList: planUpgradeEligibleDeviceList,
    userPlan: icloudPlan,
    refetchPageContent: () => {
      refreshPlanAndStorageData();
      setHidePlanUpgrade(true);
    },
    buttonTextData: planUpgradeButtonTextData
  })) : /*#__PURE__*/react["createElement"](ChangePlanSection, {
    plan: icloudPlan
  }))))), shouldShowUpgradePlanTiles ? /*#__PURE__*/react["createElement"](UpgradePlanTiles, null) : null);
};
// CONCATENATED MODULE: ./src/Pages/MailDropPage/MailDropPage.scss
// extracted by mini-css-extract-plugin

// EXTERNAL MODULE: /workspace/node_modules/@apple/symbols/regular/icloud.and.arrow.down.svg
var icloud_and_arrow_down = __webpack_require__(1634);

// EXTERNAL MODULE: ./src/Legacy/Environment/ValidatedDownloadManager.ts + 1 modules
var ValidatedDownloadManager = __webpack_require__(2326);

// EXTERNAL MODULE: ./src/Legacy/Environment/ValidatedDownloadUrl.ts + 1 modules
var ValidatedDownloadUrl = __webpack_require__(2327);

// EXTERNAL MODULE: ./src/Resources/Images/apple-id-logo.svg
var apple_id_logo = __webpack_require__(1463);

// EXTERNAL MODULE: ./src/Legacy/Network/addQueryArgs.ts
var addQueryArgs = __webpack_require__(924);

// CONCATENATED MODULE: ./src/Pages/MailDropPage/MailDropPage.tsx
function MailDropPage_extends() { return MailDropPage_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, MailDropPage_extends.apply(null, arguments); }

















// Give a 3 second overlap for the download-frame to properly report a failure.
const ERROR_TIMEOUT_DURATION = 3 * 1000;
const MailDropPageComponent = _ref => {
  var _mailDropDetail$fileT;
  let {
    className: cls,
    mailDropDetail
  } = _ref;
  const className = classnames_default()("maildrop-page", cls);
  const pageTitle = Object(useLoc["a" /* getLoc */])("ShareAcceptancePage.Title");
  const [showAlert] = Object(useShowAlert["b" /* useShowAlert */])();
  const shareTitle = mailDropDetail.downloadURL ? mailDropDetail.title : "";
  const size = Object(BytesToHumanizedFormat["a" /* bytesToHumanizedFormat */])(mailDropDetail.downloadURL ? mailDropDetail.size : 0, 1);
  const baseFileType = mailDropDetail.downloadURL ? (_mailDropDetail$fileT = mailDropDetail.fileType) !== null && _mailDropDetail$fileT !== void 0 ? _mailDropDetail$fileT : "dmg" : "dmg";
  const fileType = escapeHTML(baseFileType);
  const itemDescription = Object(useLoc["a" /* getLoc */])("MailDropPage.Download.Item.Description", {
    fileType: Object(getDriveFileInfo["a" /* getDriveFileDescription */])(fileType),
    size
  });
  const postMessageHandlerRef = react["useRef"](undefined);
  const downloadUrlRef = react["useRef"]();
  const errorTypeRef = react["useRef"]();
  function onErrorModalOKClicked() {
    CloudOSApplication["a" /* CloudOSApplication */].cloudOSApplication.switchToSpringboard(true);
  }
  const showErrorModal = react["useCallback"]((titleLocKey, descriptionLocKey) => {
    showAlert({
      icon: /*#__PURE__*/react["createElement"](apple_id_logo["a" /* default */], null),
      title: Object(useLoc["a" /* getLoc */])(titleLocKey),
      description: Object(useLoc["a" /* getLoc */])(descriptionLocKey),
      variant: "standard",
      buttons: [{
        title: Object(useLoc["a" /* getLoc */])("CloudOS.Button.OK.Title"),
        action: "ok"
      }],
      defaultAction: "ok",
      onActionSelected: onErrorModalOKClicked
    });
  }, [showAlert]);
  react["useEffect"](() => {
    if (!mailDropDetail.downloadURL) {
      showErrorModal("MailDropPage.Error.Title", "MailDropPage.Error.Description");
    } else {
      downloadUrlRef.current = Object(addQueryArgs["a" /* addQueryArgs */])(mailDropDetail.downloadURL, {
        teh: "1"
      });
    }
  }, [mailDropDetail.downloadURL, showErrorModal]);
  const handleDownloadError = error => {
    // Separate messaging depending on error code
    errorTypeRef.current = error;
    switch (error === null || error === void 0 ? void 0 : error.status) {
      case 403:
      case 410:
        // Status 403 Expired URL
        // Status 410 Expired URL
        showErrorModal("MailDropPage.Error.Title.Expired", "MailDropPage.Error.Description.Expired");
        break;
      case 404:
        // Status 404 iCloud cannot find the file
        showErrorModal("MailDropPage.Error.Title.NotFound", "MailDropPage.Error.Description.NotFound");
        break;
      case 429:
        // Status 429 File Downloaded Max number of times.
        showErrorModal("MailDropPage.Error.Title.MaxDownloads", "MailDropPage.Error.Description.MaxDownloads");
        break;
      default:
        showErrorModal("MailDropPage.Error.Title", "MailDropPage.Error.Description");
      // Status 310
      // Status 400 Bad Request
      // Status 500 Internal Server Error
      // Status 502 Bad Gateway
      // Status 503 Service Unavailable
      // Status 520
      // Others
    }
    const downloadErrorStat = new Stat["a" /* Stat */]("MaildropAttachment.failure", {
      status: error === null || error === void 0 ? void 0 : error.status
    });
    Telemetry["b" /* Telemetry */].sharedInstance.recordStat(downloadErrorStat);
  };
  const removePostMessageHandler = () => {
    const currentPostMessageHandler = postMessageHandlerRef.current;
    if (currentPostMessageHandler) {
      postMessageHandlerRef.current = undefined;
      window.removeEventListener("message", currentPostMessageHandler);
    }
  };
  const postMessageHandler = event => {
    var _downloadUrlRef$curre;
    if (event.origin === ((_downloadUrlRef$curre = downloadUrlRef.current) === null || _downloadUrlRef$curre === void 0 ? void 0 : _downloadUrlRef$curre.origin)) {
      let data = event.data;
      try {
        data = JSON.parse(data);
      } catch (e) {
        data = {};
      }
      handleDownloadError(data);
    }
    // Now that we've handled the response, remove said handler.
    removePostMessageHandler();
  };
  const addPostMessageHandler = () => {
    const currentPostMessageHandler = postMessageHandlerRef.current;
    if (!currentPostMessageHandler) {
      const handler = postMessageHandlerRef.current = event => postMessageHandler(event);
      window.addEventListener("message", handler);
    }
  };
  const downloadButtonClicked = async () => {
    if (!downloadUrlRef.current) {
      showErrorModal("MailDropPage.Error.Title", "MailDropPage.Error.Description");
      return;
    }
    const validatedDownloadManager = new ValidatedDownloadManager["a" /* ValidatedDownloadManager */](" ", downloadUrlRef.current.hostname);
    const validatedDownloadUrl = new ValidatedDownloadUrl["a" /* ValidatedDownloadUrl */](downloadUrlRef.current.href, " ");

    // Add a handler to the downloader iFrame.
    addPostMessageHandler();
    const result = await validatedDownloadManager.download(validatedDownloadUrl);
    if (result.success) {
      Telemetry["b" /* Telemetry */].sharedInstance.recordStat(new Stat["a" /* Stat */]("MaildropAttachment.success", {
        status: 200
      }));

      // If we have a successful response, no need to keep the
      // handler around.
      removePostMessageHandler();
    } else {
      // Give the child-frame a chance to report a
      // failure, first.
      setTimeout(() => {
        // If we haven't heard from the child-frame at this
        // point, remove the handlers and render a generic
        // error instead.
        if (!errorTypeRef.current) {
          removePostMessageHandler();
          handleDownloadError();
        }
      }, ERROR_TIMEOUT_DURATION);
    }
  };
  return /*#__PURE__*/react["createElement"]("div", {
    className: className
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "header-section"
  }, /*#__PURE__*/react["createElement"](icloud_and_arrow_down["a" /* default */], {
    className: "header-image",
    width: 60,
    height: 60,
    layoutMode: "glyphBox"
  }), /*#__PURE__*/react["createElement"]("h2", null, pageTitle), /*#__PURE__*/react["createElement"]("p", null, Object(useLoc["a" /* getLoc */])("MailDropPage.Description")), /*#__PURE__*/react["createElement"]("div", {
    className: "maildrop-details"
  }, /*#__PURE__*/react["createElement"](FileIcon["a" /* FileIcon */], MailDropPage_extends({
    fileExtension: fileType
  }, Object(getDriveFileInfo["b" /* getDriveFileIconSize */])(fileType))), /*#__PURE__*/react["createElement"]("div", {
    className: "item-title"
  }, shareTitle), /*#__PURE__*/react["createElement"]("div", {
    className: "item-description"
  }, itemDescription))), /*#__PURE__*/react["createElement"]("div", {
    className: "bottom-section"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "buttons-row"
  }, /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
    onActivate: downloadButtonClicked,
    className: "download-button",
    variant: "block primary"
  }, Object(useLoc["a" /* getLoc */])("MailDropPage.Download.Button.Text")))));
};
function escapeHTML(inputText) {
  const HTML_ENTITY_CHARS = /[&<>]/g;
  const HTML_ENTITY_NAMES = {
    "&": "&amp;",
    "<": "&lt;",
    ">": "&gt;",
    '"': "&quot;",
    "'": "&#39;"
  };
  return inputText.replace(HTML_ENTITY_CHARS, s => HTML_ENTITY_NAMES[s] || "");
}
const MailDropPage = /*#__PURE__*/react["memo"](MailDropPageComponent);
// CONCATENATED MODULE: ./src/Pages/ShareAcceptanceErrorPage/ShareAcceptanceErrorPage.scss
// extracted by mini-css-extract-plugin

// CONCATENATED MODULE: ./src/Pages/ShareAcceptanceErrorPage/ShareAcceptanceErrorPage.tsx





const ShareAcceptanceErrorPage = _ref => {
  let {
    className: cls,
    errorTitle,
    errorDescription
  } = _ref;
  const className = classnames_default()("share-acceptance-error-page", cls);
  const pageTitle = Object(useLoc["a" /* getLoc */])("ShareAcceptancePage.Title");
  return /*#__PURE__*/react["createElement"]("div", {
    className: className
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "header-section"
  }, /*#__PURE__*/react["createElement"](icloud_and_arrow_down["a" /* default */], {
    className: "header-image",
    width: 60,
    height: 60,
    layoutMode: "glyphBox"
  }), /*#__PURE__*/react["createElement"]("h2", null, pageTitle), /*#__PURE__*/react["createElement"]("div", {
    className: "error-details"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "error-title"
  }, errorTitle), /*#__PURE__*/react["createElement"]("div", {
    className: "error-description"
  }, errorDescription))));
};
// CONCATENATED MODULE: ./src/Pages/RemindersTemplatePage/RemindersTemplatePage.scss
// extracted by mini-css-extract-plugin

// EXTERNAL MODULE: /workspace/node_modules/@icloudweb/safe/build/loadUrl.js
var loadUrl = __webpack_require__(902);

// CONCATENATED MODULE: ./src/Pages/RemindersTemplatePage/RemindersTemplatePage.tsx










const RemindersTemplateActionButton = _ref => {
  let {
    longGuid,
    isUnsupportedOs,
    isUnsupportedOsVersion,
    isIOS,
    isiPad,
    isMac
  } = _ref;
  if (isUnsupportedOs) {
    return /*#__PURE__*/react["createElement"]("h3", null, Object(useLoc["a" /* getLoc */])("RemindersTemplatePage.Description.UnsupportedOs"));
  } else if (isUnsupportedOsVersion) {
    return /*#__PURE__*/react["createElement"]("h3", null, Object(useLoc["a" /* getLoc */])(isiPad ? "RemindersTemplatePage.Description.UnsupportedIpadOsVersion" : isIOS ? "RemindersTemplatePage.Description.UnsupportedIOsVersion" : isMac ? "RemindersTemplatePage.Description.UnsupportedMacOsVersion" : "RemindersTemplatePage.Description.UnsupportedOs"));
  } else {
    return /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
      onActivate: () => {
        loadUrl["a" /* loadUrl */](`x-apple-reminderkit://publictemplate/${longGuid}`);
      },
      className: "preview-template",
      variant: "block primary"
    }, Object(useLoc["a" /* getLoc */])("RemindersTemplatePage.Button.RemindersTemplate"));
  }
};
function checkIfDeviceUnsupported(isMac, isIOS, isDesktopClassIpad, osMajorVersion, osMinorVersion, osMicroVersion) {
  const isUnsupportedOs = !(isMac || isIOS);

  // Note: Reminders Template feature is shipped with iOS16/iPadOS16/macOS13
  // since macOS useragent cap at 10.15.7, we show the button for user with 10.15.7 or newer
  const isUnsupportedOsVersion = isMac && (osMajorVersion < 10 || osMajorVersion === 10 && (osMinorVersion < 15 || osMinorVersion === 15 && osMicroVersion < 7)) ||
  // iPad safari pretents to be a Mac by using a macOS useragent so we have to exclude it from here
  isIOS && !isDesktopClassIpad && osMajorVersion < 16;
  return {
    isUnsupportedOs,
    isUnsupportedOsVersion
  };
}
const RemindersTemplatePage = _ref2 => {
  let {
    className: cls,
    shareInfo
  } = _ref2;
  const {
    applicationIdentifier,
    shareTitle,
    longGuid
  } = shareInfo;
  const className = classnames_default()("reminders-template-page", cls);
  const pageTitle = Object(useLoc["a" /* getLoc */])("ShareAcceptancePage.Title");
  const {
    isMac,
    isIOS,
    osMajorVersion,
    osMinorVersion,
    osMicroVersion,
    isDesktopClassIpad
  } = CloudOSParameters["a" /* CloudOSParameters */].sharedInstance.applicationParameter;
  const isiPad = Platform["c" /* Platform */].sharedInstance.isiPad;
  const {
    isUnsupportedOs,
    isUnsupportedOsVersion
  } = checkIfDeviceUnsupported(isMac, isIOS, isDesktopClassIpad, osMajorVersion, osMinorVersion, osMicroVersion);
  return /*#__PURE__*/react["createElement"]("div", {
    className: className
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "share-contant-container"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "header-section"
  }, /*#__PURE__*/react["createElement"](icloud_and_arrow_down["a" /* default */], {
    className: "header-image",
    width: 60,
    height: 60,
    layoutMode: "glyphBox"
  }), /*#__PURE__*/react["createElement"]("h2", null, pageTitle), /*#__PURE__*/react["createElement"]("div", {
    className: classnames_default()("sharing-details", {
      disabled: isUnsupportedOs || isUnsupportedOsVersion
    })
  }, /*#__PURE__*/react["createElement"](AppIcon["a" /* AppIcon */], {
    applicationIdentifier: applicationIdentifier,
    iconSize: 40
  }), /*#__PURE__*/react["createElement"]("div", {
    className: "sharing-title"
  }, Object(useLoc["a" /* getLoc */])("RemindersTemplatePage.Title.RemindersTemplate")), /*#__PURE__*/react["createElement"]("div", {
    className: "sharing-item-description"
  }, shareTitle))), /*#__PURE__*/react["createElement"]("div", {
    className: "bottom-section"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "buttons-row"
  }, /*#__PURE__*/react["createElement"](RemindersTemplateActionButton, {
    longGuid: longGuid,
    isUnsupportedOs: isUnsupportedOs,
    isUnsupportedOsVersion: isUnsupportedOsVersion,
    isIOS: isIOS,
    isiPad: isiPad,
    isMac: isMac
  })), /*#__PURE__*/react["createElement"]("p", {
    className: "download-add-description"
  }, isUnsupportedOs || isUnsupportedOsVersion ? Object(useLoc["a" /* getLoc */])("RemindersTemplatePage.Description.Unsupported") : Object(useLoc["a" /* getLoc */])("RemindersTemplatePage.Description.Supported")))));
};
// EXTERNAL MODULE: ./src/Resources/Images/icloud_welcome.png
var icloud_welcome = __webpack_require__(1601);

// EXTERNAL MODULE: ./src/Resources/Images/icloud_welcome@2x.png
var icloud_welcome_2x = __webpack_require__(1602);

// EXTERNAL MODULE: ./src/Resources/Images/icloud_welcome@3x.png
var icloud_welcome_3x = __webpack_require__(1603);

// EXTERNAL MODULE: /workspace/node_modules/@icloudweb/auth-service/react/DomainRedirect/DomainRedirectPage.js + 1 modules
var DomainRedirectPage = __webpack_require__(2303);

// CONCATENATED MODULE: ./src/Pages/DomainRedirectPage/DomainRedirectPage.tsx
function DomainRedirectPage_extends() { return DomainRedirectPage_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, DomainRedirectPage_extends.apply(null, arguments); }





const DomainRedirectPage_DomainRedirectPage = props => {
  return /*#__PURE__*/react["createElement"](DomainRedirectPage["a" /* DomainRedirectPage */], DomainRedirectPage_extends({}, props, {
    logo: /*#__PURE__*/react["createElement"]("img", {
      src: icloud_welcome["a" /* default */],
      srcSet: `${icloud_welcome["a" /* default */]}, ${icloud_welcome_2x["a" /* default */]} 2x, ${icloud_welcome_3x["a" /* default */]} 3x`,
      width: 430,
      height: 388,
      alt: "",
      "aria-hidden": true
    })
  }));
};
// CONCATENATED MODULE: ./src/Legacy/Resources/Styles/TermsAndConditionsSuccessConfirmation.scss
// extracted by mini-css-extract-plugin

// EXTERNAL MODULE: ./src/Legacy/loc.ts
var loc = __webpack_require__(925);

// CONCATENATED MODULE: ./src/Legacy/Components/TermsAndConditionsSuccessConfirmation.tsx





function TermsAndConditionsSuccessConfirmation(props) {
  const buttonRef = react["useRef"](null);
  react["useEffect"](() => {
    var _buttonRef$current;
    (_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 || _buttonRef$current.focus();
  }, []);
  const title = Object(loc["a" /* loc */])("CloudOS.TermsAndConditions.SuccessConfirmation.Title");
  const description = (() => {
    const choice = (CloudOSParameters["a" /* CloudOSParameters */].sharedInstance.needsGameCenterTermsFlow ? 1 : 0) + 2 * (props.wasTermsUpdatePerformed ? 1 : 0);
    switch (choice) {
      case 0:
        return Object(loc["a" /* loc */])("CloudOS.TermsAndConditions.SuccessConfirmation.UpToDate.Description");
      case 1:
        return Object(loc["a" /* loc */])("CloudOS.TermsAndConditions.SuccessConfirmation.GameCenter.UpToDate.Description");
      case 2:
        return Object(loc["a" /* loc */])("CloudOS.TermsAndConditions.SuccessConfirmation.Description");
      case 3:
        return Object(loc["a" /* loc */])("CloudOS.TermsAndConditions.SuccessConfirmation.GameCenter.Description");
      default:
        return undefined;
    }
  })();
  const dismissHandler = () => {
    var _props$onDismiss;
    if (CloudOSParameters["a" /* CloudOSParameters */].sharedInstance.applicationUrl.pathname.startsWith("/terms")) {
      CloudOSParameters["a" /* CloudOSParameters */].sharedInstance.replaceHistoryState(undefined, undefined, undefined, undefined, undefined, undefined);
    }
    (_props$onDismiss = props.onDismiss) === null || _props$onDismiss === void 0 || _props$onDismiss.call(props);
  };
  return /*#__PURE__*/react["createElement"]("div", {
    className: "terms-and-conditions-success-confirmation"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "content"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "title-text"
  }, title), /*#__PURE__*/react["createElement"]("div", {
    className: "description-text"
  }, description), /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
    ref: buttonRef,
    onActivate: dismissHandler
  }, Object(loc["a" /* loc */])("CloudOS.Button.OK.Title"))));
}
// CONCATENATED MODULE: ./src/Pages/TermsAndConditionsPage/TermsAndConditionsPage.scss
// extracted by mini-css-extract-plugin

// EXTERNAL MODULE: ./src/Pages/LandingPage/GCBDBranding.tsx + 1 modules
var GCBDBranding = __webpack_require__(2310);

// EXTERNAL MODULE: /workspace/node_modules/html-react-parser/index.mjs
var html_react_parser = __webpack_require__(1529);

// CONCATENATED MODULE: ./src/Pages/TermsAndConditionsPage/TermsAndConditionsPage.tsx











function TermsAndConditionsDialog(props) {
  const handleDisagree = () => {
    window.location.reload();
  };
  const handleDownloadCopy = () => {
    const {
      locale,
      country,
      downloadICloudTerms
    } = props.termsDetails;
    const termsURL = Object(addQueryArgs["a" /* addQueryArgs */])(downloadICloudTerms, {
      locale,
      country
    });
    const downloadManager = new ValidatedDownloadManager["a" /* ValidatedDownloadManager */]("X-APPLE-TERMS-VALIDATE", DomainManagerService["a" /* DomainManagerService */].sharedInstance.current.servicesDomain);
    downloadManager.download(new ValidatedDownloadUrl["a" /* ValidatedDownloadUrl */](termsURL, "termsValidateToken"));
  };
  const [showDefaultAlert] = Object(useShowAlert["b" /* useShowAlert */])();
  const [showGcbdPrivacyNoticeAlert] = Object(useShowAlert["b" /* useShowAlert */])();
  const showConsentAlert = _ref => {
    let {
      title,
      description,
      accessory,
      onActionSelected,
      animates = UIPaneContainer["b" /* PaneAnimates */].IN,
      showAlertFn,
      variant = "standard",
      buttons = [{
        title: Object(useLoc["a" /* getLoc */])("CloudOS.TermsAndConditions.AgreeButton.Title"),
        action: "agree"
      }, {
        title: Object(useLoc["a" /* getLoc */])("CloudOS.TermsAndConditions.CancelButton.Title"),
        action: "cancel"
      }]
    } = _ref;
    showAlertFn({
      icon: /*#__PURE__*/react["createElement"](icloud["a" /* default */], {
        fill: "#0061e1",
        layoutMode: "glyphBox",
        "aria-hidden": "true"
      }),
      variant,
      animates,
      title,
      buttons,
      cancelAction: "cancel",
      onActionSelected: action => {
        onActionSelected(action);
      },
      ...(!!description && {
        description
      }),
      ...(!!accessory && {
        accessory
      })
    });
  };
  const showTermsAndConditionsAgreeAlert = () => {
    showConsentAlert({
      showAlertFn: showDefaultAlert,
      title: Object(useLoc["a" /* getLoc */])("CloudOS.TermsAndConditions.Title"),
      description: props.accountCountry === "CHN" ? Object(useLoc["a" /* getLoc */])("CloudOS.TermsAndConditions.ChinaTerms.Description") : Object(useLoc["a" /* getLoc */])("CloudOS.TermsAndConditions.Description"),
      onActionSelected: action => {
        if (action === "agree") {
          if (props.showGcbdPrivacyConsent) {
            var _props$termsDetails$g, _props$termsDetails$g2, _props$termsDetails$c, _props$termsDetails$d;
            showConsentAlert({
              showAlertFn: showGcbdPrivacyNoticeAlert,
              title: (_props$termsDetails$g = props.termsDetails.gcbdPrivacyNoticeTitle) !== null && _props$termsDetails$g !== void 0 ? _props$termsDetails$g : "",
              accessory: Object(html_react_parser["default"])(`<p class="description">${unescapeHTML((_props$termsDetails$g2 = props.termsDetails.gcbdPrivacyNoticeMessage) !== null && _props$termsDetails$g2 !== void 0 ? _props$termsDetails$g2 : "")}</p>`),
              variant: "standard disable-animation should-stack",
              buttons: [{
                title: (_props$termsDetails$c = props.termsDetails.confirmAndAgreeButtonText) !== null && _props$termsDetails$c !== void 0 ? _props$termsDetails$c : Object(useLoc["a" /* getLoc */])("CloudOS.TermsAndConditions.AgreeButton.Title"),
                action: "agree"
              }, {
                title: (_props$termsDetails$d = props.termsDetails.disagreeButtonText) !== null && _props$termsDetails$d !== void 0 ? _props$termsDetails$d : Object(useLoc["a" /* getLoc */])("CloudOS.TermsAndConditions.DisagreeButton.Title"),
                action: "cancel"
              }],
              onActionSelected: action2nd => {
                if (action2nd === "agree") {
                  props.onAcceptTerms(true);
                }
              }
            });
          } else {
            props.onAcceptTerms(true);
          }
        }
      }
    });
  };

  // Here we get regular modal upto spec: show full size dioalog
  // but keep footer from the main page visible and actionable
  react["useEffect"](() => {
    var _document$getElements;
    // This will allow clicking footer if needed
    (_document$getElements = document.getElementsByTagName("ui-main-pane")[0]) === null || _document$getElements === void 0 || _document$getElements.removeAttribute("inert");
    let backdrops = document.getElementsByClassName("show-modal-pane-centered");
    for (let i = 0; i < backdrops.length; i++) {
      // Letting touch/click events to go thru
      const {
        style
      } = backdrops[i];
      style.background = "transparent";
      style.pointerEvents = "none";
    }
    // We dont care about restoring this as whole modal will be gone on acceptance
  }, []);
  return /*#__PURE__*/react["createElement"]("div", {
    className: "terms-and-conditions"
  }, /*#__PURE__*/react["createElement"](icloud["a" /* default */], {
    desiredFontSize: 24,
    fill: "#0061e1",
    className: "cloud-image"
  }), /*#__PURE__*/react["createElement"]("div", {
    className: "terms-header"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "terms-header-title"
  }, props.isChina ? /*#__PURE__*/react["createElement"](react["Fragment"], null, Object(useLoc["a" /* getLoc */])("Application.Title"), /*#__PURE__*/react["createElement"](GCBDBranding["a" /* GCBDBranding */], {
    className: "china-terms-and-conditions-branding"
  }), /*#__PURE__*/react["createElement"]("div", null, Object(useLoc["a" /* getLoc */])("CloudOS.TermsAndConditions.Title.WithoutiCloud"))) : /*#__PURE__*/react["createElement"](react["Fragment"], null, Object(useLoc["a" /* getLoc */])("CloudOS.TermsAndConditions.Title")))), /*#__PURE__*/react["createElement"]("div", {
    className: "content-scroll"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "content-desc",
    dangerouslySetInnerHTML: {
      __html: props.termsDetails.iCloudTerms.content
    }
  })), /*#__PURE__*/react["createElement"]("div", {
    className: "terms-footer"
  }, /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
    variant: "block secondary",
    className: "download-button",
    onActivate: handleDownloadCopy
  }, Object(useLoc["a" /* getLoc */])("CloudOS.TermsAndConditions.DownloadCopyButton.Title")), /*#__PURE__*/react["createElement"]("div", {
    className: "button-groups"
  }, /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
    variant: "block neutral",
    className: "disagree-button",
    onActivate: handleDisagree
  }, Object(useLoc["a" /* getLoc */])("CloudOS.TermsAndConditions.DisagreeButton.Title")), /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
    variant: "block primary",
    onActivate: showTermsAndConditionsAgreeAlert
  }, Object(useLoc["a" /* getLoc */])("CloudOS.TermsAndConditions.AgreeButton.Title")))));
}
function ChinaTermsAndConditions(props) {
  return /*#__PURE__*/react["createElement"]("div", {
    className: "terms-and-conditions"
  }, /*#__PURE__*/react["createElement"](icloud["a" /* default */], {
    desiredFontSize: 24,
    fill: "#0061e1",
    className: "cloud-image"
  }), /*#__PURE__*/react["createElement"]("div", {
    className: "terms-header"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "terms-header-title"
  }, Object(useLoc["a" /* getLoc */])("Application.Title"), /*#__PURE__*/react["createElement"](GCBDBranding["a" /* GCBDBranding */], {
    className: "china-terms-and-conditions-branding"
  }))), /*#__PURE__*/react["createElement"]("div", {
    className: "content-scroll"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "china-terms-label"
  }, Object(useLoc["a" /* getLoc */])("CloudOS.TermsAndConditions.ChinaTerms.Paragraph.One")), /*#__PURE__*/react["createElement"]("div", {
    className: "china-terms-label"
  }, Object(useLoc["a" /* getLoc */])("CloudOS.TermsAndConditions.ChinaTerms.Paragraph.Two"))), /*#__PURE__*/react["createElement"]("div", {
    className: "terms-footer china"
  }, /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
    variant: "block primary",
    onActivate: props.onContinue
  }, Object(useLoc["a" /* getLoc */])("CloudOS.TermsAndConditions.ContinueButton.Title"))));
}
const TermsAndConditionsPage = props => {
  const [chinaTermsContinued, setChinaTermsContinued] = react["useState"](false);
  const handleChinaTermsContinued = () => setChinaTermsContinued(true);
  const terms = props.accountCountry === "CHN" && !chinaTermsContinued ? /*#__PURE__*/react["createElement"](ChinaTermsAndConditions, {
    onContinue: handleChinaTermsContinued
  }) : /*#__PURE__*/react["createElement"](TermsAndConditionsDialog, {
    onAcceptTerms: props.onAcceptTerms,
    accountCountry: props.accountCountry,
    termsDetails: props.termsDetails,
    isChina: props.accountCountry === "CHN",
    showGcbdPrivacyConsent: props.showGcbdPrivacyConsent
  });
  return /*#__PURE__*/react["createElement"]("div", {
    className: "terms-and-conditions-container"
  }, terms);
};
function unescapeHTML(htmlStr) {
  return htmlStr.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&amp;/g, "&");
}
// CONCATENATED MODULE: ./src/Legacy/Components/RootComponentRoutePages.tsx






























function RootComponentRoutePages_onPageLoaded() {
  if (AuthenticationController["h" /* userSignal */].value) {
    CloudOSApplication["a" /* CloudOSApplication */].cloudOSApplication.triggerPrefetchTileData(false, AuthenticationController["h" /* userSignal */].value);
  }
  Object(Push["c" /* initializePushConnection */])();
}
function WaitingForPCSKeysRoute(props) {
  return /*#__PURE__*/react["createElement"](FixedFlexPage["a" /* FixedFlexPage */], {
    className: props.className
  }, /*#__PURE__*/react["createElement"](ApplicationToolbarThemeProvider["b" /* ApplicationToolbarThemeProvider */], {
    value: ApplicationToolbarThemeProvider["a" /* ApplicationToolbarTheme */].LOGIN
  }, /*#__PURE__*/react["createElement"](CloudOSApplicationToolbar["a" /* CloudOSApplicationToolbar */], null)), /*#__PURE__*/react["createElement"]("main", null, /*#__PURE__*/react["createElement"](EPLoadingPage, null)), /*#__PURE__*/react["createElement"]("footer", null, /*#__PURE__*/react["createElement"](LegalFooter["a" /* LegalFooter */], null)));
}
function AccountMaintenancePageRoute(props) {
  return /*#__PURE__*/react["createElement"](FixedFlexPage["a" /* FixedFlexPage */], {
    className: props.className
  }, /*#__PURE__*/react["createElement"](ApplicationToolbarThemeProvider["b" /* ApplicationToolbarThemeProvider */], {
    value: ApplicationToolbarThemeProvider["a" /* ApplicationToolbarTheme */].LOGIN
  }, /*#__PURE__*/react["createElement"](CloudOSApplicationToolbar["a" /* CloudOSApplicationToolbar */], null)), /*#__PURE__*/react["createElement"]("main", null, /*#__PURE__*/react["createElement"](AccountMaintenancePage, null)), /*#__PURE__*/react["createElement"]("footer", null, /*#__PURE__*/react["createElement"](LegalFooter["a" /* LegalFooter */], null)));
}
function WebAccessBlockedPageRoute(props) {
  return /*#__PURE__*/react["createElement"](FixedFlexPage["a" /* FixedFlexPage */], {
    className: props.className
  }, /*#__PURE__*/react["createElement"](ApplicationToolbarThemeProvider["b" /* ApplicationToolbarThemeProvider */], {
    value: ApplicationToolbarThemeProvider["a" /* ApplicationToolbarTheme */].LOGIN
  }, /*#__PURE__*/react["createElement"](CloudOSApplicationToolbar["a" /* CloudOSApplicationToolbar */], null)), /*#__PURE__*/react["createElement"]("main", null, /*#__PURE__*/react["createElement"](WebAccessBlockedPage, {
    onComplete: props.onComplete
  })), /*#__PURE__*/react["createElement"]("footer", null, /*#__PURE__*/react["createElement"](LegalFooter["a" /* LegalFooter */], null)));
}
function SettingsPageRoute(props) {
  const shouldShowUpgradePlanTiles = useShouldShowUpgradePlanTiles();
  return /*#__PURE__*/react["createElement"](FixedFlexPage["a" /* FixedFlexPage */], {
    className: classnames_default()("settings-page-route", props.className)
  }, /*#__PURE__*/react["createElement"](ApplicationToolbarThemeProvider["b" /* ApplicationToolbarThemeProvider */], {
    value: ApplicationToolbarThemeProvider["a" /* ApplicationToolbarTheme */].INTERNAL_APP
  }, /*#__PURE__*/react["createElement"](CloudOSApplicationToolbar["a" /* CloudOSApplicationToolbar */], {
    canTriggerAutoWhatsNew: true
  })), /*#__PURE__*/react["createElement"]("main", null, /*#__PURE__*/react["createElement"](AccountPage, {
    onPageLoaded: RootComponentRoutePages_onPageLoaded
  })), /*#__PURE__*/react["createElement"]("footer", {
    className: `${shouldShowUpgradePlanTiles ? "gray-theme" : ""}`
  }, /*#__PURE__*/react["createElement"](Breadcrumbs, {
    currentPageName: Object(useLoc["a" /* getLoc */])("Settings.DisplayName")
  }), /*#__PURE__*/react["createElement"](LegalFooter["a" /* LegalFooter */], null)));
}
function RecoveryPageRoute(props) {
  return /*#__PURE__*/react["createElement"](FixedFlexPage["a" /* FixedFlexPage */], {
    className: classnames_default()("recovery-page-route", props.className)
  }, /*#__PURE__*/react["createElement"](ApplicationToolbarThemeProvider["b" /* ApplicationToolbarThemeProvider */], {
    value: ApplicationToolbarThemeProvider["a" /* ApplicationToolbarTheme */].INTERNAL_APP
  }, /*#__PURE__*/react["createElement"](CloudOSApplicationToolbar["a" /* CloudOSApplicationToolbar */], {
    canTriggerAutoWhatsNew: true
  })), /*#__PURE__*/react["createElement"]("main", null, /*#__PURE__*/react["createElement"](RecoveryPage, null)), /*#__PURE__*/react["createElement"]("footer", null, /*#__PURE__*/react["createElement"](Breadcrumbs, {
    currentPageName: Object(useLoc["a" /* getLoc */])("RecoveryPage.Title")
  }), /*#__PURE__*/react["createElement"](LegalFooter["a" /* LegalFooter */], null)));
}
function ICloudPlusPageRoute(props) {
  return /*#__PURE__*/react["createElement"](FixedFlexPage["a" /* FixedFlexPage */], {
    className: classnames_default()("icloud-plus-page-route", props.className)
  }, /*#__PURE__*/react["createElement"](ApplicationToolbarThemeProvider["b" /* ApplicationToolbarThemeProvider */], {
    value: ApplicationToolbarThemeProvider["a" /* ApplicationToolbarTheme */].INTERNAL_APP
  }, /*#__PURE__*/react["createElement"](CloudOSApplicationToolbar["a" /* CloudOSApplicationToolbar */], {
    canTriggerAutoWhatsNew: true
  })), /*#__PURE__*/react["createElement"]("main", null, /*#__PURE__*/react["createElement"](ICloudPlusPage, {
    onPageLoaded: RootComponentRoutePages_onPageLoaded
  })), /*#__PURE__*/react["createElement"]("footer", null, /*#__PURE__*/react["createElement"](Breadcrumbs, {
    currentPageName: Object(useLoc["a" /* getLoc */])("ICloudPlusPage.Title")
  }), /*#__PURE__*/react["createElement"](LegalFooter["a" /* LegalFooter */], null)));
}
function StoragePageRoute(props) {
  const currentPageName = props.isBeneficiary ? Object(useLoc["a" /* getLoc */])("StoragePage.Title.Lite") : Object(useLoc["a" /* getLoc */])("StoragePage.Title");
  return /*#__PURE__*/react["createElement"](FixedFlexPage["a" /* FixedFlexPage */], {
    className: classnames_default()("storage-page-route", props.className)
  }, /*#__PURE__*/react["createElement"](ApplicationToolbarThemeProvider["b" /* ApplicationToolbarThemeProvider */], {
    value: ApplicationToolbarThemeProvider["a" /* ApplicationToolbarTheme */].INTERNAL_APP
  }, /*#__PURE__*/react["createElement"](CloudOSApplicationToolbar["a" /* CloudOSApplicationToolbar */], {
    canTriggerAutoWhatsNew: true
  })), /*#__PURE__*/react["createElement"]("main", null, /*#__PURE__*/react["createElement"](StoragePage, {
    onPageLoaded: RootComponentRoutePages_onPageLoaded
  })), /*#__PURE__*/react["createElement"]("footer", null, /*#__PURE__*/react["createElement"](Breadcrumbs, {
    currentPageName: currentPageName
  }), /*#__PURE__*/react["createElement"](LegalFooter["a" /* LegalFooter */], null)));
}
function PlanPageRoute(props) {
  const currentPageName = props.isBeneficiary ? Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Title.Lite") : Object(useLoc["a" /* getLoc */])("PlanDetailsPage.Title");
  const shouldShowUpgradePlanTiles = useShouldShowUpgradePlanTiles();
  return /*#__PURE__*/react["createElement"](FixedFlexPage["a" /* FixedFlexPage */], {
    className: classnames_default()("plan-page-route", props.className)
  }, /*#__PURE__*/react["createElement"](ApplicationToolbarThemeProvider["b" /* ApplicationToolbarThemeProvider */], {
    value: ApplicationToolbarThemeProvider["a" /* ApplicationToolbarTheme */].INTERNAL_APP
  }, /*#__PURE__*/react["createElement"](CloudOSApplicationToolbar["a" /* CloudOSApplicationToolbar */], {
    canTriggerAutoWhatsNew: true
  })), /*#__PURE__*/react["createElement"]("main", null, /*#__PURE__*/react["createElement"](PlanDetailsPage, {
    onPageLoaded: RootComponentRoutePages_onPageLoaded
  })), /*#__PURE__*/react["createElement"]("footer", {
    className: `${shouldShowUpgradePlanTiles ? "gray-theme" : ""}`
  }, /*#__PURE__*/react["createElement"](Breadcrumbs, {
    currentPageName: currentPageName
  }), /*#__PURE__*/react["createElement"](LegalFooter["a" /* LegalFooter */], null)));
}
function MailDropRoute(props) {
  return /*#__PURE__*/react["createElement"](FixedFlexPage["a" /* FixedFlexPage */], {
    className: props.className
  }, /*#__PURE__*/react["createElement"](ApplicationToolbarThemeProvider["b" /* ApplicationToolbarThemeProvider */], {
    value: ApplicationToolbarThemeProvider["a" /* ApplicationToolbarTheme */].LOGIN
  }, /*#__PURE__*/react["createElement"](CloudOSApplicationToolbar["a" /* CloudOSApplicationToolbar */], null)), /*#__PURE__*/react["createElement"]("main", null, /*#__PURE__*/react["createElement"](MailDropPage, {
    mailDropDetail: props.details
  })), /*#__PURE__*/react["createElement"]("footer", null, /*#__PURE__*/react["createElement"](LegalFooter["a" /* LegalFooter */], null)));
}
function ShareAcceptanceErrorRoute(props) {
  return /*#__PURE__*/react["createElement"](FixedFlexPage["a" /* FixedFlexPage */], {
    className: props.className
  }, /*#__PURE__*/react["createElement"](ApplicationToolbarThemeProvider["b" /* ApplicationToolbarThemeProvider */], {
    value: ApplicationToolbarThemeProvider["a" /* ApplicationToolbarTheme */].LOGIN
  }, /*#__PURE__*/react["createElement"](CloudOSApplicationToolbar["a" /* CloudOSApplicationToolbar */], null)), /*#__PURE__*/react["createElement"]("main", null, /*#__PURE__*/react["createElement"](ShareAcceptanceErrorPage, {
    errorDescription: props.errorDescription,
    errorTitle: props.errorTitle,
    applicationIdentifier: props.applicationIdentifier
  })), /*#__PURE__*/react["createElement"]("footer", null, /*#__PURE__*/react["createElement"](LegalFooter["a" /* LegalFooter */], null)));
}
function RequestAccessPageRoute(props) {
  return  false ? /*#__PURE__*/undefined : null;
}
function CKRemindersTemplateRoute(props) {
  return /*#__PURE__*/react["createElement"](FixedFlexPage["a" /* FixedFlexPage */], {
    className: props.className
  }, /*#__PURE__*/react["createElement"](ApplicationToolbarThemeProvider["b" /* ApplicationToolbarThemeProvider */], {
    value: ApplicationToolbarThemeProvider["a" /* ApplicationToolbarTheme */].LOGIN
  }, /*#__PURE__*/react["createElement"](CloudOSApplicationToolbar["a" /* CloudOSApplicationToolbar */], null)), /*#__PURE__*/react["createElement"]("main", {
    className: "centering"
  }, /*#__PURE__*/react["createElement"](RemindersTemplatePage, props.pageProps)), /*#__PURE__*/react["createElement"]("footer", null, /*#__PURE__*/react["createElement"](LegalFooter["a" /* LegalFooter */], null)));
}
function MailEmailView(props) {
  const launcher = Object(ApplicationLaunchProvider["b" /* useApplicationLauncher */])();
  launcher.launchApp("mail", {
    options: {
      source: {
        reason: ChildApplication["b" /* LaunchReason */].OPEN_DOCUMENT
      },
      launchItem: {
        id: props.threadId
      }
    }
  });
  return null;
}
function CalendarEventView(props) {
  const launcher = Object(ApplicationLaunchProvider["b" /* useApplicationLauncher */])();
  launcher.launchApp("calendar", {
    options: {
      source: {
        reason: ChildApplication["b" /* LaunchReason */].OPEN_DOCUMENT
      },
      launchItem: {
        id: props.eventId,
        calendarId: props.collectionId
      }
    }
  });
  return null;
}
function RedirectToDomainRoute(props) {
  return /*#__PURE__*/react["createElement"](FixedFlexPage["a" /* FixedFlexPage */], {
    className: classnames_default()("redirect-to-domain-route", props.className)
  }, /*#__PURE__*/react["createElement"](ApplicationToolbarThemeProvider["b" /* ApplicationToolbarThemeProvider */], {
    value: ApplicationToolbarThemeProvider["a" /* ApplicationToolbarTheme */].LOGIN
  }, /*#__PURE__*/react["createElement"](CloudOSApplicationToolbar["a" /* CloudOSApplicationToolbar */], null)), /*#__PURE__*/react["createElement"]("main", null, /*#__PURE__*/react["createElement"](DomainRedirectPage_DomainRedirectPage, props.pageProps)), /*#__PURE__*/react["createElement"]("footer", null, /*#__PURE__*/react["createElement"](LegalFooter["a" /* LegalFooter */], null)));
}
function TermsAndConditionsConfirmationRoute(props) {
  return /*#__PURE__*/react["createElement"]("main", null, /*#__PURE__*/react["createElement"](TermsAndConditionsSuccessConfirmation, {
    wasTermsUpdatePerformed: props.wasTermsUpdatePerformed,
    onDismiss: props.onDismiss
  }));
}
function TermsAndConditionsRoute(props) {
  return /*#__PURE__*/react["createElement"](FixedFlexPage["a" /* FixedFlexPage */], {
    className: classnames_default()("terms-and-conditions-route", props.className)
  }, /*#__PURE__*/react["createElement"](ApplicationToolbarThemeProvider["b" /* ApplicationToolbarThemeProvider */], {
    value: ApplicationToolbarThemeProvider["a" /* ApplicationToolbarTheme */].LOGIN
  }, /*#__PURE__*/react["createElement"](CloudOSApplicationToolbar["a" /* CloudOSApplicationToolbar */], null)), /*#__PURE__*/react["createElement"]("main", null, /*#__PURE__*/react["createElement"](TermsAndConditionsPage, props.pageProps)), /*#__PURE__*/react["createElement"]("footer", null, /*#__PURE__*/react["createElement"](LegalFooter["a" /* LegalFooter */], null)));
}

/***/ }),

/***/ 2156:
/*!************************************************************************!*\
  !*** ./src/ComponentsGeneric/Tiles/FileIcon/FileIcon.tsx + 12 modules ***!
  \************************************************************************/
/*! exports provided: FileIcon */
/*! exports used: FileIcon */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Hooks/useLoc.ts */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/react/index.js (<- Module is not an ECMAScript module) */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";

// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ FileIcon; });

// EXTERNAL MODULE: /workspace/node_modules/react/index.js
var react = __webpack_require__(870);
var react_default = /*#__PURE__*/__webpack_require__.n(react);

// CONCATENATED MODULE: ./src/Resources/Images/FileIcons/keynote_icon.svg
var _excluded = ["styles"];
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }

/* harmony default export */ var keynote_icon = (function (_ref) {
  var _ref$styles = _ref.styles,
    styles = _ref$styles === void 0 ? {} : _ref$styles,
    props = _objectWithoutProperties(_ref, _excluded);
  return /*#__PURE__*/react_default.a.createElement("svg", _extends({
    xmlns: "http://www.w3.org/2000/svg",
    viewBox: "37.11 6.39 82.13 90.14"
  }, props), /*#__PURE__*/react_default.a.createElement("path", {
    fill: "var(--theme-color-systemBlue)",
    fillRule: "evenodd",
    d: "M55.663 37.29h44.796c1.503 0 2.685 1.181 2.685 2.736a2.661 2.661 0 01-2.685 2.695H55.663c-1.514 0-2.685-1.182-2.685-2.695 0-1.555 1.171-2.737 2.685-2.737zm22.435-5.067c-6.81 0-11.773-4.827-11.773-10.287 0-6.063 5.502-10.486 11.773-10.486 5.959 0 11.689 4.122 11.689 10.62 0 5.389-4.963 10.153-11.69 10.153zM45.692 50.255h64.948c6.3 0 9.66-4.13 8.29-10.968l-4.682-23.034c-1.204-6.08-5.426-9.865-11.546-9.865H53.63c-6.12 0-10.342 3.786-11.535 9.865l-4.682 23.034c-1.38 6.838 1.98 10.968 8.28 10.968zM74.08 91.72h8.174V48.853H74.08zm-12.89 4.806h33.95c2.227 0 4.082-1.906 4.082-4.082 0-2.237-1.855-4.082-4.082-4.082H61.19c-2.227 0-4.082 1.845-4.082 4.082 0 2.176 1.855 4.082 4.082 4.082z"
  }));
});
// CONCATENATED MODULE: ./src/Resources/Images/FileIcons/pages_icon.svg
var pages_icon_excluded = ["styles"];
function pages_icon_extends() { return pages_icon_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, pages_icon_extends.apply(null, arguments); }
function pages_icon_objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = pages_icon_objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function pages_icon_objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }

/* harmony default export */ var pages_icon = (function (_ref) {
  var _ref$styles = _ref.styles,
    styles = _ref$styles === void 0 ? {} : _ref$styles,
    props = pages_icon_objectWithoutProperties(_ref, pages_icon_excluded);
  return /*#__PURE__*/react_default.a.createElement("svg", pages_icon_extends({
    xmlns: "http://www.w3.org/2000/svg",
    viewBox: "31.89 11.51 92.55 78.89"
  }, props), /*#__PURE__*/react_default.a.createElement("path", {
    fill: "var(--theme-color-systemOrange)",
    d: "M70.12 42.164l10.174 10.235 16.4-16.338c10.7-10.647 16.737-20.997 13.968-23.767-2.977-2.966-13.287 2.699-23.934 13.335zm5.488 13.375l-8.616-8.586-26.194 26.194-2.613 3.722 7.466 7.403 3.764-2.55zM32.113 88.116c-.788 1.451.622 2.81 2.01 2.073l7.236-3.821-5.362-5.31zm17.918 2.249h70.482c2.135 0 3.927-1.803 3.927-3.979 0-2.124-1.792-3.926-3.927-3.926H57.988z"
  }));
});
// CONCATENATED MODULE: ./src/Resources/Images/FileIcons/numbers_icon.svg
var numbers_icon_excluded = ["styles"];
function numbers_icon_extends() { return numbers_icon_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, numbers_icon_extends.apply(null, arguments); }
function numbers_icon_objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = numbers_icon_objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function numbers_icon_objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }

/* harmony default export */ var numbers_icon = (function (_ref) {
  var _ref$styles = _ref.styles,
    styles = _ref$styles === void 0 ? {} : _ref$styles,
    props = numbers_icon_objectWithoutProperties(_ref, numbers_icon_excluded);
  return /*#__PURE__*/react_default.a.createElement("svg", numbers_icon_extends({
    xmlns: "http://www.w3.org/2000/svg",
    viewBox: "32 6.28 92.33 90.35"
  }, props), /*#__PURE__*/react_default.a.createElement("path", {
    fill: "var(--theme-color-systemGreen)",
    d: "M37.499 96.634h6.37c3.29 0 5.447-2.261 5.447-5.673V73.584c0-3.35-2.158-5.673-5.446-5.673h-6.371c-3.278 0-5.498 2.323-5.498 5.673v17.377c0 3.412 2.22 5.673 5.498 5.673zm24.995 0h6.37c3.268 0 5.499-2.261 5.499-5.673V50.239c0-3.413-2.23-5.684-5.498-5.684h-6.37c-3.29 0-5.447 2.271-5.447 5.684V90.96c0 3.412 2.158 5.673 5.446 5.673zm25.037 0h6.308c3.289 0 5.508-2.261 5.508-5.673V11.9c0-3.412-2.22-5.62-5.508-5.62h-6.308c-3.278 0-5.498 2.208-5.498 5.62v79.06c0 3.412 2.22 5.673 5.498 5.673zm24.984 0h6.32c3.288 0 5.497-2.261 5.497-5.673v-56.2c0-3.412-2.209-5.673-5.498-5.673h-6.319c-3.267 0-5.498 2.261-5.498 5.673v56.2c0 3.412 2.23 5.673 5.498 5.673z"
  }));
});
// CONCATENATED MODULE: ./src/Resources/Images/FileIcons/ppt_icon.svg
var ppt_icon_excluded = ["styles"];
function ppt_icon_extends() { return ppt_icon_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, ppt_icon_extends.apply(null, arguments); }
function ppt_icon_objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = ppt_icon_objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function ppt_icon_objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }

/* harmony default export */ var ppt_icon = (function (_ref) {
  var _ref$styles = _ref.styles,
    styles = _ref$styles === void 0 ? {} : _ref$styles,
    props = ppt_icon_objectWithoutProperties(_ref, ppt_icon_excluded);
  return /*#__PURE__*/react_default.a.createElement("svg", ppt_icon_extends({
    width: "20",
    height: "20",
    xmlns: "http://www.w3.org/2000/svg"
  }, props), /*#__PURE__*/react_default.a.createElement("path", {
    d: "M16.795 0c1.115 0 1.519.116 1.926.334.407.218.727.538.945.945.218.407.334.811.334 1.926v13.59c0 1.115-.116 1.519-.334 1.926a2.272 2.272 0 01-.945.945c-.407.218-.811.334-1.926.334H3.205c-1.115 0-1.519-.116-1.926-.334a2.272 2.272 0 01-.945-.945C.116 18.314 0 17.91 0 16.795V3.205C0 2.09.116 1.686.334 1.279.552.872.872.552 1.279.334 1.686.116 2.09 0 3.205 0h13.59zm-6.663 4.431H5.933V15H7.77v-3.516l2.362.001.263-.007a3.7 3.7 0 001.607-.435 3.185 3.185 0 001.256-1.236c.301-.53.452-1.145.452-1.847v-.014l-.007-.26a3.54 3.54 0 00-.445-1.584 3.177 3.177 0 00-1.256-1.231c-.536-.293-1.159-.44-1.87-.44zm-.454 1.51l.223.006c.58.035 1.038.208 1.375.52.379.35.568.846.568 1.489v.015l-.007.207c-.037.54-.224.966-.561 1.28-.379.353-.911.53-1.598.53H7.77V5.94h1.91z",
    fill: "#B9380B",
    fillRule: "evenodd"
  }));
});
// CONCATENATED MODULE: ./src/Resources/Images/FileIcons/word_icon.svg
var word_icon_excluded = ["styles"];
function word_icon_extends() { return word_icon_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, word_icon_extends.apply(null, arguments); }
function word_icon_objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = word_icon_objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function word_icon_objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }

/* harmony default export */ var word_icon = (function (_ref) {
  var _ref$styles = _ref.styles,
    styles = _ref$styles === void 0 ? {} : _ref$styles,
    props = word_icon_objectWithoutProperties(_ref, word_icon_excluded);
  return /*#__PURE__*/react_default.a.createElement("svg", word_icon_extends({
    width: "20",
    height: "20",
    xmlns: "http://www.w3.org/2000/svg"
  }, props), /*#__PURE__*/react_default.a.createElement("path", {
    d: "M16.795 0c1.115 0 1.519.116 1.926.334.407.218.727.538.945.945.218.407.334.811.334 1.926v13.59c0 1.115-.116 1.519-.334 1.926a2.272 2.272 0 01-.945.945c-.407.218-.811.334-1.926.334H3.205c-1.115 0-1.519-.116-1.926-.334a2.272 2.272 0 01-.945-.945C.116 18.314 0 17.91 0 16.795V3.205C0 2.09.116 1.686.334 1.279.552.872.872.552 1.279.334 1.686.116 2.09 0 3.205 0h13.59zM5.177 4.931H3.264L6.098 15.5h1.734L10 7.867h.105l2.179 7.633h1.727l2.834-10.569h-1.904l-1.83 7.99h-.105l-2.132-7.99H9.231l-2.11 7.99h-.106l-1.838-7.99z",
    fill: "#205BC5",
    fillRule: "evenodd"
  }));
});
// CONCATENATED MODULE: ./src/Resources/Images/FileIcons/excel_icon.svg
var excel_icon_excluded = ["styles"];
function excel_icon_extends() { return excel_icon_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, excel_icon_extends.apply(null, arguments); }
function excel_icon_objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = excel_icon_objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function excel_icon_objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }

/* harmony default export */ var excel_icon = (function (_ref) {
  var _ref$styles = _ref.styles,
    styles = _ref$styles === void 0 ? {} : _ref$styles,
    props = excel_icon_objectWithoutProperties(_ref, excel_icon_excluded);
  return /*#__PURE__*/react_default.a.createElement("svg", excel_icon_extends({
    width: "20",
    height: "20",
    xmlns: "http://www.w3.org/2000/svg"
  }, props), /*#__PURE__*/react_default.a.createElement("path", {
    d: "M16.795 0c1.115 0 1.519.116 1.926.334.407.218.727.538.945.945.218.407.334.811.334 1.926v13.59c0 1.115-.116 1.519-.334 1.926a2.272 2.272 0 01-.945.945c-.407.218-.811.334-1.926.334H3.205c-1.115 0-1.519-.116-1.926-.334a2.272 2.272 0 01-.945-.945C.116 18.314 0 17.91 0 16.795V3.205C0 2.09.116 1.686.334 1.279.552.872.872.552 1.279.334 1.686.116 2.09 0 3.205 0h13.59zm-9.33 4.931h-2.38l3.388 5.224L5.06 15.5h2.19l2.494-3.816 2.427 3.816h2.313l-3.451-5.3 3.506-5.269H12.28l-2.443 3.91-2.373-3.91z",
    fill: "#297337",
    fillRule: "evenodd"
  }));
});
// CONCATENATED MODULE: ./src/Resources/Images/FileIcons/pdf_icon.svg
var pdf_icon_excluded = ["styles"];
function pdf_icon_extends() { return pdf_icon_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, pdf_icon_extends.apply(null, arguments); }
function pdf_icon_objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = pdf_icon_objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function pdf_icon_objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }

/* harmony default export */ var pdf_icon = (function (_ref) {
  var _ref$styles = _ref.styles,
    styles = _ref$styles === void 0 ? {} : _ref$styles,
    props = pdf_icon_objectWithoutProperties(_ref, pdf_icon_excluded);
  return /*#__PURE__*/react_default.a.createElement("svg", pdf_icon_extends({
    width: "16",
    height: "20",
    xmlns: "http://www.w3.org/2000/svg"
  }, props), /*#__PURE__*/react_default.a.createElement("path", {
    d: "M2.949 20H13.05c1.97 0 2.949-.98 2.949-2.92V8.61H9.113c-1.218 0-1.798-.569-1.798-1.763V0H2.95C.989 0 0 .989 0 2.93v14.15C0 19.03.98 20 2.949 20zm5.08-6.627c.315 0 .573.057.774.171.202.114.35.278.447.49.097.212.146.466.146.76 0 .298-.05.555-.148.771a1.074 1.074 0 01-.45.5c-.201.116-.458.174-.769.174H6.843v-2.866zm3.855 0v.554h-1.286v.693h1.17v.537h-1.17v1.082H9.87v-2.866h2.014zm-6.517 0c.233 0 .428.045.584.136.157.09.275.21.355.36.08.151.12.317.12.498 0 .182-.041.348-.122.496a.882.882 0 01-.358.355 1.199 1.199 0 01-.587.132h-.541v.889H4.09v-2.866zm2.546.547h-.342v1.771h.342c.13 0 .24-.018.333-.054a.537.537 0 00.228-.165.724.724 0 00.132-.275c.028-.11.042-.239.042-.386 0-.196-.025-.36-.076-.493a.583.583 0 00-.238-.299.792.792 0 00-.42-.1zM5.2 13.903h-.384v.928H5.2a.57.57 0 00.26-.055.39.39 0 00.17-.158.506.506 0 00.058-.251c0-.15-.043-.266-.13-.345a.512.512 0 00-.358-.12zM8.62.103c.399.065.789.335 1.236.783l5.241 5.233c.457.457.733.83.79 1.213H9.14c-.351 0-.523-.168-.523-.504z",
    fill: "var(--theme-color-systemRed)"
  }));
});
// CONCATENATED MODULE: ./src/Resources/Images/FileIcons/zip_icon.svg
var zip_icon_excluded = ["styles"];
function zip_icon_extends() { return zip_icon_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, zip_icon_extends.apply(null, arguments); }
function zip_icon_objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = zip_icon_objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function zip_icon_objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }

/* harmony default export */ var zip_icon = (function (_ref) {
  var _ref$styles = _ref.styles,
    styles = _ref$styles === void 0 ? {} : _ref$styles,
    props = zip_icon_objectWithoutProperties(_ref, zip_icon_excluded);
  return /*#__PURE__*/react_default.a.createElement("svg", zip_icon_extends({
    width: "16",
    height: "20",
    xmlns: "http://www.w3.org/2000/svg"
  }, props), /*#__PURE__*/react_default.a.createElement("path", {
    d: "M6.602 0L6.24 1.502 5.784 3.46a3.66 3.66 0 00-.086.783c0 1.157.628 1.922 1.712 2.118v2.341H5.755c-.333 0-.59.243-.59.56 0 .327.257.588.59.588H7.41v1.38H5.755c-.333 0-.59.243-.59.56 0 .327.257.588.59.588H7.41v1.38H5.755c-.333 0-.59.243-.59.56 0 .327.257.588.59.588H7.41v1.38H5.755a.573.573 0 100 1.148H7.41v1.063h1.18v-2.332h1.655a.573.573 0 100-1.147H8.59v-1.38h1.655c.333 0 .59-.253.59-.58a.573.573 0 00-.59-.568H8.59v-1.38h1.655c.333 0 .59-.253.59-.58a.573.573 0 00-.59-.568H8.59v-1.38h1.655c.333 0 .59-.253.59-.58a.573.573 0 00-.59-.568H8.59V6.362c1.084-.196 1.712-.96 1.712-2.118a3.66 3.66 0 00-.086-.783l-.455-1.952h.002L9.41 0h3.64c1.899 0 2.878.92 2.945 2.725l.004.204V17.08c0 1.95-.98 2.92-2.949 2.92H2.95C.979 20 0 19.03 0 17.08V2.93C0 .988.98 0 2.949 0h3.653zM8 3.134c.58 0 1.037.448 1.037 1.017 0 .578-.438 1.026-1.037 1.026-.59 0-1.037-.448-1.037-1.026 0-.569.457-1.017 1.037-1.017z",
    fill: "var(--theme-color-labelPrimary)"
  }));
});
// CONCATENATED MODULE: ./src/Resources/Images/FileIcons/image_icon.svg
var image_icon_excluded = ["styles"];
function image_icon_extends() { return image_icon_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, image_icon_extends.apply(null, arguments); }
function image_icon_objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = image_icon_objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function image_icon_objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }

/* harmony default export */ var image_icon = (function (_ref) {
  var _ref$styles = _ref.styles,
    styles = _ref$styles === void 0 ? {} : _ref$styles,
    props = image_icon_objectWithoutProperties(_ref, image_icon_excluded);
  return /*#__PURE__*/react_default.a.createElement("svg", image_icon_extends({
    width: "24",
    height: "18",
    xmlns: "http://www.w3.org/2000/svg"
  }, props), /*#__PURE__*/react_default.a.createElement("path", {
    d: "M3.563 18h16.874c2.049 0 3.063-1.007 3.063-3.021V3.03C23.5 1.017 22.486 0 20.437 0H3.563C1.524 0 .5 1.017.5 3.031v11.948C.5 16.993 1.524 18 3.563 18zm4.253-8.75a2.417 2.417 0 01-2.41-2.416 2.424 2.424 0 012.41-2.415c1.316 0 2.399 1.095 2.399 2.415a2.415 2.415 0 01-2.4 2.415zm-4.234 7.186c-.946 0-1.512-.567-1.512-1.526v-.596l2.995-2.62c.43-.382.897-.577 1.326-.577.478 0 .976.195 1.405.596l1.863 1.682 4.662-4.146c.478-.43 1.015-.625 1.57-.625a2.27 2.27 0 011.552.635l4.487 4.165v1.506c0 .939-.576 1.506-1.503 1.506H3.582z",
    fill: "var(--theme-color-systemYellow)"
  }));
});
// CONCATENATED MODULE: ./src/Resources/Images/FileIcons/audio_icon.svg
var audio_icon_excluded = ["styles"];
function audio_icon_extends() { return audio_icon_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, audio_icon_extends.apply(null, arguments); }
function audio_icon_objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = audio_icon_objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function audio_icon_objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }

/* harmony default export */ var audio_icon = (function (_ref) {
  var _ref$styles = _ref.styles,
    styles = _ref$styles === void 0 ? {} : _ref$styles,
    props = audio_icon_objectWithoutProperties(_ref, audio_icon_excluded);
  return /*#__PURE__*/react_default.a.createElement("svg", audio_icon_extends({
    width: "22",
    height: "24"
  }, props), /*#__PURE__*/react_default.a.createElement("path", {
    fill: "var(--theme-color-systemPink)",
    d: "M8.736 0c.667 0 1.19.523 1.19 1.18v20.907c0 .656-.523 1.169-1.19 1.169a1.153 1.153 0 01-1.158-1.17V1.18C7.578.523 8.09 0 8.736 0zm7.578 2.215c.666 0 1.19.533 1.19 1.19v16.457c0 .656-.524 1.179-1.19 1.179a1.162 1.162 0 01-1.159-1.18V3.405c0-.656.513-1.19 1.159-1.19zM4.953 3.507c.656 0 1.179.533 1.179 1.19V18.56c0 .656-.523 1.179-1.18 1.179a1.164 1.164 0 01-1.168-1.18V4.697c0-.656.512-1.19 1.169-1.19zm7.577 1.59c.657 0 1.18.532 1.18 1.189V16.98a1.17 1.17 0 01-1.18 1.17 1.162 1.162 0 01-1.169-1.17V6.286c0-.657.513-1.19 1.17-1.19zM20.108 6.9c.656 0 1.18.533 1.18 1.18v7.095c0 .656-.524 1.169-1.18 1.169a1.156 1.156 0 01-1.169-1.17V8.08c0-.646.513-1.18 1.169-1.18zm-18.95.554c.667 0 1.19.533 1.19 1.189v5.978c0 .646-.523 1.169-1.19 1.169A1.16 1.16 0 010 14.622V8.644c0-.656.513-1.19 1.159-1.19z"
  }));
});
// CONCATENATED MODULE: ./src/Resources/Images/FileIcons/video_icon.svg
var video_icon_excluded = ["styles"];
function video_icon_extends() { return video_icon_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, video_icon_extends.apply(null, arguments); }
function video_icon_objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = video_icon_objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function video_icon_objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }

/* harmony default export */ var video_icon = (function (_ref) {
  var _ref$styles = _ref.styles,
    styles = _ref$styles === void 0 ? {} : _ref$styles,
    props = video_icon_objectWithoutProperties(_ref, video_icon_excluded);
  return /*#__PURE__*/react_default.a.createElement("svg", video_icon_extends({
    width: "22",
    height: "18",
    xmlns: "http://www.w3.org/2000/svg"
  }, props), /*#__PURE__*/react_default.a.createElement("path", {
    d: "M2.166 18h17.668C21.14 18 22 17.122 22 15.797V2.203C22 .878 21.14 0 19.834 0H2.166C.85 0 0 .878 0 2.203v13.594C0 17.122.851 18 2.166 18zm-.01-14.26a.42.42 0 01-.435-.43v-.925c0-.277.186-.468.454-.468h1.027c.241 0 .417.182.417.449v.944c0 .238-.176.43-.417.43H2.156zm3.471 4.3c-.296 0-.5-.2-.5-.505V2.423c0-.305.204-.506.5-.506h10.709c.296 0 .5.2.5.506v5.113c0 .305-.204.505-.5.505H5.627zm13.134-4.3a.423.423 0 01-.426-.429v-.944c0-.267.185-.449.426-.449h1.018c.277 0 .462.191.462.468v.925a.42.42 0 01-.435.43h-1.045zM2.156 6.84a.425.425 0 01-.435-.429v-.935c0-.267.176-.448.435-.448h1.046c.241 0 .417.181.417.448v.935c0 .23-.176.43-.417.43H2.156zm16.605 0a.43.43 0 01-.426-.429v-.935c0-.267.185-.448.426-.448h1.045c.26 0 .435.181.435.448v.935c0 .23-.175.43-.435.43h-1.045zM2.156 9.901a.42.42 0 01-.435-.429v-.935c0-.257.176-.438.435-.438h1.046c.241 0 .417.18.417.438v.935c0 .239-.176.43-.417.43H2.156zm16.605 0a.423.423 0 01-.426-.429v-.935a.42.42 0 01.426-.438h1.045c.26 0 .435.18.435.438v.935a.42.42 0 01-.435.43h-1.045zM5.627 16.073c-.296 0-.5-.2-.5-.505v-5.085c0-.305.204-.515.5-.515h10.709c.296 0 .5.21.5.515v5.085c0 .305-.204.505-.5.505H5.627zm-3.47-3.09c-.26 0-.436-.2-.436-.44v-.925c0-.267.176-.448.435-.448h1.046c.241 0 .417.181.417.448v.926c0 .238-.176.439-.417.439H2.156zm16.604 0a.431.431 0 01-.426-.44v-.925c0-.267.185-.448.426-.448h1.045c.26 0 .435.181.435.448v.926a.428.428 0 01-.435.439h-1.045zm-16.586 3.09a.437.437 0 01-.454-.458V14.7c0-.268.176-.449.435-.449h1.046c.241 0 .417.181.417.449v.934c0 .258-.176.44-.417.44H2.175zm16.586 0a.42.42 0 01-.426-.439V14.7c0-.268.185-.449.426-.449h1.045c.26 0 .435.181.435.449v.915a.439.439 0 01-.462.458H18.76z",
    fill: "var(--theme-color-gray1)"
  }));
});
// CONCATENATED MODULE: ./src/Resources/Images/FileIcons/default_icon.svg
var default_icon_excluded = ["styles"];
function default_icon_extends() { return default_icon_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, default_icon_extends.apply(null, arguments); }
function default_icon_objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = default_icon_objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function default_icon_objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }

/* harmony default export */ var default_icon = (function (_ref) {
  var _ref$styles = _ref.styles,
    styles = _ref$styles === void 0 ? {} : _ref$styles,
    props = default_icon_objectWithoutProperties(_ref, default_icon_excluded);
  return /*#__PURE__*/react_default.a.createElement("svg", default_icon_extends({
    width: "16",
    height: "20",
    xmlns: "http://www.w3.org/2000/svg"
  }, props), /*#__PURE__*/react_default.a.createElement("path", {
    d: "M4.379 5.366a.605.605 0 01-.443-1.03.615.615 0 01.443-.17h7.253c.176 0 .323.056.441.17a.559.559 0 01.178.42.602.602 0 01-.619.61H4.379zm0 3.322a.597.597 0 01-.443-.18.592.592 0 01-.178-.43.56.56 0 01.178-.422.615.615 0 01.443-.17h7.253c.176 0 .323.057.441.17a.56.56 0 01.178.421c0 .168-.06.311-.178.431a.595.595 0 01-.441.18H4.379zm0 3.313a.614.614 0 01-.443-.17.56.56 0 01-.178-.42.605.605 0 01.62-.61l3.472-.002a.597.597 0 01.617.611.567.567 0 01-.173.42.606.606 0 01-.444.171H4.379zM0 17.024c0 .985.252 1.728.755 2.227.503.5 1.249.749 2.236.749h10.018c.993 0 1.74-.25 2.24-.749.5-.499.751-1.242.751-2.227V2.985c0-.986-.25-1.73-.75-2.232C14.75.251 14.001 0 13.01 0H2.99C2.005 0 1.259.251.756.753.252 1.255 0 2 0 2.985v14.039z",
    fill: "var(--theme-color-systemPurple)"
  }));
});
// EXTERNAL MODULE: ./src/Hooks/useLoc.ts
var useLoc = __webpack_require__(1227);

// CONCATENATED MODULE: ./src/ComponentsGeneric/Tiles/FileIcon/FileIcon.tsx
function FileIcon_extends() { return FileIcon_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, FileIcon_extends.apply(null, arguments); }














const FileIcon = props => {
  const extensionFileTypeMapping = {
    aac: "FileIcon.FileType.aac",
    abbu: "FileIcon.FileType.abbu",
    ai: "FileIcon.FileType.ai",
    aiff: "FileIcon.FileType.aiff",
    apk: "FileIcon.FileType.apk",
    app: "FileIcon.FileType.app",
    avi: "FileIcon.FileType.avi",
    band: "FileIcon.FileType.band",
    bat: "FileIcon.FileType.bat",
    bin: "FileIcon.FileType.bin",
    blend: "FileIcon.FileType.blend",
    bmp: "FileIcon.FileType.bmp",
    c: "FileIcon.FileType.c",
    c4d: "FileIcon.FileType.c4d",
    class: "FileIcon.FileType.class",
    cpp: "FileIcon.FileType.cpp",
    css: "FileIcon.FileType.css",
    cer: "FileIcon.FileType.cer",
    csv: "FileIcon.FileType.csv",
    dae: "FileIcon.FileType.dae",
    dmg: "FileIcon.FileType.dmg",
    dng: "FileIcon.FileType.dng",
    doc: "FileIcon.FileType.doc",
    docx: "FileIcon.FileType.docx",
    dxf: "FileIcon.FileType.dxf",
    eps: "FileIcon.FileType.eps",
    exe: "FileIcon.FileType.exe",
    fbx: "FileIcon.FileType.fbx",
    gif: "FileIcon.FileType.gif",
    gz: "FileIcon.FileType.gz",
    h: "FileIcon.FileType.h",
    hqx: "FileIcon.FileType.hqx",
    htm: "FileIcon.FileType.htm",
    epub: "FileIcon.FileType.epub",
    ibooks: "FileIcon.FileType.ibooks",
    icns: "FileIcon.FileType.icns",
    ico: "FileIcon.FileType.ico",
    ics: "FileIcon.FileType.ics",
    indd: "FileIcon.FileType.indd",
    ipa: "FileIcon.FileType.ipa",
    iso: "FileIcon.FileType.iso",
    java: "FileIcon.FileType.java",
    jpg: "FileIcon.FileType.jpg",
    jpeg: "FileIcon.FileType.jpg",
    js: "FileIcon.FileType.js",
    key: "FileIcon.FileType.key",
    keychain: "FileIcon.FileType.keychain",
    log: "FileIcon.FileType.log",
    m: "FileIcon.FileType.m",
    m3u: "FileIcon.FileType.m3u",
    m4a: "FileIcon.FileType.m4a",
    m4p: "FileIcon.FileType.m4p",
    m4r: "FileIcon.FileType.m4r",
    m4v: "FileIcon.FileType.m4v",
    mid: "FileIcon.FileType.mid",
    qt: "FileIcon.FileType.qt",
    mp3: "FileIcon.FileType.mp3",
    mp4: "FileIcon.FileType.mp4",
    mpeg: "FileIcon.FileType.mpeg",
    numbers: "FileIcon.FileType.numbers",
    obj: "FileIcon.FileType.obj",
    otf: "FileIcon.FileType.otf",
    pages: "FileIcon.FileType.pages",
    pdf: "FileIcon.FileType.pdf",
    perl: "FileIcon.FileType.perl",
    pkg: "FileIcon.FileType.pkg",
    png: "FileIcon.FileType.png",
    pps: "FileIcon.FileType.pps",
    ppsx: "FileIcon.FileType.ppsx",
    ppt: "FileIcon.FileType.ppt",
    pptx: "FileIcon.FileType.pptx",
    ps: "FileIcon.FileType.ps",
    psd: "FileIcon.FileType.psd",
    py: "FileIcon.FileType.py",
    rar: "FileIcon.FileType.rar",
    rtf: "FileIcon.FileType.rtf",
    safariextz: "FileIcon.FileType.safariextz",
    scpt: "FileIcon.FileType.scpt",
    sh: "FileIcon.FileType.sh",
    stl: "FileIcon.FileType.stl",
    svg: "FileIcon.FileType.svg",
    swift: "FileIcon.FileType.swift",
    tar: "FileIcon.FileType.tar",
    tiff: "FileIcon.FileType.tiff",
    ttf: "FileIcon.FileType.ttf",
    txt: "FileIcon.FileType.txt",
    vcf: "FileIcon.FileType.vcf",
    wave: "FileIcon.FileType.wave",
    wma: "FileIcon.FileType.wma",
    wmv: "FileIcon.FileType.wmv",
    xcodeproj: "FileIcon.FileType.xcodeproj",
    xhtml: "FileIcon.FileType.xhtml",
    xlam: "FileIcon.FileType.xlam",
    xls: "FileIcon.FileType.xls",
    xlsx: "FileIcon.FileType.xlsx",
    xml: "FileIcon.FileType.xml",
    zip: "FileIcon.FileType.zip"
  };

  // restProps is spread instead of applying each prop individually to avoid
  // clobbering the svg's default dimensions unless they have actually been
  // overridden
  const {
    fileExtension: extension,
    ...restProps
  } = props;
  const fileTypeLabel = extension && extensionFileTypeMapping[extension] ? Object(useLoc["a" /* getLoc */])(extensionFileTypeMapping[extension]) : Object(useLoc["a" /* getLoc */])("FileIcon.FileType.default");
  const getFileIcon = () => {
    switch (extension) {
      case "key":
        return /*#__PURE__*/react["createElement"](keynote_icon, FileIcon_extends({
          "aria-label": fileTypeLabel,
          "data-testid": "keynote-icon",
          height: 18,
          width: 20
        }, restProps));
      case "numbers":
        return /*#__PURE__*/react["createElement"](numbers_icon, FileIcon_extends({
          "aria-label": fileTypeLabel,
          "data-testid": "numbers-icon",
          height: 18,
          width: 20
        }, restProps));
      case "pages":
        return /*#__PURE__*/react["createElement"](pages_icon, FileIcon_extends({
          "aria-label": fileTypeLabel,
          "data-testid": "pages-icon",
          height: 18,
          width: 20
        }, restProps));
      case "pptx":
      case "ppt":
        return /*#__PURE__*/react["createElement"](ppt_icon, FileIcon_extends({
          "aria-label": fileTypeLabel,
          "data-testid": "ppt-icon"
        }, restProps));
      case "xlsx":
      case "xls":
      case "xlam":
        return /*#__PURE__*/react["createElement"](excel_icon, FileIcon_extends({
          "aria-label": fileTypeLabel,
          "data-testid": "excel-icon"
        }, restProps));
      case "docx":
      case "doc":
        return /*#__PURE__*/react["createElement"](word_icon, FileIcon_extends({
          "aria-label": fileTypeLabel,
          "data-testid": "word-icon"
        }, restProps));
      case "jpg":
      case "jpeg":
      case "png":
      case "gif":
      case "tiff":
      case "tif":
      case "bmp":
        return /*#__PURE__*/react["createElement"](image_icon, FileIcon_extends({
          "aria-label": fileTypeLabel,
          "data-testid": "image-icon"
        }, restProps));
      case "aac":
      case "wav":
      case "m4a":
      case "m4p":
      case "aiff":
      case "midi":
      case "wave":
      case "mp3":
        return /*#__PURE__*/react["createElement"](audio_icon, FileIcon_extends({
          "aria-label": fileTypeLabel,
          "data-testid": "audio-icon"
        }, restProps));
      case "mp4":
      case "m4v":
      case "mov":
        return /*#__PURE__*/react["createElement"](video_icon, FileIcon_extends({
          "aria-label": fileTypeLabel,
          "data-testid": "video-icon"
        }, restProps));
      case "zip":
        return /*#__PURE__*/react["createElement"](zip_icon, FileIcon_extends({
          "aria-label": fileTypeLabel,
          "data-testid": "zip-icon"
        }, restProps));
      case "pdf":
        return /*#__PURE__*/react["createElement"](pdf_icon, FileIcon_extends({
          "aria-label": fileTypeLabel,
          "data-testid": "pdf-icon"
        }, restProps));
      case "folder":
      default:
        return /*#__PURE__*/react["createElement"](default_icon, FileIcon_extends({
          "aria-label": fileTypeLabel,
          "data-testid": "default-icon"
        }, restProps));
    }
  };
  return /*#__PURE__*/react["createElement"]("div", {
    className: "icon"
  }, getFileIcon());
};

/***/ }),

/***/ 2187:
/*!*************************************************************************************************************!*\
  !*** ./src/Components/ICloudPlus/HideMyEmail/HideMyEmailTileWrapper/HideMyEmailTileWrapper.tsx + 4 modules ***!
  \*************************************************************************************************************/
/*! exports provided: HideMyEmailTileWrapper */
/*! exports used: HideMyEmailTileWrapper */
/*! ModuleConcatenation bailout: Cannot concat with ./src/API/Common/paths.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/API/Common/request.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/API/Common/useAPIQuery.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/API/CustomEmailDomain/customEmailDomain.converter.ts because of ./src/Legacy/Components/RootComponent.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/API/HideMyEmail/hme.schema.ts because of ./src/Legacy/Components/RootComponent.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/ComponentsGeneric/AppIcon/AppIcon.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/ComponentsGeneric/Tiles/ErrorHomeTileContent/ErrorHomeTileContent.tsx because of ./src/Legacy/Components/RootComponent.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/ComponentsGeneric/Tiles/StaticTileContent/StaticTileContent.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/ComponentsGeneric/Tiles/Tile/Tile.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Contexts/ApplicationLaunchProvider.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Contexts/CustomizationProvider.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Hooks/useLoc.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Environment/CloudOSParameters.ts */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/react/index.js (<- Module is not an ECMAScript module) */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";

// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ HideMyEmailTileWrapper; });

// EXTERNAL MODULE: /workspace/node_modules/react/index.js
var react = __webpack_require__(870);

// EXTERNAL MODULE: ./src/API/Common/useAPIQuery.ts
var useAPIQuery = __webpack_require__(1478);

// EXTERNAL MODULE: ./src/API/Common/paths.ts + 1 modules
var paths = __webpack_require__(2266);

// EXTERNAL MODULE: ./src/API/Common/request.ts
var Common_request = __webpack_require__(1413);

// EXTERNAL MODULE: ./src/API/CustomEmailDomain/customEmailDomain.converter.ts
var customEmailDomain_converter = __webpack_require__(1625);

// CONCATENATED MODULE: ./src/API/HideMyEmail/hme.converter.ts

/**
 * this function converts hme list api response to hmeInfo object
 * @param {WireHmeListResponse} response hme list api response
 * @returns {HmeInfo} returns hmeInfo object
 * @throw Error if the api request is not success or result object is not valid
 */
function hmeListConverter(response) {
  if (Object(customEmailDomain_converter["a" /* checkIfAccountNeedsUpgrade */])(response.success)) {
    // for account needs upgrade, do not show any hide my emails and
    // let users complete upgrade action inside the app
    return {
      active: 0,
      inactive: 0
    };
  }
  if (!response.success || !response.result) {
    var _response$error;
    throw new Error((response === null || response === void 0 || (_response$error = response.error) === null || _response$error === void 0 ? void 0 : _response$error.errorMessage) || "hide my email api returns error");
  } else {
    const {
      hmeEmails
    } = response.result;
    const active = hmeEmails.filter(email => email.isActive).length;
    const inactive = hmeEmails.filter(email => !email.isActive).length;
    return {
      active,
      inactive
    };
  }
}
// EXTERNAL MODULE: ./src/API/HideMyEmail/hme.schema.ts
var hme_schema = __webpack_require__(1624);

// CONCATENATED MODULE: ./src/API/HideMyEmail/hme.endpoint.ts



const HME_LIST_PATH = "/v2/hme/list";

/**
 * this function sends get api request to hme list endpoint and returns converted hmeInfo
 * @param {TileDataRequest} request has webServices urls
 * @returns {Promise<HmeInfo>} returns hmeInfo object in a promise
 * @throws `Error` if the webServices do not have premiummailsettings url
 */
function listHme(_ref) {
  let {
    webServices
  } = _ref;
  if (!(webServices !== null && webServices !== void 0 && webServices.premiummailsettings)) throw new Error("no service url available");
  return Object(Common_request["a" /* apiRequest */])({
    url: `${webServices.premiummailsettings}${HME_LIST_PATH}`,
    includeCredentials: true,
    validate: {
      type: "WireHmeListResponse",
      schema: hme_schema["b" /* wireHmeListResponseSchema */]
    }
  }).then(res => hmeListConverter(res));
}
// CONCATENATED MODULE: ./src/API/HideMyEmail/useHmeList.ts



/**
 * Fetches active / inactive counts of Hide My Email addresses
 * @returns `react-query` `useQuery` results
 */
function useHmeList(callbacks) {
  return Object(useAPIQuery["a" /* useAPIQuery */])({
    ...callbacks,
    // especially onError and onSuccess
    endpoint: paths["b" /* EndpointName */].hmeList,
    fetchProvider: request => () => listHme(request)
  });
}
// EXTERNAL MODULE: ./src/ComponentsGeneric/Tiles/Tile/Tile.tsx + 3 modules
var Tile = __webpack_require__(2200);

// EXTERNAL MODULE: ./src/Legacy/Environment/CloudOSParameters.ts + 1 modules
var CloudOSParameters = __webpack_require__(2241);

// EXTERNAL MODULE: ./src/Hooks/useLoc.ts
var useLoc = __webpack_require__(1227);

// EXTERNAL MODULE: ./src/Contexts/ApplicationLaunchProvider.tsx
var ApplicationLaunchProvider = __webpack_require__(1319);

// EXTERNAL MODULE: ./src/Contexts/CustomizationProvider.tsx
var CustomizationProvider = __webpack_require__(1316);

// EXTERNAL MODULE: ./src/ComponentsGeneric/Tiles/ErrorHomeTileContent/ErrorHomeTileContent.tsx + 1 modules
var ErrorHomeTileContent = __webpack_require__(2330);

// EXTERNAL MODULE: ./src/ComponentsGeneric/Tiles/StaticTileContent/StaticTileContent.tsx + 1 modules
var StaticTileContent = __webpack_require__(2321);

// EXTERNAL MODULE: ./src/ComponentsGeneric/AppIcon/AppIcon.tsx + 205 modules
var AppIcon = __webpack_require__(2132);

// CONCATENATED MODULE: ./src/Components/ICloudPlus/HideMyEmail/HideMyEmailTile/HideMyEmailTile.tsx









const HideMyEmailTile = props => {
  var _CloudOSParameters$sh;
  const {
    hmeInfo,
    tileSize,
    isLoading,
    tileIndex,
    error,
    appId
  } = props;
  const heading = Object(useLoc["a" /* getLoc */])("HideMyEmailTile.Heading");
  // Banner description text
  const descriptionText = Object(useLoc["a" /* getLoc */])("HideMyEmailTile.Description");
  const contentTitleText = Object(useLoc["a" /* getLoc */])("HideMyEmailTile.Content.Title");
  const contentListItems = [Object(useLoc["a" /* getLoc */])("HideMyEmailTile.Content.ListItem.Active", {
    count: hmeInfo ? hmeInfo.active : 0
  }), Object(useLoc["a" /* getLoc */])("HideMyEmailTile.Content.ListItem.Inactive", {
    count: hmeInfo ? hmeInfo.inactive : 0
  })];
  const launcher = Object(ApplicationLaunchProvider["b" /* useApplicationLauncher */])();
  const launchModal = react["useCallback"](() => {
    launcher.launchApp("hidemyemail", undefined, {
      presentationStyle: "modal"
    });
  }, [launcher]);
  const showHideEmailModal = ((_CloudOSParameters$sh = CloudOSParameters["a" /* CloudOSParameters */].sharedInstance.applicationParameter.informationalPageDetails) === null || _CloudOSParameters$sh === void 0 ? void 0 : _CloudOSParameters$sh.relativePath) === "hidemyemail";
  react["useEffect"](() => {
    if (showHideEmailModal) launchModal();
  }, [launchModal, showHideEmailModal]);
  const {
    isInCustomizationMode
  } = Object(CustomizationProvider["b" /* useCustomization */])();
  return /*#__PURE__*/react["createElement"](Tile["b" /* Tile */], {
    appId: appId,
    tileIndex: tileIndex,
    icon: /*#__PURE__*/react["createElement"](AppIcon["a" /* AppIcon */], {
      iconSize: 40,
      applicationIdentifier: "hidemyemail"
    }),
    className: "hide-my-email-tile",
    heading: heading,
    description: descriptionText,
    isLoading: isLoading,
    tileSize: tileSize,
    onTileClick: isInCustomizationMode ? undefined : launchModal,
    error: error
  }, props.error ? /*#__PURE__*/react["createElement"](ErrorHomeTileContent["a" /* ErrorHomeTileContent */], {
    refetch: props.refetch,
    showClouds: false
  }) : /*#__PURE__*/react["createElement"](StaticTileContent["a" /* StaticTileContent */], {
    contentTitleText: contentTitleText,
    contentListItems: contentListItems
  }));
};
// CONCATENATED MODULE: ./src/Components/ICloudPlus/HideMyEmail/HideMyEmailTileWrapper/HideMyEmailTileWrapper.tsx




const HideMyEmailTileWrapper = _ref => {
  let {
    onSuccess,
    onError,
    appId,
    tileIndex,
    tileSize
  } = _ref;
  const {
    data,
    error,
    isLoading,
    isSuccess,
    refetch
  } = useHmeList({
    onSuccess,
    onError
  });
  return /*#__PURE__*/react["createElement"](HideMyEmailTile, {
    appId: appId,
    tileIndex: tileIndex !== null && tileIndex !== void 0 ? tileIndex : 0,
    error: error,
    isLoading: isLoading,
    isSuccess: isSuccess,
    hmeInfo: data,
    refetch: refetch,
    tileSize: tileSize !== null && tileSize !== void 0 ? tileSize : Tile["c" /* TileSize */].Small
  });
};

/***/ }),

/***/ 2202:
/*!*******************************************************************************************************************************!*\
  !*** ./src/Components/ICloudPlus/CustomEmailDomain/CustomEmailDomainTileWrapper/CustomEmailDomainTileWrapper.tsx + 3 modules ***!
  \*******************************************************************************************************************************/
/*! exports provided: CustomEmailDomainTileWrapper */
/*! exports used: CustomEmailDomainTileWrapper */
/*! ModuleConcatenation bailout: Cannot concat with ./src/API/Common/paths.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/API/Common/request.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/API/Common/useAPIQuery.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/API/CustomEmailDomain/customEmailDomain.converter.ts because of ./src/Legacy/Components/RootComponent.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/API/CustomEmailDomain/customEmailDomain.schema.ts because of ./src/Legacy/Components/RootComponent.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/ComponentsGeneric/AppIcon/AppIcon.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/ComponentsGeneric/Tiles/ErrorHomeTileContent/ErrorHomeTileContent.tsx because of ./src/Legacy/Components/RootComponent.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/ComponentsGeneric/Tiles/StaticTileContent/StaticTileContent.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/ComponentsGeneric/Tiles/Tile/Tile.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Contexts/ApplicationLaunchProvider.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Contexts/CustomizationProvider.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Hooks/useLoc.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Environment/CloudOSParameters.ts */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/react/index.js (<- Module is not an ECMAScript module) */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";

// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ CustomEmailDomainTileWrapper; });

// EXTERNAL MODULE: /workspace/node_modules/react/index.js
var react = __webpack_require__(870);

// EXTERNAL MODULE: ./src/API/Common/useAPIQuery.ts
var useAPIQuery = __webpack_require__(1478);

// EXTERNAL MODULE: ./src/API/Common/paths.ts + 1 modules
var paths = __webpack_require__(2266);

// EXTERNAL MODULE: ./src/API/Common/request.ts
var Common_request = __webpack_require__(1413);

// EXTERNAL MODULE: ./src/API/CustomEmailDomain/customEmailDomain.schema.ts
var customEmailDomain_schema = __webpack_require__(1626);

// EXTERNAL MODULE: ./src/API/CustomEmailDomain/customEmailDomain.converter.ts
var customEmailDomain_converter = __webpack_require__(1625);

// CONCATENATED MODULE: ./src/API/CustomEmailDomain/customEmailDomain.endpoint.ts



const CUSTOM_DOMAIN_LIST_PATH = "/v2/domain/list";

/**
 * this function sends get api request to custom domain list endpoint and returns array of domain names
 * @param request has webServices urls
 * @returns array of domain names in a promise
 * @throws `Error` if the webServices do not have premiummailsettings url
 */
function listCustomEmailDomains(_ref) {
  let {
    webServices
  } = _ref;
  if (!(webServices !== null && webServices !== void 0 && webServices.premiummailsettings)) throw new Error("no service url available");
  return Object(Common_request["a" /* apiRequest */])({
    url: `${webServices.premiummailsettings}${CUSTOM_DOMAIN_LIST_PATH}`,
    includeCredentials: true,
    validate: {
      type: "WireCustomDomainListResponse",
      schema: customEmailDomain_schema["b" /* wireCustomDomainListResponseSchema */]
    }
  }).then(res => Object(customEmailDomain_converter["b" /* customDomainConverter */])(res));
}
// CONCATENATED MODULE: ./src/API/CustomEmailDomain/useCustomEmailDomains.ts



/**
 * Fetches all your custom domain names
 * @returns `react-query` `useQuery` results
 */
function useCustomEmailDomains(callbacks) {
  return Object(useAPIQuery["a" /* useAPIQuery */])({
    ...callbacks,
    // especially onError and onSuccess
    endpoint: paths["b" /* EndpointName */].customEmailDomains,
    fetchProvider: request => () => listCustomEmailDomains(request)
  });
}
// EXTERNAL MODULE: ./src/Legacy/Environment/CloudOSParameters.ts + 1 modules
var CloudOSParameters = __webpack_require__(2241);

// EXTERNAL MODULE: ./src/Hooks/useLoc.ts
var useLoc = __webpack_require__(1227);

// EXTERNAL MODULE: ./src/Contexts/ApplicationLaunchProvider.tsx
var ApplicationLaunchProvider = __webpack_require__(1319);

// EXTERNAL MODULE: ./src/Contexts/CustomizationProvider.tsx
var CustomizationProvider = __webpack_require__(1316);

// EXTERNAL MODULE: ./src/ComponentsGeneric/Tiles/ErrorHomeTileContent/ErrorHomeTileContent.tsx + 1 modules
var ErrorHomeTileContent = __webpack_require__(2330);

// EXTERNAL MODULE: ./src/ComponentsGeneric/Tiles/StaticTileContent/StaticTileContent.tsx + 1 modules
var StaticTileContent = __webpack_require__(2321);

// EXTERNAL MODULE: ./src/ComponentsGeneric/Tiles/Tile/Tile.tsx + 3 modules
var Tile = __webpack_require__(2200);

// EXTERNAL MODULE: ./src/ComponentsGeneric/AppIcon/AppIcon.tsx + 205 modules
var AppIcon = __webpack_require__(2132);

// CONCATENATED MODULE: ./src/Components/ICloudPlus/CustomEmailDomain/CustomEmailDomainTile/CustomEmailDomainTile.tsx









const CustomEmailDomainTile = props => {
  var _CloudOSParameters$sh;
  const {
    customEmailDomainNames,
    tileSize,
    isLoading,
    tileIndex,
    error,
    appId
  } = props;
  const heading = Object(useLoc["a" /* getLoc */])("CustomEmailDomainTile.Heading");
  // Banner description text
  const descriptionText = Object(useLoc["a" /* getLoc */])("CustomEmailDomainTile.Description");
  const totalNumCustomEmailDomainNames = customEmailDomainNames ? customEmailDomainNames.length : 0;
  const contentTitleText = Object(useLoc["b" /* getLocCount */])({
    zero: "CustomEmailDomainTile.Content.Title.Zero",
    one: "CustomEmailDomainTile.Content.Title.One",
    two: "CustomEmailDomainTile.Content.Title.Two",
    many: "CustomEmailDomainTile.Content.Title.Many"
  }, totalNumCustomEmailDomainNames);
  const launcher = Object(ApplicationLaunchProvider["b" /* useApplicationLauncher */])();
  const launchModal = react["useCallback"](() => {
    launcher.launchApp("customdomainsettings", undefined, {
      presentationStyle: "modal"
    });
  }, [launcher]);
  const showCustomEmailDomainModal = ((_CloudOSParameters$sh = CloudOSParameters["a" /* CloudOSParameters */].sharedInstance.applicationParameter.informationalPageDetails) === null || _CloudOSParameters$sh === void 0 ? void 0 : _CloudOSParameters$sh.relativePath) === "customdomain";
  react["useEffect"](() => {
    if (showCustomEmailDomainModal) launchModal();
  }, [launchModal, showCustomEmailDomainModal]);
  const {
    isInCustomizationMode
  } = Object(CustomizationProvider["b" /* useCustomization */])();
  return /*#__PURE__*/react["createElement"](Tile["b" /* Tile */], {
    appId: appId,
    tileIndex: tileIndex,
    icon: /*#__PURE__*/react["createElement"](AppIcon["a" /* AppIcon */], {
      iconSize: 40,
      applicationIdentifier: "customdomainsettings"
    }),
    className: "custom-email-domain-tile",
    heading: heading,
    description: descriptionText,
    isLoading: isLoading,
    tileSize: tileSize,
    onTileClick: isInCustomizationMode ? undefined : launchModal,
    error: error
  }, props.error ? /*#__PURE__*/react["createElement"](ErrorHomeTileContent["a" /* ErrorHomeTileContent */], {
    refetch: props.refetch,
    showClouds: false
  }) : /*#__PURE__*/react["createElement"](StaticTileContent["a" /* StaticTileContent */], {
    contentTitleText: contentTitleText,
    contentListItems: customEmailDomainNames
  }));
};
// CONCATENATED MODULE: ./src/Components/ICloudPlus/CustomEmailDomain/CustomEmailDomainTileWrapper/CustomEmailDomainTileWrapper.tsx




const CustomEmailDomainTileWrapper = _ref => {
  let {
    onSuccess,
    onError,
    appId,
    tileIndex,
    tileSize
  } = _ref;
  const {
    data,
    error,
    isLoading,
    isSuccess,
    refetch
  } = useCustomEmailDomains({
    onSuccess,
    onError
  });
  return /*#__PURE__*/react["createElement"](CustomEmailDomainTile, {
    appId: appId,
    tileIndex: tileIndex !== null && tileIndex !== void 0 ? tileIndex : 0,
    error: error,
    isLoading: isLoading,
    isSuccess: isSuccess,
    customEmailDomainNames: data,
    refetch: refetch,
    tileSize: tileSize !== null && tileSize !== void 0 ? tileSize : Tile["c" /* TileSize */].Small
  });
};

/***/ }),

/***/ 2235:
/*!**************************************************************************!*\
  !*** ./src/Components/Toolbar/StaticAvatar/StaticAvatar.tsx + 2 modules ***!
  \**************************************************************************/
/*! exports provided: StaticAvatar */
/*! exports used: StaticAvatar */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/symbols/medium/exclamationmark.icloud.fill.svg */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/symbols/regular/person.crop.circle.svg */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Hooks/useLoc.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Utils/convertImageCropRect.ts because of ./src/Legacy/Components/RootComponent.tsx */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/ui-components/build/UIButton.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/ui-components/build/UIImage.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/ui-components/build/UIPaneContainer.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/ui-components/build/UIPopover/UIPopover.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/ui-components/build/UIPopover/makeUIPopoverPositioner.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/react/index.js (<- Module is not an ECMAScript module) */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";

// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ StaticAvatar; });

// EXTERNAL MODULE: /workspace/node_modules/react/index.js
var react = __webpack_require__(870);

// CONCATENATED MODULE: ./src/Components/Toolbar/StaticAvatar/StaticAvatar.scss
// extracted by mini-css-extract-plugin

// EXTERNAL MODULE: ./src/Hooks/useLoc.ts
var useLoc = __webpack_require__(1227);

// CONCATENATED MODULE: ./src/Hooks/useImageSize.ts

const useImageSize = imgUrl => {
  const [size, setSize] = react["useState"](undefined);
  react["useEffect"](() => {
    if (!imgUrl) {
      setSize(undefined);
      return;
    }
    const loadHandler = () => {
      setSize({
        width: img.width,
        height: img.height
      });
    };
    const img = new Image();
    img.addEventListener("load", loadHandler);
    img.src = imgUrl;
    return () => {
      img.removeEventListener("load", loadHandler);
    };
  }, [imgUrl]);
  return size;
};
// EXTERNAL MODULE: /workspace/node_modules/@apple/ui-components/build/UIPopover/makeUIPopoverPositioner.js + 2 modules
var makeUIPopoverPositioner = __webpack_require__(2224);

// EXTERNAL MODULE: /workspace/node_modules/@apple/ui-components/build/UIPaneContainer.js + 1 modules
var UIPaneContainer = __webpack_require__(2257);

// EXTERNAL MODULE: /workspace/node_modules/@apple/ui-components/build/UIPopover/UIPopover.js + 3 modules
var UIPopover = __webpack_require__(2196);

// EXTERNAL MODULE: /workspace/node_modules/@apple/ui-components/build/UIImage.js + 1 modules
var UIImage = __webpack_require__(2271);

// EXTERNAL MODULE: /workspace/node_modules/@apple/ui-components/build/UIButton.js + 1 modules
var UIButton = __webpack_require__(2259);

// EXTERNAL MODULE: /workspace/node_modules/classnames/index.js
var classnames = __webpack_require__(1215);
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);

// EXTERNAL MODULE: ./src/Utils/convertImageCropRect.ts
var convertImageCropRect = __webpack_require__(1605);

// EXTERNAL MODULE: /workspace/node_modules/@apple/symbols/medium/exclamationmark.icloud.fill.svg
var exclamationmark_icloud_fill = __webpack_require__(1620);

// EXTERNAL MODULE: /workspace/node_modules/@apple/symbols/regular/person.crop.circle.svg
var person_crop_circle = __webpack_require__(1471);

// CONCATENATED MODULE: ./src/Components/Toolbar/StaticAvatar/StaticAvatar.tsx








const StaticAvatar = _ref => {
  var _profilePhoto$url;
  let {
    profilePhoto,
    isProfilePhotoLoading,
    size = 120,
    onPhotoReady,
    imageAlt: imageAltOverride,
    showPlaceholderOnError = false
  } = _ref;
  const imageAlt = imageAltOverride || Object(useLoc["a" /* getLoc */])("Avatar.ImageAlt");
  const imgSize = useImageSize((_profilePhoto$url = profilePhoto === null || profilePhoto === void 0 ? void 0 : profilePhoto.url) !== null && _profilePhoto$url !== void 0 ? _profilePhoto$url : "");
  const [didImageLoadFail, setDidImageLoadFail] = react["useState"](false);
  const prevProfilePhotoURLRef = react["useRef"](profilePhoto === null || profilePhoto === void 0 ? void 0 : profilePhoto.url);
  const errorLoadingImageText = Object(useLoc["a" /* getLoc */])("AccountTilePopover.Button.Text");
  const noImageConfigured = !profilePhoto || !profilePhoto.url;
  const showPlaceholder = noImageConfigured || showPlaceholderOnError;
  react["useEffect"](() => {
    if ((profilePhoto === null || profilePhoto === void 0 ? void 0 : profilePhoto.url) !== prevProfilePhotoURLRef.current) {
      prevProfilePhotoURLRef.current = profilePhoto === null || profilePhoto === void 0 ? void 0 : profilePhoto.url;
      // reset image states
      setDidImageLoadFail(false);
    }
  }, [profilePhoto === null || profilePhoto === void 0 ? void 0 : profilePhoto.url]);
  react["useEffect"](() => {
    if (!isProfilePhotoLoading && noImageConfigured) {
      onPhotoReady === null || onPhotoReady === void 0 || onPhotoReady();
    }
  }, [onPhotoReady, isProfilePhotoLoading, noImageConfigured]);
  const buttonRef = react["useRef"](null);
  const basePositioner = Object(makeUIPopoverPositioner["b" /* makeUIPopoverPositioner */])({
    ...makeUIPopoverPositioner["c" /* positionerDefaults */],
    anchorMargin: -10,
    sidePreference: [makeUIPopoverPositioner["a" /* UIPopoverPositioner */].below]
  });
  const [showPopover] = Object(UIPaneContainer["i" /* useDismissiblePane */])(/*#__PURE__*/react["createElement"](UIPopover["b" /* UIPopover */], {
    style: {
      padding: "10px",
      width: "275px",
      height: "60px",
      display: "flex",
      justifyContent: "center",
      alignItems: "center"
    },
    arrowAsset: /*#__PURE__*/react["createElement"](react["Fragment"], null),
    cornerArrowAsset: /*#__PURE__*/react["createElement"](react["Fragment"], null),
    positioner: basePositioner,
    anchorRef: buttonRef
  }, /*#__PURE__*/react["createElement"]("div", null, errorLoadingImageText)));
  const cropPropertyExists = profilePhoto !== null && profilePhoto !== void 0 && profilePhoto.crop && imgSize ? Object(convertImageCropRect["a" /* convertImageCropRect */])(profilePhoto.crop, imgSize) : undefined;
  return /*#__PURE__*/react["createElement"]("div", {
    className: classnames_default()("static-avatar", isProfilePhotoLoading ? "static-avatar-loading" : undefined, showPlaceholder ? "image-placeholder" : undefined),
    style: {
      width: size,
      height: size
    }
  }, !isProfilePhotoLoading && /*#__PURE__*/react["createElement"]("div", {
    className: classnames_default()("profile-image-container", showPlaceholder ? "image-placeholder" : undefined)
  }, noImageConfigured ? /*#__PURE__*/react["createElement"](person_crop_circle["a" /* default */], {
    width: size,
    height: size,
    layoutMode: "glyphBox",
    className: "icon"
  }) : !didImageLoadFail ? /*#__PURE__*/react["createElement"](UIImage["b" /* UIImage */], {
    className: cropPropertyExists ? undefined : "no-crop",
    style: {
      width: size,
      height: size
    },
    src: profilePhoto === null || profilePhoto === void 0 ? void 0 : profilePhoto.url,
    crop: cropPropertyExists,
    alt: imageAlt,
    onLoadFailure: () => {
      setDidImageLoadFail(true);
      // when it is in error state, we still notify as ready
      onPhotoReady === null || onPhotoReady === void 0 || onPhotoReady(true);
    },
    onLoad: onPhotoReady
  }) : null, didImageLoadFail && (showPlaceholderOnError ? /*#__PURE__*/react["createElement"](person_crop_circle["a" /* default */], {
    width: size,
    height: size,
    layoutMode: "glyphBox",
    className: "icon"
  }) : /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
    ref: buttonRef,
    className: "static-avatar-error",
    onActivate: showPopover
  }, /*#__PURE__*/react["createElement"](exclamationmark_icloud_fill["a" /* default */], {
    height: 35,
    width: 24,
    layoutMode: "glyphBox"
  })))));
};

/***/ }),

/***/ 2300:
/*!****************************************************************************************************************!*\
  !*** ./src/Components/LoadChildApplicationADPBlockedRoute/LoadChildApplicationADPBlockedRoute.tsx + 1 modules ***!
  \****************************************************************************************************************/
/*! exports provided: LoadChildApplicationADPBlockedRoute */
/*! exports used: LoadChildApplicationADPBlockedRoute */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/symbols/regular/lock.rectangle.stack.fill.svg */
/*! ModuleConcatenation bailout: Cannot concat with ./src/ADP/useADPStateMachine.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Components/FixedFlexPage/FixedFlexPage.tsx because of ./src/Legacy/Routes/CalendarEventReplyRoute.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Components/Toolbar/CloudOSApplicationToolbar/CloudOSApplicationToolbar.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/ComponentsGeneric/AppIcon/AppIcon.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Contexts/ApplicationToolbarThemeProvider.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Hooks/useLoc.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/ChildApplication/ChildApplicationConfiguration.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/ChildApplication/ChildApplicationManager.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/ChildApplication/ChildApplicationsController.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Components/LegalFooter.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Environment/DomainManagerService.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Utils/getDataNameForApplication.ts */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/ui-components/build/UIButton.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@icloudweb/auth-service/server/AuthenticationController.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/react/index.js (<- Module is not an ECMAScript module) */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";

// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ LoadChildApplicationADPBlockedRoute; });

// EXTERNAL MODULE: /workspace/node_modules/react/index.js
var react = __webpack_require__(870);

// EXTERNAL MODULE: /workspace/node_modules/classnames/index.js
var classnames = __webpack_require__(1215);
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);

// EXTERNAL MODULE: /workspace/node_modules/@apple/symbols/regular/lock.rectangle.stack.fill.svg
var lock_rectangle_stack_fill = __webpack_require__(1349);

// EXTERNAL MODULE: /workspace/node_modules/@apple/ui-components/build/UIButton.js + 1 modules
var UIButton = __webpack_require__(2259);

// EXTERNAL MODULE: ./src/Legacy/ChildApplication/ChildApplicationConfiguration.ts
var ChildApplicationConfiguration = __webpack_require__(1248);

// EXTERNAL MODULE: ./src/Legacy/ChildApplication/ChildApplicationManager.ts
var ChildApplicationManager = __webpack_require__(1247);

// EXTERNAL MODULE: ./src/Legacy/ChildApplication/ChildApplicationsController.ts
var ChildApplicationsController = __webpack_require__(1264);

// EXTERNAL MODULE: ./src/Components/FixedFlexPage/FixedFlexPage.tsx + 1 modules
var FixedFlexPage = __webpack_require__(2317);

// EXTERNAL MODULE: ./src/Contexts/ApplicationToolbarThemeProvider.tsx
var ApplicationToolbarThemeProvider = __webpack_require__(1452);

// EXTERNAL MODULE: ./src/Components/Toolbar/CloudOSApplicationToolbar/CloudOSApplicationToolbar.tsx + 30 modules
var CloudOSApplicationToolbar = __webpack_require__(2143);

// EXTERNAL MODULE: ./src/Hooks/useLoc.ts
var useLoc = __webpack_require__(1227);

// EXTERNAL MODULE: ./src/Utils/getDataNameForApplication.ts
var getDataNameForApplication = __webpack_require__(1459);

// EXTERNAL MODULE: ./src/Legacy/Environment/DomainManagerService.ts
var DomainManagerService = __webpack_require__(900);

// EXTERNAL MODULE: ./src/Legacy/Components/LegalFooter.tsx + 1 modules
var LegalFooter = __webpack_require__(2272);

// EXTERNAL MODULE: ./src/ComponentsGeneric/AppIcon/AppIcon.tsx + 205 modules
var AppIcon = __webpack_require__(2132);

// CONCATENATED MODULE: ./src/Components/LoadChildApplicationADPBlockedRoute/LoadChildApplicationADPBlockedRoute.scss
// extracted by mini-css-extract-plugin

// EXTERNAL MODULE: ./src/ADP/useADPStateMachine.ts
var useADPStateMachine = __webpack_require__(1460);

// EXTERNAL MODULE: /workspace/node_modules/@icloudweb/auth-service/server/AuthenticationController.js + 12 modules
var AuthenticationController = __webpack_require__(2155);

// CONCATENATED MODULE: ./src/Components/LoadChildApplicationADPBlockedRoute/LoadChildApplicationADPBlockedRoute.tsx


















function LoadChildApplicationADPBlockedRoute(props) {
  const applicationIdentifier = props.applicationIdentifier;
  const pcsKeyIdentifier = props.pcsKeyIdentifier;
  const configuration = ChildApplicationManager["a" /* ChildApplicationManager */].sharedInstance.getApplicationConfiguration(applicationIdentifier);
  const adpMinimumOSListLocKey = configuration === null || configuration === void 0 ? void 0 : configuration.applicationInfo.adpMinimumOSListLocKey;
  // For some apps we will use the "titleName" and for some apps we will use the "displayName".
  // The reason for this is we need to show `iCloud Mail` for Mail, but for Notes it will just be `Notes`.
  // For iWork apps we will use the "displayName" instead of "titleName".
  // i.e. “Pages”, “Numbers” and “Keynote” instead of “iCloud Pages”, “iCloud Numbers” and “iCloud Keynote”.
  // rdar://115802164 (Consolidate usage of DisplayName and TitleName)
  const shouldUseTitleName = applicationIdentifier ? ["mail", "photos", "iclouddrive"].indexOf(applicationIdentifier) !== -1 : false;
  const displayName = configuration ? shouldUseTitleName ? Object(ChildApplicationConfiguration["d" /* getBrowserTitleForApplication */])(configuration) : Object(ChildApplicationConfiguration["e" /* getDisplayNameForApplication */])(configuration) : "";
  const [state, restartMachine] = Object(useADPStateMachine["b" /* useADPStateMachine */])(applicationIdentifier, pcsKeyIdentifier);
  react["useEffect"](() => {
    if (state === useADPStateMachine["a" /* ADPState */].AccessGranted) {
      ChildApplicationsController["a" /* ChildApplicationsController */].sharedInstance.switchToApplication(applicationIdentifier);
    }
  }, [applicationIdentifier, state]);
  const onComplete = props.onComplete;
  react["useEffect"](() => {
    return () => {
      onComplete === null || onComplete === void 0 || onComplete();
    };
  }, [onComplete]);
  const content = (() => {
    switch (state) {
      case useADPStateMachine["a" /* ADPState */].ArmingRequest:
        return /*#__PURE__*/react["createElement"](ArmingRequestState, null);
      case useADPStateMachine["a" /* ADPState */].FailedToSendAccessRequest:
        return /*#__PURE__*/react["createElement"](FailedToSendAccessRequestState, {
          adpMinimumOSListLocKey: adpMinimumOSListLocKey,
          onTryAgain: restartMachine
        });
      case useADPStateMachine["a" /* ADPState */].AwaitingDeviceConsent:
        return /*#__PURE__*/react["createElement"](AwaitingDeviceConsentState, {
          adpMinimumOSListLocKey: adpMinimumOSListLocKey,
          onTryAgain: restartMachine
        });
      case useADPStateMachine["a" /* ADPState */].FailedToObtainConsent:
        return /*#__PURE__*/react["createElement"](FailedToObtainConsentState, {
          applicationIdentifier: applicationIdentifier,
          onTryAgain: restartMachine
        });
      case useADPStateMachine["a" /* ADPState */].DeviceConsentDenied:
        return /*#__PURE__*/react["createElement"](DeviceConsentDeniedState, {
          applicationIdentifier: applicationIdentifier,
          onTryAgain: restartMachine
        });
      case useADPStateMachine["a" /* ADPState */].FailedToFetchKeys:
        return /*#__PURE__*/react["createElement"](FailedToFetchKeysState, {
          applicationIdentifier: applicationIdentifier,
          onTryAgain: restartMachine
        });
      case useADPStateMachine["a" /* ADPState */].AppNotSupportedWithArmedDevice:
        return /*#__PURE__*/react["createElement"](AppNotSupportedWithArmedDeviceState, {
          applicationIdentifier: applicationIdentifier,
          adpMinimumOSListLocKey: adpMinimumOSListLocKey
        });
      case useADPStateMachine["a" /* ADPState */].FetchingKeys:
      case useADPStateMachine["a" /* ADPState */].AccessGranted:
        return /*#__PURE__*/react["createElement"](FetchingKeysState, {
          applicationIdentifier: applicationIdentifier
        });
    }
  })();
  const elementRef = react["useRef"](null);
  react["useEffect"](() => {
    var _elementRef$current;
    // Announce changes in header.
    (_elementRef$current = elementRef.current) === null || _elementRef$current === void 0 || (_elementRef$current = _elementRef$current.querySelector("h2")) === null || _elementRef$current === void 0 || _elementRef$current.focus();
  }, [state]);
  return /*#__PURE__*/react["createElement"](FixedFlexPage["a" /* FixedFlexPage */], {
    className: classnames_default()("load-child-application-adp-blocked-route", props.className)
  }, /*#__PURE__*/react["createElement"](ApplicationToolbarThemeProvider["b" /* ApplicationToolbarThemeProvider */], {
    value: ApplicationToolbarThemeProvider["a" /* ApplicationToolbarTheme */].LOGIN
  }, /*#__PURE__*/react["createElement"](CloudOSApplicationToolbar["a" /* CloudOSApplicationToolbar */], null)), /*#__PURE__*/react["createElement"]("main", {
    ref: elementRef,
    className: "centering"
  }, applicationIdentifier && /*#__PURE__*/react["createElement"](AppIcon["a" /* AppIcon */], {
    iconSize: 80,
    applicationIdentifier: applicationIdentifier
  }), /*#__PURE__*/react["createElement"]("div", {
    className: "title"
  }, displayName), /*#__PURE__*/react["createElement"](lock_rectangle_stack_fill["a" /* default */], {
    "aria-hidden": "true",
    className: "rectangle-icon",
    layoutMode: "layoutBox",
    desiredFontSize: 40
  }), content, /*#__PURE__*/react["createElement"]("div", {
    style: {
      flex: 1
    }
  })), /*#__PURE__*/react["createElement"]("footer", null, /*#__PURE__*/react["createElement"](LegalFooter["a" /* LegalFooter */], null)));
}
function LoadingEllipsis() {
  return /*#__PURE__*/react["createElement"]("span", {
    className: "ellipsis"
  }, /*#__PURE__*/react["createElement"]("span", {
    className: "dots"
  }));
}
function ArmingRequestState() {
  return /*#__PURE__*/react["createElement"]("h2", {
    tabIndex: -1,
    className: "with-ellipsis"
  }, /*#__PURE__*/react["createElement"]("span", null, Object(useLoc["a" /* getLoc */])("ADP.ArmingRequestState.Title")), "\u2060", /*#__PURE__*/react["createElement"](LoadingEllipsis, null));
}
function AwaitingDeviceConsentState(props) {
  var _props$adpMinimumOSLi;
  const domain = DomainManagerService["a" /* DomainManagerService */].sharedInstance.isDomainCN ? Object(useLoc["a" /* getLoc */])("ADP.Domain.icloud.com.cn") : Object(useLoc["a" /* getLoc */])("ADP.Domain.icloud.com");
  const title = Object(useLoc["a" /* getLoc */])("ADP.AwaitingDeviceConsentState.Title");
  const description = Object(useLoc["a" /* getLoc */])("ADP.AwaitingDeviceConsentState.Description.WithOSList", {
    domain,
    osList: Object(useLoc["a" /* getLoc */])((_props$adpMinimumOSLi = props.adpMinimumOSListLocKey) !== null && _props$adpMinimumOSLi !== void 0 ? _props$adpMinimumOSLi : "ADP.SupportedOS.Default")
  });
  const didntReceive = Object(useLoc["a" /* getLoc */])("ADP.AwaitingDeviceConsentState.DidntReceive");
  const buttonText = Object(useLoc["a" /* getLoc */])("ADP.AwaitingDeviceConsentState.SendAgain");
  return /*#__PURE__*/react["createElement"](react["Fragment"], null, /*#__PURE__*/react["createElement"]("h2", {
    tabIndex: -1
  }, title), /*#__PURE__*/react["createElement"]("div", {
    className: "description"
  }, description), /*#__PURE__*/react["createElement"]("div", {
    className: "didnt-receive"
  }, didntReceive), /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
    variant: "send-again",
    onActivate: props.onTryAgain
  }, " ", buttonText));
}
function FailedToSendAccessRequestState(props) {
  var _userSignal$value, _props$adpMinimumOSLi2, _props$adpMinimumOSLi3;
  const appleId = (_userSignal$value = AuthenticationController["h" /* userSignal */].value) === null || _userSignal$value === void 0 ? void 0 : _userSignal$value.primaryEmail;
  const title = Object(useLoc["a" /* getLoc */])("ADP.FailedToSendAccessRequest.Title");
  const description = appleId ? Object(useLoc["a" /* getLoc */])("ADP.FailedToSendAccessRequest.Description.WithOSList", {
    appleId,
    osList: Object(useLoc["a" /* getLoc */])((_props$adpMinimumOSLi2 = props.adpMinimumOSListLocKey) !== null && _props$adpMinimumOSLi2 !== void 0 ? _props$adpMinimumOSLi2 : "ADP.SupportedOS.Default")
  }) : Object(useLoc["a" /* getLoc */])("ADP.FailedToSendAccessRequest.Description.NoUser.WithOSList", {
    osList: Object(useLoc["a" /* getLoc */])((_props$adpMinimumOSLi3 = props.adpMinimumOSListLocKey) !== null && _props$adpMinimumOSLi3 !== void 0 ? _props$adpMinimumOSLi3 : "ADP.SupportedOS.Default")
  });
  const buttonText = Object(useLoc["a" /* getLoc */])("ADP.FailedToSendAccessRequest.TryAgain");
  return /*#__PURE__*/react["createElement"](FailedState, {
    title: title,
    description: description,
    buttonText: buttonText,
    onClick: props.onTryAgain
  });
}
function FailedToObtainConsentState(props) {
  const domain = DomainManagerService["a" /* DomainManagerService */].sharedInstance.isDomainCN ? Object(useLoc["a" /* getLoc */])("ADP.Domain.icloud.com.cn") : Object(useLoc["a" /* getLoc */])("ADP.Domain.icloud.com");
  const data = Object(getDataNameForApplication["a" /* getDataNameForApplication */])(props.applicationIdentifier);
  const dataTitleCase = Object(getDataNameForApplication["b" /* getDataNameForApplicationTitleCase */])(props.applicationIdentifier);
  const title = Object(useLoc["a" /* getLoc */])("ADP.FailedToObtainConsent.Title", {
    data: dataTitleCase
  });
  const description = Object(useLoc["a" /* getLoc */])("ADP.FailedToObtainConsent.Description", {
    domain,
    data
  });
  const buttonText = Object(useLoc["a" /* getLoc */])("ADP.FailedToObtainConsent.TryAgain");
  return /*#__PURE__*/react["createElement"](FailedState, {
    title: title,
    description: description,
    buttonText: buttonText,
    onClick: props.onTryAgain
  });
}
function DeviceConsentDeniedState(props) {
  const domain = DomainManagerService["a" /* DomainManagerService */].sharedInstance.isDomainCN ? Object(useLoc["a" /* getLoc */])("ADP.Domain.icloud.com.cn") : Object(useLoc["a" /* getLoc */])("ADP.Domain.icloud.com");
  const data = Object(getDataNameForApplication["a" /* getDataNameForApplication */])(props.applicationIdentifier);
  const dataTitleCase = Object(getDataNameForApplication["b" /* getDataNameForApplicationTitleCase */])(props.applicationIdentifier);
  const title = Object(useLoc["a" /* getLoc */])("ADP.DeviceConsentDenied.Title", {
    data: dataTitleCase
  });
  const description = Object(useLoc["a" /* getLoc */])("ADP.DeviceConsentDenied.Description", {
    domain,
    data
  });
  const buttonText = Object(useLoc["a" /* getLoc */])("ADP.DeviceConsentDenied.TryAgain");
  return /*#__PURE__*/react["createElement"](FailedState, {
    title: title,
    description: description,
    buttonText: buttonText,
    onClick: props.onTryAgain
  });
}
function FailedState(props) {
  return /*#__PURE__*/react["createElement"](react["Fragment"], null, /*#__PURE__*/react["createElement"]("h2", {
    tabIndex: -1
  }, props.title), /*#__PURE__*/react["createElement"]("div", {
    className: "description"
  }, props.description), !props.hideButtons && props.buttonText && props.onClick && /*#__PURE__*/react["createElement"]("div", null, /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
    variant: "failed-state",
    onActivate: props.onClick
  }, props.buttonText)));
}
function FailedToFetchKeysState(props) {
  const data = Object(getDataNameForApplication["a" /* getDataNameForApplication */])(props.applicationIdentifier);
  const dataTitleCase = Object(getDataNameForApplication["b" /* getDataNameForApplicationTitleCase */])(props.applicationIdentifier);
  const title = Object(useLoc["a" /* getLoc */])("ADP.FailedToFetchKeys.Title", {
    data: dataTitleCase
  });
  const description = Object(useLoc["a" /* getLoc */])("ADP.FailedToFetchKeys.Description", {
    data
  });
  const buttonText = Object(useLoc["a" /* getLoc */])("ADP.FailedToFetchKeys.TryAgain");
  return /*#__PURE__*/react["createElement"](FailedState, {
    title: title,
    description: description,
    buttonText: buttonText,
    onClick: props.onTryAgain
  });
}
function AppNotSupportedWithArmedDeviceState(props) {
  var _props$adpMinimumOSLi4;
  const data = Object(getDataNameForApplication["a" /* getDataNameForApplication */])(props.applicationIdentifier);
  const dataTitleCase = Object(getDataNameForApplication["b" /* getDataNameForApplicationTitleCase */])(props.applicationIdentifier);
  const title = Object(useLoc["a" /* getLoc */])("ADP.FailedToFetchKeys.Title", {
    data: dataTitleCase
  });
  const description = Object(useLoc["a" /* getLoc */])("ADP.FailedToFetchKeys.ArmedDeviceNotSupported.Description", {
    data,
    osList: Object(useLoc["a" /* getLoc */])((_props$adpMinimumOSLi4 = props.adpMinimumOSListLocKey) !== null && _props$adpMinimumOSLi4 !== void 0 ? _props$adpMinimumOSLi4 : "ADP.SupportedOS.Default")
  });
  return /*#__PURE__*/react["createElement"](FailedState, {
    title: title,
    description: description
  });
}
function FetchingKeysState(props) {
  const domain = DomainManagerService["a" /* DomainManagerService */].sharedInstance.isDomainCN ? Object(useLoc["a" /* getLoc */])("ADP.Domain.icloud.com.cn") : Object(useLoc["a" /* getLoc */])("ADP.Domain.icloud.com");
  const description = (() => {
    switch (props.applicationIdentifier) {
      case "maildrop":
        return Object(useLoc["a" /* getLoc */])("ADP.FetchingKeysState.Description.MailDrop");
      case "bookmarks":
        return Object(useLoc["a" /* getLoc */])("ADP.FetchingKeysState.Description.MailDrop");
      default:
        return Object(useLoc["a" /* getLoc */])("ADP.FetchingKeysState.Description", {
          domain,
          data: Object(getDataNameForApplication["a" /* getDataNameForApplication */])(props.applicationIdentifier)
        });
    }
  })();
  return /*#__PURE__*/react["createElement"](react["Fragment"], null, /*#__PURE__*/react["createElement"]("h2", {
    tabIndex: -1,
    className: "with-ellipsis"
  }, /*#__PURE__*/react["createElement"]("span", null, Object(useLoc["a" /* getLoc */])("ADP.FetchingKeysState.Title")), "\u2060", /*#__PURE__*/react["createElement"](LoadingEllipsis, null)), /*#__PURE__*/react["createElement"]("div", {
    className: "description"
  }, description));
}

/***/ }),

/***/ 2301:
/*!********************************************************************************************!*\
  !*** ./src/Components/LoadChildApplicationRoute/LoadChildApplicationRoute.tsx + 1 modules ***!
  \********************************************************************************************/
/*! exports provided: LoadChildApplicationRoute */
/*! exports used: LoadChildApplicationRoute */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/symbols/bold/arrow.clockwise.svg */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Components/ExternalLink/ExternalLink.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Components/FixedFlexPage/FixedFlexPage.tsx because of ./src/Legacy/Routes/CalendarEventReplyRoute.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Components/Toolbar/CloudOSApplicationToolbar/CloudOSApplicationToolbar.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/ComponentsGeneric/AppIcon/AppIcon.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/ComponentsGeneric/LoadingDots/LoadingDots.tsx because of ./src/Pages/HomePage/HomePageLoading.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Contexts/ApplicationToolbarThemeProvider.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Hooks/useLoc.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Application/CloudOSApplication.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/ChildApplication/ChildApplicationConfiguration.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/ChildApplication/ChildApplicationManager.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/ChildApplication/ChildApplicationsController.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Components/LegalFooter.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Preferences/PreferencesStore.ts */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/ui-components/build/UIButton.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@icloudweb/process-kit3/build/process-kit/state/UIState.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/react/index.js (<- Module is not an ECMAScript module) */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";

// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ LoadChildApplicationRoute; });

// EXTERNAL MODULE: /workspace/node_modules/react/index.js
var react = __webpack_require__(870);

// EXTERNAL MODULE: /workspace/node_modules/classnames/index.js
var classnames = __webpack_require__(1215);
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);

// EXTERNAL MODULE: /workspace/node_modules/@icloudweb/process-kit3/build/process-kit/state/UIState.js
var UIState = __webpack_require__(1295);

// EXTERNAL MODULE: /workspace/node_modules/@apple/ui-components/build/UIButton.js + 1 modules
var UIButton = __webpack_require__(2259);

// EXTERNAL MODULE: ./src/Legacy/ChildApplication/ChildApplicationConfiguration.ts
var ChildApplicationConfiguration = __webpack_require__(1248);

// EXTERNAL MODULE: ./src/Legacy/ChildApplication/ChildApplicationManager.ts
var ChildApplicationManager = __webpack_require__(1247);

// EXTERNAL MODULE: ./src/Legacy/ChildApplication/ChildApplicationsController.ts
var ChildApplicationsController = __webpack_require__(1264);

// EXTERNAL MODULE: ./src/Legacy/Application/CloudOSApplication.tsx + 134 modules
var CloudOSApplication = __webpack_require__(2134);

// EXTERNAL MODULE: ./src/Components/FixedFlexPage/FixedFlexPage.tsx + 1 modules
var FixedFlexPage = __webpack_require__(2317);

// EXTERNAL MODULE: ./src/Contexts/ApplicationToolbarThemeProvider.tsx
var ApplicationToolbarThemeProvider = __webpack_require__(1452);

// EXTERNAL MODULE: ./src/Components/Toolbar/CloudOSApplicationToolbar/CloudOSApplicationToolbar.tsx + 30 modules
var CloudOSApplicationToolbar = __webpack_require__(2143);

// EXTERNAL MODULE: ./src/Hooks/useLoc.ts
var useLoc = __webpack_require__(1227);

// EXTERNAL MODULE: /workspace/node_modules/@apple/symbols/bold/arrow.clockwise.svg
var arrow_clockwise = __webpack_require__(1600);

// EXTERNAL MODULE: ./src/Legacy/Components/LegalFooter.tsx + 1 modules
var LegalFooter = __webpack_require__(2272);

// EXTERNAL MODULE: ./src/ComponentsGeneric/AppIcon/AppIcon.tsx + 205 modules
var AppIcon = __webpack_require__(2132);

// EXTERNAL MODULE: ./src/Components/ExternalLink/ExternalLink.tsx + 3 modules
var ExternalLink = __webpack_require__(2201);

// CONCATENATED MODULE: ./src/Components/LoadChildApplicationRoute/LoadChildApplicationRoute.scss
// extracted by mini-css-extract-plugin

// EXTERNAL MODULE: ./src/ComponentsGeneric/LoadingDots/LoadingDots.tsx + 1 modules
var LoadingDots = __webpack_require__(2318);

// EXTERNAL MODULE: ./src/Legacy/Preferences/PreferencesStore.ts + 4 modules
var PreferencesStore = __webpack_require__(2180);

// CONCATENATED MODULE: ./src/Components/LoadChildApplicationRoute/LoadChildApplicationRoute.tsx



















function LoadChildApplicationRoute(props) {
  const configuration = ChildApplicationManager["a" /* ChildApplicationManager */].sharedInstance.getApplicationConfiguration(props.applicationIdentifier);
  const applicationIdentifier = configuration === null || configuration === void 0 ? void 0 : configuration.identifier;

  // rdar://115802164 (Consolidate usage of DisplayName and TitleName)
  let displayName = null;
  if (configuration) {
    if (applicationIdentifier === "newspublisher") {
      displayName = Object(ChildApplicationConfiguration["e" /* getDisplayNameForApplication */])(configuration);
    } else {
      displayName = Object(ChildApplicationConfiguration["d" /* getBrowserTitleForApplication */])(configuration);
    }
  }
  const handleTryAgain = async () => {
    const currentChildApplicationConfiguration = ChildApplicationManager["a" /* ChildApplicationManager */].sharedInstance.displayOrder.find(childApplicationConfiguration => childApplicationConfiguration.identifier === applicationIdentifier);
    if (currentChildApplicationConfiguration && PreferencesStore["b" /* preferencesStore */].isAppPreferenceFailedToInitilize(currentChildApplicationConfiguration.applicationInfo.authBagId)) {
      const res = await PreferencesStore["b" /* preferencesStore */].initializeAppPreferences([currentChildApplicationConfiguration.applicationInfo.authBagId], true);
      if (res.isOK) {
        ChildApplicationsController["a" /* ChildApplicationsController */].sharedInstance.switchToApplication(props.applicationIdentifier, {});
      }
    } else {
      ChildApplicationsController["a" /* ChildApplicationsController */].sharedInstance.switchToApplication(props.applicationIdentifier, {});
    }
  };
  const mainRef = react["useRef"](null);
  react["useEffect"](() => {
    const main = mainRef.current;
    if (!main) return;
    const applicationInfo = configuration === null || configuration === void 0 ? void 0 : configuration.applicationInfo;
    if (!applicationInfo) return;
    const controller = ChildApplicationsController["a" /* ChildApplicationsController */].sharedInstance.getChildApplicationController(applicationInfo);
    if (!controller) return;
    const applicationContext = controller.applicationContext;
    if (!applicationContext) return;

    // `targetUIStateWhenLaunched` is controlling whether the application
    // is displayed when it finishes loading.
    //
    // The loading screen is initially shown with the main content hidden.
    // If the application loads within `delayBeforeShowingLoadingScreen`
    // milliseconds, the main content will never be shown and the app is
    // displayed.
    //
    // Otherwise, the main content is faded in. When the fade in completes,
    // the loading screen is forced to be displayed for at least
    // `requiredDisplayTimeForLoadingScreen` milliseconds, to avoid any
    // flickering or jarring transitions.
    const delayBeforeShowingLoadingScreen = 2700;
    const requiredDisplayTimeForLoadingScreen = 500;
    const animationEndHandler = () => {
      timeout = window.setTimeout(() => {
        applicationContext.targetUIStateWhenLaunched = UIState["a" /* UIState */].ACTIVE_FOREGROUND;
        if (!applicationInfo) {
          return;
        }

        // Check if app can still be launched (may have become disabled during slow load)
        if (!ChildApplicationsController["a" /* ChildApplicationsController */].sharedInstance.canLaunchChildApplication(applicationInfo)) {
          // App became disabled during loading, show unsupported page
          if (configuration) {
            CloudOSApplication["a" /* CloudOSApplication */].cloudOSApplication.couldNotLaunchApplication(configuration);
          }
          return;
        }
        ChildApplicationsController["a" /* ChildApplicationsController */].sharedInstance.launchChildApplication(applicationInfo, {}, undefined, true);
      }, requiredDisplayTimeForLoadingScreen);
    };
    main.addEventListener("animationend", animationEndHandler);
    let timeout = window.setTimeout(() => {
      applicationContext.targetUIStateWhenLaunched = UIState["a" /* UIState */].BACKGROUND;
      main.classList.add("load-child-application-main-fade-in");
    }, delayBeforeShowingLoadingScreen);
    applicationContext.targetUIStateWhenLaunched = UIState["a" /* UIState */].ACTIVE_FOREGROUND;
    return () => {
      applicationContext.targetUIStateWhenLaunched = UIState["a" /* UIState */].BACKGROUND;
      main.removeEventListener("animationend", animationEndHandler);
      window.clearTimeout(timeout);
    };
  }, [configuration]);

  // when the page is showing application launch has error,
  // it needs to add load-child-application-main-fade-in class for the title/icon to show up
  react["useEffect"](() => {
    const main = mainRef.current;
    if (!props.hadError || !main || main.classList.contains("load-child-application-main-fade-in")) return;
    main.classList.add("load-child-application-main-fade-in");
  }, [props.hadError]);
  return /*#__PURE__*/react["createElement"](FixedFlexPage["a" /* FixedFlexPage */], {
    className: classnames_default()("load-child-application-route", props.className)
  }, /*#__PURE__*/react["createElement"](ApplicationToolbarThemeProvider["b" /* ApplicationToolbarThemeProvider */], {
    value: ApplicationToolbarThemeProvider["a" /* ApplicationToolbarTheme */].LOGIN
  }, /*#__PURE__*/react["createElement"](CloudOSApplicationToolbar["a" /* CloudOSApplicationToolbar */], null)), /*#__PURE__*/react["createElement"]("main", {
    className: "centering",
    ref: mainRef
  }, applicationIdentifier && /*#__PURE__*/react["createElement"](AppIcon["a" /* AppIcon */], {
    className: "delayed-fade-in",
    iconSize: 80,
    applicationIdentifier: applicationIdentifier
  }), displayName && /*#__PURE__*/react["createElement"]("div", {
    className: "delayed-fade-in title"
  }, displayName), !props.hadError && /*#__PURE__*/react["createElement"](LoadingDots["a" /* LoadingDots */], {
    className: "load-child-application-dots"
  }), props.hadError && /*#__PURE__*/react["createElement"](react["Fragment"], null, /*#__PURE__*/react["createElement"]("div", {
    className: "problem"
  }, Object(useLoc["a" /* getLoc */])("LoadingPage.Problem", {
    application: displayName !== null && displayName !== void 0 ? displayName : ""
  })), /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
    className: "try-again",
    onActivate: handleTryAgain
  }, /*#__PURE__*/react["createElement"](arrow_clockwise["a" /* default */], {
    "aria-hidden": "true",
    desiredFontSize: 12,
    layoutMode: "glyphBox"
  }), "\xA0", Object(useLoc["a" /* getLoc */])("LoadingPage.TryAgain")), /*#__PURE__*/react["createElement"](ExternalLink["a" /* ExternalLink */], {
    className: "system-status",
    href: "https://www.apple.com/support/systemstatus/"
  }, Object(useLoc["a" /* getLoc */])("LoadingPage.SystemStatus"))), /*#__PURE__*/react["createElement"]("div", {
    style: {
      flex: 1
    }
  })), /*#__PURE__*/react["createElement"]("footer", null, /*#__PURE__*/react["createElement"](LegalFooter["a" /* LegalFooter */], null)));
}

/***/ }),

/***/ 2302:
/*!*********************************************************************************!*\
  !*** ./src/ComponentsGeneric/ChunkLoadingPage/ChunkLoadingPage.tsx + 1 modules ***!
  \*********************************************************************************/
/*! exports provided: ChunkLoadingPage */
/*! exports used: ChunkLoadingPage */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Components/Toolbar/CloudOSApplicationToolbar/CloudOSApplicationToolbar.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Contexts/ApplicationToolbarThemeProvider.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Hooks/useLoc.ts */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/ui-components/build/UIActivityIndicator.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/react/index.js (<- Module is not an ECMAScript module) */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";

// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ ChunkLoadingPage; });

// EXTERNAL MODULE: ./src/Components/Toolbar/CloudOSApplicationToolbar/CloudOSApplicationToolbar.tsx + 30 modules
var CloudOSApplicationToolbar = __webpack_require__(2143);

// EXTERNAL MODULE: /workspace/node_modules/react/index.js
var react = __webpack_require__(870);

// EXTERNAL MODULE: ./src/Contexts/ApplicationToolbarThemeProvider.tsx
var ApplicationToolbarThemeProvider = __webpack_require__(1452);

// EXTERNAL MODULE: /workspace/node_modules/@apple/ui-components/build/UIActivityIndicator.js + 1 modules
var UIActivityIndicator = __webpack_require__(2262);

// EXTERNAL MODULE: ./src/Hooks/useLoc.ts
var useLoc = __webpack_require__(1227);

// CONCATENATED MODULE: ./src/ComponentsGeneric/ChunkLoadingPage/ChunkLoadingPage.scss
// extracted by mini-css-extract-plugin

// CONCATENATED MODULE: ./src/ComponentsGeneric/ChunkLoadingPage/ChunkLoadingPage.tsx






const ChunkLoadingPage = () => {
  return /*#__PURE__*/react["createElement"]("div", {
    className: "chunk-loading-page"
  }, /*#__PURE__*/react["createElement"](ApplicationToolbarThemeProvider["b" /* ApplicationToolbarThemeProvider */], {
    value: ApplicationToolbarThemeProvider["a" /* ApplicationToolbarTheme */].LOGIN
  }, /*#__PURE__*/react["createElement"](CloudOSApplicationToolbar["a" /* CloudOSApplicationToolbar */], null)), /*#__PURE__*/react["createElement"]("div", {
    className: "spinner-container"
  }, /*#__PURE__*/react["createElement"](UIActivityIndicator["a" /* UIActivityIndicator */], {
    description: Object(useLoc["a" /* getLoc */])("LoadingPage.Loading")
  })));
};

/***/ }),

/***/ 2304:
/*!******************************************************!*\
  !*** ./src/Legacy/Components/Banner.tsx + 1 modules ***!
  \******************************************************/
/*! exports provided: Banner */
/*! exports used: Banner */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Components/NavigationChevron/NavigationChevron.tsx */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/ui-components/build/UIButton.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/react/index.js (<- Module is not an ECMAScript module) */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";

// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ Banner; });

// EXTERNAL MODULE: /workspace/node_modules/react/index.js
var react = __webpack_require__(870);

// EXTERNAL MODULE: /workspace/node_modules/@apple/ui-components/build/UIButton.js + 1 modules
var UIButton = __webpack_require__(2259);

// CONCATENATED MODULE: ./src/Legacy/Resources/Styles/Banner.scss
// extracted by mini-css-extract-plugin

// EXTERNAL MODULE: ./src/Components/NavigationChevron/NavigationChevron.tsx
var NavigationChevron = __webpack_require__(1570);

// CONCATENATED MODULE: ./src/Legacy/Components/Banner.tsx




function Banner(props) {
  const banner = props.bannerData;
  const onClick = () => {
    var _banner$onClick;
    return (_banner$onClick = banner.onClick) === null || _banner$onClick === void 0 ? void 0 : _banner$onClick.call(banner, banner);
  };
  return /*#__PURE__*/react["createElement"]("div", {
    role: "banner",
    className: "banner"
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "banner-inner"
  }, /*#__PURE__*/react["createElement"]("span", {
    className: "title"
  }, banner.title), /*#__PURE__*/react["createElement"]("span", {
    className: "description"
  }, banner.description), banner.buttonTitle && banner.onClick && /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
    variant: "banner-button",
    onActivate: onClick
  }, /*#__PURE__*/react["createElement"]("span", null, banner.buttonTitle), banner.buttonType === "link" && /*#__PURE__*/react["createElement"](NavigationChevron["b" /* NavigationChevron */], {
    "aria-hidden": true,
    desiredFontSize: 8
  }))));
}

/***/ }),

/***/ 2317:
/*!********************************************************************!*\
  !*** ./src/Components/FixedFlexPage/FixedFlexPage.tsx + 1 modules ***!
  \********************************************************************/
/*! exports provided: FixedFlexPage */
/*! exports used: FixedFlexPage */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/react/index.js (<- Module is not an ECMAScript module) */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";

// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ FixedFlexPage; });

// EXTERNAL MODULE: /workspace/node_modules/react/index.js
var react = __webpack_require__(870);

// EXTERNAL MODULE: /workspace/node_modules/classnames/index.js
var classnames = __webpack_require__(1215);
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);

// CONCATENATED MODULE: ./src/Components/FixedFlexPage/FixedFlexPage.scss
// extracted by mini-css-extract-plugin

// CONCATENATED MODULE: ./src/Components/FixedFlexPage/FixedFlexPage.tsx



function FixedFlexPage(props) {
  return /*#__PURE__*/react["createElement"]("div", {
    className: classnames_default()("flex-page-viewport", props.className),
    style: props.style
  }, /*#__PURE__*/react["createElement"]("div", {
    className: classnames_default()("flex-page-content")
  }, props.children));
}

/***/ }),

/***/ 2318:
/*!***********************************************************************!*\
  !*** ./src/ComponentsGeneric/LoadingDots/LoadingDots.tsx + 1 modules ***!
  \***********************************************************************/
/*! exports provided: LoadingDots */
/*! exports used: LoadingDots */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/loc.ts */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/react/index.js (<- Module is not an ECMAScript module) */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";

// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ LoadingDots; });

// EXTERNAL MODULE: /workspace/node_modules/react/index.js
var react = __webpack_require__(870);

// EXTERNAL MODULE: ./src/Legacy/loc.ts
var loc = __webpack_require__(925);

// EXTERNAL MODULE: /workspace/node_modules/classnames/index.js
var classnames = __webpack_require__(1215);
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);

// CONCATENATED MODULE: ./src/ComponentsGeneric/LoadingDots/LoadingDots.scss
// extracted by mini-css-extract-plugin

// CONCATENATED MODULE: ./src/ComponentsGeneric/LoadingDots/LoadingDots.tsx




function LoadingDots(_ref) {
  let {
    className
  } = _ref;
  return /*#__PURE__*/react["createElement"]("div", {
    "aria-label": Object(loc["b" /* useLoc */])("LoadingPage.Loading"),
    className: classnames_default()("loading-dots", className)
  }, /*#__PURE__*/react["createElement"]("div", {
    "aria-hidden": true
  }), /*#__PURE__*/react["createElement"]("div", {
    "aria-hidden": true
  }), /*#__PURE__*/react["createElement"]("div", {
    "aria-hidden": true
  }));
}

/***/ }),

/***/ 2324:
/*!*********************************************************************!*\
  !*** ./src/Pages/WelcomePage/ICloudHero/ICloudHero.tsx + 1 modules ***!
  \*********************************************************************/
/*! exports provided: ICloudHero */
/*! exports used: ICloudHero */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/react/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Resources/Images/icloud_welcome.png because of ./src/Legacy/Components/RootComponent.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Resources/Images/icloud_welcome@2x.png because of ./src/Legacy/Components/RootComponent.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Resources/Images/icloud_welcome@3x.png because of ./src/Legacy/Components/RootComponent.tsx */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";

// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ ICloudHero; });

// EXTERNAL MODULE: /workspace/node_modules/react/index.js
var react = __webpack_require__(870);

// EXTERNAL MODULE: /workspace/node_modules/classnames/index.js
var classnames = __webpack_require__(1215);
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);

// EXTERNAL MODULE: ./src/Resources/Images/icloud_welcome.png
var icloud_welcome = __webpack_require__(1601);

// EXTERNAL MODULE: ./src/Resources/Images/icloud_welcome@2x.png
var icloud_welcome_2x = __webpack_require__(1602);

// EXTERNAL MODULE: ./src/Resources/Images/icloud_welcome@3x.png
var icloud_welcome_3x = __webpack_require__(1603);

// CONCATENATED MODULE: ./src/Pages/WelcomePage/ICloudHero/ICloudHero.scss
// extracted by mini-css-extract-plugin

// CONCATENATED MODULE: ./src/Pages/WelcomePage/ICloudHero/ICloudHero.tsx






const ICloudHero = props => {
  return /*#__PURE__*/react["createElement"]("div", {
    className: classnames_default()("icloud-hero", props.className)
  }, /*#__PURE__*/react["createElement"]("div", {
    className: "clouds"
  }, /*#__PURE__*/react["createElement"]("img", {
    src: icloud_welcome["a" /* default */],
    srcSet: `${icloud_welcome["a" /* default */]}, ${icloud_welcome_2x["a" /* default */]} 2x, ${icloud_welcome_3x["a" /* default */]} 3x`,
    width: 430,
    height: 388,
    alt: "",
    "aria-hidden": true
  })), /*#__PURE__*/react["createElement"]("h1", null, props.title));
};

/***/ }),

/***/ 2325:
/*!***********************************************************************************************!*\
  !*** ./src/ComponentsGeneric/ScreenreaderOnlyHeading/ScreenreaderOnlyHeading.tsx + 1 modules ***!
  \***********************************************************************************************/
/*! exports provided: ScreenreaderOnlyHeading */
/*! exports used: ScreenreaderOnlyHeading */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/react/index.js (<- Module is not an ECMAScript module) */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";

// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ ScreenreaderOnlyHeading; });

// EXTERNAL MODULE: /workspace/node_modules/react/index.js
var react = __webpack_require__(870);

// CONCATENATED MODULE: ./src/ComponentsGeneric/ScreenreaderOnlyHeading/ScreenreaderOnlyHeading.scss
// extracted by mini-css-extract-plugin

// CONCATENATED MODULE: ./src/ComponentsGeneric/ScreenreaderOnlyHeading/ScreenreaderOnlyHeading.tsx


/**
 * Creates a heading that is only visible to a screen reader.
 * This should be used for giving context to content that can be inferred by sighted users.
 * For example, giving a group of items a heading that can be quickly navigated
 * to, but does not have a visual treatment to keep the UI uncluttered.
 * Follow heading guidelines when selecting the level: https://www.w3.org/WAI/tutorials/page-structure/headings/
 * @param ariaLevel translates to what the heading level should be (ariaLevel={1} => h1)
 * @param id optional id
 * @param text the heading text
 */
const ScreenreaderOnlyHeading = props => {
  const {
    ariaLevel,
    id,
    text
  } = props;
  return /*#__PURE__*/react["createElement"]("span", {
    "aria-level": ariaLevel,
    className: "ScreenreaderOnlyHeading",
    id: id,
    role: "heading"
  }, text);
};

/***/ }),

/***/ 2326:
/*!************************************************************************!*\
  !*** ./src/Legacy/Environment/ValidatedDownloadManager.ts + 1 modules ***!
  \************************************************************************/
/*! exports provided: DownloadErrorReasons, ValidatedDownloadManager */
/*! exports used: ValidatedDownloadManager */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Environment/CloudOSParameters.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Environment/CookieManager.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Environment/Platform.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Environment/ValidatedDownloadUrl.ts because of ./src/Pages/ShareAcceptancePage/ShareAcceptancePage.tsx */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@icloudweb/safe/build/openUrl.js */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";

// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ ValidatedDownloadManager_ValidatedDownloadManager; });

// UNUSED EXPORTS: DownloadErrorReasons

// EXTERNAL MODULE: /workspace/node_modules/@icloudweb/safe/build/openUrl.js
var openUrl = __webpack_require__(911);

// EXTERNAL MODULE: ./src/Legacy/Environment/CookieManager.ts + 1 modules
var CookieManager = __webpack_require__(2252);

// EXTERNAL MODULE: ./src/Legacy/Environment/ValidatedDownloadUrl.ts + 1 modules
var ValidatedDownloadUrl = __webpack_require__(2327);

// CONCATENATED MODULE: ./src/Legacy/Environment/IFrameDownloadManager.ts
let DownloadCompletionStatus = /*#__PURE__*/function (DownloadCompletionStatus) {
  DownloadCompletionStatus[DownloadCompletionStatus["FAILED"] = 0] = "FAILED";
  DownloadCompletionStatus[DownloadCompletionStatus["SURVIVED"] = 1] = "SURVIVED";
  return DownloadCompletionStatus;
}({});
const DEFAULT_TIMEOUT_MS = 5000;

/**
 * Configures an iframe to download from the given url. After the download is initiated[1]
 * and the iframe is attached to the DOM, the returned promise will resolve with
 * `DownloadCompletionStatus.FAILED` if the iframe download failed[2] or with
 * `DownloadCompletionStatus.SURVIVED` if the `timeout` elapses without failure, whichever comes
 * first.
 *
 * [1] By setting the iframe‘s src
 *
 * [2] We know this because an iframe will fire a secondary `onload` call when the request
 * fails and the html of the iframe changes to reflect this failure. Note that this is a hack...
 *
 * In CoreWeb, this was part of a larger queue that was designed to support a large number of
 * downloads. Since ValidatedDownloadManager only supports one download at a time, this was
 * not replicated.
 *
 */
class IFrameDownloadManager {
  constructor() {
    this.running = false;
    this.urlQueue = [];
  }
  downloadFromURL(url) {
    const promise = new Promise(resolve => {
      this.urlQueue.push([url, resolve]);
    });
    if (!this.running) {
      this.run();
    }
    return promise;
  }
  async run() {
    this.running = true;
    while (this.urlQueue.length) {
      const [newUrl, resolvePromise] = this.urlQueue.shift();
      const result = await this.beginIFrameDownload(newUrl);
      resolvePromise(result);
    }
    this.running = false;
  }
  async beginIFrameDownload(url) {
    const iframe = document.createElement("iframe");
    iframe.style.display = "none";
    document.body.appendChild(iframe);
    let failedListener = () => {};
    let outcome = DownloadCompletionStatus.FAILED;
    try {
      const timeoutPromise = new Promise(resolve => {
        window.setTimeout(resolve, DEFAULT_TIMEOUT_MS);
      }).then(() => DownloadCompletionStatus.SURVIVED);
      const failedPromise = new Promise(resolve => {
        failedListener = () => resolve(DownloadCompletionStatus.FAILED);
      });
      iframe.addEventListener("load", failedListener);
      iframe.id = url;
      iframe.src = url;
      outcome = await Promise.race([timeoutPromise, failedPromise]);
    } finally {
      var _iframe$parentElement;
      // Ensure that we clean up the iframe so it can be garbage-collected.
      iframe.removeEventListener("load", failedListener);
      (_iframe$parentElement = iframe.parentElement) === null || _iframe$parentElement === void 0 || _iframe$parentElement.removeChild(iframe);
    }
    return outcome;
  }
}
// EXTERNAL MODULE: ./src/Legacy/Environment/Platform.ts
var Platform = __webpack_require__(903);

// EXTERNAL MODULE: ./src/Legacy/Environment/CloudOSParameters.ts + 1 modules
var CloudOSParameters = __webpack_require__(2241);

// CONCATENATED MODULE: ./src/Legacy/Environment/ValidatedDownloadManager.ts






/**
 * DownloadErrorReasons
 * ====================
 *
 * Defines the various download error reasons.
 */
let DownloadErrorReasons = /*#__PURE__*/function (DownloadErrorReasons) {
  DownloadErrorReasons["FAILED_TO_DOWNLOAD"] = "Failed to download the url";
  DownloadErrorReasons["ALREADY_DOWNLOADING"] = "Already downloading a file. Retry after some time.";
  return DownloadErrorReasons;
}({});

/**
 * Performs a 'validated' download of a given URL. Validated downloads are required due to browser
 * limitations in how a download must be initiated by directing the page to a URL.
 *
 * Furthermore, we wish to verify that iCloud is the originator of this request, which because
 * XHRs cannot initiate downloads cannot be done via the ORIGIN header.
 *
 * This leaves us with the below plan to work around these various limitations:
 *
 * 1.  Before download, the client writes a new cookie, with a name previously agreed upon with
 *     the service providing the download, with an opaque value. (Presumably a UUID or a random
 *     number.) This cookie is session-based, and scoped to iCloud domain.
 *
 * 2.  The client does a request to the `url` endpoint. In addition, the params must also contain
 *     the opaque token written to a cookie in (1), which proves that the web client can read a
 *     cookie from iCloud domain, which proves the request originated from iCloud domain. (Thus,
 *     giving you the same benefit of the ORIGIN header.)
 *
 * 3.  If the values for token parameter and the cookie do not match, the server treats it as
 *     unauthorized. In this manner, it does not expose any information to third parties hitting
 *     the same endpoint.
 *
 * 4.  When the download begins, the server removes the cookie.
 *
 * Usage:
 * const validatedDownloadManager = ValidatedDownloadManager.create('','icloud.com');
 * const validatedDownloadUrl = ValidatedDownloadUrl.create('https://www.icloud.com/blank.png', 'termsValidateToken');
 *
 * validatedDownloadManager.download(validatedDownloadUrl);
 *
 */
class ValidatedDownloadManager_ValidatedDownloadManager {
  static create() {
    for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
      params[_key] = arguments[_key];
    }
    return new ValidatedDownloadManager_ValidatedDownloadManager(...params);
  }
  constructor(downloadCookieName, cookieManagerDomain) {
    // Name of the cookie that is sent to the server.
    // The server will look at the value of this cookie, and
    // match it against the value sent in the request.
    this._cookieManager = void 0;
    this.shouldUseIFrameDownloader = void 0;
    this._downloadManager = void 0;
    this.downloadCookieName = downloadCookieName;
    if (!downloadCookieName) {
      throw new Error("downloadCookieName is required to create the ValidatedDownloadManager");
    }
    if (!cookieManagerDomain) {
      throw new Error("cookieManagerDomain is required to create the ValidatedDownloadManager");
    }
    this._cookieManager = new CookieManager["a" /* CookieManager */](cookieManagerDomain);
    this._downloadManager = new IFrameDownloadManager();
    let shouldUseDownloadManager = true;
    const isInteractionModeTouch = Platform["c" /* Platform */].sharedInstance.primaryInteractionMode === Platform["b" /* InteractionMode */].TOUCH;

    // Only on touch devices with iOS >= 13 open the link in on the same window using download manager as per <rdar://problem/55129581>.
    if (isInteractionModeTouch) {
      const isIOS = CloudOSParameters["a" /* CloudOSParameters */].sharedInstance.applicationParameter.isIOS;
      const osMajorVersion = CloudOSParameters["a" /* CloudOSParameters */].sharedInstance.applicationParameter.osMajorVersion;
      shouldUseDownloadManager = isIOS && osMajorVersion >= 13;
    }
    this.shouldUseIFrameDownloader = shouldUseDownloadManager;
  }

  /**
   * Writes the cookie first, adds token Param to the Url, and then actually starts the download.
   *
   * @type {ValidatedDownloadUrl} url - Url to download.
   *
   */
  download(url) {
    if (!(url instanceof ValidatedDownloadUrl["a" /* ValidatedDownloadUrl */])) {
      throw new Error("Url to be downloaded is not of type ValidatedDownloadUrl");
    }
    const {
      _cookieManager: cookieManager,
      downloadCookieName
    } = this;
    const cookieValue = cookieManager.readCookieValue(downloadCookieName);
    if (cookieValue) {
      return Promise.resolve({
        success: false,
        errorReason: DownloadErrorReasons.ALREADY_DOWNLOADING
      });
    } else {
      this._writeCookie(url);
      return this.startDownload(url);
    }
  }

  // ======================================================================
  // Private methods and properties
  // ======================================================================

  /**
   * Starts downloading the document associated with the downloadURL.
   */
  async startDownload(url) {
    if (!this.shouldUseIFrameDownloader) {
      Object(openUrl["a" /* openUrl */])(url.toString(), {
        target: "_blank",
        features: []
      });
      return {
        success: true
      };
    }
    const downloadResult = await this._downloadManager.downloadFromURL(url.href);
    if (downloadResult === DownloadCompletionStatus.FAILED) {
      return {
        success: false,
        errorReason: DownloadErrorReasons.FAILED_TO_DOWNLOAD
      };
    } else {
      return {
        success: true
      };
    }
  }

  /**
   * Writes a scoped cookie as described in the top-level class
   * documentation.
   */
  _writeCookie(url) {
    const {
      downloadTokenQueryParamValue
    } = url;
    const {
      _cookieManager: cookieManager,
      downloadCookieName
    } = this;

    // Write a cookie that is set to expire in 1 hour.
    cookieManager.writeCookie(downloadCookieName, downloadTokenQueryParamValue, undefined, true, undefined, 1);
  }
}

/***/ }),

/***/ 2327:
/*!********************************************************************!*\
  !*** ./src/Legacy/Environment/ValidatedDownloadUrl.ts + 1 modules ***!
  \********************************************************************/
/*! exports provided: ValidatedDownloadUrl */
/*! exports used: ValidatedDownloadUrl */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Network/CloudOSURLConnection.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Network/addQueryArgs.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Utils/uuidString.ts */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@icloudweb/auth-service/server/Environment/Configurations.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@icloudweb/safe/build/parseUrl.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/zod/lib/index.mjs (<- Module is referenced from these modules with unsupported syntax: /workspace/node_modules/@icloudweb/mecard-service/server/MeCardLink.js (referenced with cjs require), /workspace/node_modules/@icloudweb/photos-tile/build/index.js (referenced with cjs require), /workspace/node_modules/@icloudweb/quota-service/server/QuotaLink.js (referenced with cjs require), /workspace/node_modules/@icloudweb/subscription-service/common/Interface.js (referenced with cjs require)) */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";

// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ ValidatedDownloadUrl_ValidatedDownloadUrl; });

// EXTERNAL MODULE: ./src/Legacy/Network/CloudOSURLConnection.ts
var CloudOSURLConnection = __webpack_require__(973);

// EXTERNAL MODULE: ./src/Legacy/Utils/uuidString.ts
var uuidString = __webpack_require__(922);

// EXTERNAL MODULE: /workspace/node_modules/@icloudweb/safe/build/parseUrl.js + 1 modules
var parseUrl = __webpack_require__(2249);

// CONCATENATED MODULE: ./src/Legacy/Environment/LegacyURL.ts

class LegacyURL_LegacyURL {
  constructor(urlInfo) {
    this.url = void 0;
    if (typeof urlInfo === "string") {
      this.url = parseUrl["c" /* parseUrl */](urlInfo);
    } else if (urlInfo && urlInfo.constructor === window.Location) {
      // Does anyone use this?
      this.url = parseUrl["c" /* parseUrl */](urlInfo.href);
    } else {
      throw new Error("A URL object cannot be created with the data provided");
    }
  }
  get protocol() {
    return this.url.protocol;
  }
  set protocol(protocol) {
    this.url.protocol = protocol;
  }
  get auth() {
    return `${this.url.username}:${this.url.password}`;
  }
  set auth(auth) {
    const [username, password] = auth.split(":");
    this.url.username = username;
    this.url.password = password;
  }
  get hostname() {
    return this.url.hostname;
  }
  set hostname(hostname) {
    this.url.hostname = hostname;
  }
  get port() {
    return this.url.port;
  }
  set port(port) {
    this.url.port = typeof port === "number" ? port.toString() : parseInt(port, 10).toString(); // Match CW behaviour
  }
  get pathname() {
    return this.url.pathname;
  }
  set pathname(pathname) {
    this.url.pathname = pathname;
  }
  get query() {
    return this.url.search;
  }
  set query(query) {
    this.url.search = query;
  }
  get hash() {
    return this.url.hash;
  }
  set hash(hash) {
    this.url.hash = hash;
  }
  get href() {
    return this.url.href;
  }
  get host() {
    return this.url.host;
  }
  get origin() {
    return this.url.origin;
  }
  get path() {
    if (this.query) {
      return `${this.pathname || ""}${this.query}`;
    }
    return this.pathname;
  }
  get queryObject() {
    const params = this.url.searchParams;
    const output = {};
    params.forEach((__value, key) => {
      if (output[key]) {
        // Protect against duplicate keys
        return;
      }
      const values = params.getAll(key);
      if (values.length === 1) {
        const testValue = values[0];
        if (testValue.indexOf(",") > -1) {
          output[key] = testValue.split(",");
        } else {
          output[key] = testValue;
        }
        return;
      }
      // An array of values
      output[key] = values;
    });
    return output;
  }
  set queryObject(queryObject) {
    const keyValues = [];
    for (const key of Object.keys(queryObject)) {
      const value = queryObject[key];
      if (Array.isArray(value)) {
        keyValues.push(`${key}=${value.map(v => v.toString()).join(",")}`);
      } else {
        keyValues.push(`${key}=${value.toString()}`);
      }
    }
    this.url.search = `?${keyValues.join("&")}`;
  }
  isInDomain(domain) {
    const hostname = this.hostname;
    if (!hostname || domain === "") return false;
    return hostname.indexOf(domain) > -1;
  }
  setQueryParameter(key, value) {
    const params = this.url.searchParams;
    params.delete(key);
    params.set(key, value);
    this.url.search = `?${params.toString()}`;
    return this;
  }
  appendQueryParameter(key, value) {
    const params = this.url.searchParams;
    params.append(key, value);
    this.url.search = `?${params.toString()}`;
    return this;
  }
  removeQueryParameter(key) {
    const params = this.url.searchParams;
    params.delete(key);
    return this;
  }
  getQueryParameter(key) {
    const params = this.url.searchParams;
    return params.get(key);
  }
  setMultipleQueryParameters(queryParams) {
    for (const key in queryParams) {
      if (queryParams.hasOwnProperty(key)) {
        this.setQueryParameter(key, queryParams[key]);
      }
    }
    return this;
  }
  toString() {
    return this.url.href;
  }
  toJSON() {
    return this.url.toJSON();
  }
}
// EXTERNAL MODULE: /workspace/node_modules/zod/lib/index.mjs
var lib = __webpack_require__(888);

// EXTERNAL MODULE: ./src/Legacy/Network/addQueryArgs.ts
var addQueryArgs = __webpack_require__(924);

// EXTERNAL MODULE: /workspace/node_modules/@icloudweb/auth-service/server/Environment/Configurations.js + 1 modules
var Configurations = __webpack_require__(2248);

// CONCATENATED MODULE: ./src/Legacy/Environment/ValidatedDownloadUrl.ts






const wirePackageDownloadUrlSchema = lib["z"].object({
  package_token: lib["z"].object({
    url: lib["z"].string()
  })
});
async function fetchPackageDownloadURL(url) {
  try {
    const fetched = await CloudOSURLConnection["a" /* CloudOSURLConnection */].fetchJSON(url, {
      validate: {
        type: "WirePackageDownloadUrl",
        schema: wirePackageDownloadUrlSchema
      }
    });
    return fetched.ok ? {
      success: true,
      url: fetched.value.package_token.url
    } : {
      success: false,
      data: fetched.response
    };
  } catch {
    return {
      success: false,
      data: null
    };
  }
}
class ValidatedDownloadUrl_ValidatedDownloadUrl extends LegacyURL_LegacyURL {
  /**
   * Given a `shortToken` determine the correct URL to download from. At
   * which point, return a properly validated
   * `ValidatedDownloadURL` instance.
   *
   * @param shortToken The ShortGUID to leverage.
   * @param databaseScope The correct zone to leverage.
   */
  static async packageUrlFromShortToken(shortToken, databaseScope) {
    if (!shortToken) {
      throw new Error("Cannot fetch a `ValidatedPackageDownloadURL` without a `shortToken`.");
    }
    if (!databaseScope) {
      throw new Error("Cannot fetch a `ValidatedPackageDownloadURL` without defining a `databaseScope`.");
    }

    // Ensure the shortToken is set.
    const url = Object(addQueryArgs["a" /* addQueryArgs */])(Object(Configurations["j" /* urlForServiceName */])("docws", `ws/${databaseScope.toLowerCase()}/download/by_token`), {
      short_token: shortToken
    });
    const response = await fetchPackageDownloadURL(url);
    if (!response.success) return response;
    return new ValidatedDownloadUrl_ValidatedDownloadUrl(response.url, " ");
  }

  /**
   * The query param name that is sent to the server which includes the cookie
   * value.
   *
   * The value is an opaque token generated on send.
   */

  /**
   * Make sure that downloadTokenQueryParamKey is provided to the constructor,
   * else throw an error.
   *
   * @param url Url to download
   * @param downloadTokenQueryParamKey Query Param Name used for downloadToken
   * @param downloadTokenQueryParamValue Query Param Value used for downloadToken
   */
  constructor(url, downloadTokenQueryParamKey, downloadTokenQueryParamValue) {
    super(String(url));
    this.downloadTokenQueryParamKey = void 0;
    /**
     * The value of the token input and validation cookie that
     * are checked by the server to ensure the origin of the
     * request.
     *
     * By default we generate a UUID, but this can be overriden
     * if a specific value is expected.
     */
    this.downloadTokenQueryParamValue = void 0;
    if (!downloadTokenQueryParamKey) {
      throw new Error("downloadTokenQueryParamKey not provided");
    }
    this.downloadTokenQueryParamKey = downloadTokenQueryParamKey;
    if (downloadTokenQueryParamValue) {
      this.downloadTokenQueryParamValue = downloadTokenQueryParamValue;
    } else {
      this.downloadTokenQueryParamValue = Object(uuidString["a" /* uuidString */])();
    }
    this.setQueryParameter(this.downloadTokenQueryParamKey, this.downloadTokenQueryParamValue);
  }
  static create() {
    for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
      params[_key] = arguments[_key];
    }
    return new ValidatedDownloadUrl_ValidatedDownloadUrl(...params);
  }
}

/***/ }),

/***/ 2330:
/*!***********************************************************************************************!*\
  !*** ./src/ComponentsGeneric/Tiles/ErrorHomeTileContent/ErrorHomeTileContent.tsx + 1 modules ***!
  \***********************************************************************************************/
/*! exports provided: ErrorHomeTileContent */
/*! exports used: ErrorHomeTileContent */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/symbols/medium/arrow.clockwise.svg */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/symbols/medium/exclamationmark.icloud.fill.svg */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Contexts/ApplicationLaunchProvider.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Contexts/CustomizationProvider.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Hooks/useLoc.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Legacy/Components/ChildApplication.tsx */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/@apple/ui-components/build/UIButton.js */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/react/index.js (<- Module is not an ECMAScript module) */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";

// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ ErrorHomeTileContent; });

// EXTERNAL MODULE: /workspace/node_modules/react/index.js
var react = __webpack_require__(870);

// EXTERNAL MODULE: /workspace/node_modules/classnames/index.js
var classnames = __webpack_require__(1215);
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);

// EXTERNAL MODULE: /workspace/node_modules/@apple/symbols/medium/arrow.clockwise.svg
var arrow_clockwise = __webpack_require__(1617);

// EXTERNAL MODULE: /workspace/node_modules/@apple/symbols/medium/exclamationmark.icloud.fill.svg
var exclamationmark_icloud_fill = __webpack_require__(1620);

// CONCATENATED MODULE: ./src/ComponentsGeneric/Tiles/ErrorHomeTileContent/ErrorHomeTileContent.scss
// extracted by mini-css-extract-plugin

// EXTERNAL MODULE: /workspace/node_modules/@apple/ui-components/build/UIButton.js + 1 modules
var UIButton = __webpack_require__(2259);

// EXTERNAL MODULE: ./src/Hooks/useLoc.ts
var useLoc = __webpack_require__(1227);

// EXTERNAL MODULE: ./src/Contexts/CustomizationProvider.tsx
var CustomizationProvider = __webpack_require__(1316);

// EXTERNAL MODULE: ./src/Contexts/ApplicationLaunchProvider.tsx
var ApplicationLaunchProvider = __webpack_require__(1319);

// EXTERNAL MODULE: ./src/Legacy/Components/ChildApplication.tsx
var ChildApplication = __webpack_require__(1265);

// CONCATENATED MODULE: ./src/ComponentsGeneric/Tiles/ErrorHomeTileContent/ErrorHomeTileContent.tsx










const ErrorHomeTileContent = _ref => {
  let {
    className,
    refetch,
    errorMessage = Object(useLoc["a" /* getLoc */])("ErrorHomeTileContent.Message"),
    showClouds = true,
    hideRetryButton = false,
    showOpenAppId = undefined
  } = _ref;
  const {
    isInCustomizationMode
  } = Object(CustomizationProvider["b" /* useCustomization */])();
  const launcher = Object(ApplicationLaunchProvider["b" /* useApplicationLauncher */])();
  const tryAgainText = Object(useLoc["a" /* getLoc */])("ErrorHomeTileContent.TryAgain");
  const openAppText = Object(useLoc["a" /* getLoc */])("ErrorHomeTileContent.OpenApp", {
    appName: Object(useLoc["a" /* getLoc */])("ICloudDrive.DisplayName")
  });
  return /*#__PURE__*/react["createElement"]("div", {
    className: classnames_default()("error-home-tile-content", className)
  }, showClouds && /*#__PURE__*/react["createElement"](exclamationmark_icloud_fill["a" /* default */], {
    "aria-hidden": true,
    className: "cloud",
    height: 50,
    width: 50,
    layoutMode: "glyphBox"
  }), /*#__PURE__*/react["createElement"]("p", {
    className: "message"
  }, errorMessage), !isInCustomizationMode && !hideRetryButton && /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
    className: "reload-button",
    onActivate: refetch
  }, /*#__PURE__*/react["createElement"](arrow_clockwise["a" /* default */], {
    "aria-hidden": true,
    className: "arrow-clockwise",
    height: 20,
    width: 20,
    layoutMode: "glyphBox"
  }), tryAgainText), !isInCustomizationMode && showOpenAppId && /*#__PURE__*/react["createElement"](UIButton["a" /* UIButton */], {
    className: "reload-button",
    onActivate: () => {
      launcher.launchApp(showOpenAppId, {
        options: {
          source: {
            reason: ChildApplication["b" /* LaunchReason */].TILE_CLICK
          }
        }
      });
    }
  }, openAppText));
};

/***/ }),

/***/ 2334:
/*!*************************************************!*\
  !*** ./src/API/MeCard/useMeCard.ts + 1 modules ***!
  \*************************************************/
/*! exports provided: useMeCard */
/*! exports used: useMeCard */
/*! ModuleConcatenation bailout: Cannot concat with ./src/Services/MeCard.ts */
/*! ModuleConcatenation bailout: Cannot concat with /workspace/node_modules/react/index.js (<- Module is not an ECMAScript module) */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";

// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ useMeCard; });

// EXTERNAL MODULE: /workspace/node_modules/react/index.js
var react = __webpack_require__(870);

// CONCATENATED MODULE: ./src/API/MeCard/meCard.converter.ts
function meCardSchemaConverter(meCard) {
  var _meCard$contacts;
  const contact = (_meCard$contacts = meCard.contacts) === null || _meCard$contacts === void 0 ? void 0 : _meCard$contacts[0];
  if (!contact) {
    return {
      contactId: ""
    };
  }
  const photo = contact.photo;
  if (!photo) {
    return {
      contactId: contact.contactId
    };
  }
  const cropData = photo.crop ? {
    width: photo.crop.width,
    height: photo.crop.height,
    x: photo.crop.x,
    y: photo.crop.y
  } : undefined;
  return {
    contactId: contact.contactId,
    url: photo.url,
    crop: cropData,
    signature: photo.signature
  };
}
function profilePhotoConverter(profilePhoto) {
  var _profilePhoto$url, _profilePhoto$crop$x, _profilePhoto$crop, _profilePhoto$crop$y, _profilePhoto$crop2, _profilePhoto$crop$wi, _profilePhoto$crop3, _profilePhoto$crop$he, _profilePhoto$crop4;
  return {
    contacts: [{
      contactId: profilePhoto.contactId,
      photo: {
        url: (_profilePhoto$url = profilePhoto.url) !== null && _profilePhoto$url !== void 0 ? _profilePhoto$url : "",
        crop: {
          x: (_profilePhoto$crop$x = (_profilePhoto$crop = profilePhoto.crop) === null || _profilePhoto$crop === void 0 ? void 0 : _profilePhoto$crop.x) !== null && _profilePhoto$crop$x !== void 0 ? _profilePhoto$crop$x : 0,
          y: (_profilePhoto$crop$y = (_profilePhoto$crop2 = profilePhoto.crop) === null || _profilePhoto$crop2 === void 0 ? void 0 : _profilePhoto$crop2.y) !== null && _profilePhoto$crop$y !== void 0 ? _profilePhoto$crop$y : 0,
          width: (_profilePhoto$crop$wi = (_profilePhoto$crop3 = profilePhoto.crop) === null || _profilePhoto$crop3 === void 0 ? void 0 : _profilePhoto$crop3.width) !== null && _profilePhoto$crop$wi !== void 0 ? _profilePhoto$crop$wi : 0,
          height: (_profilePhoto$crop$he = (_profilePhoto$crop4 = profilePhoto.crop) === null || _profilePhoto$crop4 === void 0 ? void 0 : _profilePhoto$crop4.height) !== null && _profilePhoto$crop$he !== void 0 ? _profilePhoto$crop$he : 0
        },
        signature: profilePhoto.signature
      }
    }]
  };
}
// EXTERNAL MODULE: ./src/Services/MeCard.ts
var MeCard = __webpack_require__(987);

// CONCATENATED MODULE: ./src/API/MeCard/useMeCard.ts



function getMeCardDataFromController() {
  var _getMeCardController;
  const meCard = (_getMeCardController = Object(MeCard["b" /* getMeCardController */])()) === null || _getMeCardController === void 0 ? void 0 : _getMeCardController.meCard;
  if (!meCard) return {
    contactId: ""
  };
  return meCardSchemaConverter(meCard);
}
function useMeCard() {
  const [photoData, setPhotoData] = react["useState"](() => getMeCardDataFromController());
  const meCardController = Object(MeCard["b" /* getMeCardController */])();
  const [isMeCardLoading, setIsMeCardLoading] = react["useState"](() => {
    var _meCardController$isF;
    return (_meCardController$isF = meCardController === null || meCardController === void 0 ? void 0 : meCardController.isFetching) !== null && _meCardController$isF !== void 0 ? _meCardController$isF : false;
  });
  react["useEffect"](() => {
    // photo changed observer
    const changeObserver = () => {
      const updatedPhotoData = getMeCardDataFromController();
      if (updatedPhotoData.contactId !== "") {
        setPhotoData(updatedPhotoData);
      }
    };
    meCardController === null || meCardController === void 0 || meCardController.addEventListener("change", changeObserver);

    // loading observer
    const loadingObserver = () => {
      var _meCardController$isF2;
      setIsMeCardLoading((_meCardController$isF2 = meCardController === null || meCardController === void 0 ? void 0 : meCardController.isFetching) !== null && _meCardController$isF2 !== void 0 ? _meCardController$isF2 : false);
    };
    meCardController === null || meCardController === void 0 || meCardController.addEventListener("fetchingchange", loadingObserver);
    return () => {
      meCardController === null || meCardController === void 0 || meCardController.removeEventListener("fetchingchange", loadingObserver);
      meCardController === null || meCardController === void 0 || meCardController.removeEventListener("change", changeObserver);
    };
  }, [meCardController]);
  return {
    isLoading: isMeCardLoading,
    data: photoData
  };
}

/***/ })

},0,[4,1]]);
//# sourceMappingURL=RootComponentRoute.js.map