devfab 1.2.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,3 +1,7 @@
1
- "use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}function t(e,t,n,a,r,i,o){try{var s=e[i](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(a,r)}function n(e){return function(){var n=this,a=arguments;return new Promise(function(r,i){var o=e.apply(n,a);function s(e){t(o,r,i,s,u,"next",e)}function u(e){t(o,r,i,s,u,"throw",e)}s(void 0)})}}function a(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,m(a.key),a)}}function o(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e,t,n){return(t=m(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&y(e,t)}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach(function(t){s(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function h(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(-1!==t.indexOf(a))continue;n[a]=e[a]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function v(){
1
+ "use strict";function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function asyncGeneratorStep(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function _asyncToGenerator(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){asyncGeneratorStep(o,n,i,a,s,"next",e)}function s(e){asyncGeneratorStep(o,n,i,a,s,"throw",e)}a(void 0)})}}function _callSuper(e,t,r){return t=_getPrototypeOf(t),_possibleConstructorReturn(e,_isNativeReflectConstruct()?Reflect.construct(t,r||[],_getPrototypeOf(e).constructor):t.apply(e,r))}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _getPrototypeOf(e){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_getPrototypeOf(e)}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf(e,t)}function _isNativeReflectConstruct(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_isNativeReflectConstruct=function(){return!!e})()}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],u=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){c=!0,i=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}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 _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach(function(t){_defineProperty(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function _objectWithoutProperties(e,t){if(null==e)return{};var r,n,i=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],-1===t.indexOf(r)&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}function _possibleConstructorReturn(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(e)}function _regenerator(){
2
2
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
3
- var e,t,n="function"==typeof Symbol?Symbol:{},a=n.iterator||"@@iterator",r=n.toStringTag||"@@toStringTag";function i(n,a,r,i){var u=a&&a.prototype instanceof s?a:s,l=Object.create(u.prototype);return g(l,"_invoke",function(n,a,r){var i,s,u,l=0,c=r||[],d=!1,f={p:0,n:0,v:e,a:h,f:h.bind(e,4),d:function(t,n){return i=t,s=0,u=e,f.n=n,o}};function h(n,a){for(s=n,u=a,t=0;!d&&l&&!r&&t<c.length;t++){var r,i=c[t],h=f.p,v=i[2];n>3?(r=v===a)&&(u=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=h&&((r=n<2&&h<i[1])?(s=0,f.v=a,f.n=i[1]):h<v&&(r=n<3||i[0]>a||a>v)&&(i[4]=n,i[5]=a,f.n=v,s=0))}if(r||n>1)return o;throw d=!0,a}return function(r,c,v){if(l>1)throw TypeError("Generator is already running");for(d&&1===c&&h(c,v),s=c,u=v;(t=s<2?e:u)||!d;){i||(s?s<3?(s>1&&(f.n=-1),h(s,u)):f.n=u:f.v=u);try{if(l=2,i){if(s||(r="next"),t=i[r]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(u=TypeError("The iterator does not provide a '"+r+"' method"),s=1);i=e}else if((t=(d=f.n<0)?u:n.call(a,f))!==o)break}catch(t){i=e,s=1,u=t}finally{l=1}}return{value:t,done:d}}}(n,r,i),!0),l}var o={};function s(){}function u(){}function l(){}t=Object.getPrototypeOf;var c=[][a]?t(t([][a]())):(g(t={},a,function(){return this}),t),d=l.prototype=s.prototype=Object.create(c);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,g(e,r,"GeneratorFunction")),e.prototype=Object.create(d),e}return u.prototype=l,g(d,"constructor",l),g(l,"constructor",u),u.displayName="GeneratorFunction",g(l,r,"GeneratorFunction"),g(d),g(d,r,"Generator"),g(d,a,function(){return this}),g(d,"toString",function(){return"[object Generator]"}),(v=function(){return{w:i,m:f}})()}function g(e,t,n,a){var r=Object.defineProperty;try{r({},"",{})}catch(e){r=0}g=function(e,t,n,a){function i(t,n){g(e,t,function(e){return this._invoke(t,n,e)})}t?r?r(e,t,{value:n,enumerable:!a,configurable:!a,writable:!a}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},g(e,t,n,a)}function y(e,t){return y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},y(e,t)}function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i,o,s=[],u=!0,l=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(a=i.call(n)).done)&&(s.push(a.value),s.length!==t);u=!0);}catch(e){l=!0,r=e}finally{try{if(!u&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw r}}return s}}(e,t)||k(e,t)||function(){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 w(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||k(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function S(e){return S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},S(e)}function k(t,n){if(t){if("string"==typeof t)return e(t,n);var a={}.toString.call(t).slice(8,-1);return"Object"===a&&t.constructor&&(a=t.constructor.name),"Map"===a||"Set"===a?Array.from(t):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?e(t,n):void 0}}Object.defineProperty(exports,"__esModule",{value:!0});var x=["component","children","render"],b=!1,R={},C=null;function P(e){return R[e]}function I(e,t){if(Array.isArray(e)){var n=[];return e.forEach(function(e,a){var r=e.component,i=e.children,o=e.render,s=h(e,x),u=P(r);u||"function"==typeof o||console.log("[warning] Component ".concat(r," is not registered!"));var l={component:u,children:I(i,t)};s.index=a;var c=Object.assign({},null==t?void 0:t.props,s);"function"==typeof o?n.push(o({node:l,props:c})):"function"==typeof C?n.push(C({node:l,props:c})):(Object.assign(l,c),n.push(l))}),n}}var D=function(){return o(function e(){r(this,e)},[{key:"init",value:function(e){b||("function"==typeof e&&e(),b=!0)}},{key:"initComponent",value:function(e,t){!function(e,t){if(e)"string"==typeof e?R[e]?console.log("[warning] Component ".concat(e," is exist!")):R[e]=t:Object.assign(R,e)}(e,t)}},{key:"getComponents",value:function(){return f({},R)}},{key:"getComponent",value:function(e){return P(e)}},{key:"hasComponent",value:function(e){return!!P(e)}},{key:"initRenderFactory",value:function(e){!function(e){C=e}(e)}},{key:"initRequest",value:function(){}},{key:"render",value:function(e,t){return I(e,t)}},{key:"clear",value:function(){R={},C=null,b=!1}}])}(),j=function(){return o(function e(t){r(this,e),this._init(t)},[{key:"_init",value:function(e){this.cache=Object.assign({},e)}},{key:"set",value:function(e,t){this.cache[e]=t}},{key:"get",value:function(e){var t;return null===(t=this.cache)||void 0===t?void 0:t[e]}},{key:"clear",value:function(e){delete this.cache[e]}}])}(),E=function(){return o(function e(t){r(this,e),this._init(t)},[{key:"_init",value:function(e){var t;this.__ASYNC_EXECUTE__=null===(t=null==e?void 0:e.__ASYNC_EXECUTE__)||void 0===t||t,this.events=new Map,this.firstevents=new Map}},{key:"on",value:function(e,t,n){var a=this.events.get(e);Array.isArray(a)||(a=[]),a.push({callback:t,context:n}),this.events.set(e,a)}},{key:"onFirst",value:function(e,t,n){var a=this.firstevents.get(e);Array.isArray(a)||(a=[]),a.splice(0,0,{callback:t,context:n}),this.firstevents.set(e,a)}},{key:"execute",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];var r=this.events.get(e),i=this.firstevents.get(e);if(!r&&!i)return!0;var o=!0;return[].concat(w(i||[]),w(r||[])).forEach(function(e){if(!1!==o){var t=e.callback.apply(e.context||void 0,n);o=!1!==t&&o}}),o}},{key:"un",value:function(e,t){this._unEvents(e,t,this.events),this._unEvents(e,t,this.firstevents)}},{key:"_unEvents",value:function(e,t,n){if(e&&n.has(e))if(t){var a=n.get(e),r=null==a?void 0:a.findIndex(function(e){return e.callback===t});-1!==r&&(null==a||a.splice(r,1))}else n.delete(e)}},{key:"hasEvent",value:function(e){var t,n;return e?((null===(t=this.events.get(e))||void 0===t?void 0:t.length)||0)+((null===(n=this.firstevents.get(e))||void 0===n?void 0:n.length)||0):0}},{key:"fireEvent",value:function(e,t){this.execute("before".concat(e),t)&&(this.execute(e,t),this.execute("after".concat(e),t))}},{key:"_asyncExecute",value:function(e,t,n){for(var a,r=this,i=n.resolve,o=n.reject,s=n.args,u=!0,l=t||[],c=!1,d=function(t){var n,a=l[t];if(!1===u)return 0;if(c)return{v:void 0};if("development"===process.env.nodeEnv)n=a.callback.apply(a.context||r,s);else try{n=a.callback.apply(a.context||r,s)}catch(e){throw e.isAddedMsg||(e.message="(领域扩展事件执行失败,请打开控制台查看详细错误信息并修复):".concat(e.message)),e.isAddedMsg=!0,e}n instanceof Promise?(c=!0,(u=n).callbacks&&u.callbacks.push({reject:function(){u.reject(),t===l.length-1&&(null==o||o())},resolve:function(n){t===l.length-1?(s.length>1&&(s[0]=n),null==i||i(s)):r._asyncExecute(e,l.slice(t+1),{resolve:i,reject:o,args:s})}})):(u=!1!==n&&u,t===l.length-1&&(u?null==i||i(s):null==o||o()))},f=0;f<l.length&&0!==(a=d(f));f++)if(a)return a.v;return u}},{key:"_asyncPromiseExecute",value:function(e,t,n,a){var r=this.events.get(e),i=this.firstevents.get(e);if(!((Array.isArray(r)?r.length:r)||(Array.isArray(i)?i.length:i)))return null==t?void 0:t();var o=[].concat(w(i||[]),w(r||[]));return this._asyncExecute(e,o,{resolve:t,reject:n,args:a})}},{key:"promiseExecute",value:function(e,t){var n=this,a=e,r=1;if("boolean"==typeof e&&(a=t,r=2),a){for(var i=arguments.length,o=new Array(i>2?i-2:0),s=2;s<i;s++)o[s-2]=arguments[s];var u=2===r?o:[t].concat(o);if(u.length){var l,c=u.length-1,d=u[c];if("function"!=typeof d){if("object"!==S(d)||!d[0]||"function"!=typeof d[0]||!d[1]||"function"!=typeof d[1])return;l=d[1],d=d[0]}if(this.__ASYNC_EXECUTE__)return this._asyncPromiseExecute(a,function(e){d.apply(n,e)},function(){l&&"function"==typeof l&&l()},u);u.splice(c,1),u.unshift(a);var f=this.execute.apply(this,u);if(f instanceof Promise){var h=this;f.then(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];d.apply(h,t)},function(){l&&"function"==typeof l&&l()})}else if(!f)return void(l&&"function"==typeof l&&l())}}}},{key:"clearEvents",value:function(){this.events.clear(),this.firstevents.clear()}}])}();function O(e){this.pathname="",this.query={};var t=e;this.init=function(){t||(t=location.search);var e=t.indexOf("?"),n=t.indexOf("#");if(e>=0){if(this.pathname=t.substr(0,e),(t=n<0?t.substr(e+1):t.substring(e+1,n)).length>0)for(var a=(t=t.replace(/\+/g," ")).split("&"),r=0,i=a.length;r<i;r++){var o=a[r]||"";if(o){var s=o.indexOf("="),u="",l="";s<0?l=u=window.decode(o):(u=window.decode(o.substr(0,s)),l=window.decode(o.substr(s+1))),this.query[u]=l}}}else this.pathname=t},this.set=function(e,t){this.query[e]=t},this.get=function(e){return this.query[e]},this.del=function(e){delete this.query[e]},this.has=function(e){return null!=this.query[e]},this.toStr=function(){var e=["?"];for(var t in this.query)e.push(encodeURIComponent(t)),e.push("="),e.push(encodeURIComponent(this.query[t])),e.push("&");return 1===e.length?"":(e.splice(e.length-1,1),e.join(""))},this.init()}function q(e,t){if(!t)return e;var n=[],a=new O(e);for(var r in t)a.get(r)||n.push("".concat(r,"=").concat(t[r]));if(!n.length)return e;var i=n.join("&");return e.indexOf("?")>=0?"".concat(e,"&").concat(i):"".concat(e,"?").concat(i)}String.prototype.equalsIgnoreCase=function(e){return null!=e&&this.toLowerCase()===e.toLowerCase()};var M=["onBeforeRequest","_onAfterRequest"],A=["_onBeforeRequest","onAfterRequest"];var F={_xhrs:[],_jsonps:{index:0},doRequest:function(e){var t=e||{},n=t.onBeforeRequest;t._onAfterRequest;var a,r=h(t,M),i=r.method||"GET",o=r.url;try{null!=r&&r.requestHeaders&&(a=r.requestHeaders,r.requestHeaders=void 0,delete r.requestHeaders)}catch(e){console.log('[ajax]: [doRequest]: options["requestHeaders"] ERR : ',e)}try{r.params&&r.params.requestHeaders&&(a=r.params.requestHeaders,r.params.requestHeaders=void 0,delete r.params.requestHeaders)}catch(e){console.log('[ajax]: [doRequest]: options.params["requestHeaders"] ERR : ',e)}var s=null;if(i.equalsIgnoreCase("get")||i.equalsIgnoreCase("delete")?o=q(o,r.params):(i.equalsIgnoreCase("post")||i.equalsIgnoreCase("put"))&&(s=JSON.stringify(r.params)),r.jsonp)return this.getJsonp(o,r.callback);var u=this.getXMLHttpRequest();if(u){var l;if(u.open(i,o,!1!==r.async),r.timeout&&(u.timeout=r.timeout,u.setRequestHeader("timeout",r.timeout),u.ontimeout=function(){F.onerror(this,r,"timeout")}),r.contentType){if(u.setRequestHeader("Content-Type",r.contentType),r.contentType.indexOf("x-www-form-urlencoded")>=0)s=null===(l=new URLSearchParams(r.params))||void 0===l?void 0:l.toString()}else r.dateType?s=r.params:u.setRequestHeader("Content-Type","application/json;charset=utf-8");r.domainKey&&u.setRequestHeader("Domain-Key",r.domainKey);try{if(a&&"[object Object]"===Object.prototype.toString.call(a))for(var c in a)u.setRequestHeader(c,a[c])}catch(e){console.log('[ajax]: [doRequest]: options.params["requestHeaders"] ERR : ',e)}u.withCredentials=null==r||!r.hasOwnProperty("withCredentials")||r.withCredentials;try{u.send(s)}catch(e){return{error:"NetWorkError",options:r}}if(!1===r.async)return null==n||n(r),this.onreadystatechange(u,r);u.onreadystatechange=function(){F.onreadystatechange(this,r)},null==n||n(r)}},beforeReadystatechange:function(e,t,n){null==n||n()},onreadystatechange:function(e,t){var n=t||{};n._onBeforeRequest;var a=n.onAfterRequest,r=h(n,A);if(4===e.readyState){if(null==a||a(),200===e.status){var i;try{if("blob"===r.responseType){var o=function(e){var t=e.xhr.getAllResponseHeaders(),n={};return t.split("\r\n").map(function(e){var t=p(e.split(": "),2),a=t[0],r=t[1];n[a]=r}),n}({xhr:e});i={code:e.status,data:{data:e.response,headers:o}}}else i=JSON.parse(e.responseText)}catch(t){F.onerror(e,r,e.responseText)}if(!1===r.async)return e.isBusy=!1,r.precallback&&r.precallback(i),F.processAjaxResult(i,!1,null,null,r,e);F.processAjaxResult(i,r.async,r.callback,r.context,r,e),r.precallback&&r.precallback(i)}else if(0===e.status)F.onerror(e,r,"网络连接已断开,请检查设备网络状态后重试");else if(502===e.status||504===e.status)F.onerror(e,r,"服务出错了,请稍后再试");else{if(401!==e.status){var s={};try{s=JSON.parse(e.responseText)}catch(t){s={code:e.status,message:e.responseText}}return F.onerror(e,r,s)}F.onerror(e,r,"登录信息失效,请重新登录或联系技术人员")}e.isBusy=!1}},onerror:function(e,t,n){var a="[ajax]: [onerror]: 接口返回错误 \n [状态码]: ".concat(e.status," \n [错误信息]: ").concat(("object"===S(n)?JSON.stringify(n):n)||"空"," \n [请求地址]: ").concat(t.url," \n [浏览器Token]: ").concat(document.cookie);console.log("Error.E01000",a);var r="object"===S(n)?n:{code:500,message:n};t.precallback&&t.precallback(r)},getXMLHttpRequest:function(){return this.createXMLHttpRequest()},createXMLHttpRequest:function(){return window.XMLHttpRequest?new XMLHttpRequest:window.ActiveXObject?new window.ActiveXObject("Microsoft.XMLHTTP"):null},getJsonp:function(e,t){var n=e,a="callback"+this._jsonps.index++,r=document.createElement("script");this._jsonps[a]=function(e){try{t(e)}finally{document.body.removeChild(r)}},n+=-1===n.indexOf("?")?"?":"&callback=cb.rest.AjaxRequestManager._jsonps."+a,r.src=n,document.body.appendChild(r)},processAjaxResult:function(e,t,n,a,r,i){if(e){if(!e.code)return!1===t?e:void(n&&n.call(a,null,e));if(200==e.code){if(!1===t)return{result:e.data};n&&n.call(a,null,e.data,e.message,e.errorDetail,e.code,e.displayCode&&e)}else{if(!1===t)return{error:e};n&&n.call(a,e)}}}};function N(e,t){this.init&&this.init(e),this.queryParams=t}N.create=function(e,t){return new N(e,t)},N.prototype.init=function(e){if(e)for(var t in this.config=e,this.config)this[t]=function(e){return function(t,n,a){return this.Do(e,t,n,null,a)}}(t),this["".concat(t,"Sync")]=function(e){return function(t){return this.Do(e,t,null,!1)}}(t)},N.prototype.Do=function(e,t,n,a,r){var i,o,s;if(this.config&&this.config[e]&&this.config[e].url){var u=this.config[e],l=u.url;this.queryParams||(this.queryParams={}),null!==(i=u.options)&&void 0!==i&&i.proxyServiceCode&&(this.queryParams.serviceCode=u.options.proxyServiceCode),null!==(o=u.options)&&void 0!==o&&o.billnum&&(this.queryParams.billnum=u.options.billnum),null!==(s=this.queryParams)&&void 0!==s&&s.serviceCode&&(l=q(l,this.queryParams));var c=l,d=Object.assign({},u.options);return d.method=u.method||"GET","function"==typeof t?(d.callback=t,d.context=r||d.context||this):d.params=t,n&&(d.callback=n,d.context=r||d.context||this),!1===a&&(d.async=!1),this.ajax(c,d)}},N.prototype.ajax=function(e,t){return function(e,t){return t.url=e,F.doRequest(t)}(e,t)};var T=function(){return o(function e(t){r(this,e),this._init(t)},[{key:"_init",value:function(e){this._data={};var t=[];if(e)for(var n in e)t.push(n);Object.assign(this._data,{components:[],propertyNames:t},e),this._data.cache=new j,this._data.events=new E}},{key:"_del_data",value:function(e){e&&delete this._data[e]}},{key:"_cls_data",value:function(){this._data.cache.clear(),this._data.events.clear(),this._data={components:[],propertyNames:[],cache:new j,events:new E}}},{key:"_set_data",value:function(e,t,n){if(e){if(n){var a=this._data.propertyNames||[];a.indexOf(e)<0&&a.push(e)}this._data[e]=t}}},{key:"_get_data",value:function(e){if(e)return this._data[e]}},{key:"getData",value:function(){return this._get_data("value")}},{key:"getState",value:function(e,t){var n;if(!t)return this._get_data(e);var a=(this._get_data("components")||[]).find(function(e){return e.ctrlName===t});return a?null===(n=a.getState)||void 0===n?void 0:n.call(a,e):this._get_data(e)}},{key:"setState",value:function(e,t,n){n||this._set_data(e,t,!0);var a={};a[e]=t,this.doPropertyChange("setState",a,n)}},{key:"doPropertyChange",value:function(e,t,n){var a=this,r=this._get_data("components")||[];if(!r.length)return r;var i=[];if(n){var o=r.find(function(e){return e.ctrlName===n});o&&!this.notifyComponent(o,e,t)&&i.push(o)}else r.forEach(function(n){a.notifyComponent(n,e,t)||i.push(n)});return i.length?i:void 0}},{key:"notifyComponent",value:function(e,t,n){return"function"==typeof e[t]&&(this.viewUpdater(e,t,n),!0)}},{key:"viewUpdater",value:function(e,t,n){if("setState"===t)e[t](n);else{var a=this.getCache("name");e[t](n,a)}}},{key:"get",value:function(e){return this._get_data(e)}},{key:"addComponent",value:function(e,t){if(e){t&&!e.ctrlName&&(e.ctrlName=t);var n=this._get_data("components")||[];n.indexOf(e)>=0||n.push(e)}}},{key:"removeComponent",value:function(e){var t=this._get_data("components")||[],n=t.indexOf(e);n<0||t.splice(n,1)}},{key:"_applyState",value:function(e,t,n){var a=this;n||this._set_data(e,t,!0);var r="set".concat(e.charAt(0).toUpperCase()).concat(e.slice(1)),i=this.doPropertyChange(r,t,n);if(i){var o={};o[e]=t,i.forEach(function(e){a.notifyComponent(e,"setState",o)})}}},{key:"getVisible",value:function(e){return this.getState("visible",e)}},{key:"setVisible",value:function(e,t){this._applyState("visible",e,t)}},{key:"getValue",value:function(){return this.getData()}},{key:"setValue",value:function(e,t,n){var a=this,r=this.getValue();if(e!==r){var i={value:e,oldValue:r},o=this._get_data("forceFireEvent");t||o?this.promiseExecute("beforeValueChange",i,[function(){a._set_data("value",e,!0),a._applyState("value",e,n),a.execute("afterValueChange",i)},function(){a._set_data("value",r,!0),a._applyState("value",r,n)}]):(this._set_data("value",e,!0),this._applyState("value",e,n))}}},{key:"getDisabled",value:function(e){return this.getState("disabled",e)}},{key:"setDisabled",value:function(e,t){this._applyState("disabled",e,t)}},{key:"setParent",value:function(e){this.setCache("parent",e)}},{key:"getParent",value:function(){return this.getCache("parent")}},{key:"getRootParent",value:function(){for(var e=this.getParent();null!==(t=e)&&void 0!==t&&t.getParent();){var t;e=e.getParent()}return e}},{key:"setName",value:function(e){this.setCache("name",e)}},{key:"getName",value:function(){return this.getCache("name")}},{key:"setDirty",value:function(e){e?this._set_data("isDirty",!0):(this._del_data("isDirty"),this._set_data("originalData",this.getData()))}},{key:"getDirtyData",value:function(e){var t=this.getData();return!1!==e&&this._get_data("isDirty")||t!==this._get_data("originalData")?t:void 0}},{key:"clear",value:function(e){void 0===e?this._set_data("value",this._get_data("cDefaultValue")):e||this._set_data("value",void 0),this._del_data("isDirty"),this._del_data("checking"),this._del_data("checkMsg")}},{key:"on",value:function(e,t,n){this._get_data("events").on(e,t,n)}},{key:"onFirst",value:function(e,t,n){this._get_data("events").onFirst(e,t,n)}},{key:"execute",value:function(e){for(var t,n=arguments.length,a=new Array(n>1?n-1:0),r=1;r<n;r++)a[r-1]=arguments[r];return(t=this._get_data("events")).execute.apply(t,[e].concat(a))}},{key:"un",value:function(e,t){this._get_data("events").un(e,t)}},{key:"hasEvent",value:function(e){return this._get_data("events").hasEvent(e)}},{key:"fireEvent",value:function(e,t){this._get_data("events").fireEvent(e,t)}},{key:"promiseExecute",value:function(e,t){for(var n,a=arguments.length,r=new Array(a>2?a-2:0),i=2;i<a;i++)r[i-2]=arguments[i];(n=this._get_data("events")).promiseExecute.apply(n,[e,t].concat(r))}},{key:"setCache",value:function(e,t){this._get_data("cache").set(e,t)}},{key:"getCache",value:function(e){return this._get_data("cache").get(e)}},{key:"clearCache",value:function(e){this._get_data("cache").clear(e)}},{key:"setProxy",value:function(e){if(!(e instanceof N)){var t,n=this._get_data("__requestHeaders__");for(var a in e){var r,i,o;if(n&&(null===(r=e[a])||void 0===r||null===(r=r.options)||void 0===r||!r.requestHeaders))null!==(o=e[a])&&void 0!==o&&o.options||(e[a].options={}),e[a].options.requestHeaders=n;null!==(i=this.getProxy())&&void 0!==i&&i[a]&&console.warn("[baseModel.prototype.setProxy]: Proxy ".concat(a," already exists on the model. Please change the name of ").concat(a," and try again"))}return this._set_data("proxy",N.create(f(f({},(null===(t=this.getProxy())||void 0===t?void 0:t.config)||{}),e))),this.getProxy()}this._set_data("proxy",e)}},{key:"getProxy",value:function(){return this._get_data("proxy")}}])}(),K=function(){function e(){return r(this,e),a(this,e,arguments)}return l(e,T),o(e,[{key:"mounted",value:function(){var e=this,t=this.get("conditions"),n={};t.forEach(function(t){e.get(t.name),n[t.name]=t.defaultValue}),this._set_data("params",n)}},{key:"unmounted",value:function(){this._set_data("params",{}),this._set_data("conditions",[])}},{key:"getParams",value:function(){var e=this,t={};return this.get("conditions").forEach(function(n){var a=e.get(n.name);t[n.name]=null==a?void 0:a.getValue()}),this._set_data("params",t),t}},{key:"search",value:function(){var e=this.getParams();this.execute("search",e)}}])}(),V=function(){function e(t){return r(this,e),a(this,e,[t])}return l(e,T),o(e,[{key:"getDisabled",value:function(){return this.getState("disabled")}},{key:"setDisabled",value:function(e){return this.setState("disabled",!!e)}},{key:"getReadonly",value:function(){return this.getState("readonly")}},{key:"setReadonly",value:function(e){this.setState("readonly",!!e)}}])}(),U="",H="Insert",B="Update",L="Delete",z=Array.isArray,G=function(e){return null==e||""===e},X=function(e){return!e||0===Object.keys(e).length};function J(e){if(z(e))return e.map(J);if(e instanceof Date)return new Date(e.getTime());if(e&&"object"===S(e)){var t={};for(var n in e)t[n]=J(e[n]);return t}return e}function Y(e){var t={};return(z(e)?e:Object.keys(e||{}).map(function(t){var n;return f(f({},e[t]||{}),{},{field:(null===(n=e[t])||void 0===n?void 0:n.field)||t})})).forEach(function(e,n){if(e){var a=e.field||e.cCaption||e.cFieldName||"col_".concat(n);t[a]=f(f({},e),{},{field:a,fieldName:e.fieldName||a,cCaption:e.cCaption||a,index:void 0===e.index?n:e.index})}}),t}function Q(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=this.getIdFlag(),n=this.getRowKeyField(),a=this._get_data("rowIdSeq")||0;return e.forEach(function(e){if(e&&void 0===e[t]){var r=e[n];null!=r&&""!==r?e[t]=String(r):(a+=1,e[t]="rowId_".concat(a))}}),this._set_data("rowIdSeq",a),e}function W(e,t,n){var a=this;this.promiseExecute("beforeQuery",{proxyConfig:e,queryParams:t},function(){var r=a,i=a.setProxy({queryData:e}),o={page:{pageSize:a.getPageSize(),pageIndex:a.getPageIndex()}},s=Object.assign(o,t);a.setCache("proxyCache",{proxyConfig:e,params:s}),a.getRootParent();if(!1!==a.execute("beforeQueryData",s)){var u=_.cloneDeep(s);i.queryData(u,function(e,t,a,r){if(!e){this._set_data("dataSourceMode","remote");var i=function(e){if(!e)return[];if(z(e))return e;if(z(e.data))return e.data;if(z(e.records))return e.records;if(z(e.list))return e.list;if(z(e.rows))return e.rows;var t=e.data&&"object"===S(e.data)?e.data:e.result;return z(t)?t:t&&"object"===S(t)&&(t.records||t.list||t.rows||t.data)||[]}(t=Object.assign({},t));null==n||n.call(this,i)}},r)}})}function $(e){if(this.execute("beforeSetDataSource",e)){var t=this._get_data("rowKeyField"),n={};e.forEach(function(e){n[e[t]]=e}),this._set_data("keyMap",n),this._set_data("dataSource",e,!0),this.doPropertyChange("setDataSource"),this.execute("afterSetDataSource",e)}}var Z=function(){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r(this,e);var i=f(f({},{columns:{},dataSource:[],rows:[],readOnly:!0,dataSourceMode:"local",columnMode:"local",editMode:"cell",cellState:{},rowState:{},showCheckBox:!0,multiple:!0,showRowNo:!0,pagination:!0,pageInfo:{pageIndex:1,pageSize:20,pageCount:0},innerUsedAttrs:{id:"_id",selected:"_selected",status:"_status"},multiRowModel:!1,editRowModels:{},loading:!1,params:{},originalKeyMap:{},defaultRowDatas:new Map}),n);z(i.dataSource)||(i.dataSource=[]),z(i.rows)||(i.rows=[]);var o=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=f({},e.proxyConfig||{});return"function"==typeof e.dataSource&&(t.load=t.load||e.dataSource),"string"==typeof e.cUrl&&(t.load=t.load||e.cUrl),t.load||"string"!=typeof e.url||(t.load=e.url),t}(n);i.proxyConfig=o,i.dataSourceMode=n.dataSourceMode||(o.load?"remote":"local");var u=n.cData||(z(n.data)?n.data:null);return s(t=a(this,e,[i]),"modelType","GridModel"),t.initPageInfo(n.cPage||n.page),t.initColumns(i.columns),t.initRowState(),t.afterInit(),u&&t.setDataSource(u),t}return l(e,T),o(e,[{key:"afterInit",value:function(){"single"===this._get_data("parentRelation")&&this._set_data("defaultSelectedRowIndexes",!0)}},{key:"initColumns",value:function(e){var t=Y(e);return this._set_data("columns",t,!0),t}},{key:"initPageInfo",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=f({},this.getPageInfo());t.pageIndex=e.pageNo||e.pageIndex||t.pageIndex||1,t.pageSize=e.pageSize||t.pageSize||20,!1===this.get("pagination")&&(t.pageSize=-1),this.applyPageInfo(t)}},{key:"initRowState",value:function(){var e=this,t=this._get_data("dataSource");this._set_data("rowsDataState",(z(t)?t:[]).map(function(t){return(null==t?void 0:t[e.getStatusFlag()])||U}),!0)}},{key:"getInnerUsedAttrs",value:function(){return this._get_data("innerUsedAttrs")}},{key:"getIdFlag",value:function(){return this.getInnerUsedAttrs().id}},{key:"getSelectedFlag",value:function(){return this.getInnerUsedAttrs().selected}},{key:"getStatusFlag",value:function(){return this.getInnerUsedAttrs().status}},{key:"getRowKeyField",value:function(){return this._get_data("rowKeyField")||"id"}},{key:"getProxyConfig",value:function(){return this._get_data("proxyConfig")||{}}},{key:"isRemote",value:function(){return"remote"===this._get_data("dataSourceMode")}},{key:"isPagination",value:function(){return!!this.get("pagination")&&-1!==this.getPageSize()}},{key:"getReadOnly",value:function(){return!!this._get_data("readOnly")}},{key:"setReadOnly",value:function(e){this._applyState("readOnly",!!e)}},{key:"getParams",value:function(){return f(f({},this.get("cParams")||{}),this._get_data("params")||{})}},{key:"setParams",value:function(e){this._set_data("params",e||{})}},{key:"setMeta",value:function(e){this._set_data("meta",e)}},{key:"getColumns",value:function(e){var t=this._get_data("columns")||{},n={};return(e?z(e)?e:[e]:Object.getOwnPropertyNames(t)).forEach(function(e){t[e]&&(n[e]=f(f({},t[e]),{},{fieldName:t[e].fieldName||e}))}),n}},{key:"getColumn",value:function(e){var t,n=null===(t=this._get_data("columns"))||void 0===t?void 0:t[e];return n?f(f({},n),{},{fieldName:n.fieldName||e}):void 0}},{key:"hasColumn",value:function(e){return!!(this._get_data("columns")||{})[e]}},{key:"getColumnList",value:function(e){var t=this.getColumns(e);return Object.keys(t).sort(function(e,n){return(t[e].index||0)-(t[n].index||0)}).map(function(e){return t[e]})}},{key:"getVisibleColumns",value:function(e){return this.getColumnList(e).filter(function(e){return!0!==e.bHidden&&!1!==e.bShowIt})}},{key:"setColumns",value:function(e){e&&this._applyState("columns",Y(e))}},{key:"setColumnMode",value:function(e){this._set_data("columnMode","remote"===e?"remote":"local",!0)}},{key:"addColumns",value:function(e){var t=Y(e);this._applyState("columns",f(f({},this._get_data("columns")||{}),t))}},{key:"resetColumns",value:function(e){this.setColumns(e||this.get("cColumns"))}},{key:"getColumnState",value:function(e,t,n){var a,r=this.getRowKey(e);return r?((null===(a=this._get_data("cellState"))||void 0===a||null===(a=a[r])||void 0===a?void 0:a[t])||{})[n]:void 0}},{key:"setColumnState",value:function(e,t,n,a){this.setCellState(e,t,n,a)}},{key:"setColumnStates",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.setCellStates(e.map(function(e){return f(f({},e),{},{cellName:e.cellName||e.columnName})}))}},{key:"setColumnValue",value:function(e,t,n){var a=this._get_data("columns")||{};a[e]&&this._applyState("columns",f(f({},a),{},s({},e,f(f({},a[e]),{},s({},t,n)))))}},{key:"setDataSource",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2?arguments[2]:void 0;if("local"===this._get_data("dataSourceMode")){$(cb.utils.isArray(e)?e:[])}else{if(!this.execute("beforeProxyLoad",n))return;this._get_data("pageInfo").pageIndex=1,this._set_data("proxyConfig",e),this._set_data("queryParams",n),this._set_data("loadDataCallback",a),W.call(this,e,n,function(e){$.call(t,e),null==a||a.call(t)})}}},{key:"reload",value:function(){var e=this;this.getProxy();var t=this._get_data("proxyConfig"),n=this._get_data("queryParams"),a=this._get_data("loadDataCallback");W.call(this,t,n,function(t){$.call(e,t),null==a||a.call(e)})}},{key:"getDataSource",value:function(){return this._get_data("dataSource")||[]}},{key:"getData",value:function(e,t){var n=e||t?this._get_data("rows"):this._get_data("dataSource");return this.collectRows(n,e)}},{key:"getAllData",value:function(){return this.getData(!0)}},{key:"getPageData",value:function(){return this.getData(!0)}},{key:"getEffeData",value:function(){var e=this._get_data("dataSource")||[],t=this._get_data("rowsDataState")||[];return this.collectRows(e.filter(function(e,n){return t[n]!==L}),!1)}},{key:"getRows",value:function(e){var t=this._get_data("rows")||[];return!1===e?t:t.map(function(e){return J(e)})}},{key:"collectRows",value:function(e,t){var n=this._get_data("columns")||{},a=this.getStatusFlag(),r=this.getSelectedFlag();return(e||[]).map(function(e){var i={};for(var o in e){var s;t&&o===a||(t||o!==r)&&!1!==(null===(s=n[o])||void 0===s?void 0:s.needCollect)&&(i[o]=e[o])}return i})}},{key:"getShowRows",value:function(e){return(e||this._get_data("rows")||[]).map(function(e){return f({},e)})}},{key:"getRow",value:function(e,t){var n,a=null===(n=this._get_data("rows"))||void 0===n?void 0:n[e];if(a)return!1===t?a:J(a)}},{key:"getRowIndex",value:function(e){if(!e)return-1;var t=this._get_data("rows")||[],n=this.getRowKeyField();return void 0!==e[n]?t.findIndex(function(t){return t[n]===e[n]}):t.indexOf(e)}},{key:"getRowIndexByRowId",value:function(e){var t=this;return(this._get_data("rows")||[]).findIndex(function(n){return(null==n?void 0:n[t.getIdFlag()])===e})}},{key:"getDataSourceIndexByRowId",value:function(e){var t=this;return(this._get_data("dataSource")||[]).findIndex(function(n){return(null==n?void 0:n[t.getIdFlag()])===e})}},{key:"getRowKey",value:function(e){var t,n;return null!==(t=null===(n=this._get_data("rows"))||void 0===n||null===(n=n[e])||void 0===n?void 0:n[this.getIdFlag()])&&void 0!==t?t:e}},{key:"getRowKeys",value:function(e){var t=void 0===e?this.getRows():z(e)?e:[e],n=this.getRowKeyField();return t.filter(function(e){return e&&void 0!==e[n]}).map(function(e){return e[n]})}},{key:"getRowsByIndexes",value:function(e){var t=this._get_data("rows")||[];return(z(e)?e:[e]).map(function(e){return t[e]}).filter(Boolean)}},{key:"getCellValue",value:function(e,t){var n,a=e>=0?null===(n=this._get_data("rows"))||void 0===n?void 0:n[e]:null;if(a&&t)return a[t]}},{key:"setCellValue",value:function(e,t,n){var a=(this._get_data("rows")||[])[e];if(a&&t){var r=a[t];if(r!==n){var i={rowIndex:e,rowId:a[this.getIdFlag()],cellName:t,value:n,oldValue:r};this.execute("beforeCellValueChange",i)&&(a[t]=i.value,this.markRowState(e,B),this.execute("afterCellValueChange",i),this.doPropertyChange("setCellValue",i))}}}},{key:"setCellValues",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];z(t)&&t.forEach(function(t){return e.setCellValue(t.rowIndex,t.cellName||t.field,t.value)})}},{key:"getCellState",value:function(e,t,n){var a,r=this.getRowKey(e),i=r?null===(a=this._get_data("cellState"))||void 0===a||null===(a=a[r])||void 0===a?void 0:a[t]:null;if(i)return i[n]}},{key:"setCellState",value:function(e,t,n,a){var r,i=null===(r=this._get_data("rows"))||void 0===r||null===(r=r[e])||void 0===r?void 0:r[this.getIdFlag()],o=i||e;if(!G(o)){var u=this.getCellState(e,t,n);if(u!==a){var l={rowIndex:e,rowId:i,cellName:t,propertyName:n,value:a,oldValue:u};if(this.execute("beforeCellStateChange",l)){var c=f({},this._get_data("cellState")||{});c[o]=f({},c[o]||{}),c[o][t]=f(f({},c[o][t]||{}),{},s({},n,a)),this._applyState("cellState",c),this.execute("afterCellStateChange",l)}}}}},{key:"setCellStates",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];z(t)&&t.forEach(function(t){return e.setCellState(t.rowIndex,t.cellName,t.propertyName||t.name,t.value)})}},{key:"getRowDataState",value:function(e){var t,n=this.getDataSourceIndexByRow(e);return null===(t=this._get_data("rowsDataState"))||void 0===t?void 0:t[n]}},{key:"getDataSourceIndexByRow",value:function(e){var t=this,n=(this._get_data("rows")||[])[e];if(!n)return-1;var a=this._get_data("dataSource")||[],r=a.indexOf(n);return r>-1?r:a.findIndex(function(e){return(null==e?void 0:e[t.getIdFlag()])===(null==n?void 0:n[t.getIdFlag()])})}},{key:"setRowDataState",value:function(e,t){var n=this.getDataSourceIndexByRow(e);if(!(n<0)){var a=w(this._get_data("rowsDataState")||[]);a[n]=t,this._set_data("rowsDataState",a,!0)}}},{key:"markRowState",value:function(e,t){var n=this.getRowDataState(e);n!==H&&n!==t&&this.setRowDataState(e,t)}},{key:"markRowUpdate",value:function(e){var t="number"==typeof e?e:this.getRowIndex(e);t<0||this.markRowState(t,B)}},{key:"getRowState",value:function(e,t){var n,a=this.getRowKey(e),r=a?null===(n=this._get_data("rowState"))||void 0===n?void 0:n[a]:null;if(r&&t)return r[t]}},{key:"setRowState",value:function(e,t,n){var a,r=null===(a=this._get_data("rows"))||void 0===a?void 0:a[e];if(r&&t){var i=this.getRowKey(e),o=this.getRowState(e,t);if(o!==n){var u={rowIndex:e,rowId:r[this.getIdFlag()],propertyName:t,value:n,oldValue:o};if(this.execute("beforeRowStateChange",u)){var l=f({},this._get_data("rowState")||{});l[i]=f(f({},l[i]||{}),{},s({},t,n)),this._applyState("rowState",l),this.execute("afterRowStateChange",u)}}}}},{key:"setRowStates",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];z(t)&&t.forEach(function(t){return e.setRowState(t.rowIndex,t.propertyName||t.name,t.value)})}},{key:"getDirtyData",value:function(e){var t=this,n=this._get_data("dataSource")||[],a=this._get_data("rowsDataState")||[],r=[];return n.forEach(function(e,n){var i=a[n];if(i){var o=J(e);o[t.getStatusFlag()]=i,r.push(o)}}),r.length?r:void 0}},{key:"getDirtyRowIndexes",value:function(){var e=this;return(this._get_data("rows")||[]).map(function(e,t){return t}).filter(function(t){return!!e.getRowDataState(t)})}},{key:"isDirty",value:function(){return!!this.getDirtyData()}},{key:"backupState",value:function(){this._set_data("backupData",{dataSource:J(this._get_data("dataSource")||[]),rowsDataState:w(this._get_data("rowsDataState")||[])})}},{key:"restoreState",value:function(){var e=this._get_data("backupData");e&&(this._set_data("dataSource",e.dataSource,!0),this._set_data("rowsDataState",w(e.rowsDataState),!0),this.showPage())}},{key:"insertRow",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>3?arguments[3]:void 0,a=this._get_data("rows")||[],r=Math.min(a.length,Math.max(0,void 0===e?a.length:e)),i={index:r,row:f({},t),isCopy:n};if(this.execute("beforeInsertRow",i)){var o=i.row;delete o[this.getIdFlag()],Q.call(this,[o]);var s=this._get_data("dataSource")||[],u=r<a.length?this.getDataSourceIndexByRow(r):s.length;s.splice(u<0?s.length:u,0,o);var l=w(this._get_data("rowsDataState")||[]);return l.splice(u<0?l.length:u,0,H),a.splice(r,0,o),this._set_data("rowsDataState",l,!0),this.setRows(a),this.execute("afterInsertRow",f(f({},i),{},{rowIndex:r})),o}}},{key:"insertRows",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],a=[];return(z(n)?n:[n]).forEach(function(n,r){a.push(t.insertRow(e+r,n))}),a}},{key:"appendRow",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.insertRow(this.getRowsCount(),e)}},{key:"updateRow",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=null===(t=this._get_data("rows"))||void 0===t?void 0:t[e];a&&this.execute("beforeUpdateRow",{index:e,row:n})&&(Object.assign(a,n),this.markRowState(e,B),this.setRows(this._get_data("rows")),this.execute("afterUpdateRow",{index:e,row:a}))}},{key:"updateRows",value:function(){var e=this;(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach(function(t){var n;return e.updateRow(null!==(n=t.rowIndex)&&void 0!==n?n:t.index,t.rowData||t.row)})}},{key:"deleteRows",value:function(e){var t=this,n=(z(e)?e:[e]).filter(function(e){return e>=0&&e<t.getRowsCount()}).sort(function(e,t){return e-t});if(n.length){var a=this.getRowsByIndexes(n);if(this.execute("beforeDeleteRows",a,n)){var r=this._get_data("dataSource")||[],i=w(this._get_data("rowsDataState")||[]),o=new Set,s=new Set;a.forEach(function(e){var n=r.indexOf(e);if(!(n<0)){var a=e[t.getIdFlag()];o.add(a),i[n]===H&&s.add(a)}});var u=[],l=[];r.forEach(function(e,n){var a=e[t.getIdFlag()];if(!o.has(a))return u.push(e),void l.push(i[n]);s.has(a)||(u.push(e),l.push(L))}),this._set_data("dataSource",u,!0),this._set_data("rowsDataState",l,!0),this.showPage(),this.execute("afterDeleteRows",{rowIndexes:n,rows:a})}}}},{key:"deleteAllRows",value:function(){this.deleteRows(this.getRows().map(function(e,t){return t}))}},{key:"clear",value:function(){this._set_data("dataSource",[],!0),this._set_data("rows",[],!0),this._set_data("rowsDataState",[],!0),this.clearSelection(),this.applyPageInfo(f(f({},this.getPageInfo()),{},{recordCount:0,pageIndex:1})),this.setDataSourceView()}},{key:"select",value:function(e,t){var n=this;if(null!=e||!0===t){!0===t&&this.unselectAll({silent:!0});var a=!0===t?this.getRows().map(function(e,t){return t}):z(e)?e:[e];a=a.filter(function(e){return e>=0&&e<n.getRowsCount()});var r=this._get_data("rows")||[],i=this.getSelectedFlag(),o=a.filter(function(e){return!r[e][i]});if(o.length){var s={rowIndexes:o,rows:o.map(function(e){return r[e]})};this.execute("beforeSelect",s)&&(o.forEach(function(e){r[e][i]=!0,n.cacheSelectedRow(r[e],!0)}),this.flushSelection())}else!0===t&&this.flushSelection()}}},{key:"unselect",value:function(e){var t=this;if(null!=e){var n=z(e)?e:[e],a=this._get_data("rows")||[],r=this.getSelectedFlag(),i=n.filter(function(e){var t;return null===(t=a[e])||void 0===t?void 0:t[r]});i.length&&this.execute("beforeUnselect",i)&&(i.forEach(function(e){a[e][r]=!1,t.cacheSelectedRow(a[e],!1)}),this.flushSelection())}}},{key:"selectAll",value:function(){var e=this,t=this._get_data("rows")||[],n=this.getSelectedFlag();t.forEach(function(t){t[n]=!0,e.cacheSelectedRow(t,!0)}),this.flushSelection()}},{key:"unselectAll",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=this.getSelectedFlag();((t.onlyPage?this._get_data("rows"):this._get_data("dataSource"))||[]).forEach(function(e){e[n]=!1}),t.onlyPage?(this._get_data("rows")||[]).forEach(function(t){return e.cacheSelectedRow(t,!1)}):(this._set_data("selectedKeys",[],!0),this._set_data("selectedRowsMap",{},!0),this._set_data("selectedKeysSet",new Set,!0)),t.silent||this.flushSelection()}},{key:"clearSelection",value:function(){this.unselectAll()}},{key:"setSelectedRows",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=z(t)?t:[],a=this.getRowKeyField(),r=new Set(n.map(function(e){var t;return String(null!==(t=null==e?void 0:e[a])&&void 0!==t?t:e)})),i=this._get_data("rows")||[],o=this.getSelectedFlag();i.forEach(function(t){var n=r.has(String(t[a]));n!==!!t[o]&&(t[o]=n,e.cacheSelectedRow(t,n))}),this.flushSelection()}},{key:"setSelection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.unselectAll({silent:!0}),this.setSelectedRows(e)}},{key:"getSelectedRows",value:function(e){var t=this._get_data("rows")||[],n=this.getSelectedFlag(),a=e&&new Set(z(e)?e:[e]);return t.filter(function(e,t){return e[n]&&(!a||a.has(t))})}},{key:"getSelectedRowIndexes",value:function(){var e=this._get_data("rows")||[],t=this.getSelectedFlag(),n=[];return e.forEach(function(e,a){e[t]&&n.push(a)}),n}},{key:"getSelectedKeys",value:function(){return this._get_data("selectedKeys")||[]}},{key:"getAllCacheSelectedRows",value:function(){var e=this._get_data("selectedKeys")||[],t=this._get_data("selectedRowsMap")||{};return e.map(function(e){return t[e]}).filter(Boolean)}},{key:"selectByKeys",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.getRowKeyField(),a=z(e)?e:[e],r=this._get_data("rows")||[],i=[];a.forEach(function(e){var t=r.findIndex(function(t){return String(t[n])===String(e)});t>-1&&i.push(t)}),i.length&&(t?this.select(i):this.unselect(i))}},{key:"getSelectedNodes",value:function(){return this.getAllCacheSelectedRows()}},{key:"cacheSelectedRow",value:function(e,t){var n=String(null==e?void 0:e[this.getRowKeyField()]),a=(this._get_data("selectedKeys")||[]).filter(function(e){return e!==n}),r=f({},this._get_data("selectedRowsMap")||{});t&&a.push(n),t?r[n]=e:delete r[n],this._set_data("selectedKeys",a,!0),this._set_data("selectedRowsMap",r,!0),this._set_data("selectedKeysSet",new Set(a),!0)}},{key:"flushSelection",value:function(){this._applyState("selectedRows",this.getSelectedRows()),this.execute("selectionChange",{value:this.getSelectedRows(),keys:this.getSelectedKeys(),indexes:this.getSelectedRowIndexes()})}},{key:"restoreSelectedFlags",value:function(){if(this.get("cacheSelectedRows")){var e=this._get_data("selectedKeysSet")||new Set;if(e.size){var t=this.getRowKeyField(),n=this.getSelectedFlag();(this.getRows()||[]).forEach(function(a){a[n]=e.has(String(a[t]))})}}}},{key:"setPagination",value:function(e){this._applyState("pagination",!!e),this.showPage()}},{key:"getPageInfo",value:function(){return this._get_data("pageInfo")||createDefaults().pageInfo}},{key:"getPageIndex",value:function(){return this.getPageInfo().pageIndex}},{key:"getPageSize",value:function(){return this.getPageInfo().pageSize}},{key:"getTotalCount",value:function(){return this.getPageInfo().recordCount}},{key:"setPageInfo",value:function(e){this.applyPageInfo(f(f({},this.getPageInfo()),e),{refresh:!0})}},{key:"setPageIndex",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];"number"==typeof e&&this.applyPageInfo(f(f({},this.getPageInfo()),{},{pageIndex:Math.max(1,e)}),{refresh:t})}},{key:"setPageSize",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];"number"==typeof e&&this.applyPageInfo(f(f({},this.getPageInfo()),{},{pageSize:Math.max(-1,e),pageIndex:1}),{refresh:t})}},{key:"setRecordCount",value:function(e){this.applyPageInfo(f(f({},this.getPageInfo()),{},{recordCount:e||0}))}},{key:"applyPageInfo",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=f({},e||{}),a=-1===n.pageSize?-1:n.pageSize||20,r=n.recordCount||0,i=r>0;return n.pageSize=a,n.recordCount=r,n.pageCount=a>0?Math.max(1,Math.ceil(r/a)):1,n.pageIndex=a>0?Math.max(1,i?Math.min(n.pageIndex||1,n.pageCount):n.pageIndex||1):1,n.beginPageIndex=a>0?(n.pageIndex-1)*a+1:1,n.endPageIndex=a>0?Math.min(n.pageIndex*a,r):r,this._set_data("pageInfo",n,!0),t.silent||(this._applyState("pageInfo",n),this.isRemote()||this.showPage(),t.refresh&&this.isRemote()&&this.refresh()),n}},{key:"showPage",value:function(){var e=this._get_data("dataSource")||[];if(!this.isRemote()&&this.isPagination()){var t=this.getPageInfo(),n=t.pageIndex,a=t.pageSize,r=(n-1)*a;this.setRows(e.slice(r,r+a))}else this.setRows(e)}},{key:"setRows",value:function(e){var t=z(e)?e:[];this._set_data("rows",t,!0),this.setRowsIdMap(),this._applyState("data",t)}},{key:"setDataSourceView",value:function(){this._applyState("data",this._get_data("rows")||[])}},{key:"setRowsIdMap",value:function(){var e=this,t={};(this._get_data("rows")||[]).forEach(function(n){void 0!==(null==n?void 0:n[e.getIdFlag()])&&(t[n[e.getIdFlag()]]=n)}),this._set_data("rowsIdMap",t)}},{key:"getRowIdMap",value:function(){return this._get_data("rowsIdMap")||{}}},{key:"validate",value:function(e,t){var n=this;if(e)return this.doPropertyChange("validate",{type:"",message:"",errors:[]}),this._set_data("validateErrors",[]),!1;this.deleteNotModifiedRows();var a=this._get_data("columns")||{},r=t?this.getRowsByIndexes(t):this.getRows(),i=[];r.forEach(function(e,t){for(var r in a){var o=a[r];if(n.isRequiredColumn(o)){var s=e[r];if(G(s)||z(s)&&!s.length||X(s)){var u=o.cShowCaption||o.cCaption||o.cCaption||o.title||r;i.push({rowIndex:t,rowId:e[n.getIdFlag()],cellName:r,message:"".concat(u,"不能为空")}),n.setCellState(t,r,"msg","不能为空")}}}}),this._set_data("validateErrors",i);var o=i.length?i[0].message:"";return this.doPropertyChange("validate",{type:i.length?"error":"",message:o,errors:i}),this.execute("afterValidate",{valid:!i.length,errors:i}),!i.length}}])}(),ee=function(){function e(){return r(this,e),a(this,e,arguments)}return l(e,T),o(e,[{key:"getParams",value:function(){return this._get_data("params")}},{key:"setParams",value:function(e){this._set_data("params",e,!0)}},{key:"set",value:function(e,t){t instanceof T&&(t.setParent(this),t.setName(e)),this._set_data(e,t,!0)}},{key:"setData",value:function(e){for(var t in e)this.addProperty(t,e[t])}},{key:"addProperty",value:function(e,t){var n=this.get(e);null!=n&&n.setData?n.setData(t):this.set(e,t)}},{key:"getData",value:function(){var e=this,t=this._get_data("propertyNames")||[],n={};return t.forEach(function(t){var a,r=e.get(t);r instanceof T&&!1!==r._get_data("needCollect")&&(n[t]=null===(a=r.getData)||void 0===a?void 0:a.call(r))}),n}},{key:"getAllData",value:function(e){var t=this,n=this._get_data("propertyNames")||[],a={};return n.forEach(function(n){var r,i=t.get(n);if(i instanceof T&&!1!==i._get_data("needCollect")&&(!e||!i._get_data("isGrid"))){var o=null===(r=i.getData)||void 0===r?void 0:r.call(i);void 0!==o&&(a[n]=o)}}),a}},{key:"removeProperty",value:function(e){var t=this._get_data("propertyNames")||[],n=t.indexOf(e);-1!==n&&t.splice(n,1),this._del_data(e)}},{key:"loadData",value:function(e){this.setCache("isLoadData",!0),this.clear(),this.setData(e),this.setDirty(!1),this.setCache("isLoadData",!1)}},{key:"clear",value:function(e){var t=this;(this._get_data("propertyNames")||[]).forEach(function(n){var a,r=t.get(n);r instanceof T&&!1!==r._get_data("needClear")&&(null===(a=r.clear)||void 0===a||a.call(r,e))})}},{key:"setDirty",value:function(e){e?this._set_data("isDirty",!0):(this._del_data("isDirty"),this._set_data("originalData",this.getData()))}},{key:"getGridModel",value:function(e){var t;if(e)return this.get(e);var n=this._get_data("gridModel");if(n)return n;var a=null===(t=this.getParams())||void 0===t?void 0:t.masterGridModelName;if(a)return this.get(a);for(var r=this._get_data("propertyNames"),i=0,o=r.length;i<o;i++){if((n=this.get(r[i]))instanceof Z||"GridModel"==n.modelType)return this._set_data("gridModel",n),n}}},{key:"getGridModels",value:function(){for(var e=this._get_data("propertyNames"),t=[],n=0,a=e.length;n<a;n++){var r=this.get(e[n]);(r instanceof Z||"GridModel"==r.modelType)&&t.push(r)}return t}}])}();function te(e){var t=this;window&&window.__debugger_initExtendJs;var n=e.requirejs,a=e.extendFilePath,r=e.pageKey,i=e.enableExtendJs,o=void 0===i||i,s=e.extendJsPath,u=void 0===s?"_VM.Extend.js":s;if(o){var l="".concat(r).concat(u),c=[l];if("function"!=typeof n.require)return console.warn("requirejs.js 未加载,跳过扩展脚本:".concat(l)),void t.execute("extendReady",t);n.require(a,c,function(e,n){if(e&&e.doAction)try{e.doAction("init",t),n&&n.doAction("init",t)}catch(e){console.error("扩展脚本异常:",e)}else console.error("".concat(l,"扩展文件extend.*.min.js文件加载失败 或 未注册扩展脚本"));t.execute("extendReady",t)},function(e){console.warn("未找到扩展脚本:".concat(l,"错误信息:"),e),t.execute("extendReady",t)})}else t.execute("extendReady",t)}var ne=function(){var e=n(v().m(function e(t,a,r){var i,o,s,u;return v().w(function(e){for(;;)switch(e.n){case 0:if(s=t.extscripturls,u=void 0===s?[]:s,u=(u=(a.getCache("localDynamicScripts")||[]).concat(u)).concat(window.__devfab__EXT_BILL_SCRIPTS__||[]),null!==(i=a.getParams())&&void 0!==i&&i.initVMExtUrls&&(u=u.concat([a.getParams().initVMExtUrls])),null===(o=u)||void 0===o||!o.length){e.n=2;break}return u=w(new Set(u)),e.n=1,Promise.all(u.map(function(){var e=n(v().m(function e(t){return v().w(function(e){for(;;)if(0===e.n)return e.a(2,t)},e)}));return function(t){return e.apply(this,arguments)}}()));case 1:u=e.v;case 2:return t.extscripturls=u,e.a(2,new Promise(function(e,n){ae(t,a,r,function(){e(!0)})}))}},e)}));return function(t,n,a){return e.apply(this,arguments)}}();function ae(e,t,n,a){var r=e.extscripturls,i=void 0===r?[]:r;if(null!=i&&i.length)try{var o,s=null==n||null===(o=n.requirejs)||void 0===o?void 0:o.requireInner;if("function"!=typeof s)return console.warn("requirejs.js 未加载,跳过客开扩展脚本"),void(null==a||a(e,t));s(i,function(){var n=!0;if(arguments.length){for(var r=0,i=arguments.length;r<i;r++){var o=r<0||arguments.length<=r?void 0:arguments[r];o?o.doAction("init",t):n=!1}n&&(null==a||a(e,t))}else n=!1;n||console.log("[error] [extendjs] 租户级扩展脚本有语法错误,请修改正确后刷新浏览器重试!")},function(n){null==a||a(e,t)})}catch(n){null==a||a(e,t)}else null==a||a(e,t)}function re(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.extendFilePathField,i=void 0===n?"domainKey":n,s=t.pageKeyField,u=void 0===s?"billNo":s,c=t.modelNameField,d=void 0===c?"cName":c,h=e[i]||"",v=e[u]||"",g=function(){function e(){return r(this,e),a(this,e,arguments)}return l(e,ee),o(e,[{key:"init",value:function(e,t){var n=this.createModels(e,t);this.setData(n),this.setDirty(!1)}},{key:"createModels",value:function(e,n){var a={};return(Array.isArray(e)?e:[]).forEach(function(e){var r,i,o=null==t||null===(r=t.createModelFactory)||void 0===r?void 0:r.call(t,e);o||(o=function(e){var t;"input"===e.cControlType.toLowerCase()&&(t=new V(e));return t}(e));var s={model:o,field:e,meta:n};null==t||null===(i=t.onBeforeCreateModel)||void 0===i||i.call(t,s),a[e[d]]=s.model}),a}},{key:"initData",value:function(){te.call(this,f(f({},t),{},{extendFilePath:h,pageKey:v}))}}])}();return g.prototype.modelType="ViewModel",g}var ie={BaseModel:T,FilterModel:K,SimpleModel:V,GridModel:Z,ViewModel:ee,initViewModel:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2?arguments[2]:void 0;null!=t&&t.requirejs||(t.requirejs=window.__devfab);var r=function(e,t){var n=new(re(e,t));return n.init(e.models,e),n}(e,t);return r.on("destroyVM",function(){var e,t;null===(e=r)||void 0===e||null===(t=e.destroyVM)||void 0===t||t.call(e),r=null}),r.on("extendReady",n(v().m(function n(){var i;return v().w(function(n){for(;;)switch(n.n){case 0:return(i=[]).push(ne(e,r,t)),n.n=1,Promise.all(i);case 1:null==a||a(r,e);case 2:return n.a(2)}},n)}))),r.initData(),r}},oe={Builder:D,CacheUtil:j,EventUtil:E,DynamicProxy:N},se={utils:{builder:new oe.Builder,cache:new oe.CacheUtil,event:new oe.EventUtil},common:{Builder:D,models:ie,utils:oe}};exports.default=se;
3
+ var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",i=r.toStringTag||"@@toStringTag";function o(r,n,i,o){var u=n&&n.prototype instanceof s?n:s,c=Object.create(u.prototype);return _regeneratorDefine(c,"_invoke",function(r,n,i){var o,s,u,c=0,l=i||[],d=!1,f={p:0,n:0,v:e,a:h,f:h.bind(e,4),d:function(t,r){return o=t,s=0,u=e,f.n=r,a}};function h(r,n){for(s=r,u=n,t=0;!d&&c&&!i&&t<l.length;t++){var i,o=l[t],h=f.p,p=o[2];r>3?(i=p===n)&&(u=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=h&&((i=r<2&&h<o[1])?(s=0,f.v=n,f.n=o[1]):h<p&&(i=r<3||o[0]>n||n>p)&&(o[4]=r,o[5]=n,f.n=p,s=0))}if(i||r>1)return a;throw d=!0,n}return function(i,l,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===l&&h(l,p),s=l,u=p;(t=s<2?e:u)||!d;){o||(s?s<3?(s>1&&(f.n=-1),h(s,u)):f.n=u:f.v=u);try{if(c=2,o){if(s||(i="next"),t=o[i]){if(!(t=t.call(o,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(u=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=e}else if((t=(d=f.n<0)?u:r.call(n,f))!==a)break}catch(t){o=e,s=1,u=t}finally{c=1}}return{value:t,done:d}}}(r,i,o),!0),c}var a={};function s(){}function u(){}function c(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(_regeneratorDefine(t={},n,function(){return this}),t),d=c.prototype=s.prototype=Object.create(l);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,_regeneratorDefine(e,i,"GeneratorFunction")),e.prototype=Object.create(d),e}return u.prototype=c,_regeneratorDefine(d,"constructor",c),_regeneratorDefine(c,"constructor",u),u.displayName="GeneratorFunction",_regeneratorDefine(c,i,"GeneratorFunction"),_regeneratorDefine(d),_regeneratorDefine(d,i,"Generator"),_regeneratorDefine(d,n,function(){return this}),_regeneratorDefine(d,"toString",function(){return"[object Generator]"}),(_regenerator=function(){return{w:o,m:f}})()}function _regeneratorDefine(e,t,r,n){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}_regeneratorDefine=function(e,t,r,n){function o(t,r){_regeneratorDefine(e,t,function(e){return this._invoke(t,r,e)})}t?i?i(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(o("next",0),o("throw",1),o("return",2))},_regeneratorDefine(e,t,r,n)}function _setPrototypeOf(e,t){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_setPrototypeOf(e,t)}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _toPrimitive(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"==typeof t?t:t+""}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}Object.defineProperty(exports,"__esModule",{value:!0});var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},__devfab_requirejs={};
4
+ /** vim: et:ts=4:sw=4:sts=4
5
+ * @license RequireJS 2.3.2 Copyright jQuery Foundation and other contributors.
6
+ * Released under MIT license, https://github.com/requirejs/requirejs/blob/master/LICENSE
7
+ */window.__devfab_requirejs=__devfab_requirejs,function(global,setTimeout){var requirejs,require,define,req,s,head,baseElement,dataMain,src,body,interactiveScript,currentlyAddingScript,mainScript,subPath,version="2.3.2",commentRegExp=/\/\*[\s\S]*?\*\/|([^:"'=]|^)\/\/.*$/gm,cjsRequireRegExp=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,jsSuffixRegExp=/\.js$/,currDirRegExp=/^\.\//,op=Object.prototype,ostring=op.toString,hasOwn=op.hasOwnProperty,isBrowser=!("undefined"==typeof window||"undefined"==typeof navigator||!window.document),isWebWorker=!isBrowser&&"undefined"!=typeof importScripts,readyRegExp=isBrowser&&"PLAYSTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/,defContextName="_",isOpera="undefined"!=typeof opera&&"[object Opera]"===opera.toString(),contexts={},cfg={},globalDefQueue=[],useInteractive=!1;function commentReplace(e,t){return t||""}function isFunction(e){return"[object Function]"===ostring.call(e)}function isArray(e){return"[object Array]"===ostring.call(e)}function each(e,t){var r;if(e)for(r=0;r<e.length&&(!e[r]||!t(e[r],r,e));r+=1);}function eachReverse(e,t){var r;if(e)for(r=e.length-1;r>-1&&(!e[r]||!t(e[r],r,e));r-=1);}function hasProp(e,t){return hasOwn.call(e,t)}function getOwn(e,t){return hasProp(e,t)&&e[t]}function eachProp(e,t){var r;for(r in e)if(hasProp(e,r)&&t(e[r],r))break}function mixin(e,t,r,n){return t&&eachProp(t,function(t,i){!r&&hasProp(e,i)||(!n||"object"!==_typeof(t)||!t||isArray(t)||isFunction(t)||t instanceof RegExp?e[i]=t:(e[i]||(e[i]={}),mixin(e[i],t,r,n)))}),e}function bind(e,t){return function(){return t.apply(e,arguments)}}function scripts(){return document.getElementsByTagName("script")}function defaultOnError(e){throw e}function getGlobal(e){if(!e)return e;var t=global;return each(e.split("."),function(e){t=t[e]}),t}function makeError(e,t,r,n){var i=new Error(t+"\nhttp://requirejs.org/docs/errors.html#"+e);return i.requireType=e,i.requireModules=n,r&&(i.originalError=r),i}if(void 0===define){if(void 0!==requirejs){if(isFunction(requirejs))return;cfg=requirejs,requirejs=void 0}void 0===require||isFunction(require)||(cfg=require,require=void 0),req=requirejs=function(e,t,r,n){var i,o,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},s=defContextName;return isArray(e)||"string"==typeof e||(o=e,isArray(t)?(e=t,t=r,r=n):e=[]),o&&o.context&&(s=o.context),a.name&&(s=a.name),(i=getOwn(contexts,s))||(i=contexts[s]=req.s.newContext(s,a)),o&&i.configure(o),i.require(e,t,r)},req.config=function(e){return req(e)},req.nextTick=void 0!==setTimeout?function(e){setTimeout(e,4)}:function(e){e()},require||(require=req),req.version=version,req.jsExtRegExp=/^\/|:|\?|\.js$|\.css$/,req.isBrowser=isBrowser,s=req.s={contexts:contexts,newContext:newContext},req({}),each(["toUrl","undef","defined","specified"],function(e){req[e]=function(){var t=contexts[defContextName];return t.require[e].apply(t,arguments)}}),isBrowser&&(head=s.head=document.getElementsByTagName("head")[0],body=s.body=document.getElementsByTagName("body")[0],baseElement=document.getElementsByTagName("base")[0],baseElement&&(head=s.head=baseElement.parentNode)),req.onError=defaultOnError,req.createNode=function(e,t,r){var n,i="";try{r.split("?")[0].endsWith(".css")&&(i="css")}catch(e){}return"css"===i?((n=e.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:link"):document.createElement("link")).href=r,n.rel="stylesheet",n.type=e.linkType||"text/css",n):((n=e.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script")).type=e.scriptType||"text/javascript",n.charset="utf-8",n.async=!1,n)},req.load=function(e,t,r){var n,i=e&&e.config||{};if(isBrowser)return(n=req.createNode(i,t,r)).setAttribute("data-requirecontext",e.contextName),n.setAttribute("data-requiremodule",t),!n.attachEvent||n.attachEvent.toString&&n.attachEvent.toString().indexOf("[native code")<0||isOpera?(n.addEventListener("load",e.onScriptLoad,!1),n.addEventListener("error",e.onScriptError,!1)):(useInteractive=!0,n.attachEvent("onreadystatechange",e.onScriptLoad)),n.src=r,i.onNodeCreated&&i.onNodeCreated(n,i,t,r),currentlyAddingScript=n,baseElement?head.insertBefore(n,baseElement):body?body.appendChild(n):head.appendChild(n),currentlyAddingScript=null,n;if(isWebWorker)try{setTimeout(function(){},0),importScripts(r),e.completeLoad(t)}catch(n){e.onError(makeError("importscripts","importScripts failed for "+t+" at "+r,n,[t]))}},isBrowser&&!cfg.skipDataMain&&eachReverse(scripts(),function(e){if(head||(head=e.parentNode),dataMain=e.getAttribute("data-main"))return mainScript=dataMain,cfg.baseUrl||-1!==mainScript.indexOf("!")||(src=mainScript.split("/"),mainScript=src.pop(),subPath=src.length?src.join("/")+"/":"./",cfg.baseUrl=subPath),mainScript=mainScript.replace(jsSuffixRegExp,""),req.jsExtRegExp.test(mainScript)&&(mainScript=dataMain),cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript],!0}),define=function(e,t,r){var n,i;"string"!=typeof e&&(r=t,t=e,e=null),isArray(t)||(r=t,t=null),!t&&isFunction(r)&&(t=[],r.length&&(r.toString().replace(commentRegExp,commentReplace).replace(cjsRequireRegExp,function(e,r){t.push(r)}),t=(1===r.length?["require"]:["require","exports","module"]).concat(t))),useInteractive&&(n=currentlyAddingScript||getInteractiveScript())&&(e||(e=n.getAttribute("data-requiremodule")),i=contexts[n.getAttribute("data-requirecontext")]),i?(i.defQueue.push([e,t,r]),i.defQueueMap[e]=!0):globalDefQueue.push([e,t,r])},define.amd={jQuery:!0},req.exec=function(text){return eval(text)},__devfab_requirejs.require=require,__devfab_requirejs.define=define,req(cfg)}function newContext(e){var t,r,n,i,o,a={waitSeconds:(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).waitSeconds||30,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},s={},u={},c={},l=[],d={},f={},h={},p=1,v=1;function y(e,t,r){var n,i,o,s,u,c,l,d,f,h,p=t&&t.split("/"),v=a.map,y=v&&v["*"];if(e&&(c=(e=e.split("/")).length-1,a.nodeIdCompat&&jsSuffixRegExp.test(e[c])&&(e[c]=e[c].replace(jsSuffixRegExp,"")),"."===e[0].charAt(0)&&p&&(e=p.slice(0,p.length-1).concat(e)),function(e){var t,r;for(t=0;t<e.length;t++)if("."===(r=e[t]))e.splice(t,1),t-=1;else if(".."===r){if(0===t||1===t&&".."===e[2]||".."===e[t-1])continue;t>0&&(e.splice(t-1,2),t-=2)}}(e),e=e.join("/")),r&&v&&(p||y)){for(o=(i=e.split("/")).length;o>0;o-=1){if(u=i.slice(0,o).join("/"),p){var g=!1;for(s=p.length;s>0;s-=1)if((n=getOwn(v,p.slice(0,s).join("/")))&&(n=getOwn(n,u))){l=n,d=o,g=!0;break}if(g)break}!f&&y&&getOwn(y,u)&&(f=getOwn(y,u),h=o)}!l&&f&&(l=f,d=h),l&&(i.splice(0,d,l),e=i.join("/"))}return getOwn(a.pkgs,e)||e}function g(e){isBrowser&&each(scripts(),function(t){if(t.getAttribute("data-requiremodule")===e&&t.getAttribute("data-requirecontext")===n.contextName)return t.parentNode.removeChild(t),!0})}function _(e){var t=getOwn(a.paths,e);if(t&&isArray(t)&&t.length>1)return t.shift(),n.require.undef(e),n.makeRequire(null,{skipMap:!0})([e]),!0}function m(e){var t,r=e?e.indexOf("!"):-1;return r>-1&&(t=e.substring(0,r),e=e.substring(r+1,e.length)),[t,e]}function b(e,t,r,i){var o,a,s,u,c=null,l=t?t.name:null,f=e,h=!0,g="";return e||(h=!1,e="_@r"+(p+=1)),c=(u=m(e))[0],e=u[1],c&&(c=y(c,l,i),a=getOwn(d,c)),e&&(c?g=a&&a.normalize?a.normalize(e,function(e){return y(e,l,i)}):-1===e.indexOf("!")?y(e,l,i):e:(c=(u=m(g=y(e,l,i)))[0],g=u[1],r=!0,o=n.nameToUrl(g))),{prefix:c,name:g,parentMap:t,unnormalized:!!(s=!c||a||r?"":"_unnormalized"+(v+=1)),url:o,originalName:f,isDefine:h,id:(c?c+"!"+g:g)+s}}function k(e){var t=e.id,r=getOwn(s,t);return r||(r=s[t]=new n.Module(e)),r}function x(e,t,r){var n=e.id,i=getOwn(s,n);!hasProp(d,n)||i&&!i.defineEmitComplete?(i=k(e)).error&&"error"===t?r(i.error):i.on(t,r):"defined"===t&&r(d[n])}function w(e,t){var r=e.requireModules,n=!1;t?t(e):(each(r,function(t){var r=getOwn(s,t);r&&(r.error=e,r.events.error&&(n=!0,r.emit("error",e)))}),n||req.onError(e))}function S(){globalDefQueue.length&&(each(globalDefQueue,function(e){var t=e[0];"string"==typeof t&&(n.defQueueMap[t]=!0),l.push(e)}),globalDefQueue=[])}function P(e){delete s[e],delete u[e]}function C(e,t,r){var n=e.map.id;e.error?e.emit("error",e.error):(t[n]=!0,each(e.depMaps,function(n,i){var o=n.id,a=getOwn(s,o);!a||e.depMatched[i]||r[o]||(getOwn(t,o)?(e.defineDep(i,d[o]),e.check()):C(a,t,r))}),r[n]=!0)}function A(){var e,r,i=1e3*a.waitSeconds,s=i&&n.startTime+i<(new Date).getTime(),c=[],l=[],d=!1,f=!0;if(!t){if(t=!0,eachProp(u,function(e){var t=e.map,n=t.id;if(e.enabled&&(t.isDefine||l.push(e),!e.error))if(!e.inited&&s)_(n)?(r=!0,d=!0):(c.push(n),g(n));else if(!e.inited&&e.fetched&&t.isDefine&&(d=!0,!t.prefix))return f=!1}),s&&c.length)return(e=makeError("timeout","Load timeout for modules: "+c,null,c)).contextName=n.contextName,w(e);f&&each(l,function(e){C(e,{},{})}),s&&!r||!d||!isBrowser&&!isWebWorker||o||(o=setTimeout(function(){o=0,A()},50)),t=!1}}function q(e){hasProp(d,e[0])||k(b(e[0],null,!0)).init(e[1],e[2])}function j(e,t,r,n){e.detachEvent&&!isOpera?n&&e.detachEvent(n,t):e.removeEventListener(r,t,!1)}function E(e){var t=e.currentTarget||e.srcElement;return j(t,n.onScriptLoad,"load","onreadystatechange"),j(t,n.onScriptError,"error"),{node:t,id:t&&t.getAttribute("data-requiremodule")}}function O(){var e;for(S();l.length;){if(null===(e=l.shift())[0])return w(makeError("mismatch","Mismatched anonymous define() module: "+e[e.length-1]));q(e)}n.defQueueMap={}}return i={require:function(e){return e.require?e.require:e.require=n.makeRequire(e.map)},exports:function(e){e.usingExports=!0,e.map.isDefine&&(e.exports?d[e.map.id]=e.exports:e.exports=d[e.map.id]={})},module:function(e){return e.module?e.module:e.module={id:e.map.id,uri:e.map.url,config:function(){return getOwn(a.config,e.map.id)||{}},exports:e.exports||(e.exports={})}}},(r=function(e){this.events=getOwn(c,e.id)||{},this.map=e,this.shim=getOwn(a.shim,e.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0}).prototype={init:function(e,t,r,n){n=n||{},this.inited||(this.factory=t,r?this.on("error",r):this.events.error&&(r=bind(this,function(e){this.emit("error",e)})),this.depMaps=e&&e.slice(0),this.errback=r,this.inited=!0,this.ignore=n.ignore,n.enabled||this.enabled?this.enable():this.check())},defineDep:function(e,t){this.depMatched[e]||(this.depMatched[e]=!0,this.depCount-=1,this.depExports[e]=t)},fetch:function(){if(!this.fetched){this.fetched=!0,n.startTime=(new Date).getTime();var e=this.map;if(!this.shim)return e.prefix?this.callPlugin():this.load();n.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],bind(this,function(){return e.prefix?this.callPlugin():this.load()}))}},load:function(){var e=this.map.url;f[e]||(f[e]=!0,n.load(this.map.id,e))},check:function(){if(this.enabled&&!this.enabling){var e,t,r=this.map.id,i=this.depExports,o=this.exports,a=this.factory;if(this.inited){if(this.error)this.emit("error",this.error);else if(!this.defining){if(this.defining=!0,this.depCount<1&&!this.defined){if(isFunction(a)){if(this.events.error&&this.map.isDefine||req.onError!==defaultOnError)try{o=n.execCb(r,a,i,o)}catch(t){e=t}else o=n.execCb(r,a,i,o);if(this.map.isDefine&&void 0===o&&((t=this.module)?o=t.exports:this.usingExports&&(o=this.exports)),e)return e.requireMap=this.map,e.requireModules=this.map.isDefine?[this.map.id]:null,e.requireType=this.map.isDefine?"define":"require",w(this.error=e)}else o=a;if(this.exports=o,this.map.isDefine&&!this.ignore&&(d[r]=o,req.onResourceLoad)){var s=[];each(this.depMaps,function(e){s.push(e.normalizedMap||e)}),req.onResourceLoad(n,this.map,s)}P(r),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else hasProp(n.defQueueMap,r)||this.fetch()}},callPlugin:function(){var e=this.map,t=e.id,r=b(e.prefix);this.depMaps.push(r),x(r,"defined",bind(this,function(r){var i,o,u,c=getOwn(h,this.map.id),l=this.map.name,d=this.map.parentMap?this.map.parentMap.name:null,f=n.makeRequire(e.parentMap,{enableBuildCallback:!0});return this.map.unnormalized?(r.normalize&&(l=r.normalize(l,function(e){return y(e,d,!0)})||""),x(o=b(e.prefix+"!"+l,this.map.parentMap),"defined",bind(this,function(e){this.map.normalizedMap=o,this.init([],function(){return e},null,{enabled:!0,ignore:!0})})),void((u=getOwn(s,o.id))&&(this.depMaps.push(o),this.events.error&&u.on("error",bind(this,function(e){this.emit("error",e)})),u.enable()))):c?(this.map.url=n.nameToUrl(c),void this.load()):((i=bind(this,function(e){this.init([],function(){return e},null,{enabled:!0})})).error=bind(this,function(e){this.inited=!0,this.error=e,e.requireModules=[t],eachProp(s,function(e){0===e.map.id.indexOf(t+"_unnormalized")&&P(e.map.id)}),w(e)}),i.fromText=bind(this,function(r,o){var s=e.name,u=b(s),c=useInteractive;o&&(r=o),c&&(useInteractive=!1),k(u),hasProp(a.config,t)&&(a.config[s]=a.config[t]);try{req.exec(r)}catch(e){return w(makeError("fromtexteval","fromText eval for "+t+" failed: "+e,e,[t]))}c&&(useInteractive=!0),this.depMaps.push(u),n.completeLoad(s),f([s],i)}),void r.load(e.name,f,i,a))})),n.enable(r,this),this.pluginMaps[r.id]=r},enable:function(){u[this.map.id]=this,this.enabled=!0,this.enabling=!0,each(this.depMaps,bind(this,function(e,t){var r,o,a;if("string"==typeof e){if(e=b(e,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[t]=e,a=getOwn(i,e.id))return void(this.depExports[t]=a(this));this.depCount+=1,x(e,"defined",bind(this,function(e){this.undefed||(this.defineDep(t,e),this.check())})),this.errback?x(e,"error",bind(this,this.errback)):this.events.error&&x(e,"error",bind(this,function(e){this.emit("error",e)}))}r=e.id,o=s[r],hasProp(i,r)||!o||o.enabled||n.enable(e,this)})),eachProp(this.pluginMaps,bind(this,function(e){var t=getOwn(s,e.id);t&&!t.enabled&&n.enable(e,this)})),this.enabling=!1,this.check()},on:function(e,t){var r=this.events[e];r||(r=this.events[e]=[]),r.push(t)},emit:function(e,t){each(this.events[e],function(e){e(t)}),"error"===e&&delete this.events[e]}},n={config:a,contextName:e,registry:s,defined:d,urlFetched:f,defQueue:l,defQueueMap:{},Module:r,makeModuleMap:b,nextTick:req.nextTick,onError:w,configure:function(e){if(e.baseUrl&&"/"!==e.baseUrl.charAt(e.baseUrl.length-1)&&(e.baseUrl+="/"),"string"==typeof e.urlArgs){var t=e.urlArgs;e.urlArgs=function(e,r){return(-1===r.indexOf("?")?"?":"&")+t}}var r=a.shim,i={paths:!0,bundles:!0,config:!0,map:!0};eachProp(e,function(e,t){i[t]?(a[t]||(a[t]={}),mixin(a[t],e,!0,!0)):a[t]=e}),e.bundles&&eachProp(e.bundles,function(e,t){each(e,function(e){e!==t&&(h[e]=t)})}),e.shim&&(eachProp(e.shim,function(e,t){isArray(e)&&(e={deps:e}),!e.exports&&!e.init||e.exportsFn||(e.exportsFn=n.makeShimExports(e)),r[t]=e}),a.shim=r),e.packages&&each(e.packages,function(e){var t;t=(e="string"==typeof e?{name:e}:e).name,e.location&&(a.paths[t]=e.location),a.pkgs[t]=e.name+"/"+(e.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}),eachProp(s,function(e,t){e.inited||e.map.unnormalized||(e.map=b(t,null,!0))}),(e.deps||e.callback)&&n.require(e.deps||[],e.callback)},makeShimExports:function(e){return function(){var t;return e.init&&(t=e.init.apply(global,arguments)),t||e.exports&&getGlobal(e.exports)}},makeRequire:function(t,r){function o(a,u,c){var l,f;return r.enableBuildCallback&&u&&isFunction(u)&&(u.__requireJsBuild=!0),"string"==typeof a?isFunction(u)?w(makeError("requireargs","Invalid require call"),c):t&&hasProp(i,a)?i[a](s[t.id]):req.get?req.get(n,a,t,o):(l=b(a,t,!1,!0).id,hasProp(d,l)?d[l]:w(makeError("notloaded",'Module name "'+l+'" has not been loaded yet for context: '+e+(t?"":". Use require([])")))):(O(),n.nextTick(function(){O(),(f=k(b(null,t))).skipMap=r.skipMap,f.init(a,u,c,{enabled:!0}),A()}),o)}return r=r||{},mixin(o,{isBrowser:isBrowser,toUrl:function(e){var r,i=e.lastIndexOf("."),o=e.split("/")[0];return-1!==i&&(!("."===o||".."===o)||i>1)&&(r=e.substring(i,e.length),e=e.substring(0,i)),n.nameToUrl(y(e,t&&t.id,!0),r,!0)},defined:function(e){return hasProp(d,b(e,t,!1,!0).id)},specified:function(e){return e=b(e,t,!1,!0).id,hasProp(d,e)||hasProp(s,e)}}),t||(o.undef=function(e){S();var r=b(e,t,!0),i=getOwn(s,e);i.undefed=!0,g(e),delete d[e],delete f[r.url],delete c[e],eachReverse(l,function(t,r){t[0]===e&&l.splice(r,1)}),delete n.defQueueMap[e],i&&(i.events.defined&&(c[e]=i.events),P(e))}),o},enable:function(e){getOwn(s,e.id)&&k(e).enable()},completeLoad:function(e){var t,r,i,o=getOwn(a.shim,e)||{},u=o.exports;for(S();l.length;){if(null===(r=l.shift())[0]){if(r[0]=e,t)break;t=!0}else r[0]===e&&(t=!0);q(r)}if(n.defQueueMap={},i=getOwn(s,e),!t&&!hasProp(d,e)&&i&&!i.inited){if(!(!a.enforceDefine||u&&getGlobal(u)))return _(e)?void 0:w(makeError("nodefine","No define call for "+e,null,[e]));q([e,o.deps||[],o.exportsFn])}A()},nameToUrl:function(e,t,r){var i,o,s,u,c,l,d=getOwn(a.pkgs,e);if(d&&(e=d),l=getOwn(h,e))return n.nameToUrl(l,t,r);if(req.jsExtRegExp.test(e))u=e+(t||"");else{for(i=a.paths,s=(o=e.split("/")).length;s>0;s-=1)if(c=getOwn(i,o.slice(0,s).join("/"))){isArray(c)&&(c=c[0]),o.splice(0,s,c);break}u=o.join("/"),u=("/"===(u+=t||(/^data:|^blob:|\?/.test(u)||r?"":".js")).charAt(0)||u.match(/^[\w+.-]+:/)?"":a.baseUrl)+u}return a.urlArgs&&!/^blob:/.test(u)?u+a.urlArgs(e,u):u},load:function(e,t){req.load(n,e,t)},execCb:function(e,t,r,n){return t.apply(n,r)},onScriptLoad:function(e){if("load"===e.type||readyRegExp.test((e.currentTarget||e.srcElement).readyState)){interactiveScript=null;var t=E(e);n.completeLoad(t.id)}},onScriptError:function(e){var t=E(e);if(!_(t.id)){var r=[];return eachProp(s,function(e,n){0!==n.indexOf("_@r")&&each(e.depMaps,function(e){if(e.id===t.id)return r.push(n),!0})}),w(makeError("scripterror",'Script error for "'+t.id+(r.length?'", needed by: '+r.join(", "):'"'),e,[t.id]))}}},n.require=n.makeRequire(),n}function getInteractiveScript(){return interactiveScript&&"interactive"===interactiveScript.readyState||eachReverse(scripts(),function(e){if("interactive"===e.readyState)return interactiveScript=e}),interactiveScript}}(commonjsGlobal,"undefined"==typeof setTimeout?void 0:setTimeout),function(e){if(!__devfab_requirejs.__requirejsAdapterApplied){__devfab_requirejs.__requirejsAdapterApplied=!0;var t=__devfab_requirejs.require,r=__devfab_requirejs.define,n=function(e,r,n,i){var o=e,a=r,s=n,u=i;if(Array.isArray(e)&&"function"==typeof r)t(a=e,s=r,u=n);else{!e&&Array.isArray(a)&&(o=[]),Array.isArray(o)&&Array.isArray(a)&&(o=o.join("/"));var c=o?[]:a;"string"==typeof o&&o&&Array.isArray(a)&&a.forEach(function(e){c.push("".concat(o).concat("/"===e.substr(0,1)?"":"/").concat(e))}),console.debug("[devfab][requirejs]: %c requireInner, Parameter[newdeps] is %o","color:fuchsia",c),t(c,s,u)}};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&void 0===n[i]&&(n[i]=t[i]);__devfab_requirejs._require=t,__devfab_requirejs._define=r,__devfab_requirejs.require=n,__devfab_requirejs.define=function(e,t,n){var i=e,o=t,a=n;if(Array.isArray(e)&&"function"==typeof t)r(o=e,a=t);else{!e&&Array.isArray(o)&&(i=[]),Array.isArray(i)&&Array.isArray(o)&&(i=i.join("/"));var s=i?[]:o;"string"==typeof i&&i&&Array.isArray(o)&&o.forEach(function(e){s.push("".concat(i).concat("/"===e.substr(0,1)?"":"/").concat(e))}),r(s,a)}}}}();var CODE_POLICY=403;function normalizePath(e){return String(null==e?"":e).replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"")}function isAbsoluteUrl(e){return/^(?:[a-z][a-z0-9+.-]*:)?\/\//i.test(e)||/^(?:blob|data):/i.test(e)}function toHex(e){for(var t=new Uint8Array(e),r="",n=0;n<t.length;n++)r+=t[n].toString(16).padStart(2,"0");return r}var LoadPolicy=function(){return _createClass(function e(t){_classCallCheck(this,e),this.manifest=null,this.origins=null,this.lockVersion=null,this.verifyHash=!0,this.fetch=null,this._index=null,this.configure(t)},[{key:"configure",value:function(e){var t=e||{};return void 0!==t.manifest&&(this.manifest=t.manifest||null),void 0!==t.origins&&(this.origins=t.origins?[].concat(t.origins).map(function(e){return String(e).trim().replace(/\/+$/,"")}):null),void 0!==t.lockVersion&&(this.lockVersion=t.lockVersion||null),void 0!==t.verifyHash&&(this.verifyHash=!!t.verifyHash),void 0!==t.fetch?this.fetch=t.fetch||null:this.fetch||"function"!=typeof fetch||(this.fetch=function(){return fetch.apply(void 0,arguments)}),this._index=null,this}},{key:"enabled",get:function(){return!!this.manifest}},{key:"_moduleIndex",value:function(){if(this._index)return this._index;var e={},t=this.manifest&&this.manifest.modules;return Array.isArray(t)?t.forEach(function(t){t&&t.path&&(e[normalizePath(t.path)]=t)}):t&&"object"===_typeof(t)&&Object.keys(t).forEach(function(r){e[normalizePath(r)]=t[r]||{}}),this._index=e,e}},{key:"entryOf",value:function(e){return this.manifest&&this._moduleIndex()[normalizePath(e)]||null}},{key:"checkVersion",value:function(){if(!this.lockVersion||!this.manifest)return null;var e=String(this.manifest.version||"");return e===String(this.lockVersion)?null:{code:CODE_POLICY,message:"清单版本 ".concat(e||"(未声明)"," 与锁定版本 ").concat(this.lockVersion," 不一致,拒绝加载")}}},{key:"checkModules",value:function(e){var t=this.checkVersion();if(t)return t;if(!this.manifest)return null;for(var r=0;r<e.length;r++){var n=normalizePath(e[r]);if(!this._moduleIndex()[n])return{code:CODE_POLICY,message:"Module ".concat(n," not registered in the list, loading denied.")}}return null}},{key:"checkOrigin",value:function(e){if(!this.origins)return null;if(!isAbsoluteUrl(e))return null;var t;try{t=new URL(e).origin}catch(t){return{code:CODE_POLICY,message:"无法解析的地址:".concat(e)}}return-1===this.origins.indexOf(t)?{code:CODE_POLICY,message:"来源 ".concat(t," 不在白名单内(允许:").concat(this.origins.join(", "),")")}:null}},{key:"verify",value:function(e,t){var r=this;if(!this.verifyHash)return Promise.resolve({ok:!0,skipped:"disabled"});if(!t)return Promise.resolve({ok:!0});var n="undefined"!=typeof globalThis&&globalThis.crypto&&globalThis.crypto.subtle;return n?this.fetch?Promise.resolve().then(function(){return r.fetch(e)}).then(function(e){return e&&e.ok?e.arrayBuffer().then(function(e){return n.digest("SHA-256",e)}):{ok:!1,message:"完整性预检请求失败:HTTP ".concat(e&&e.status||"unknown")}}).then(function(e){if(!e||!1===e.ok)return e;var r=toHex(e),n=String(t).toLowerCase();return r!==n?{ok:!1,message:"sha256 不匹配:期望 ".concat(n,",实际 ").concat(r)}:{ok:!0}}).catch(function(e){return{ok:!1,message:"完整性预检异常:".concat(e&&e.message||e),error:e}}):Promise.resolve({ok:!0,skipped:"fetch unavailable"}):Promise.resolve({ok:!0,skipped:"crypto.subtle unavailable(需要 https / localhost)"})}},{key:"describe",value:function(){return{manifest:this.enabled?this.manifest.name||"(unnamed)":null,version:this.manifest&&this.manifest.version||null,lockVersion:this.lockVersion,modules:this.enabled?Object.keys(this._moduleIndex()).length:0,origins:this.origins?this.origins.slice():null,verifyHash:this.verifyHash}}}])}(),DEFAULT_WATCH=["$","jQuery","define","require","requirejs","devfab","__devfab","__devfab_requirejs"],GlobalGuard=function(){return _createClass(function e(t){_classCallCheck(this,e);var r=t||{};this.maxPollution=void 0===r.maxPollution?3:Number(r.maxPollution),this.watch=[].concat(r.watch||DEFAULT_WATCH),this.target=r.target||("undefined"!=typeof window?window:null),this.enabled=void 0===r.enabled||!!r.enabled,this._pending=0,this._before=null,this.lastWarnings=[]},[{key:"_snapshot",value:function(){var e=new Map,t=this.target;return t?(Object.keys(t).forEach(function(r){e.set(r,t[r])}),e):e}},{key:"_diff",value:function(){var e=this,t=this._before,r=this._snapshot(),n=[];if(!t)return n;r.forEach(function(r,i){var o=-1!==e.watch.indexOf(i);t.has(i)?t.get(i)!==r&&n.push({type:"overwritten",key:i,watched:o}):n.push({type:"added",key:i,watched:o})});var i=n.filter(function(e){return e.watched}).length,o=n.filter(function(e){return"added"===e.type}).length;return!i&&o<=this.maxPollution?[]:n}},{key:"begin",value:function(){var e=this;if(!this.enabled||!this.target)return{end:function(){return[]}};this._pending++,1===this._pending&&(this._before=this._snapshot());var t=!1;return{end:function(){if(t)return[];if(t=!0,e._pending--,e._pending>0)return[];var r=e._diff();return e._before=null,e.lastWarnings=r,r}}}},{key:"configure",value:function(e){var t=e||{};return void 0!==t.enabled&&(this.enabled=!!t.enabled),void 0!==t.maxPollution&&(this.maxPollution=Number(t.maxPollution)),void 0!==t.watch&&(this.watch=[].concat(t.watch||[])),void 0!==t.target&&(this.target=t.target||null),this}}])}(),CODE_TIMEOUT=504,nativeImport=null;try{nativeImport=new Function("s","return import(s)")}catch(e){nativeImport=null}function parseArgs(e,t,r,n){var i=e,o=t,a=r;Array.isArray(e)&&!Array.isArray(t)&&(i=null==n?void 0:n.path,o=e,a="function"==typeof t?t:r);var s=(o=Array.isArray(o)?o:[]).join(","),u={code:0,message:"",data:[],warnings:[]};return("require"===n.type&&"function"!=typeof n.require||"define"===n.type&&"function"!=typeof n.define)&&(u.code=404,u.message="requirejs is undefined, the fiels: ".concat(s)),{path:i,files:o,callback:a,filesStr:s,result:u}}function toModuleIds(e,t){var r="";return Array.isArray(e)?r=e.filter(Boolean).join("/"):"string"==typeof e&&(r=e.replace(/\/+$/,"")),t.map(function(e){var t=String(e).replace(/^\/+/,"");return r?"".concat(r,"/").concat(t):t})}function toNumber(e,t){var r=Number(e);return Number.isFinite(r)?r:t}var DEFAULT_OPTIONS={version:"",timeout:15e3,retry:0,strict:!1,baseUrl:""},BaseFileRequire=function(){return _createClass(function e(t){var r,n,i,o;_classCallCheck(this,e);var a=t||{};this.__debug=null!==(r=a.__debug)&&void 0!==r&&r,this.__rootPath=void 0,this.__define=a.define||(null===(n=window.__devfab_requirejs)||void 0===n?void 0:n.define),this.__require=a.require||(null===(i=window.__devfab_requirejs)||void 0===i?void 0:i.require),this.__undef=a.undef||("function"==typeof(null===(o=this.__require)||void 0===o?void 0:o.undef)?this.__require.undef:null),this.__requireConfig=a.requireConfig||this._pickRequireConfig(this.__require),this.__import=a.importer||null,this._setTimer=a.setTimeout||function(e,t){return setTimeout(e,t)},this._clearTimer=a.clearTimeout||function(e){return clearTimeout(e)},this.options={version:a.version?String(a.version):DEFAULT_OPTIONS.version,timeout:void 0===a.timeout?DEFAULT_OPTIONS.timeout:Math.max(0,toNumber(a.timeout,0)),retry:void 0===a.retry?DEFAULT_OPTIONS.retry:Math.max(0,toNumber(a.retry,0)),strict:!!a.strict,baseUrl:a.baseUrl||DEFAULT_OPTIONS.baseUrl},this.policy=new LoadPolicy(a),this.guard=new GlobalGuard(this._guardOptions(a)),this.options.version&&this._applyUrlArgs()},[{key:"_pickRequireConfig",value:function(e){var t,r=e&&"function"==typeof e.config?e:null===(t=window.__devfab_requirejs)||void 0===t?void 0:t.require;return r&&"function"==typeof r.config?r.config.bind(r):null}},{key:"_guardOptions",value:function(e){return!1===e.pollution?{enabled:!1,target:e.target}:e.pollution&&"object"===_typeof(e.pollution)?Object.assign({target:e.target},e.pollution):{target:e.target,watch:e.watch,maxPollution:e.maxPollution,enabled:void 0===e.pollution||!!e.pollution}}},{key:"configure",value:function(e){var t=e||{};return void 0!==t.debug&&(this.__debug=!!t.debug),void 0!==t.version&&this.setVersion(t.version),void 0!==t.timeout&&(this.options.timeout=Math.max(0,toNumber(t.timeout,this.options.timeout))),void 0!==t.retry&&(this.options.retry=Math.max(0,toNumber(t.retry,this.options.retry))),void 0!==t.strict&&(this.options.strict=!!t.strict),void 0!==t.baseUrl&&(this.options.baseUrl=t.baseUrl||""),void 0===t.manifest&&void 0===t.origins&&void 0===t.lockVersion&&void 0===t.verifyHash&&void 0===t.fetch||this.policy.configure(t),void 0!==t.pollution?this.guard.configure(this._guardOptions(t)):void 0===t.watch&&void 0===t.maxPollution&&void 0===t.target||this.guard.configure(t),this}},{key:"setVersion",value:function(e){return this.options.version=e?String(e):"",this._applyUrlArgs(),this}},{key:"_applyUrlArgs",value:function(){if("function"!=typeof this.__requireConfig)return!1;try{return this.__requireConfig({urlArgs:this.options.version?"v=".concat(encodeURIComponent(this.options.version)):""}),!0}catch(e){return!1}}},{key:"getVersion",value:function(){return this.options.version}},{key:"_snapshotConfig",value:function(){return{__debug:this.__debug,version:this.options.version,timeout:this.options.timeout,retry:this.options.retry,strict:this.options.strict,baseUrl:this.options.baseUrl,manifest:this.policy.manifest,origins:this.policy.origins,lockVersion:this.policy.lockVersion,verifyHash:this.policy.verifyHash,fetch:this.policy.fetch,pollution:this.guard.enabled,watch:this.guard.watch,maxPollution:this.guard.maxPollution,target:this.guard.target}}},{key:"describe",value:function(){return Object.assign({},this.options,{debug:this.__debug,policy:this.policy.describe(),pollutionGuard:this.guard.enabled,canUndef:"function"==typeof this.__undef,canNativeImport:"function"==typeof(this.__import||nativeImport)})}},{key:"_define",value:function(e,t,r){var n=parseArgs(e,t,r,{path:this.__rootPath,define:this.__define,type:"define"}),i=n.path,o=n.files,a=n.callback,s=n.result;404!==s.code?this.__define(i,o,a):null==a||a(s)}},{key:"_mergeWarnings",value:function(e,t){var r=(e||[]).slice();return(t||[]).forEach(function(e){r.some(function(t){return t.type===e.type&&t.key===e.key})||r.push(e)}),r}},{key:"_undefModules",value:function(e){var t=this;"function"==typeof this.__undef&&e.forEach(function(e){try{t.__undef(e)}catch(e){}})}},{key:"_load",value:function(e,t,r){var n=this,i=this.options,o=parseArgs(e,t,r,{path:this.__rootPath,require:this.__require,type:"require"}),a=o.path,s=o.files,u=o.callback,c=o.result,l=o.filesStr;if(404!==c.code){var d=toModuleIds(a,s),f=this.policy.checkModules(d);if(f)return c.code=f.code,c.message=f.message,void(null==u||u(c));var h=!1,p=0,v=null,y=null,g=function(){y&&(c.warnings=n._mergeWarnings(c.warnings,y.end()),y=null)},_=function(){h||(h=!0,null!==v&&(n._clearTimer(v),v=null),g(),i.strict&&c.warnings.length&&(c.code=500,c.message="Global pollution detection failed:".concat(c.warnings.map(function(e){return"".concat(e.type,":").concat(e.key)}).join(", "))),null==u||u(c))},m=function(){p++,y=n.guard.begin(),i.timeout>0&&(v=n._setTimer(function(){if(!h){var e=new Error("load timeout after ".concat(i.timeout,"ms: ").concat(l));e.__devfabTimeout=!0,b(e,"files load timeout after ".concat(i.timeout,"ms, the files: ").concat(l))}},i.timeout)),n.__require(a,s,function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];c.data=t,_()},function(e){b(e)})},b=function(e,t){if(!h){if(null!==v&&(n._clearTimer(v),v=null),p<=i.retry)return g(),n._undefModules(d),void m();c.code=e&&e.__devfabTimeout?CODE_TIMEOUT:500,c.message=t||"files load error, the files: ".concat(l),c.error=e,_()}};m()}else null==u||u(c)}},{key:"load",value:function(e,t,r){this._load(e,t,r)}},{key:"resolveUrl",value:function(e){var t=String(null==e?"":e);if(/^[a-z][a-z0-9+.-]*:/i.test(t)||/^\/\//.test(t))return t;var r=this.options.baseUrl||("undefined"!=typeof document&&document.baseURI?document.baseURI:"");if(!r)return t;try{return new URL(t,r).href}catch(e){return t}}},{key:"_importOne",value:function(e){var t=this,r=this.resolveUrl(e),n=this.policy.checkOrigin(r);if(n)return Promise.resolve({ok:!1,code:n.code,message:n.message});var i=this.policy.entryOf(e),o=i&&i.sha256,a=function(){var e=t.__import||nativeImport;return"function"!=typeof e?Promise.resolve({ok:!1,code:500,message:"native import() is unavailable(CSP 是否禁用了 unsafe-eval?)"}):Promise.resolve().then(function(){return e(r)}).then(function(e){return{ok:!0,module:e}},function(e){return{ok:!1,code:500,message:"module load error: ".concat(r),error:e}})};return o?this.policy.verify(r,o).then(function(e){return e.ok?a():{ok:!1,code:CODE_POLICY,message:"".concat(e.message,"(").concat(r,")")}}):a()}},{key:"loadModules",value:function(e,t,r){var n=this,i=parseArgs(e,t,r,{path:this.__rootPath,type:"module"}),o=i.path,a=i.files,s=i.callback,u=i.result,c=i.filesStr,l=toModuleIds(o,a),d=function(e){return null==s||s(e),e},f=this.policy.checkModules(l);if(f)return u.code=f.code,u.message=f.message,Promise.resolve(d(u));if(!a.length)return Promise.resolve(d(u));var h=this.guard.begin();return Promise.all(l.map(function(e){return n._importOne(e)})).then(function(e){u.warnings=h.end();var t=e.filter(function(e){return!e.ok});return t.length?(u.code=t[0].code||500,u.message="".concat(t.map(function(e){return e.message}).join("; "),"(the files: ").concat(c,")"),u.error=t[0].error):u.data=e.map(function(e){return e.module}),d(u)})}},{key:"loadModule",value:function(e,t){return this.loadModules([e],t)}}])}(),FileRequireClass=function(e){function t(){return _classCallCheck(this,t),_callSuper(this,t,arguments)}return _inherits(t,BaseFileRequire),_createClass(t,[{key:"define",value:function(e,t,r){this._define(e,t,r)}},{key:"defineScript",value:function(e){this.provideScript(e)}},{key:"provideScript",value:function(e){var t=e;"function"!=typeof e&&(t=function(){return e}),this.define([],t)}},{key:"require",value:function(e,t,r){this._load(e,t,r)}},{key:"injectScript",value:function(e,t,r,n){var i=this,o=e,a=t,s=r,u=n;Array.isArray(e)&&"function"==typeof t&&(o=void 0,a=e,s=t,u=r),this._load(o,a,function(e){if(0==e.code&&Array.isArray(e.data))for(var t=0,r=e.data.length;t<r;t++){var n,o=e.data[t];null===(n=s)||void 0===n||n(o,t)}else"function"==typeof u?u(e):i.__debug&&console.error("[devfab][FileRequire][injectScript] error: ",e)})}},{key:"requireScript",value:function(e,t,r){this.injectScript(e,t,r)}}])}(),FileRequire=new FileRequireClass;function isDebug(e){return e||window.devfab&&window.devfab.debug}function QueryString(e){this.pathname="",this.query={};var t=e;this.init=function(){t||(t=location.search);var e=t.indexOf("?"),r=t.indexOf("#");if(e>=0){if(this.pathname=t.substr(0,e),(t=r<0?t.substr(e+1):t.substring(e+1,r)).length>0)for(var n=(t=t.replace(/\+/g," ")).split("&"),i=0,o=n.length;i<o;i++){var a=n[i]||"";if(a){var s=a.indexOf("="),u="",c="";s<0?c=u=window.decode(a):(u=window.decode(a.substr(0,s)),c=window.decode(a.substr(s+1))),this.query[u]=c}}}else this.pathname=t},this.set=function(e,t){this.query[e]=t},this.get=function(e){return this.query[e]},this.del=function(e){delete this.query[e]},this.has=function(e){return null!=this.query[e]},this.toStr=function(){var e=["?"];for(var t in this.query)e.push(encodeURIComponent(t)),e.push("="),e.push(encodeURIComponent(this.query[t])),e.push("&");return 1===e.length?"":(e.splice(e.length-1,1),e.join(""))},this.init()}function _appendUrl(e,t){if(!t)return e;var r=[],n=new QueryString(e);for(var i in t)n.get(i)||r.push("".concat(i,"=").concat(t[i]));if(!r.length)return e;var o=r.join("&");return e.indexOf("?")>=0?"".concat(e,"&").concat(o):"".concat(e,"?").concat(o)}FileRequire.create=function(e){return new FileRequireClass(_objectSpread2(_objectSpread2({},this._snapshotConfig()),e))},window.__devfab=Object.assign({},window.__devfab),window.__devfab.FileRequire=FileRequire,window.__devfab.filePolicy={LoadPolicy:LoadPolicy,GlobalGuard:GlobalGuard,CODE_POLICY:CODE_POLICY,CODE_TIMEOUT:CODE_TIMEOUT},String.prototype.equalsIgnoreCase=function(e){return null!=e&&this.toLowerCase()===e.toLowerCase()};var hasValue=function(e){return null!=e&&""!==e};function pick(e,t,r){if(e){var n=r;"string"==typeof t&&Array.isArray(n)&&(n=_defineProperty({},t,r));var i=n&&n[t];if(!i)return hasValue(e[t])?e[t]:void 0;for(var o=0;o<i.length;o++){var a=e[i[o]];if(hasValue(a))return a}}}var _excluded=["children","render"],BaseBuilder=function(){return _createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"_config",{componentField:["component"]}),_defineProperty(this,"_components",{}),_defineProperty(this,"_renderFactory",null)},[{key:"init",value:function(e,t,r){this._initConfig(e),this._initComponent(t),this._initRenderFactory(r)}},{key:"_initConfig",value:function(e){this._config=Object.assign(this._config,e)}},{key:"_initComponent",value:function(e,t){if(e)if("string"==typeof e){if(this._components[e])return void console.log("[warning] Component ".concat(e," is exist!"));this._components[e]=t}else"function"==typeof e?Object.assign(this._components,null==e?void 0:e()):"object"===_typeof(e)&&Object.assign(this._components,e)}},{key:"_getComponent",value:function(e){return this._components[e]}},{key:"_clearComponents",value:function(){this._components={}}},{key:"_initRenderFactory",value:function(e){this._renderFactory=e}},{key:"_renderComponent",value:function(e,t){var r=this;if(Array.isArray(e)){var n=[];return e.forEach(function(e,i){var o=_objectSpread2({},e),a=pick(o,"component",r._config.componentField),s=o.children,u=o.render,c=_objectWithoutProperties(o,_excluded),l=r._getComponent(a);l||"function"==typeof u||console.log("[warning] Component ".concat(a," is not registered!"));var d={component:l,children:r._renderComponent(s,t)};c.index=i;var f=Object.assign({},null==t?void 0:t.props,{meta:c});"function"==typeof u?n.push(u({node:d,props:f})):"function"==typeof r._renderFactory?n.push(r._renderFactory({node:d,props:f})):(Object.assign(d,f),n.push(d))}),n}}},{key:"clear",value:function(){this._clearComponents(),this._renderFactory=null}}])}(),Builder=function(e){function t(){return _classCallCheck(this,t),_callSuper(this,t,arguments)}return _inherits(t,BaseBuilder),_createClass(t,[{key:"initComponent",value:function(e,t){this._initComponent(e,t)}},{key:"getComponents",value:function(){return _objectSpread2({},this._components)}},{key:"getComponent",value:function(e){return this._getComponent(e)}},{key:"hasComponent",value:function(e){return!!this._getComponent(e)}},{key:"initRenderFactory",value:function(e){this._initRenderFactory(e)}},{key:"render",value:function(e,t){return this._renderComponent(e,t)}}])}();function _getUrl(e,t){return e}function getAllResponseHeaders(e){var t=e.xhr.getAllResponseHeaders(),r={};return t.split("\r\n").map(function(e){var t=_slicedToArray(e.split(": "),2),n=t[0],i=t[1];r[n]=i}),r}Builder.create=function(e){return new Builder(e)};var AjaxUtil={_xhrs:[],_jsonps:{index:0},doRequest:function(e){var t,r=e.method||"GET",n=_getUrl(e.url);try{null!=e&&e.requestHeaders&&(t=e.requestHeaders,e.requestHeaders=void 0,delete e.requestHeaders)}catch(e){isDebug()&&console.log('[devfab][ajax]: [doRequest]: options["requestHeaders"] ERR : ',e)}try{e.params&&e.params.requestHeaders&&(t=e.params.requestHeaders,e.params.requestHeaders=void 0,delete e.params.requestHeaders)}catch(e){isDebug()&&console.log('[devfab][ajax]: [doRequest]: options.params["requestHeaders"] ERR : ',e)}var i=null;if(r.equalsIgnoreCase("get")||r.equalsIgnoreCase("delete")?n=_appendUrl(n,e.params):(r.equalsIgnoreCase("post")||r.equalsIgnoreCase("put"))&&(i=JSON.stringify(e.params)),e.jsonp)return this.getJsonp(n,e.callback);var o=this.getXMLHttpRequest();if(o){var a;if(o.open(r,n,!1!==e.async),e.timeout&&(o.timeout=e.timeout,o.setRequestHeader("timeout",e.timeout),o.ontimeout=function(){AjaxUtil.onerror(this,e,"timeout")}),e.contentType){if(o.setRequestHeader("Content-Type",e.contentType),e.contentType.indexOf("x-www-form-urlencoded")>=0)i=null===(a=new URLSearchParams(e.params))||void 0===a?void 0:a.toString()}else e.dateType?i=e.params:o.setRequestHeader("Content-Type","application/json;charset=utf-8");try{if(t&&"[object Object]"===Object.prototype.toString.call(t))for(var s in t)o.setRequestHeader(s,t[s])}catch(e){isDebug()&&console.log('[devfab][ajax]: [doRequest]: options.params["requestHeaders"] ERR : ',e)}o.withCredentials=null==e||!e.hasOwnProperty("withCredentials")||e.withCredentials,e.onBeforeRequest&&e.onBeforeRequest(o,i);try{o.send(i)}catch(t){return{error:"NetWorkError",options:e}}if(!1===e.async)return this.onreadystatechange(o,e);o.onreadystatechange=function(){AjaxUtil.onreadystatechange(this,e)}}},onreadystatechange:function(e,t){if(4===e.readyState){if(200===e.status){var r;try{if("blob"===t.responseType){var n=getAllResponseHeaders({xhr:e});r={code:e.status,data:{data:e.response,headers:n}}}else r=JSON.parse(e.responseText)}catch(r){AjaxUtil.onerror(e,t,e.responseText)}if(!1===t.async)return e.isBusy=!1,t.onAfterRequest&&t.onAfterRequest(r),AjaxUtil.parseAjaxResult(r,!1,null,null,t,e);AjaxUtil.parseAjaxResult(r,t.async,t.callback,t.context,t,e),t.onAfterRequest&&t.onAfterRequest(r)}else if(0===e.status)AjaxUtil.onerror(e,t,"The network connection has been disconnected. Please check the network status of the device and try.");else if(502===e.status||504===e.status)AjaxUtil.onerror(e,t,"An error has occurred with the service. Please try again later.");else{if(401!==e.status){var i={};try{i=JSON.parse(e.responseText)}catch(t){i={code:e.status,message:e.responseText}}return AjaxUtil.onerror(e,t,i)}AjaxUtil.onerror(e,t,"Login information has expired. Please log in again or contact technical staff.")}e.isBusy=!1}},onerror:function(e,t,r){var n="[devfab][ajax]: [onerror]: api error \n [code]: ".concat(e.status," \n [error]: ").concat(("object"===_typeof(r)?JSON.stringify(r):r)||"空"," \n [url]: ").concat(t.url," \n [token]: ").concat(document.cookie);isDebug()&&console.log(n);var i="object"===_typeof(r)?r:{code:500,message:r};t.onAfterRequest&&t.onAfterRequest(i)},getXMLHttpRequest:function(){return this.createXMLHttpRequest()},createXMLHttpRequest:function(){return window.XMLHttpRequest?new XMLHttpRequest:window.ActiveXObject?new window.ActiveXObject("Microsoft.XMLHTTP"):null},getJsonp:function(e,t){var r=e,n="callback"+this._jsonps.index++,i=document.createElement("script");this._jsonps[n]=function(e){try{t(e)}finally{document.body.removeChild(i)}},r+=-1===r.indexOf("?")?"?":"&callback=cb.rest.AjaxUtil._jsonps."+n,i.src=r,document.body.appendChild(i)},parseAjaxResult:function(e,t,r,n,i,o){if(e){if(!e.code)return!1===t?e:void(r&&r.call(n,null,e));if(200==e.code){if(!1===t)return{result:e.data};r&&r.call(n,null,e.data,e.message,e.errorDetail,e.code,e.displayCode&&e)}else{if(!1===t)return{error:e};r&&r.call(n,e)}}}};function ajax(e,t){return t.url=e,AjaxUtil.doRequest(t)}function DynamicProxy(e,t){this.init&&this.init(e),this.queryParams=t}DynamicProxy.create=function(e,t){return new DynamicProxy(e,t)},DynamicProxy.prototype.init=function(e){if(e)for(var t in this.config=e,this.config)this[t]=function(e){return function(t,r,n){return this.Do(e,t,r,null,n)}}(t),this["".concat(t,"Sync")]=function(e){return function(t){return this.Do(e,t,null,!1)}}(t)},DynamicProxy.prototype.Do=function(e,t,r,n,i){var o,a,s;if(this.config&&this.config[e]&&this.config[e].url){var u=this.config[e],c=u.url;this.queryParams||(this.queryParams={}),null!==(o=u.options)&&void 0!==o&&o.proxyServiceCode&&(this.queryParams.serviceCode=u.options.proxyServiceCode),null!==(a=u.options)&&void 0!==a&&a.billnum&&(this.queryParams.billnum=u.options.billnum),null!==(s=this.queryParams)&&void 0!==s&&s.serviceCode&&(c=_appendUrl(c,this.queryParams));var l=c,d=Object.assign({},u.options);return d.method=u.method||"GET","function"==typeof t?(d.callback=t,d.context=i||d.context||this):d.params=t,r&&(d.callback=r,d.context=i||d.context||this),!1===n&&(d.async=!1),this.ajax(l,d)}},DynamicProxy.prototype.ajax=function(e,t){return ajax(e,t)};var Event=function(){return _createClass(function e(t){_classCallCheck(this,e),this._init(t)},[{key:"_init",value:function(e){var t;this.__ASYNC_EXECUTE__=null===(t=null==e?void 0:e.__ASYNC_EXECUTE__)||void 0===t||t,this._events=new Map,this._firstevents=new Map}},{key:"on",value:function(e,t,r){var n=this._events.get(e);Array.isArray(n)||(n=[]),n.push({callback:t,context:r}),this._events.set(e,n)}},{key:"onFirst",value:function(e,t,r){var n=this._firstevents.get(e);Array.isArray(n)||(n=[]),n.splice(0,0,{callback:t,context:r}),this._firstevents.set(e,n)}},{key:"execute",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var i=this._events.get(e),o=this._firstevents.get(e);if(!i&&!o)return!0;var a=!0;return[].concat(_toConsumableArray(o||[]),_toConsumableArray(i||[])).forEach(function(e){if(!1!==a){var t=e.callback.apply(e.context||void 0,r);a=!1!==t&&a}}),a}},{key:"un",value:function(e,t){this._unEvents(e,t,this._events),this._unEvents(e,t,this._firstevents)}},{key:"_unEvents",value:function(e,t,r){if(e&&r.has(e))if(t){var n=r.get(e),i=null==n?void 0:n.findIndex(function(e){return e.callback===t});-1!==i&&(null==n||n.splice(i,1))}else r.delete(e)}},{key:"hasEvent",value:function(e){var t,r;return e?((null===(t=this._events.get(e))||void 0===t?void 0:t.length)||0)+((null===(r=this._firstevents.get(e))||void 0===r?void 0:r.length)||0):0}},{key:"fireEvent",value:function(e,t){this.execute("before".concat(e),t)&&(this.execute(e,t),this.execute("after".concat(e),t))}},{key:"_asyncExecute",value:function(e,t,r){for(var n,i=this,o=r.resolve,a=r.reject,s=r.args,u=!0,c=t||[],l=!1,d=function(t){var r,n=c[t];if(!1===u)return 0;if(l)return{v:void 0};if("development"===process.env.nodeEnv)r=n.callback.apply(n.context||i,s);else try{r=n.callback.apply(n.context||i,s)}catch(e){throw e.isAddedMsg||(e.message="(领域扩展事件执行失败,请打开控制台查看详细错误信息并修复):".concat(e.message)),e.isAddedMsg=!0,e}r instanceof Promise?(l=!0,(u=r).callbacks&&u.callbacks.push({reject:function(){u.reject(),t===c.length-1&&(null==a||a())},resolve:function(r){t===c.length-1?(s.length>1&&(s[0]=r),null==o||o(s)):i._asyncExecute(e,c.slice(t+1),{resolve:o,reject:a,args:s})}})):(u=!1!==r&&u,t===c.length-1&&(u?null==o||o(s):null==a||a()))},f=0;f<c.length&&0!==(n=d(f));f++)if(n)return n.v;return u}},{key:"_asyncPromiseExecute",value:function(e,t,r,n){var i=this._events.get(e),o=this._firstevents.get(e);if(!((Array.isArray(i)?i.length:i)||(Array.isArray(o)?o.length:o)))return null==t?void 0:t();var a=[].concat(_toConsumableArray(o||[]),_toConsumableArray(i||[]));return this._asyncExecute(e,a,{resolve:t,reject:r,args:n})}},{key:"promiseExecute",value:function(e,t){var r=this,n=e,i=1;if("boolean"==typeof e&&(n=t,i=2),n){for(var o=arguments.length,a=new Array(o>2?o-2:0),s=2;s<o;s++)a[s-2]=arguments[s];var u=2===i?a:[t].concat(a);if(u.length){var c,l=u.length-1,d=u[l];if("function"!=typeof d){if("object"!==_typeof(d)||!d[0]||"function"!=typeof d[0]||!d[1]||"function"!=typeof d[1])return;c=d[1],d=d[0]}if(this.__ASYNC_EXECUTE__)return this._asyncPromiseExecute(n,function(e){d.apply(r,e)},function(){c&&"function"==typeof c&&c()},u);u.splice(l,1),u.unshift(n);var f=this.execute.apply(this,u);if(f instanceof Promise){var h=this;f.then(function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];d.apply(h,t)},function(){c&&"function"==typeof c&&c()})}else if(!f)return void(c&&"function"==typeof c&&c())}}}},{key:"clear",value:function(){this._events.clear(),this._firstevents.clear()}}])}();Event.create=function(e){return new Event(e)};var Cache=function(){return _createClass(function e(t){_classCallCheck(this,e),this._init(t)},[{key:"_init",value:function(e){this._data=Object.assign({},e)}},{key:"set",value:function(e,t){this._data[e]=t}},{key:"get",value:function(e){var t;return null===(t=this._data)||void 0===t?void 0:t[e]}},{key:"delete",value:function(e){delete this._data[e]}},{key:"clear",value:function(){this._data={}}}])}();Cache.create=function(e){return new Cache};var BaseModel$1=function(){return _createClass(function e(t){_classCallCheck(this,e),this._init(t)},[{key:"_init",value:function(e){this._data={};var t=[];if(e)for(var r in e)t.push(r);Object.assign(this._data,{components:[],propertyNames:t},e),this._data.cache=new Cache,this._data.events=new Event}},{key:"_del_data",value:function(e){e&&delete this._data[e]}},{key:"_cls_data",value:function(){this._data.cache.clear(),this._data.events.clear(),this._data={components:[],propertyNames:[],cache:new Cache,events:new Event}}},{key:"_set_data",value:function(e,t,r){if(e){if(r){var n=this._data.propertyNames||[];n.indexOf(e)<0&&n.push(e)}this._data[e]=t}}},{key:"_get_data",value:function(e){if(e)return this._data[e]}},{key:"getData",value:function(){return this._get_data("value")}},{key:"getState",value:function(e,t){var r;if(!t)return this._get_data(e);var n=(this._get_data("components")||[]).find(function(e){return e.ctrlName===t});return n?null===(r=n.getState)||void 0===r?void 0:r.call(n,e):this._get_data(e)}},{key:"setState",value:function(e,t,r){r||this._set_data(e,t,!0);var n={};n[e]=t,this.doPropertyChange("setState",n,r)}},{key:"doPropertyChange",value:function(e,t,r){var n=this,i=this._get_data("components")||[];if(!i.length)return i;var o=[];if(r){var a=i.find(function(e){return e.ctrlName===r});a&&!this.notifyComponent(a,e,t)&&o.push(a)}else i.forEach(function(r){n.notifyComponent(r,e,t)||o.push(r)});return o.length?o:void 0}},{key:"notifyComponent",value:function(e,t,r){return"function"==typeof e[t]&&(this.viewUpdater(e,t,r),!0)}},{key:"viewUpdater",value:function(e,t,r){if("setState"===t)e[t](r);else{var n=this.getCache("name");e[t](r,n)}}},{key:"get",value:function(e){return this._get_data(e)}},{key:"addComponent",value:function(e,t){if(e){t&&!e.ctrlName&&(e.ctrlName=t);var r=this._get_data("components")||[];r.indexOf(e)>=0||r.push(e)}}},{key:"removeComponent",value:function(e){var t=this._get_data("components")||[],r=t.indexOf(e);r<0||t.splice(r,1)}},{key:"_applyState",value:function(e,t,r){var n=this;r||this._set_data(e,t,!0);var i="set".concat(e.charAt(0).toUpperCase()).concat(e.slice(1)),o=this.doPropertyChange(i,t,r);if(o){var a={};a[e]=t,o.forEach(function(e){n.notifyComponent(e,"setState",a)})}}},{key:"getVisible",value:function(e){return this.getState("visible",e)}},{key:"setVisible",value:function(e,t){this._applyState("visible",e,t)}},{key:"getValue",value:function(){return this.getData()}},{key:"setValue",value:function(e,t,r){var n=this,i=this.getValue();if(e!==i){var o={value:e,oldValue:i},a=this._get_data("forceFireEvent");t||a?this.promiseExecute("beforeValueChange",o,[function(){n._set_data("value",e,!0),n._applyState("value",e,r),n.execute("afterValueChange",o)},function(){n._set_data("value",i,!0),n._applyState("value",i,r)}]):(this._set_data("value",e,!0),this._applyState("value",e,r))}}},{key:"getDisabled",value:function(e){return this.getState("disabled",e)}},{key:"setDisabled",value:function(e,t){this._applyState("disabled",e,t)}},{key:"setParent",value:function(e){this.setCache("parent",e)}},{key:"getParent",value:function(){return this.getCache("parent")}},{key:"getRootParent",value:function(){for(var e=this.getParent();null!==(t=e)&&void 0!==t&&t.getParent();){var t;e=e.getParent()}return e}},{key:"setName",value:function(e){this.setCache("name",e)}},{key:"getName",value:function(){return this.getCache("name")}},{key:"setDirty",value:function(e){e?this._set_data("isDirty",!0):(this._del_data("isDirty"),this._set_data("originalData",this.getData()))}},{key:"getDirtyData",value:function(e){var t=this.getData();return!1!==e&&this._get_data("isDirty")||t!==this._get_data("originalData")?t:void 0}},{key:"clear",value:function(e){void 0===e?this._set_data("value",this._get_data("cDefaultValue")):e||this._set_data("value",void 0),this._del_data("isDirty"),this._del_data("checking"),this._del_data("checkMsg")}},{key:"on",value:function(e,t,r){this._get_data("events").on(e,t,r)}},{key:"onFirst",value:function(e,t,r){this._get_data("events").onFirst(e,t,r)}},{key:"execute",value:function(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return(t=this._get_data("events")).execute.apply(t,[e].concat(n))}},{key:"un",value:function(e,t){this._get_data("events").un(e,t)}},{key:"hasEvent",value:function(e){return this._get_data("events").hasEvent(e)}},{key:"fireEvent",value:function(e,t){this._get_data("events").fireEvent(e,t)}},{key:"promiseExecute",value:function(e,t){for(var r,n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];(r=this._get_data("events")).promiseExecute.apply(r,[e,t].concat(i))}},{key:"setCache",value:function(e,t){this._get_data("cache").set(e,t)}},{key:"getCache",value:function(e){return this._get_data("cache").get(e)}},{key:"clearCache",value:function(e){this._get_data("cache").delete(e)}},{key:"setProxy",value:function(e){if(!(e instanceof DynamicProxy)){var t,r=this._get_data("__requestHeaders__");for(var n in e){var i,o,a;if(r&&(null===(i=e[n])||void 0===i||null===(i=i.options)||void 0===i||!i.requestHeaders))null!==(a=e[n])&&void 0!==a&&a.options||(e[n].options={}),e[n].options.requestHeaders=r;null!==(o=this.getProxy())&&void 0!==o&&o[n]&&window.devfab.debug&&console.warn("[devfab][baseModel.prototype.setProxy]: Proxy ".concat(n," already exists on the model. Please change the name of ").concat(n," and try again"))}return this._set_data("proxy",DynamicProxy.create(_objectSpread2(_objectSpread2({},(null===(t=this.getProxy())||void 0===t?void 0:t.config)||{}),e))),this.getProxy()}this._set_data("proxy",e)}},{key:"getProxy",value:function(){return this._get_data("proxy")}}])}(),SimpleModel$1=function(e){function t(){var e;_classCallCheck(this,t);for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return _defineProperty(e=_callSuper(this,t,[].concat(n)),"modelType","SimpleModel"),e}return _inherits(t,BaseModel$1),_createClass(t,[{key:"getDisabled",value:function(){return this.getState("disabled")}},{key:"setDisabled",value:function(e,t){this._applyState("disabled",e,t)}},{key:"getReadonly",value:function(){return this.getState("readonly")}},{key:"setReadonly",value:function(e,t){this._applyState("readonly",e,t)}}])}(),DEFAULT_PAGE_SIZE=20,isArray=Array.isArray;function cloneDeep(e){if(isArray(e))return e.map(cloneDeep);if(e instanceof Date)return new Date(e.getTime());if(e&&"object"===_typeof(e)){var t={};for(var r in e)t[r]=cloneDeep(e[r]);return t}return e}function normalizeColumns(e){var t={};return(isArray(e)?e:Object.keys(e||{}).map(function(t){var r;return _objectSpread2(_objectSpread2({},e[t]||{}),{},{field:(null===(r=e[t])||void 0===r?void 0:r.field)||t})})).forEach(function(e,r){if(e){var n=e.field||e.cFieldName||e.cName||"col_".concat(r);t[n]=_objectSpread2(_objectSpread2({},e),{},{field:n,label:e.label||e.title||e.cCaption||n,index:void 0===e.index?r:e.index})}}),t}function resolveRowsData(e){if(!e)return[];if(isArray(e))return e;if(isArray(e.data))return e.data;if(isArray(e.records))return e.records;if(isArray(e.list))return e.list;if(isArray(e.rows))return e.rows;var t=e.data&&"object"===_typeof(e.data)?e.data:e.result;return isArray(t)?t:t&&"object"===_typeof(t)&&(t.records||t.list||t.rows||t.data)||[]}function createDefaultProps(){var e={id:"_id",selected:"_selected",status:"_status",pageIndex:"pageNo",pageSize:"pageSize",pageCount:"total"};return{columns:{},dataSource:[],rows:[],readOnly:!0,dataSourceMode:"local",columnMode:"local",editMode:"cell",rowKeyField:"id",cellState:{},rowState:{},showCheckBox:!1,multiple:!0,showRowNo:!0,pagination:!0,pageInfo:_defineProperty(_defineProperty(_defineProperty({},e.pageIndex,1),e.pageSize,DEFAULT_PAGE_SIZE),e.pageCount,0),innerUsedAttrs:e,multiRowModel:!1,editRowModels:{},loading:!1,params:{},originalKeyMap:{},defaultRowDatas:new Map}}function resolveProxyConfig(){return _objectSpread2({},(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).proxyConfig||{})}function _getData(e,t,r){var n=this;this.promiseExecute("beforeQuery",{proxyConfig:e,queryParams:t},function(){var i=n,o=n.setProxy({queryData:e}),a=n._get_data("innerUsedAttrs").pageIndex,s={page:_defineProperty(_defineProperty({},n._get_data("innerUsedAttrs").pageSize,n.getPageSize()),a,n.getPageIndex())},u=Object.assign(t,s);n.setCache("proxyCache",{proxyConfig:e,params:u,callback:r});if(!1!==n.execute("beforeQueryData",u)){var c=cloneDeep(u);o.queryData(c,function(e,t,n,i){if(!e){var o=t;this._set_data("dataSourceMode","remote");var a=resolveRowsData(o=Object.assign({},o));this.execute("afterQueryData",o),null==r||r.call(this,a)}},i)}})}function _setData(e){if(this.execute("beforeSetDataSource",e)){var t=this.getRowKeyField(),r={};e.forEach(function(e){r[e[t]]=e}),this._set_data("keyMap",r),this._set_data("dataSource",e,!0),this.doPropertyChange("setDataSource"),this.execute("afterSetDataSource",e)}}var GridModel$1=function(e){function t(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};_classCallCheck(this,t);var n=_objectSpread2(_objectSpread2({},createDefaultProps()),r);isArray(n.dataSource)||(n.dataSource=[]),isArray(n.rows)||(n.rows=[]);var i=resolveProxyConfig(r);return n.proxyConfig=i,n.dataSourceMode=r.dataSourceMode||n.dataSourceMode,_defineProperty(e=_callSuper(this,t,[n]),"modelType","GridModel"),e.initColumns(n.columns),e.initPageInfo(r.cPage||r.page),e.afterInit(),e}return _inherits(t,BaseModel$1),_createClass(t,[{key:"afterInit",value:function(){this.execute("afterInit")}},{key:"initColumns",value:function(e){var t=normalizeColumns(e);return this._set_data("columns",t,!0),t}},{key:"initPageInfo",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=_objectSpread2({},this.getPageInfo()),r=this._get_data("innerUsedAttrs").pageIndex,n=this._get_data("innerUsedAttrs").pageSize;t[r]=e.pageNo||e.pageIndex||t.pageIndex||1,t[n]=e.pageSize||t.pageSize||DEFAULT_PAGE_SIZE,!1===this.get("pagination")&&(t[r]=-1),this._set_data("pageInfo",t)}},{key:"getRowKeyField",value:function(){return this._get_data("rowKeyField")}},{key:"isRemote",value:function(){return"remote"===this._get_data("dataSourceMode")}},{key:"getReadOnly",value:function(){return!!this._get_data("readOnly")}},{key:"setReadOnly",value:function(e){this._applyState("readOnly",!!e)}},{key:"setShowCheckbox",value:function(e){this._applyState("showCheckBox",!!e)}},{key:"setShowRowNo",value:function(e){this._applyState("showRowNo",!!e)}},{key:"getParams",value:function(){return _objectSpread2(_objectSpread2({},this.get("cParams")||{}),this._get_data("params")||{})}},{key:"setParams",value:function(e){this._set_data("params",e||{})}},{key:"getInnerUsedAttrs",value:function(e){var t=this._get_data("innerUsedAttrs");return e?t[e]:t}},{key:"getId",value:function(){return this.getInnerUsedAttrs("id")}},{key:"setDataSource",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;if("local"===this._get_data("dataSourceMode")){_setData(isArray(e)?e:[])}else{if(!this.execute("beforeProxyLoad",r))return;this.setPageIndex(1),_getData.call(this,e,r,function(e){_setData.call(t,e),null==n||n.call(t)})}}},{key:"reloadData",value:function(){var e=this,t=this.getCache("proxyCache");if(t){var r=t.proxyConfig,n=t.params,i=t.callback;_getData.call(this,r,n,function(t){null==i||i.call(e,t)})}else isDebug()&&console.log("[devfab][GridModel] proxyConfig is null")}},{key:"getDataSource",value:function(){return this._get_data("dataSource")||[]}},{key:"getData",value:function(e){return e?this._get_data("rows"):this._get_data("dataSource")}},{key:"getAllData",value:function(){return this.getData(!0)}},{key:"clear",value:function(){this._set_data("dataSource",[],!0),this._set_data("rows",[],!0)}},{key:"getPageInfo",value:function(){return this._get_data("pageInfo")}},{key:"getPageIndex",value:function(){var e=this._get_data("innerUsedAttrs").pageIndex;return this.getPageInfo()[e]}},{key:"getPageSize",value:function(){var e=this._get_data("innerUsedAttrs").pageSize;return this.getPageInfo()[e]}},{key:"getTotalCount",value:function(){var e=this._get_data("innerUsedAttrs").pageCount;return this.getPageInfo()[e]}},{key:"setPageInfo",value:function(e){var t=this.getPageInfo();this._set_data("pageInfo",_objectSpread2(_objectSpread2({},t),e)),this.reloadData()}},{key:"setPageIndex",value:function(e){if("number"==typeof e){var t=this._get_data("innerUsedAttrs").pageIndex;this._set_data("pageInfo",_objectSpread2(_objectSpread2({},this.getPageInfo()),{},_defineProperty({},t,Math.max(1,e))))}}},{key:"setPageSize",value:function(e){if("number"==typeof e){var t=this._get_data("innerUsedAttrs").pageIndex,r=this._get_data("innerUsedAttrs").pageSize;this._set_data("pageInfo",_objectSpread2(_objectSpread2({},this.getPageInfo()),{},_defineProperty(_defineProperty({},r,Math.max(-1,e)),t,1)))}}},{key:"setTotalCount",value:function(e){var t=this._get_data("innerUsedAttrs").pageCount;this.getPageInfo()[t]=e}}])}(),ViewModel$1=function(e){function t(){var e;_classCallCheck(this,t);for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return _defineProperty(e=_callSuper(this,t,[].concat(n)),"modelType","ViewModel"),e}return _inherits(t,BaseModel$1),_createClass(t,[{key:"getParams",value:function(){return this._get_data("params")}},{key:"setParams",value:function(e){this._set_data("params",e,!0)}},{key:"set",value:function(e,t){t instanceof BaseModel$1&&(t.setParent(this),t.setName(e)),this._set_data(e,t,!0)}},{key:"setData",value:function(e){for(var t in e)this.addProperty(t,e[t])}},{key:"addProperty",value:function(e,t){var r=this.get(e);null!=r&&r.setData?r.setData(t):this.set(e,t)}},{key:"getData",value:function(){var e=this,t=this._get_data("propertyNames")||[],r={};return t.forEach(function(t){var n,i=e.get(t);i instanceof BaseModel$1&&!1!==i._get_data("needCollect")&&(r[t]=null===(n=i.getData)||void 0===n?void 0:n.call(i))}),r}},{key:"getAllData",value:function(e){var t=this,r=this._get_data("propertyNames")||[],n={};return r.forEach(function(r){var i,o=t.get(r);if(o instanceof BaseModel$1&&!1!==o._get_data("needCollect")&&(!e||!o._get_data("isGrid"))){var a=null===(i=o.getData)||void 0===i?void 0:i.call(o);void 0!==a&&(n[r]=a)}}),n}},{key:"removeProperty",value:function(e){var t=this._get_data("propertyNames")||[],r=t.indexOf(e);-1!==r&&t.splice(r,1),this._del_data(e)}},{key:"loadData",value:function(e){this.setCache("isLoadData",!0),this.clear(),this.setData(e),this.setDirty(!1),this.setCache("isLoadData",!1)}},{key:"clear",value:function(e){var t=this;(this._get_data("propertyNames")||[]).forEach(function(r){var n,i=t.get(r);i instanceof BaseModel$1&&!1!==i._get_data("needClear")&&(null===(n=i.clear)||void 0===n||n.call(i,e))})}},{key:"setDirty",value:function(e){e?this._set_data("isDirty",!0):(this._del_data("isDirty"),this._set_data("originalData",this.getData()))}},{key:"getGridModel",value:function(e){var t;if(e)return this.get(e);var r=this._get_data("gridModel");if(r)return r;var n=null===(t=this.getParams())||void 0===t?void 0:t.masterGridModelName;if(n)return this.get(n);for(var i=this._get_data("propertyNames"),o=0,a=i.length;o<a;o++){if((r=this.get(i[o]))instanceof GridModel$1||"GridModel"==r.modelType)return this._set_data("gridModel",r),r}}},{key:"getGridModels",value:function(){for(var e=this._get_data("propertyNames"),t=[],r=0,n=e.length;r<n;r++){var i=this.get(e[r]);(i instanceof GridModel$1||"GridModel"==i.modelType)&&t.push(i)}return t}},{key:"getGridFilterModel",value:function(e){return this.getGridModel(e).getCache("FilterViewModel")}}])}();function loadScripts(e,t,r,n,i){var o,a=t,s=r,u=n,c=i;Array.isArray(t)&&"function"==typeof r&&(a=void 0,s=t,u=r,c=n);var l=(null===(o=c)||void 0===o?void 0:o.viewModel)||this,d=(s=Array.isArray(s)?s:[]).join(",");return FileRequire.create({require:e}).require(a,s,function(e){var t;if(0==e.code&&Array.isArray(e.data))for(var r=0,n=e.data.length;r<n;r++){var i=e.data[r];if(i&&i.doAction)try{i.doAction("init",l)}catch(t){e.code=500,e.message="".concat(d," script execute error"),e.error=t;break}else try{var o;"function"==typeof(null===(o=c)||void 0===o?void 0:o.onFileBack)&&c.onFileBack(i,r)}catch(t){e.code=500,e.message="".concat(d," script customize execute error");break}}0!=e.code&&window.__devfab.debug&&console.info("[devfab][models][extend][loadScripts] ".concat(d," \n [message]: ").concat(e.message," \n").concat(e.error?" \n [error]: ":""),e.error),null===(t=u)||void 0===t||t(e)})}function initExtendScripts(e){var t=this;window.__devfab&&window.__devfab.__debugger_initExtendJs;var r=e.requirejs,n=e.extendScriptParams,i=e.readyEventName,o=void 0===i?"extendReady":i,a=n||{},s=a.enableJs,u=void 0!==s&&s,c=a.filepath,l=a.scriptUrl;if(!u)return window.__devfab.debug&&console.info("[devfab][extend][js] not enable extend script"),void t.execute(o,t);if(!l)return window.__devfab.debug&&console.info("[devfab][extend][js] extend script is not defined"),void t.execute(o,t);var d=c,f=[l];t.getEnv&&t.getEnv("everyCommonExtend")&&f.push(t.getEnv("everyCommonExtend")),loadScripts.call(t,null==r?void 0:r.require,d,f,function(e){t.execute(o,t,e)})}var initExtScripts=function(){var e=_asyncToGenerator(_regenerator().m(function e(t,r,n){var i,o,a,s,u,c,l,d,f,h,p;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if(window.__devfab&&window.__devfab.__debugger_initExtJs,a=n.requirejs,s=n.extendScriptParams,c=(u=s||{}).enableExtJs,l=void 0!==c&&c,d=u.exturlsField,f=void 0===d?"extscripturls":d,l){e.n=1;break}return window.__devfab.debug&&console.info("[devfab][extend][exturls] ext script is not enable"),e.a(2,Promise.resolve(!0));case 1:if(t){e.n=2;break}return window.__devfab.debug&&console.info("[devfab][extend][exturls] script data is null"),e.a(2,Promise.resolve(!0));case 2:if(h=null==t?void 0:t[f],p=Array.isArray(h)?h:[],p=(p=(r.getCache("localScripts")||[]).concat(p)).concat(window.__devfab__GLOBAL_EXT_SCRIPTS__||[]),null!==(i=r.getParams())&&void 0!==i&&i.selfExtUrls&&(p=p.concat([r.getParams().selfExtUrls])),null===(o=p)||void 0===o||!o.length){e.n=4;break}return p=_toConsumableArray(new Set(p)),e.n=3,Promise.all(p.map(function(){var e=_asyncToGenerator(_regenerator().m(function e(t){return _regenerator().w(function(e){for(;;)if(0===e.n)return e.a(2,t)},e)}));return function(t){return e.apply(this,arguments)}}()));case 3:p=e.v;case 4:return t[f]=p,e.a(2,new Promise(function(e,t){loadScripts.call(r,null==a?void 0:a.require,p,function(t){e(t)})}))}},e)}));return function(t,r,n){return e.apply(this,arguments)}}(),BaseModel=BaseModel$1,SimpleModel=SimpleModel$1,ViewModel=ViewModel$1,GridModel=GridModel$1;function createModelFactory(e,t){var r=(null==t?void 0:t.SimpleModel)||SimpleModel$1,n=e.cControlType||e.component||e.controlType||e.ctrlType;return n=n.toLowerCase(),new r(e)}function _createViewModel(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.modelNameField,i=void 0===n?"cName":n,o=function(e){function t(){return _classCallCheck(this,t),_callSuper(this,t,arguments)}return _inherits(t,e),_createClass(t,[{key:"init",value:function(e,t){var r=this.createModels(e,t);this.setData(r),this.setDirty(!1)}},{key:"createModels",value:function(e,t){var n={};return(Array.isArray(e)?e:[]).forEach(function(e){var t,o,a={model:createModelFactory(e,r),meta:e,childModel:!0,modelName:e[i]};null==r||null===(t=r.onBeforeInitModel)||void 0===t||t.call(r,a),n[a.modelName]=a.model,null==r||null===(o=r.onAfterInitModel)||void 0===o||o.call(r,a)}),n}},{key:"initData",value:function(){initExtendScripts.call(this,r)}}])}((null==r||null===(t=r.models)||void 0===t?void 0:t.ViewModel)||ViewModel$1);return o.prototype.modelType="ViewModel",o}function _initViewModel(e,t){var r,n,i,o=new(_createViewModel(e,t)),a={model:o,meta:e};return null==t||null===(r=t.onBeforeInitModel)||void 0===r||r.call(t,a),a.model=o,null==o||null===(n=o.init)||void 0===n||n.call(o,e.models,e),null==t||null===(i=t.onAfterInitModel)||void 0===i||i.call(t,a),o}function initViewModel(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,n=_initViewModel(e,t);return n.on("destroyVM",function(){var e,t;null===(e=n)||void 0===e||null===(t=e.destroyVM)||void 0===t||t.call(e),n=null,window.devfab.debug&&console.info("[devfab][models][initVM]: destory vm ".concat((new Date).toString()))}),n.on("extendReady",_asyncToGenerator(_regenerator().m(function i(){var o;return _regenerator().w(function(i){for(;;)switch(i.n){case 0:return(o=[]).push(initExtScripts(e,n,t)),i.n=1,Promise.all(o);case 1:window.devfab.debug&&console.info("[devfab][models][initVM]: after vm init ".concat((new Date).toString())),null==r||r(n,e);case 2:return i.a(2)}},i)}))),n.initData(),n}var models=Object.freeze({__proto__:null,BaseModel:BaseModel,SimpleModel:SimpleModel,GridModel:GridModel,ViewModel:ViewModel,initViewModel:initViewModel,loadScripts:loadScripts}),utils={models:models,Builder:Builder,Cache:Cache,Event:Event,Ajax:DynamicProxy},devfab={debug:!1,FileRequire:FileRequire,define:function(){FileRequire.define.apply(FileRequire,arguments)},require:function(){FileRequire.require.apply(FileRequire,arguments)},provideScript:function(){FileRequire.provideScript.apply(FileRequire,arguments)},injectScript:function(){FileRequire.injectScript.apply(FileRequire,arguments)},utils:_objectSpread2(_objectSpread2({},utils),{},{builder:utils.Builder.create(),cache:utils.Cache.create(),event:utils.Event.create()})};window.__devfab=Object.assign({},window.__devfab,devfab),exports.default=devfab;