"use strict";var _baseComponent=_interopRequireDefault(require("../helpers/baseComponent")),_classNames=_interopRequireDefault(require("../helpers/libs/classNames")),_styleToCssString=_interopRequireDefault(require("../helpers/libs/styleToCssString")),_warning=_interopRequireDefault(require("../helpers/libs/warning")),_omit=require("../helpers/shared/omit"),_utils=require("../dialog/utils"),_utils2=require("../loading/utils"),_utils3=require("../notification/utils"),_utils4=require("../toast/utils"),_utils5=require("../toptips/utils");function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _slicedToArray(t,e){return _arrayWithHoles(t)||_iterableToArrayLimit(t,e)||_unsupportedIterableToArray(t,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,e){var r;if(t)return"string"==typeof t?_arrayLikeToArray(t,e):"Map"===(r="Object"===(r=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:r)||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(t,e):void 0}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,o=new Array(e);r 无法找到对应的组件,请按文档说明使用组件"))},useComponentRef=function(t,e){var r=e.data,o=r.prefixCls,r=r.uuid,o="#".concat(o,"__").concat(t,"-").concat(r);return{current:e.querySelector(o)}},useDialog=function(r,t){var o=useComponentRef("dialog",t),n={};return["show","open","alert","confirm","prompt"].forEach(function(e){n[e]=function(t){return o.current?o.current[e](_objectSpread(_objectSpread({},r),t)):(warningUnhooked(!1,"Dialog"),(t=function(){}).then=function(){},t)}}),[n,o]},useLoading=function(e,t){var r=useComponentRef("loading",t);return[{show:function(t){return r.current?r.current.show(_objectSpread(_objectSpread({},e),t)):(warningUnhooked(!1,"Loading"),(t=function(){}).then=function(){},t)},hide:function(){r.current&&r.current.hide()}},r]},useNotification=function(e,t){var r=useComponentRef("notification",t);return[{show:function(t){return r.current?r.current.show(_objectSpread(_objectSpread({},e),t)):(warningUnhooked(!1,"Notification"),(t=function(){}).then=function(){},t)},hide:function(){r.current&&r.current.hide()}},r]},useToast=function(r,t){var o=useComponentRef("toast",t),n={};return["show","success","warning","info","error"].forEach(function(e){n[e]=function(t){return o.current?o.current[e](_objectSpread(_objectSpread({},r),t)):(warningUnhooked(!1,"Toast"),(t=function(){}).then=function(){},t)}}),[n,o]},useToptips=function(r,t){var o=useComponentRef("toptips",t),n={};return["show","success","warn","info","error"].forEach(function(e){n[e]=function(t){return o.current?o.current[e](_objectSpread(_objectSpread({},r),t)):(warningUnhooked(!1,"Toptips"),(t=function(){}).then=function(){},t)}}),[n,o]};(0,_baseComponent.default)({useExport:!0,properties:{prefixCls:{type:String,value:"wux-app"},config:{type:Object,value:appConfig},shadowRoot:{type:Boolean,value:!1},wrapCls:{type:String,value:""},wrapStyle:{type:[String,Object],value:"",observer:function(t){this.setData({extStyle:(0,_styleToCssString.default)(t)})}}},data:{extStyle:"",uuid:uuid,memoizedAPI:null},observers:_defineProperty({},"prefixCls, config",function(){this.updateMemoizedAPI(arguments.length<=1?void 0:arguments[1])}),computed:{classes:["prefixCls, uuid",function(t,e){return{wrap:(0,_classNames.default)(t),dialog:"".concat(t,"__dialog-").concat(e),loading:"".concat(t,"__loading-").concat(e),notification:"".concat(t,"__notification-").concat(e),toast:"".concat(t,"__toast-").concat(e),toptips:"".concat(t,"__toptips-").concat(e)}}]},methods:_defineProperty({updateMemoizedAPI:function(t){t={dialog:_slicedToArray(useDialog(appConfig.dialog,this),1)[0],loading:_slicedToArray(useLoading(t.loading,this),1)[0],notification:_slicedToArray(useNotification(t.notification,this),1)[0],toast:_slicedToArray(useToast(t.toast,this),1)[0],toptips:_slicedToArray(useToptips(t.toptips,this),1)[0]};this.data.memoizedAPI!==t&&this.setData({memoizedAPI:t})}},"export",function(){var t=this;return{useApp:function(){return t.data.memoizedAPI}}}),attached:function(){this.setData({uuid:++uuid}),this.updateMemoizedAPI(this.data.config)}});