var __defProp = Object.defineProperty;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
  for (var prop in b || (b = {}))
    if (__hasOwnProp.call(b, prop))
      __defNormalProp(a, prop, b[prop]);
  if (__getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(b)) {
      if (__propIsEnum.call(b, prop))
        __defNormalProp(a, prop, b[prop]);
    }
  return a;
};
import { n as normalizeComponent, h as Icon, l as lodash, R as to, f as mapState, d as api, o as editor } from "./index.js";
import "vue";
var render$3 = function() {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("div", {
    class: _vm.bem()
  }, [_c("GInput", {
    class: _vm.bem("input"),
    attrs: {
      "value": _vm.width,
      "placeholder": "\u5BBD\u5EA6"
    },
    on: {
      "input": _vm.handleWidthInput
    }
  }), _c("span", {
    class: _vm.bem("separator")
  }, [_c("Icon", {
    attrs: {
      "type": "iconpopup_close"
    }
  })], 1), _c("GInput", {
    class: _vm.bem("input"),
    attrs: {
      "value": _vm.height,
      "placeholder": "\u9AD8\u5EA6"
    },
    on: {
      "input": _vm.handleHeightInput
    }
  }), _c("GSelect", {
    class: _vm.bem("select"),
    attrs: {
      "options": _vm.units,
      "value": _vm.unit,
      "border": ""
    },
    on: {
      "change": _vm.handleUnitInput
    }
  }), _vm._t("default")], 2);
};
var staticRenderFns$3 = [];
var sizeInput_vue_vue_type_style_index_0_lang = /* @__PURE__ */ (() => '.create-design-size-input{display:flex;align-items:center}.create-design-size-input__input{width:120px}.create-design-size-input__input .g-input__inner{width:100%;height:38px}.create-design-size-input__separator{margin:0 12px}.create-design-size-input__separator>i{vertical-align:initial}.create-design-size-input__separator svg{font-size:16px;color:#000;vertical-align:sub}.create-design-size-input__select{width:136px!important;height:40px;margin-left:16px}body{min-width:1200px;overflow:overlay;-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:rgba(0,0,0,0)}body::-webkit-scrollbar{width:7px}body::-webkit-scrollbar-thumb{background-color:#000000b3;border:1px solid #fff;border-radius:10rem}body::-webkit-scrollbar-track-piece:start,body::-webkit-scrollbar-track-piece:end{background:transparent}ul{padding:0;list-style:none}.tofh{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}[id^=HUABAN],[class^=HUABAN],[id^=ZCOOL],[class^=ZCOOL],[id^=lvye],[class^=lvye],[id^=xmt-],[class^=xmt-]{display:none!important}body>iframe[src="chrome-extension://gpdjojdkbbmdfjfahjcgigfpmkopogic/html/grid.html"],body>iframe[src="chrome-extension://gpdjojdkbbmdfjfahjcgigfpmkopogic/html/search.html"]{visibility:hidden!important;transform:translate(-10000px)!important}.eui-popup-base{z-index:2100!important}.eui-tabs__header{border-bottom-width:1px!important}.gda-btn:not(.gda-btn-sm){min-width:88px}.gda-btn>.gdaicon{font-size:20px;vertical-align:-.1em}.gda-btn svg{vertical-align:bottom}.gda-btn.disabled,.gda-btn[disabled]{cursor:default}.gda-dropdown-menu{box-shadow:0 2px 8px #00000029}.gda-dropdown-menu-item{padding:10px 12px;line-height:20px}.gda-dropdown-menu-item>.gdaicon:first-child{font-size:20px;vertical-align:bottom}.gda-dropdown-menu-item:hover,.gda-dropdown-menu-submenu-title:hover{background:#f6f7f9}.gda-dropdown-menu-item-disabled:hover,.gda-dropdown-menu-submenu-title-disabled:hover{background-color:#fff}.gda-modal-header{padding:18px 24px;border-bottom:none}.gda-modal-title{line-height:24px}.gda-modal-close-x{width:60px;height:60px;line-height:60px}.gda-modal-footer{border-top:none}.gda-form-item-label{font-weight:700}.gda-form-horizontal .gda-form-item{margin-bottom:10px}.gda-form-horizontal .gda-form-item-label{font-weight:700;line-height:48px}.gda-pagination-item,.gda-pagination-item:focus,.gda-pagination-item:hover,.gda-pagination-prev .gda-pagination-item-link,.gda-pagination-next .gda-pagination-item-link{color:#444950;background-color:#f0f3f4;border:none}.gda-pagination-item-active,.gda-pagination-item-active:focus,.gda-pagination-item-active:hover{background:#2254f4;border:none}.gda-pagination-item-active a,.gda-pagination-item-active:focus a,.gda-pagination-item-active:hover a{color:#fff}.gda-pagination-prev.gda-pagination-disabled .gda-pagination-item-link,.gda-pagination-next.gda-pagination-disabled .gda-pagination-item-link{opacity:.3}.gda-pagination-prev:focus .gda-pagination-item-link,.gda-pagination-next:focus .gda-pagination-item-link,.gda-pagination-prev:hover .gda-pagination-item-link,.gda-pagination-next:hover .gda-pagination-item-link{color:#444950}.gda-tree li,.gda-tree li:first-child,.gda-tree li:last-child{padding:0}.gda-tree-child-tree>li:first-child{padding-top:0}:root .gda-tree li span.gda-tree-switcher.gda-tree-switcher_close .gda-tree-switcher-icon,:root .gda-tree li span.gda-tree-switcher.gda-tree-switcher_open .gda-tree-switcher-icon{font-size:16px;vertical-align:-3px}.gda-tree.gda-tree-directory>li span.gda-tree-node-content-wrapper:hover:before,.gda-tree.gda-tree-directory .gda-tree-child-tree>li span.gda-tree-node-content-wrapper:hover:before{border-radius:4px}.gda-tree .gda-tree-treenode-checkbox-checked .gda-tree-checkbox-checked:after{display:none}\n')();
const MAX_SIZES = {
  px: [9e3, 12e3],
  cm: [500, 500],
  mm: [5e3, 5e3]
};
const MIN_SIZES = {
  px: [20, 20],
  cm: [1, 1],
  mm: [1, 1]
};
const __vue2_script$3 = {
  name: "create-design-size-input",
  components: {
    Icon
  },
  props: {
    value: {
      type: Object,
      required: true
    },
    units: {
      type: Array,
      default: () => [
        { label: "px(\u50CF\u7D20)", value: "px" },
        { label: "cm(\u5398\u7C73)", value: "cm" },
        { label: "mm(\u6BEB\u7C73)", value: "mm" }
      ]
    }
  },
  computed: {
    width() {
      return this.value.data[0];
    },
    height() {
      return this.value.data[1];
    },
    unit() {
      return this.value.unit;
    }
  },
  methods: {
    formatInput(value) {
      if (!value) {
        return value;
      }
      return +value.replace(/[^\d]/g, "");
    },
    handleWidthInput(e) {
      this.$emit("input", {
        data: [this.formatInput(e.target.value), this.height],
        unit: this.unit
      });
    },
    handleHeightInput(e) {
      this.$emit("input", {
        data: [this.width, this.formatInput(e.target.value)],
        unit: this.unit
      });
    },
    handleUnitInput(unit) {
      this.$emit("input", {
        data: [this.width, this.height],
        unit
      });
    }
  },
  validator(rule, value, callback) {
    const {
      data: [w, h],
      unit
    } = value;
    const maxSize = MAX_SIZES[unit];
    const minSize = MIN_SIZES[unit];
    if (!lodash.exports.isNumber(w) || !lodash.exports.isNumber(h)) {
      callback(new Error("\u8BF7\u8F93\u5165\u6709\u6548\u5C3A\u5BF8"));
      return;
    }
    if (w > maxSize[0] || h > maxSize[1]) {
      callback(new Error(`\u8D85\u51FA\u5C3A\u5BF8\u4E0A\u9650\uFF1A${maxSize[0]} \xD7 ${maxSize[1]}`));
      return;
    }
    if (w < minSize[0] || h < minSize[1]) {
      callback(new Error(`\u6700\u5C0F\u5C3A\u5BF8\u9650\u5236\uFF1A${minSize[0]} \xD7 ${minSize[1]}`));
      return false;
    }
    callback();
  }
};
const __cssModules$3 = {};
var __component__$3 = /* @__PURE__ */ normalizeComponent(__vue2_script$3, render$3, staticRenderFns$3, false, __vue2_injectStyles$3, null, null, null);
function __vue2_injectStyles$3(context) {
  for (let o in __cssModules$3) {
    this[o] = __cssModules$3[o];
  }
}
var SizeInput = /* @__PURE__ */ function() {
  return __component__$3.exports;
}();
var render$2 = function() {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("GFormModel", {
    ref: "form",
    class: _vm.bem(),
    attrs: {
      "inline": "",
      "id": "create-design-form",
      "model": _vm.form,
      "rules": _vm.rules
    },
    nativeOn: {
      "submit": function($event) {
        $event.preventDefault();
      }
    }
  }, [_c("GFormModelItem", {
    attrs: {
      "prop": "size"
    }
  }, [_c("SizeInput", {
    model: {
      value: _vm.form.size,
      callback: function($$v) {
        _vm.$set(_vm.form, "size", $$v);
      },
      expression: "form.size"
    }
  }, [_c("GButton", {
    class: _vm.bem("btn"),
    attrs: {
      "htmlType": "submit",
      "type": "primary"
    },
    on: {
      "click": _vm.handleSubmit
    }
  }, [_vm._v(" \u521B\u5EFA\u8BBE\u8BA1 ")])], 1)], 1)], 1);
};
var staticRenderFns$2 = [];
var sizeForm_vue_vue_type_style_index_0_lang = /* @__PURE__ */ (() => '.create-design-size-form .g-form-item__content{display:block}.create-design-size-form .g-form-item{margin:0}.create-design-size-form__btn{width:110px;height:40px;margin-left:32px}body{min-width:1200px;overflow:overlay;-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:rgba(0,0,0,0)}body::-webkit-scrollbar{width:7px}body::-webkit-scrollbar-thumb{background-color:#000000b3;border:1px solid #fff;border-radius:10rem}body::-webkit-scrollbar-track-piece:start,body::-webkit-scrollbar-track-piece:end{background:transparent}ul{padding:0;list-style:none}.tofh{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}[id^=HUABAN],[class^=HUABAN],[id^=ZCOOL],[class^=ZCOOL],[id^=lvye],[class^=lvye],[id^=xmt-],[class^=xmt-]{display:none!important}body>iframe[src="chrome-extension://gpdjojdkbbmdfjfahjcgigfpmkopogic/html/grid.html"],body>iframe[src="chrome-extension://gpdjojdkbbmdfjfahjcgigfpmkopogic/html/search.html"]{visibility:hidden!important;transform:translate(-10000px)!important}.eui-popup-base{z-index:2100!important}.eui-tabs__header{border-bottom-width:1px!important}.gda-btn:not(.gda-btn-sm){min-width:88px}.gda-btn>.gdaicon{font-size:20px;vertical-align:-.1em}.gda-btn svg{vertical-align:bottom}.gda-btn.disabled,.gda-btn[disabled]{cursor:default}.gda-dropdown-menu{box-shadow:0 2px 8px #00000029}.gda-dropdown-menu-item{padding:10px 12px;line-height:20px}.gda-dropdown-menu-item>.gdaicon:first-child{font-size:20px;vertical-align:bottom}.gda-dropdown-menu-item:hover,.gda-dropdown-menu-submenu-title:hover{background:#f6f7f9}.gda-dropdown-menu-item-disabled:hover,.gda-dropdown-menu-submenu-title-disabled:hover{background-color:#fff}.gda-modal-header{padding:18px 24px;border-bottom:none}.gda-modal-title{line-height:24px}.gda-modal-close-x{width:60px;height:60px;line-height:60px}.gda-modal-footer{border-top:none}.gda-form-item-label{font-weight:700}.gda-form-horizontal .gda-form-item{margin-bottom:10px}.gda-form-horizontal .gda-form-item-label{font-weight:700;line-height:48px}.gda-pagination-item,.gda-pagination-item:focus,.gda-pagination-item:hover,.gda-pagination-prev .gda-pagination-item-link,.gda-pagination-next .gda-pagination-item-link{color:#444950;background-color:#f0f3f4;border:none}.gda-pagination-item-active,.gda-pagination-item-active:focus,.gda-pagination-item-active:hover{background:#2254f4;border:none}.gda-pagination-item-active a,.gda-pagination-item-active:focus a,.gda-pagination-item-active:hover a{color:#fff}.gda-pagination-prev.gda-pagination-disabled .gda-pagination-item-link,.gda-pagination-next.gda-pagination-disabled .gda-pagination-item-link{opacity:.3}.gda-pagination-prev:focus .gda-pagination-item-link,.gda-pagination-next:focus .gda-pagination-item-link,.gda-pagination-prev:hover .gda-pagination-item-link,.gda-pagination-next:hover .gda-pagination-item-link{color:#444950}.gda-tree li,.gda-tree li:first-child,.gda-tree li:last-child{padding:0}.gda-tree-child-tree>li:first-child{padding-top:0}:root .gda-tree li span.gda-tree-switcher.gda-tree-switcher_close .gda-tree-switcher-icon,:root .gda-tree li span.gda-tree-switcher.gda-tree-switcher_open .gda-tree-switcher-icon{font-size:16px;vertical-align:-3px}.gda-tree.gda-tree-directory>li span.gda-tree-node-content-wrapper:hover:before,.gda-tree.gda-tree-directory .gda-tree-child-tree>li span.gda-tree-node-content-wrapper:hover:before{border-radius:4px}.gda-tree .gda-tree-treenode-checkbox-checked .gda-tree-checkbox-checked:after{display:none}\n')();
const __vue2_script$2 = {
  name: "create-design-size-form",
  components: {
    SizeInput
  },
  data() {
    return {
      form: {
        size: {
          data: ["", ""],
          unit: "px"
        }
      },
      rules: {
        size: [{ validator: SizeInput.validator, trigger: "blur" }]
      }
    };
  },
  methods: {
    async handleSubmit() {
      const [, valid] = await to(this.$refs.form.validate());
      if (!valid) {
        return false;
      }
      const {
        data: [width, height],
        unit
      } = this.form.size;
      this.$emit("submit", {
        width,
        height,
        unit
      });
    }
  }
};
const __cssModules$2 = {};
var __component__$2 = /* @__PURE__ */ normalizeComponent(__vue2_script$2, render$2, staticRenderFns$2, false, __vue2_injectStyles$2, null, null, null);
function __vue2_injectStyles$2(context) {
  for (let o in __cssModules$2) {
    this[o] = __cssModules$2[o];
  }
}
var SizeForm = /* @__PURE__ */ function() {
  return __component__$2.exports;
}();
var render$1 = function() {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("a", {
    class: _vm.bem("")
  }, [_c("div", {
    class: _vm.bem("content")
  }, [_c("div", {
    class: _vm.bem("img")
  }, [_c("img", {
    attrs: {
      "src": _vm.img,
      "alt": _vm.name
    }
  })]), _vm.type ? _c("span", {
    class: _vm.bem("type")
  }, [_vm._v(_vm._s(_vm.type))]) : _vm._e()]), _c("div", {
    class: _vm.bem("name")
  }, [_vm._v(_vm._s(_vm.name))]), _c("div", {
    class: _vm.bem("size")
  }, [_vm._v(_vm._s(_vm.size))])]);
};
var staticRenderFns$1 = [];
var categoryDisplay_vue_vue_type_style_index_0_lang = /* @__PURE__ */ (() => '.category-display{display:flex;flex-direction:column;justify-content:flex-end;width:calc(100% / 7);padding:0 12px;margin-bottom:40px;cursor:pointer}.category-display__content{position:relative;display:flex}.category-display__name{margin-top:12px;font-weight:600;line-height:20px;color:#000;text-align:center}.category-display__size{height:18px;font-size:12px;font-weight:400;line-height:18px;color:#7f8792;text-align:center;opacity:0;transition:opacity .25s}.category-display:hover .category-display__size{opacity:1}.category-display__type{position:absolute;bottom:4px;left:4px;padding:5px 7px;font-size:12px;line-height:1;color:#fff;text-transform:uppercase;background:rgba(0,0,0,.6);border-radius:11px}.category-display__img{width:100%;margin-top:auto}.category-display__img>img{display:block;width:100%;height:100%;border-radius:4px;box-shadow:0 1px 4px #0000001f;transition:all .4s ease}.category-display__img>img:hover{box-shadow:0 4px 16px #00000029}body{min-width:1200px;overflow:overlay;-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:rgba(0,0,0,0)}body::-webkit-scrollbar{width:7px}body::-webkit-scrollbar-thumb{background-color:#000000b3;border:1px solid #fff;border-radius:10rem}body::-webkit-scrollbar-track-piece:start,body::-webkit-scrollbar-track-piece:end{background:transparent}ul{padding:0;list-style:none}.tofh{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}[id^=HUABAN],[class^=HUABAN],[id^=ZCOOL],[class^=ZCOOL],[id^=lvye],[class^=lvye],[id^=xmt-],[class^=xmt-]{display:none!important}body>iframe[src="chrome-extension://gpdjojdkbbmdfjfahjcgigfpmkopogic/html/grid.html"],body>iframe[src="chrome-extension://gpdjojdkbbmdfjfahjcgigfpmkopogic/html/search.html"]{visibility:hidden!important;transform:translate(-10000px)!important}.eui-popup-base{z-index:2100!important}.eui-tabs__header{border-bottom-width:1px!important}.gda-btn:not(.gda-btn-sm){min-width:88px}.gda-btn>.gdaicon{font-size:20px;vertical-align:-.1em}.gda-btn svg{vertical-align:bottom}.gda-btn.disabled,.gda-btn[disabled]{cursor:default}.gda-dropdown-menu{box-shadow:0 2px 8px #00000029}.gda-dropdown-menu-item{padding:10px 12px;line-height:20px}.gda-dropdown-menu-item>.gdaicon:first-child{font-size:20px;vertical-align:bottom}.gda-dropdown-menu-item:hover,.gda-dropdown-menu-submenu-title:hover{background:#f6f7f9}.gda-dropdown-menu-item-disabled:hover,.gda-dropdown-menu-submenu-title-disabled:hover{background-color:#fff}.gda-modal-header{padding:18px 24px;border-bottom:none}.gda-modal-title{line-height:24px}.gda-modal-close-x{width:60px;height:60px;line-height:60px}.gda-modal-footer{border-top:none}.gda-form-item-label{font-weight:700}.gda-form-horizontal .gda-form-item{margin-bottom:10px}.gda-form-horizontal .gda-form-item-label{font-weight:700;line-height:48px}.gda-pagination-item,.gda-pagination-item:focus,.gda-pagination-item:hover,.gda-pagination-prev .gda-pagination-item-link,.gda-pagination-next .gda-pagination-item-link{color:#444950;background-color:#f0f3f4;border:none}.gda-pagination-item-active,.gda-pagination-item-active:focus,.gda-pagination-item-active:hover{background:#2254f4;border:none}.gda-pagination-item-active a,.gda-pagination-item-active:focus a,.gda-pagination-item-active:hover a{color:#fff}.gda-pagination-prev.gda-pagination-disabled .gda-pagination-item-link,.gda-pagination-next.gda-pagination-disabled .gda-pagination-item-link{opacity:.3}.gda-pagination-prev:focus .gda-pagination-item-link,.gda-pagination-next:focus .gda-pagination-item-link,.gda-pagination-prev:hover .gda-pagination-item-link,.gda-pagination-next:hover .gda-pagination-item-link{color:#444950}.gda-tree li,.gda-tree li:first-child,.gda-tree li:last-child{padding:0}.gda-tree-child-tree>li:first-child{padding-top:0}:root .gda-tree li span.gda-tree-switcher.gda-tree-switcher_close .gda-tree-switcher-icon,:root .gda-tree li span.gda-tree-switcher.gda-tree-switcher_open .gda-tree-switcher-icon{font-size:16px;vertical-align:-3px}.gda-tree.gda-tree-directory>li span.gda-tree-node-content-wrapper:hover:before,.gda-tree.gda-tree-directory .gda-tree-child-tree>li span.gda-tree-node-content-wrapper:hover:before{border-radius:4px}.gda-tree .gda-tree-treenode-checkbox-checked .gda-tree-checkbox-checked:after{display:none}\n')();
const __vue2_script$1 = {
  name: "category-display",
  props: {
    name: {
      type: String,
      required: true
    },
    size: {
      type: String,
      default: ""
    },
    type: {
      type: String,
      default: ""
    },
    img: {
      type: String,
      required: true
    }
  }
};
const __cssModules$1 = {};
var __component__$1 = /* @__PURE__ */ normalizeComponent(__vue2_script$1, render$1, staticRenderFns$1, false, __vue2_injectStyles$1, null, null, null);
function __vue2_injectStyles$1(context) {
  for (let o in __cssModules$1) {
    this[o] = __cssModules$1[o];
  }
}
var CategoryDisplay = /* @__PURE__ */ function() {
  return __component__$1.exports;
}();
var render = function() {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("div", {
    class: _vm.bem()
  }, [_c("div", {
    class: _vm.bem("block")
  }, [_c("div", {
    class: _vm.bem("head")
  }, [_c("div", {
    class: _vm.bem("name")
  }, [_vm._v("\u81EA\u5B9A\u4E49\u5C3A\u5BF8")])]), _c("div", {
    class: _vm.bem("content")
  }, [_c("SizeForm", {
    on: {
      "submit": _vm.handleSubmit
    }
  })], 1)]), _c("div", {
    class: _vm.bem("block")
  }, [_c("div", {
    class: _vm.bem("head")
  }, [_c("div", {
    class: _vm.bem("name")
  }, [_vm._v(" \u63A8\u8350\u5206\u7C7B ")])]), _c("div", {
    class: _vm.bem("content", "variant")
  }, [_c("div", {
    class: _vm.bem("categories")
  }, _vm._l(_vm.categories, function(cat) {
    return _c("CategoryDisplay", {
      key: cat.id,
      attrs: {
        "name": cat.name,
        "size": _vm.getCategorySize(cat),
        "img": _vm.getOssUrl(cat.extra.preview.url)
      },
      nativeOn: {
        "click": function($event) {
          return _vm.handleClick(cat);
        }
      }
    });
  }), 1)])])]);
};
var staticRenderFns = [];
var index_vue_vue_type_style_index_0_lang = /* @__PURE__ */ (() => '.create-design-page{flex:1;padding:24px 52px 0}.create-design-page__head{display:flex;justify-content:space-between}.create-design-page__content{padding:16px 0 40px}.create-design-page__content--variant{padding-bottom:0}.create-design-page__name{font-size:20px;font-weight:600;line-height:28px;color:#000}.create-design-page__name>span{margin-left:12px;font-size:14px;font-weight:400;color:#8d949e;vertical-align:bottom}.create-design-page__link{display:flex;align-items:center;line-height:28px;color:#444950}.create-design-page__link>.g-icon{margin-left:4px;font-size:20px;vertical-align:bottom}.create-design-page__categories{display:flex;flex-wrap:wrap;margin:0 -12px}body{min-width:1200px;overflow:overlay;-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:rgba(0,0,0,0)}body::-webkit-scrollbar{width:7px}body::-webkit-scrollbar-thumb{background-color:#000000b3;border:1px solid #fff;border-radius:10rem}body::-webkit-scrollbar-track-piece:start,body::-webkit-scrollbar-track-piece:end{background:transparent}ul{padding:0;list-style:none}.tofh{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}[id^=HUABAN],[class^=HUABAN],[id^=ZCOOL],[class^=ZCOOL],[id^=lvye],[class^=lvye],[id^=xmt-],[class^=xmt-]{display:none!important}body>iframe[src="chrome-extension://gpdjojdkbbmdfjfahjcgigfpmkopogic/html/grid.html"],body>iframe[src="chrome-extension://gpdjojdkbbmdfjfahjcgigfpmkopogic/html/search.html"]{visibility:hidden!important;transform:translate(-10000px)!important}.eui-popup-base{z-index:2100!important}.eui-tabs__header{border-bottom-width:1px!important}.gda-btn:not(.gda-btn-sm){min-width:88px}.gda-btn>.gdaicon{font-size:20px;vertical-align:-.1em}.gda-btn svg{vertical-align:bottom}.gda-btn.disabled,.gda-btn[disabled]{cursor:default}.gda-dropdown-menu{box-shadow:0 2px 8px #00000029}.gda-dropdown-menu-item{padding:10px 12px;line-height:20px}.gda-dropdown-menu-item>.gdaicon:first-child{font-size:20px;vertical-align:bottom}.gda-dropdown-menu-item:hover,.gda-dropdown-menu-submenu-title:hover{background:#f6f7f9}.gda-dropdown-menu-item-disabled:hover,.gda-dropdown-menu-submenu-title-disabled:hover{background-color:#fff}.gda-modal-header{padding:18px 24px;border-bottom:none}.gda-modal-title{line-height:24px}.gda-modal-close-x{width:60px;height:60px;line-height:60px}.gda-modal-footer{border-top:none}.gda-form-item-label{font-weight:700}.gda-form-horizontal .gda-form-item{margin-bottom:10px}.gda-form-horizontal .gda-form-item-label{font-weight:700;line-height:48px}.gda-pagination-item,.gda-pagination-item:focus,.gda-pagination-item:hover,.gda-pagination-prev .gda-pagination-item-link,.gda-pagination-next .gda-pagination-item-link{color:#444950;background-color:#f0f3f4;border:none}.gda-pagination-item-active,.gda-pagination-item-active:focus,.gda-pagination-item-active:hover{background:#2254f4;border:none}.gda-pagination-item-active a,.gda-pagination-item-active:focus a,.gda-pagination-item-active:hover a{color:#fff}.gda-pagination-prev.gda-pagination-disabled .gda-pagination-item-link,.gda-pagination-next.gda-pagination-disabled .gda-pagination-item-link{opacity:.3}.gda-pagination-prev:focus .gda-pagination-item-link,.gda-pagination-next:focus .gda-pagination-item-link,.gda-pagination-prev:hover .gda-pagination-item-link,.gda-pagination-next:hover .gda-pagination-item-link{color:#444950}.gda-tree li,.gda-tree li:first-child,.gda-tree li:last-child{padding:0}.gda-tree-child-tree>li:first-child{padding-top:0}:root .gda-tree li span.gda-tree-switcher.gda-tree-switcher_close .gda-tree-switcher-icon,:root .gda-tree li span.gda-tree-switcher.gda-tree-switcher_open .gda-tree-switcher-icon{font-size:16px;vertical-align:-3px}.gda-tree.gda-tree-directory>li span.gda-tree-node-content-wrapper:hover:before,.gda-tree.gda-tree-directory .gda-tree-child-tree>li span.gda-tree-node-content-wrapper:hover:before{border-radius:4px}.gda-tree .gda-tree-treenode-checkbox-checked .gda-tree-checkbox-checked:after{display:none}\n')();
const { cdmApi } = api;
const { createBlankDesign } = editor;
const mapId = {
  2.35: 353,
  1: 374,
  0.56: 370
};
const __vue2_script = {
  name: "create-design-page",
  components: {
    SizeForm,
    CategoryDisplay
  },
  data() {
    return {
      categories: []
    };
  },
  computed: __spreadValues({}, mapState("user", ["user"])),
  created() {
    this.getCategories();
  },
  methods: {
    async getCategories() {
      var _a;
      const variables = {
        page_num: 1,
        page_size: 50,
        userId: (_a = this.user) == null ? void 0 : _a.id
      };
      const materials = await cdmApi.getRecommandCatogories(variables);
      const categories = materials.data.map((item) => {
        item.extra = item.extra && JSON.parse(item.extra);
        return item;
      }).filter((item) => {
        return item.extra && item.extra.preview && (["page", "poster", "list"].includes(item.extra.resource_type) || [514, 513].includes(+item.id));
      }).slice(0, 28);
      this.categories = categories;
    },
    getCategorySize(category) {
      if (!category.extra)
        return null;
      return `${category.extra.width} \xD7 ${category.extra.height} ${category.extra.unit}`;
    },
    handleClick(category) {
      const params = {
        category_id: category.id
      };
      const isOdyssey = [514, 513].includes(+category.id);
      const categoryType = category.flag === "tool" ? "ppt" : category.extra.resource_type;
      createBlankDesign({ type: isOdyssey ? "web_page" : categoryType }, params);
    },
    handleSubmit({ width, height, unit }) {
      const category = this.filterCategory(width, height, unit);
      createBlankDesign({}, { category_id: category.id, width, height, unit });
    },
    filterCategory(width, height, unit) {
      const ratio = width / height;
      const id = Object.keys(mapId).sort((a, b) => {
        return Math.abs(a - ratio) - Math.abs(b - ratio);
      })[0];
      return {
        id: mapId[id],
        extra: {
          width,
          height,
          unit,
          extends: {
            dpi: 72
          }
        }
      };
    },
    getOssUrl(url) {
      if (url) {
        return this.ossUrl(url, { height: 250, type: "webp" });
      }
      return "";
    }
  }
};
const __cssModules = {};
var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles, null, null, null);
function __vue2_injectStyles(context) {
  for (let o in __cssModules) {
    this[o] = __cssModules[o];
  }
}
var index = /* @__PURE__ */ function() {
  return __component__.exports;
}();
export { index as default };
