"use strict";
var __async = (__this, __arguments, generator) => {
  return new Promise((resolve, reject) => {
    var fulfilled = (value) => {
      try {
        step(generator.next(value));
      } catch (e) {
        reject(e);
      }
    };
    var rejected = (value) => {
      try {
        step(generator.throw(value));
      } catch (e) {
        reject(e);
      }
    };
    var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
    step((generator = generator.apply(__this, __arguments)).next());
  });
};
const common_vendor = require("../../common/vendor.js");
const utils_commUtils = require("../../utils/commUtils.js");
const utils_http = require("../../utils/http.js");
const utils_platform = require("../../utils/platform.js");
if (!Array) {
  const _easycom_wd_icon2 = common_vendor.resolveComponent("wd-icon");
  const _component_layout_default_uni = common_vendor.resolveComponent("layout-default-uni");
  (_easycom_wd_icon2 + _component_layout_default_uni)();
}
const _easycom_wd_icon = () => "../../node-modules/wot-design-uni/components/wd-icon/wd-icon.js";
if (!Math) {
  (Banner + AddressCell + Search + LoadingAnimation + ProfileInfo + hurry + _easycom_wd_icon + QuickServiceCarousel + RecommendedServices + Tabbar)();
}
const ProfileInfo = () => "./components/profileInfo.js";
const hurry = () => "./components/hurry.js";
const QuickServiceCarousel = () => "./components/quickServiceCarousel.js";
const RecommendedServices = () => "./components/recommendedServices.js";
const Banner = () => "./components/banner.js";
const LoadingAnimation = () => "../../components/LoadingAnimation.js";
const Tabbar = () => "../../components/Tabbar.js";
const AddressCell = () => "../../components/AddressCell.js";
const Search = () => "../../components/Search.js";
const _sfc_main = {
  __name: "index",
  setup(__props) {
    const isLoading = common_vendor.ref(false);
    const petInfo = common_vendor.ref({});
    const getPetInfo = () => __async(this, null, function* () {
      try {
        const res = yield utils_http.httpGet("/petInfo/index");
        if (res.code === 200) {
          petInfo.value = res.data;
        } else {
          utils_commUtils.toast(res.message);
        }
      } catch (error) {
        console.log(error);
      }
    });
    const toExtended = () => {
      common_vendor.index.navigateTo({
        url: "/pages/extended/index"
      });
    };
    const toPath = (path) => {
      common_vendor.index.navigateTo({
        url: path
      });
    };
    common_vendor.onLoad(() => __async(this, null, function* () {
      isLoading.value = true;
      yield getPetInfo();
      isLoading.value = false;
    }));
    return (_ctx, _cache) => {
      var _a, _b, _c, _d, _e, _f, _g, _h, _i;
      return common_vendor.e({
        a: common_vendor.n(common_vendor.unref(utils_platform.isH5) ? "top-_a_1vw_a_" : "top-_a_3vw_a_"),
        b: common_vendor.o(($event) => common_vendor.isRef(isLoading) ? isLoading.value = $event : null),
        c: common_vendor.p({
          modelValue: common_vendor.unref(isLoading)
        }),
        d: (_a = common_vendor.unref(petInfo)) == null ? void 0 : _a.id
      }, ((_b = common_vendor.unref(petInfo)) == null ? void 0 : _b.id) ? {
        e: common_vendor.p({
          profileIcon: ((_c = common_vendor.unref(petInfo)) == null ? void 0 : _c.profileUrl) ? common_vendor.unref(utils_commUtils.imgUrl)((_d = common_vendor.unref(petInfo)) == null ? void 0 : _d.profileUrl) : "@/static/icons/cat.png",
          profileName: (_e = common_vendor.unref(petInfo)) == null ? void 0 : _e.name,
          gender: (_f = common_vendor.unref(petInfo)) == null ? void 0 : _f.sex,
          profileTags: [(_g = common_vendor.unref(petInfo)) == null ? void 0 : _g.breed, ((_h = common_vendor.unref(petInfo)) == null ? void 0 : _h.sex) == 0 ? "妹妹" : "弟弟", ((_i = common_vendor.unref(petInfo)) == null ? void 0 : _i.isSterilization) == 1 ? "已绝育" : "未绝育"]
        }),
        f: common_vendor.o(($event) => toPath("/pages/pet/pet-detail-page?id=" + common_vendor.unref(petInfo).id))
      } : {}, {
        g: common_vendor.p({
          name: "萌萌哒",
          distance: 25,
          time: 45
        }),
        h: common_vendor.unref(utils_commUtils.imgUrl)("@/static/home/cwpb.png"),
        i: common_vendor.o(($event) => toPath("/pages/service/search")),
        j: common_vendor.unref(utils_commUtils.imgUrl)("@/static/home/cwpl.png"),
        k: common_vendor.o(($event) => toPath("/pages/service/slippery")),
        l: common_vendor.unref(utils_commUtils.imgUrl)("@/static/home/smfw.png"),
        m: common_vendor.o(($event) => toPath("/pages/service/search")),
        n: common_vendor.p({
          name: "arrow-right"
        }),
        o: common_vendor.o(toExtended)
      });
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-83a5a03c"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=index.js.map