"use strict";
(self["webpackChunkapp"] = self["webpackChunkapp"] || []).push([["node_modules_ionic_core_dist_esm_ion-segment-view_entry_js"],{

/***/ 54540:
/*!*********************************************************************!*\
  !*** ./node_modules/@ionic/core/dist/esm/ion-segment-view.entry.js ***!
  \*********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ion_segment_view: () => (/* binding */ SegmentView)
/* harmony export */ });
/* harmony import */ var _workdir_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js */ 89204);
/* harmony import */ var _index_C8IsBmNU_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./index-C8IsBmNU.js */ 66922);
/* harmony import */ var _dir_C53feagD_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./dir-C53feagD.js */ 11008);

/*!
 * (C) Ionic http://ionicframework.com - MIT License
 */


const segmentViewIosCss = ":host{display:-ms-flexbox;display:flex;height:100%;overflow-x:scroll;-webkit-scroll-snap-type:x mandatory;-ms-scroll-snap-type:x mandatory;scroll-snap-type:x mandatory;scrollbar-width:none;-ms-overflow-style:none}:host::-webkit-scrollbar{display:none}:host(.segment-view-disabled){-ms-touch-action:none;touch-action:none;overflow-x:hidden}:host(.segment-view-scroll-disabled){pointer-events:none}:host(.segment-view-disabled){opacity:0.3}";
const segmentViewMdCss = ":host{display:-ms-flexbox;display:flex;height:100%;overflow-x:scroll;-webkit-scroll-snap-type:x mandatory;-ms-scroll-snap-type:x mandatory;scroll-snap-type:x mandatory;scrollbar-width:none;-ms-overflow-style:none}:host::-webkit-scrollbar{display:none}:host(.segment-view-disabled){-ms-touch-action:none;touch-action:none;overflow-x:hidden}:host(.segment-view-scroll-disabled){pointer-events:none}:host(.segment-view-disabled){opacity:0.3}";
const SegmentView = class {
  constructor(hostRef) {
    (0,_index_C8IsBmNU_js__WEBPACK_IMPORTED_MODULE_1__.r)(this, hostRef);
    this.ionSegmentViewScroll = (0,_index_C8IsBmNU_js__WEBPACK_IMPORTED_MODULE_1__.c)(this, "ionSegmentViewScroll", 7);
    this.scrollEndTimeout = null;
    this.isTouching = false;
    /**
     * If `true`, the segment view cannot be interacted with.
     */
    this.disabled = false;
  }
  handleScroll(ev) {
    var _a;
    const {
      scrollLeft,
      scrollWidth,
      clientWidth
    } = ev.target;
    const max = scrollWidth - clientWidth;
    const scrollRatio = ((0,_dir_C53feagD_js__WEBPACK_IMPORTED_MODULE_2__.i)(this.el) ? -1 : 1) * (scrollLeft / max);
    this.ionSegmentViewScroll.emit({
      scrollRatio,
      isManualScroll: (_a = this.isManualScroll) !== null && _a !== void 0 ? _a : true
    });
    // Reset the timeout to check for scroll end
    this.resetScrollEndTimeout();
  }
  /**
   * Handle touch start event to know when the user is actively dragging the segment view.
   */
  handleScrollStart() {
    if (this.scrollEndTimeout) {
      clearTimeout(this.scrollEndTimeout);
      this.scrollEndTimeout = null;
    }
    this.isTouching = true;
  }
  /**
   * Handle touch end event to know when the user is no longer dragging the segment view.
   */
  handleTouchEnd() {
    this.isTouching = false;
  }
  /**
   * Reset the scroll end detection timer. This is called on every scroll event.
   */
  resetScrollEndTimeout() {
    if (this.scrollEndTimeout) {
      clearTimeout(this.scrollEndTimeout);
      this.scrollEndTimeout = null;
    }
    this.scrollEndTimeout = setTimeout(() => {
      this.checkForScrollEnd();
    },
    // Setting this to a lower value may result in inconsistencies in behavior
    // across browsers (particularly Firefox).
    // Ideally, all of this logic is removed once the scroll end event is
    // supported on all browsers (https://caniuse.com/?search=scrollend)
    100);
  }
  /**
   * Check if the scroll has ended and the user is not actively touching.
   * If the conditions are met (active content is enabled and no active touch),
   * reset the scroll position and emit the scroll end event.
   */
  checkForScrollEnd() {
    // Only emit scroll end event if the active content is not disabled and
    // the user is not touching the segment view
    if (!this.isTouching) {
      this.isManualScroll = undefined;
    }
  }
  /**
   * @internal
   *
   * This method is used to programmatically set the displayed segment content
   * in the segment view. Calling this method will update the `value` of the
   * corresponding segment button.
   *
   * @param id: The id of the segment content to display.
   * @param smoothScroll: Whether to animate the scroll transition.
   */
  setContent(_x) {
    var _this = this;
    return (0,_workdir_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function* (id, smoothScroll = true) {
      const contents = _this.getSegmentContents();
      const index = contents.findIndex(content => content.id === id);
      if (index === -1) return;
      _this.isManualScroll = false;
      _this.resetScrollEndTimeout();
      const contentWidth = _this.el.offsetWidth;
      const offset = index * contentWidth;
      _this.el.scrollTo({
        top: 0,
        left: ((0,_dir_C53feagD_js__WEBPACK_IMPORTED_MODULE_2__.i)(_this.el) ? -1 : 1) * offset,
        behavior: smoothScroll ? 'smooth' : 'instant'
      });
    }).apply(this, arguments);
  }
  getSegmentContents() {
    return Array.from(this.el.querySelectorAll('ion-segment-content'));
  }
  render() {
    const {
      disabled,
      isManualScroll
    } = this;
    return (0,_index_C8IsBmNU_js__WEBPACK_IMPORTED_MODULE_1__.h)(_index_C8IsBmNU_js__WEBPACK_IMPORTED_MODULE_1__.d, {
      key: 'e180b67bb3143a5f4611fb358c037be6fc782a8f',
      class: {
        'segment-view-disabled': disabled,
        'segment-view-scroll-disabled': isManualScroll === false
      }
    }, (0,_index_C8IsBmNU_js__WEBPACK_IMPORTED_MODULE_1__.h)("slot", {
      key: '41c11d6a7406a10f5c64a2e73abfc072afd8fc73'
    }));
  }
  get el() {
    return (0,_index_C8IsBmNU_js__WEBPACK_IMPORTED_MODULE_1__.g)(this);
  }
};
SegmentView.style = {
  ios: segmentViewIosCss,
  md: segmentViewMdCss
};


/***/ })

}]);
//# sourceMappingURL=node_modules_ionic_core_dist_esm_ion-segment-view_entry_js.js.map