devfab 2.0.0 → 2.1.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/README.md +98 -31
- package/dist/common/models.esm.js +2 -2
- package/dist/common/models.js +2 -2
- package/dist/common/require.esm.js +2 -2
- package/dist/common/require.js +2 -2
- package/dist/common/utils.esm.js +2 -2
- package/dist/common/utils.js +2 -2
- package/dist/index.esm.js +2 -2
- package/dist/index.js +2 -2
- package/dist/index.umd.js +2 -2
- package/lib/devfab.js +130 -125
- package/lib/devfab.min.js +2 -2
- package/lib/devfab.require.js +74 -122
- package/lib/devfab.require.min.js +2 -2
- package/package.json +1 -1
package/dist/common/require.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}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 i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,_toPropertyKey(i.key),i)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function
|
|
1
|
+
"use strict";function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}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 i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,_toPropertyKey(i.key),i)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),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 _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 _setPrototypeOf(e,t){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_setPrototypeOf(e,t)}function _toPrimitive(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;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)}
|
|
2
2
|
/** vim: et:ts=4:sw=4:sts=4
|
|
3
3
|
* @license RequireJS 2.3.2 Copyright jQuery Foundation and other contributors.
|
|
4
4
|
* Released under MIT license, https://github.com/requirejs/requirejs/blob/master/LICENSE
|
|
5
|
-
*/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,i){return t&&eachProp(t,function(t,n){!r&&hasProp(e,n)||(!i||"object"!==_typeof(t)||!t||isArray(t)||isFunction(t)||t instanceof RegExp?e[n]=t:(e[n]||(e[n]={}),mixin(e[n],t,r,i)))}),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,i){var n=new Error(t+"\nhttp://requirejs.org/docs/errors.html#"+e);return n.requireType=e,n.requireModules=i,r&&(n.originalError=r),n}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,i){var n,o,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=defContextName;return isArray(e)||"string"==typeof e||(o=e,isArray(t)?(e=t,t=r,r=i):e=[]),o&&o.context&&(a=o.context),s.name&&(a=s.name),(n=getOwn(contexts,a))||(n=contexts[a]=req.s.newContext(a,s)),o&&n.configure(o),n.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 i,n="";try{r.split("?")[0].endsWith(".css")&&(n="css")}catch(e){}return"css"===n?((i=e.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:link"):document.createElement("link")).href=r,i.rel="stylesheet",i.type=e.linkType||"text/css",i):((i=e.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script")).type=e.scriptType||"text/javascript",i.charset="utf-8",i.async=!1,i)},req.load=function(e,t,r){var i,n=e&&e.config||{};if(isBrowser)return(i=req.createNode(n,t,r)).setAttribute("data-requirecontext",e.contextName),i.setAttribute("data-requiremodule",t),!i.attachEvent||i.attachEvent.toString&&i.attachEvent.toString().indexOf("[native code")<0||isOpera?(i.addEventListener("load",e.onScriptLoad,!1),i.addEventListener("error",e.onScriptError,!1)):(useInteractive=!0,i.attachEvent("onreadystatechange",e.onScriptLoad)),i.src=r,n.onNodeCreated&&n.onNodeCreated(i,n,t,r),currentlyAddingScript=i,baseElement?head.insertBefore(i,baseElement):body?body.appendChild(i):head.appendChild(i),currentlyAddingScript=null,i;if(isWebWorker)try{setTimeout(function(){},0),importScripts(r),e.completeLoad(t)}catch(i){e.onError(makeError("importscripts","importScripts failed for "+t+" at "+r,i,[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 i,n;"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&&(i=currentlyAddingScript||getInteractiveScript())&&(e||(e=i.getAttribute("data-requiremodule")),n=contexts[i.getAttribute("data-requirecontext")]),n?(n.defQueue.push([e,t,r]),n.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,i,n,o,s={waitSeconds:(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).waitSeconds||30,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},a={},u={},c={},l=[],f={},d={},p={},h=1,m=1;function g(e,t,r){var i,n,o,a,u,c,l,f,d,p,h=t&&t.split("/"),m=s.map,g=m&&m["*"];if(e&&(c=(e=e.split("/")).length-1,s.nodeIdCompat&&jsSuffixRegExp.test(e[c])&&(e[c]=e[c].replace(jsSuffixRegExp,"")),"."===e[0].charAt(0)&&h&&(e=h.slice(0,h.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&&m&&(h||g)){for(o=(n=e.split("/")).length;o>0;o-=1){if(u=n.slice(0,o).join("/"),h){var v=!1;for(a=h.length;a>0;a-=1)if((i=getOwn(m,h.slice(0,a).join("/")))&&(i=getOwn(i,u))){l=i,f=o,v=!0;break}if(v)break}!d&&g&&getOwn(g,u)&&(d=getOwn(g,u),p=o)}!l&&d&&(l=d,f=p),l&&(n.splice(0,f,l),e=n.join("/"))}return getOwn(s.pkgs,e)||e}function v(e){isBrowser&&each(scripts(),function(t){if(t.getAttribute("data-requiremodule")===e&&t.getAttribute("data-requirecontext")===i.contextName)return t.parentNode.removeChild(t),!0})}function y(e){var t=getOwn(s.paths,e);if(t&&isArray(t)&&t.length>1)return t.shift(),i.require.undef(e),i.makeRequire(null,{skipMap:!0})([e]),!0}function b(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 _(e,t,r,n){var o,s,a,u,c=null,l=t?t.name:null,d=e,p=!0,v="";return e||(p=!1,e="_@r"+(h+=1)),c=(u=b(e))[0],e=u[1],c&&(c=g(c,l,n),s=getOwn(f,c)),e&&(c?v=s&&s.normalize?s.normalize(e,function(e){return g(e,l,n)}):-1===e.indexOf("!")?g(e,l,n):e:(c=(u=b(v=g(e,l,n)))[0],v=u[1],r=!0,o=i.nameToUrl(v))),{prefix:c,name:v,parentMap:t,unnormalized:!!(a=!c||s||r?"":"_unnormalized"+(m+=1)),url:o,originalName:d,isDefine:p,id:(c?c+"!"+v:v)+a}}function k(e){var t=e.id,r=getOwn(a,t);return r||(r=a[t]=new i.Module(e)),r}function x(e,t,r){var i=e.id,n=getOwn(a,i);!hasProp(f,i)||n&&!n.defineEmitComplete?(n=k(e)).error&&"error"===t?r(n.error):n.on(t,r):"defined"===t&&r(f[i])}function w(e,t){var r=e.requireModules,i=!1;t?t(e):(each(r,function(t){var r=getOwn(a,t);r&&(r.error=e,r.events.error&&(i=!0,r.emit("error",e)))}),i||req.onError(e))}function O(){globalDefQueue.length&&(each(globalDefQueue,function(e){var t=e[0];"string"==typeof t&&(i.defQueueMap[t]=!0),l.push(e)}),globalDefQueue=[])}function q(e){delete a[e],delete u[e]}function P(e,t,r){var i=e.map.id;e.error?e.emit("error",e.error):(t[i]=!0,each(e.depMaps,function(i,n){var o=i.id,s=getOwn(a,o);!s||e.depMatched[n]||r[o]||(getOwn(t,o)?(e.defineDep(n,f[o]),e.check()):P(s,t,r))}),r[i]=!0)}function E(){var e,r,n=1e3*s.waitSeconds,a=n&&i.startTime+n<(new Date).getTime(),c=[],l=[],f=!1,d=!0;if(!t){if(t=!0,eachProp(u,function(e){var t=e.map,i=t.id;if(e.enabled&&(t.isDefine||l.push(e),!e.error))if(!e.inited&&a)y(i)?(r=!0,f=!0):(c.push(i),v(i));else if(!e.inited&&e.fetched&&t.isDefine&&(f=!0,!t.prefix))return d=!1}),a&&c.length)return(e=makeError("timeout","Load timeout for modules: "+c,null,c)).contextName=i.contextName,w(e);d&&each(l,function(e){P(e,{},{})}),a&&!r||!f||!isBrowser&&!isWebWorker||o||(o=setTimeout(function(){o=0,E()},50)),t=!1}}function j(e){hasProp(f,e[0])||k(_(e[0],null,!0)).init(e[1],e[2])}function S(e,t,r,i){e.detachEvent&&!isOpera?i&&e.detachEvent(i,t):e.removeEventListener(r,t,!1)}function A(e){var t=e.currentTarget||e.srcElement;return S(t,i.onScriptLoad,"load","onreadystatechange"),S(t,i.onScriptError,"error"),{node:t,id:t&&t.getAttribute("data-requiremodule")}}function C(){var e;for(O();l.length;){if(null===(e=l.shift())[0])return w(makeError("mismatch","Mismatched anonymous define() module: "+e[e.length-1]));j(e)}i.defQueueMap={}}return n={require:function(e){return e.require?e.require:e.require=i.makeRequire(e.map)},exports:function(e){e.usingExports=!0,e.map.isDefine&&(e.exports?f[e.map.id]=e.exports:e.exports=f[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(s.config,e.map.id)||{}},exports:e.exports||(e.exports={})}}},(r=function(e){this.events=getOwn(c,e.id)||{},this.map=e,this.shim=getOwn(s.shim,e.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0}).prototype={init:function(e,t,r,i){i=i||{},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=i.ignore,i.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,i.startTime=(new Date).getTime();var e=this.map;if(!this.shim)return e.prefix?this.callPlugin():this.load();i.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;d[e]||(d[e]=!0,i.load(this.map.id,e))},check:function(){if(this.enabled&&!this.enabling){var e,t,r=this.map.id,n=this.depExports,o=this.exports,s=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(s)){if(this.events.error&&this.map.isDefine||req.onError!==defaultOnError)try{o=i.execCb(r,s,n,o)}catch(t){e=t}else o=i.execCb(r,s,n,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=s;if(this.exports=o,this.map.isDefine&&!this.ignore&&(f[r]=o,req.onResourceLoad)){var a=[];each(this.depMaps,function(e){a.push(e.normalizedMap||e)}),req.onResourceLoad(i,this.map,a)}q(r),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else hasProp(i.defQueueMap,r)||this.fetch()}},callPlugin:function(){var e=this.map,t=e.id,r=_(e.prefix);this.depMaps.push(r),x(r,"defined",bind(this,function(r){var n,o,u,c=getOwn(p,this.map.id),l=this.map.name,f=this.map.parentMap?this.map.parentMap.name:null,d=i.makeRequire(e.parentMap,{enableBuildCallback:!0});return this.map.unnormalized?(r.normalize&&(l=r.normalize(l,function(e){return g(e,f,!0)})||""),x(o=_(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(a,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=i.nameToUrl(c),void this.load()):((n=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(a,function(e){0===e.map.id.indexOf(t+"_unnormalized")&&q(e.map.id)}),w(e)}),n.fromText=bind(this,function(r,o){var a=e.name,u=_(a),c=useInteractive;o&&(r=o),c&&(useInteractive=!1),k(u),hasProp(s.config,t)&&(s.config[a]=s.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),i.completeLoad(a),d([a],n)}),void r.load(e.name,d,n,s))})),i.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,s;if("string"==typeof e){if(e=_(e,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[t]=e,s=getOwn(n,e.id))return void(this.depExports[t]=s(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=a[r],hasProp(n,r)||!o||o.enabled||i.enable(e,this)})),eachProp(this.pluginMaps,bind(this,function(e){var t=getOwn(a,e.id);t&&!t.enabled&&i.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]}},i={config:s,contextName:e,registry:a,defined:f,urlFetched:d,defQueue:l,defQueueMap:{},Module:r,makeModuleMap:_,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=s.shim,n={paths:!0,bundles:!0,config:!0,map:!0};eachProp(e,function(e,t){n[t]?(s[t]||(s[t]={}),mixin(s[t],e,!0,!0)):s[t]=e}),e.bundles&&eachProp(e.bundles,function(e,t){each(e,function(e){e!==t&&(p[e]=t)})}),e.shim&&(eachProp(e.shim,function(e,t){isArray(e)&&(e={deps:e}),!e.exports&&!e.init||e.exportsFn||(e.exportsFn=i.makeShimExports(e)),r[t]=e}),s.shim=r),e.packages&&each(e.packages,function(e){var t;t=(e="string"==typeof e?{name:e}:e).name,e.location&&(s.paths[t]=e.location),s.pkgs[t]=e.name+"/"+(e.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}),eachProp(a,function(e,t){e.inited||e.map.unnormalized||(e.map=_(t,null,!0))}),(e.deps||e.callback)&&i.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(s,u,c){var l,d;return r.enableBuildCallback&&u&&isFunction(u)&&(u.__requireJsBuild=!0),"string"==typeof s?isFunction(u)?w(makeError("requireargs","Invalid require call"),c):t&&hasProp(n,s)?n[s](a[t.id]):req.get?req.get(i,s,t,o):(l=_(s,t,!1,!0).id,hasProp(f,l)?f[l]:w(makeError("notloaded",'Module name "'+l+'" has not been loaded yet for context: '+e+(t?"":". Use require([])")))):(C(),i.nextTick(function(){C(),(d=k(_(null,t))).skipMap=r.skipMap,d.init(s,u,c,{enabled:!0}),E()}),o)}return r=r||{},mixin(o,{isBrowser:isBrowser,toUrl:function(e){var r,n=e.lastIndexOf("."),o=e.split("/")[0];return-1!==n&&(!("."===o||".."===o)||n>1)&&(r=e.substring(n,e.length),e=e.substring(0,n)),i.nameToUrl(g(e,t&&t.id,!0),r,!0)},defined:function(e){return hasProp(f,_(e,t,!1,!0).id)},specified:function(e){return e=_(e,t,!1,!0).id,hasProp(f,e)||hasProp(a,e)}}),t||(o.undef=function(e){O();var r=_(e,t,!0),n=getOwn(a,e);n.undefed=!0,v(e),delete f[e],delete d[r.url],delete c[e],eachReverse(l,function(t,r){t[0]===e&&l.splice(r,1)}),delete i.defQueueMap[e],n&&(n.events.defined&&(c[e]=n.events),q(e))}),o},enable:function(e){getOwn(a,e.id)&&k(e).enable()},completeLoad:function(e){var t,r,n,o=getOwn(s.shim,e)||{},u=o.exports;for(O();l.length;){if(null===(r=l.shift())[0]){if(r[0]=e,t)break;t=!0}else r[0]===e&&(t=!0);j(r)}if(i.defQueueMap={},n=getOwn(a,e),!t&&!hasProp(f,e)&&n&&!n.inited){if(!(!s.enforceDefine||u&&getGlobal(u)))return y(e)?void 0:w(makeError("nodefine","No define call for "+e,null,[e]));j([e,o.deps||[],o.exportsFn])}E()},nameToUrl:function(e,t,r){var n,o,a,u,c,l,f=getOwn(s.pkgs,e);if(f&&(e=f),l=getOwn(p,e))return i.nameToUrl(l,t,r);if(req.jsExtRegExp.test(e))u=e+(t||"");else{for(n=s.paths,a=(o=e.split("/")).length;a>0;a-=1)if(c=getOwn(n,o.slice(0,a).join("/"))){isArray(c)&&(c=c[0]),o.splice(0,a,c);break}u=o.join("/"),u=("/"===(u+=t||(/^data:|^blob:|\?/.test(u)||r?"":".js")).charAt(0)||u.match(/^[\w+.-]+:/)?"":s.baseUrl)+u}return s.urlArgs&&!/^blob:/.test(u)?u+s.urlArgs(e,u):u},load:function(e,t){req.load(i,e,t)},execCb:function(e,t,r,i){return t.apply(i,r)},onScriptLoad:function(e){if("load"===e.type||readyRegExp.test((e.currentTarget||e.srcElement).readyState)){interactiveScript=null;var t=A(e);i.completeLoad(t.id)}},onScriptError:function(e){var t=A(e);if(!y(t.id)){var r=[];return eachProp(a,function(e,i){0!==i.indexOf("_@r")&&each(e.depMaps,function(e){if(e.id===t.id)return r.push(i),!0})}),w(makeError("scripterror",'Script error for "'+t.id+(r.length?'", needed by: '+r.join(", "):'"'),e,[t.id]))}}},i.require=i.makeRequire(),i}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,i=function(e,r,i,n){var o=e,s=r,a=i,u=n;if(Array.isArray(e)&&"function"==typeof r)t(s=e,a=r,u=i);else{!e&&Array.isArray(s)&&(o=[]),Array.isArray(o)&&Array.isArray(s)&&(o=o.join("/"));var c=o?[]:s;"string"==typeof o&&o&&Array.isArray(s)&&s.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,a,u)}};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&void 0===i[n]&&(i[n]=t[n]);__devfab_requirejs._require=t,__devfab_requirejs._define=r,__devfab_requirejs.require=i,__devfab_requirejs.define=function(e,t,i){var n=e,o=t,s=i;if(Array.isArray(e)&&"function"==typeof t)r(o=e,s=t);else{!e&&Array.isArray(o)&&(n=[]),Array.isArray(n)&&Array.isArray(o)&&(n=n.join("/"));var a=n?[]:o;"string"==typeof n&&n&&Array.isArray(o)&&o.forEach(function(e){a.push("".concat(n).concat("/"===e.substr(0,1)?"":"/").concat(e))}),r(a,s)}}}}();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="",i=0;i<t.length;i++)r+=t[i].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 i=normalizePath(e[r]);if(!this._moduleIndex()[i])return{code:CODE_POLICY,message:"Module ".concat(i," 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 i="undefined"!=typeof globalThis&&globalThis.crypto&&globalThis.crypto.subtle;return i?this.fetch?Promise.resolve().then(function(){return r.fetch(e)}).then(function(e){return e&&e.ok?e.arrayBuffer().then(function(e){return i.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),i=String(t).toLowerCase();return r!==i?{ok:!1,message:"sha256 不匹配:期望 ".concat(i,",实际 ").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(),i=[];if(!t)return i;r.forEach(function(r,n){var o=-1!==e.watch.indexOf(n);t.has(n)?t.get(n)!==r&&i.push({type:"overwritten",key:n,watched:o}):i.push({type:"added",key:n,watched:o})});var n=i.filter(function(e){return e.watched}).length,o=i.filter(function(e){return"added"===e.type}).length;return!n&&o<=this.maxPollution?[]:i}},{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,i){var n=e,o=t,s=r;Array.isArray(e)&&!Array.isArray(t)&&(n=null==i?void 0:i.path,o=e,s="function"==typeof t?t:r);var a=(o=Array.isArray(o)?o:[]).join(","),u={code:0,message:"",data:[],warnings:[]};return("require"===i.type&&"function"!=typeof i.require||"define"===i.type&&"function"!=typeof i.define)&&(u.code=404,u.message="requirejs is undefined, the fiels: ".concat(a)),{path:n,files:o,callback:s,filesStr:a,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,i,n,o;_classCallCheck(this,e);var s=t||{};this.__debug=null!==(r=s.__debug)&&void 0!==r&&r,this.__rootPath=void 0,this.__define=s.define||(null===(i=window.__devfab_requirejs)||void 0===i?void 0:i.define),this.__require=s.require||(null===(n=window.__devfab_requirejs)||void 0===n?void 0:n.require),this.__undef=s.undef||("function"==typeof(null===(o=this.__require)||void 0===o?void 0:o.undef)?this.__require.undef:null),this.__requireConfig=s.requireConfig||this._pickRequireConfig(this.__require),this.__import=s.importer||null,this._setTimer=s.setTimeout||function(e,t){return setTimeout(e,t)},this._clearTimer=s.clearTimeout||function(e){return clearTimeout(e)},this.options={version:s.version?String(s.version):DEFAULT_OPTIONS.version,timeout:void 0===s.timeout?DEFAULT_OPTIONS.timeout:Math.max(0,toNumber(s.timeout,0)),retry:void 0===s.retry?DEFAULT_OPTIONS.retry:Math.max(0,toNumber(s.retry,0)),strict:!!s.strict,baseUrl:s.baseUrl||DEFAULT_OPTIONS.baseUrl},this.policy=new LoadPolicy(s),this.guard=new GlobalGuard(this._guardOptions(s)),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 i=parseArgs(e,t,r,{path:this.__rootPath,define:this.__define,type:"define"}),n=i.path,o=i.files,s=i.callback,a=i.result;404!==a.code?this.__define(n,o,s):null==s||s(a)}},{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 i=this,n=this.options,o=parseArgs(e,t,r,{path:this.__rootPath,require:this.__require,type:"require"}),s=o.path,a=o.files,u=o.callback,c=o.result,l=o.filesStr;if(404!==c.code){var f=toModuleIds(s,a),d=this.policy.checkModules(f);if(d)return c.code=d.code,c.message=d.message,void(null==u||u(c));var p=!1,h=0,m=null,g=null,v=function(){g&&(c.warnings=i._mergeWarnings(c.warnings,g.end()),g=null)},y=function(){p||(p=!0,null!==m&&(i._clearTimer(m),m=null),v(),n.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))},b=function(){h++,g=i.guard.begin(),n.timeout>0&&(m=i._setTimer(function(){if(!p){var e=new Error("load timeout after ".concat(n.timeout,"ms: ").concat(l));e.__devfabTimeout=!0,_(e,"files load timeout after ".concat(n.timeout,"ms, the files: ").concat(l))}},n.timeout)),i.__require(s,a,function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];c.data=t,y()},function(e){_(e)})},_=function(e,t){if(!p){if(null!==m&&(i._clearTimer(m),m=null),h<=n.retry)return v(),i._undefModules(f),void b();c.code=e&&e.__devfabTimeout?CODE_TIMEOUT:500,c.message=t||"files load error, the files: ".concat(l),c.error=e,y()}};b()}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),i=this.policy.checkOrigin(r);if(i)return Promise.resolve({ok:!1,code:i.code,message:i.message});var n=this.policy.entryOf(e),o=n&&n.sha256,s=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?s():{ok:!1,code:CODE_POLICY,message:"".concat(e.message,"(").concat(r,")")}}):s()}},{key:"loadModules",value:function(e,t,r){var i=this,n=parseArgs(e,t,r,{path:this.__rootPath,type:"module"}),o=n.path,s=n.files,a=n.callback,u=n.result,c=n.filesStr,l=toModuleIds(o,s),f=function(e){return null==a||a(e),e},d=this.policy.checkModules(l);if(d)return u.code=d.code,u.message=d.message,Promise.resolve(f(u));if(!s.length)return Promise.resolve(f(u));var p=this.guard.begin();return Promise.all(l.map(function(e){return i._importOne(e)})).then(function(e){u.warnings=p.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}),f(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,i){var n=this,o=e,s=t,a=r,u=i;Array.isArray(e)&&"function"==typeof t&&(o=void 0,s=e,a=t,u=r),this._load(o,s,function(e){if(0==e.code&&Array.isArray(e.data))for(var t=0,r=e.data.length;t<r;t++){var i,o=e.data[t];null===(i=a)||void 0===i||i(o,t)}else"function"==typeof u?u(e):n.__debug&&console.error("[devfab][FileRequire][injectScript] error: ",e)})}},{key:"requireScript",value:function(e,t,r){this.injectScript(e,t,r)}}])}(),FileRequire=new FileRequireClass;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},exports.CODE_POLICY=CODE_POLICY,exports.CODE_TIMEOUT=CODE_TIMEOUT,exports.DEFAULT_WATCH=DEFAULT_WATCH,exports.FileRequire=FileRequire,exports.GlobalGuard=GlobalGuard,exports.LoadPolicy=LoadPolicy,exports.default=FileRequire;
|
|
5
|
+
*/Object.defineProperty(exports,"__esModule",{value:!0});var __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,i){return t&&eachProp(t,function(t,n){!r&&hasProp(e,n)||(!i||"object"!==_typeof(t)||!t||isArray(t)||isFunction(t)||t instanceof RegExp?e[n]=t:(e[n]||(e[n]={}),mixin(e[n],t,r,i)))}),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,i){var n=new Error(t+"\nhttp://requirejs.org/docs/errors.html#"+e);return n.requireType=e,n.requireModules=i,r&&(n.originalError=r),n}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,i){var n,o,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=defContextName;return isArray(e)||"string"==typeof e||(o=e,isArray(t)?(e=t,t=r,r=i):e=[]),o&&o.context&&(a=o.context),s.name&&(a=s.name),(n=getOwn(contexts,a))||(n=contexts[a]=req.s.newContext(a,s)),o&&n.configure(o),n.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 i,n="";try{r.split("?")[0].endsWith(".css")&&(n="css")}catch(e){}return"css"===n?((i=e.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:link"):document.createElement("link")).href=r,i.rel="stylesheet",i.type=e.linkType||"text/css",i):((i=e.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script")).type=e.scriptType||"text/javascript",i.charset="utf-8",i.async=!1,i)},req.load=function(e,t,r){var i,n=e&&e.config||{};if(isBrowser)return(i=req.createNode(n,t,r)).setAttribute("data-requirecontext",e.contextName),i.setAttribute("data-requiremodule",t),!i.attachEvent||i.attachEvent.toString&&i.attachEvent.toString().indexOf("[native code")<0||isOpera?(i.addEventListener("load",e.onScriptLoad,!1),i.addEventListener("error",e.onScriptError,!1)):(useInteractive=!0,i.attachEvent("onreadystatechange",e.onScriptLoad)),i.src=r,n.onNodeCreated&&n.onNodeCreated(i,n,t,r),currentlyAddingScript=i,baseElement?head.insertBefore(i,baseElement):body?body.appendChild(i):head.appendChild(i),currentlyAddingScript=null,i;if(isWebWorker)try{setTimeout(function(){},0),importScripts(r),e.completeLoad(t)}catch(i){e.onError(makeError("importscripts","importScripts failed for "+t+" at "+r,i,[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 i,n;"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&&(i=currentlyAddingScript||getInteractiveScript())&&(e||(e=i.getAttribute("data-requiremodule")),n=contexts[i.getAttribute("data-requirecontext")]),n?(n.defQueue.push([e,t,r]),n.defQueueMap[e]=!0):globalDefQueue.push([e,t,r])},define.amd={jQuery:!0},req.exec=function(text){return eval(text)},__requirejs.require=require,__requirejs.define=define,req(cfg)}function newContext(e){var t,r,i,n,o,s={waitSeconds:(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).waitSeconds||30,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},a={},u={},c={},l=[],f={},d={},p={},h=1,m=1;function g(e,t,r){var i,n,o,a,u,c,l,f,d,p,h=t&&t.split("/"),m=s.map,g=m&&m["*"];if(e&&(c=(e=e.split("/")).length-1,s.nodeIdCompat&&jsSuffixRegExp.test(e[c])&&(e[c]=e[c].replace(jsSuffixRegExp,"")),"."===e[0].charAt(0)&&h&&(e=h.slice(0,h.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&&m&&(h||g)){for(o=(n=e.split("/")).length;o>0;o-=1){if(u=n.slice(0,o).join("/"),h){var v=!1;for(a=h.length;a>0;a-=1)if((i=getOwn(m,h.slice(0,a).join("/")))&&(i=getOwn(i,u))){l=i,f=o,v=!0;break}if(v)break}!d&&g&&getOwn(g,u)&&(d=getOwn(g,u),p=o)}!l&&d&&(l=d,f=p),l&&(n.splice(0,f,l),e=n.join("/"))}return getOwn(s.pkgs,e)||e}function v(e){isBrowser&&each(scripts(),function(t){if(t.getAttribute("data-requiremodule")===e&&t.getAttribute("data-requirecontext")===i.contextName)return t.parentNode.removeChild(t),!0})}function y(e){var t=getOwn(s.paths,e);if(t&&isArray(t)&&t.length>1)return t.shift(),i.require.undef(e),i.makeRequire(null,{skipMap:!0})([e]),!0}function b(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 _(e,t,r,n){var o,s,a,u,c=null,l=t?t.name:null,d=e,p=!0,v="";return e||(p=!1,e="_@r"+(h+=1)),c=(u=b(e))[0],e=u[1],c&&(c=g(c,l,n),s=getOwn(f,c)),e&&(c?v=s&&s.normalize?s.normalize(e,function(e){return g(e,l,n)}):-1===e.indexOf("!")?g(e,l,n):e:(c=(u=b(v=g(e,l,n)))[0],v=u[1],r=!0,o=i.nameToUrl(v))),{prefix:c,name:v,parentMap:t,unnormalized:!!(a=!c||s||r?"":"_unnormalized"+(m+=1)),url:o,originalName:d,isDefine:p,id:(c?c+"!"+v:v)+a}}function x(e){var t=e.id,r=getOwn(a,t);return r||(r=a[t]=new i.Module(e)),r}function k(e,t,r){var i=e.id,n=getOwn(a,i);!hasProp(f,i)||n&&!n.defineEmitComplete?(n=x(e)).error&&"error"===t?r(n.error):n.on(t,r):"defined"===t&&r(f[i])}function w(e,t){var r=e.requireModules,i=!1;t?t(e):(each(r,function(t){var r=getOwn(a,t);r&&(r.error=e,r.events.error&&(i=!0,r.emit("error",e)))}),i||req.onError(e))}function q(){globalDefQueue.length&&(each(globalDefQueue,function(e){var t=e[0];"string"==typeof t&&(i.defQueueMap[t]=!0),l.push(e)}),globalDefQueue=[])}function O(e){delete a[e],delete u[e]}function E(e,t,r){var i=e.map.id;e.error?e.emit("error",e.error):(t[i]=!0,each(e.depMaps,function(i,n){var o=i.id,s=getOwn(a,o);!s||e.depMatched[n]||r[o]||(getOwn(t,o)?(e.defineDep(n,f[o]),e.check()):E(s,t,r))}),r[i]=!0)}function P(){var e,r,n=1e3*s.waitSeconds,a=n&&i.startTime+n<(new Date).getTime(),c=[],l=[],f=!1,d=!0;if(!t){if(t=!0,eachProp(u,function(e){var t=e.map,i=t.id;if(e.enabled&&(t.isDefine||l.push(e),!e.error))if(!e.inited&&a)y(i)?(r=!0,f=!0):(c.push(i),v(i));else if(!e.inited&&e.fetched&&t.isDefine&&(f=!0,!t.prefix))return d=!1}),a&&c.length)return(e=makeError("timeout","Load timeout for modules: "+c,null,c)).contextName=i.contextName,w(e);d&&each(l,function(e){E(e,{},{})}),a&&!r||!f||!isBrowser&&!isWebWorker||o||(o=setTimeout(function(){o=0,P()},50)),t=!1}}function A(e){hasProp(f,e[0])||x(_(e[0],null,!0)).init(e[1],e[2])}function S(e,t,r,i){e.detachEvent&&!isOpera?i&&e.detachEvent(i,t):e.removeEventListener(r,t,!1)}function j(e){var t=e.currentTarget||e.srcElement;return S(t,i.onScriptLoad,"load","onreadystatechange"),S(t,i.onScriptError,"error"),{node:t,id:t&&t.getAttribute("data-requiremodule")}}function T(){var e;for(q();l.length;){if(null===(e=l.shift())[0])return w(makeError("mismatch","Mismatched anonymous define() module: "+e[e.length-1]));A(e)}i.defQueueMap={}}return n={require:function(e){return e.require?e.require:e.require=i.makeRequire(e.map)},exports:function(e){e.usingExports=!0,e.map.isDefine&&(e.exports?f[e.map.id]=e.exports:e.exports=f[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(s.config,e.map.id)||{}},exports:e.exports||(e.exports={})}}},(r=function(e){this.events=getOwn(c,e.id)||{},this.map=e,this.shim=getOwn(s.shim,e.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0}).prototype={init:function(e,t,r,i){i=i||{},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=i.ignore,i.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,i.startTime=(new Date).getTime();var e=this.map;if(!this.shim)return e.prefix?this.callPlugin():this.load();i.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;d[e]||(d[e]=!0,i.load(this.map.id,e))},check:function(){if(this.enabled&&!this.enabling){var e,t,r=this.map.id,n=this.depExports,o=this.exports,s=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(s)){if(this.events.error&&this.map.isDefine||req.onError!==defaultOnError)try{o=i.execCb(r,s,n,o)}catch(t){e=t}else o=i.execCb(r,s,n,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=s;if(this.exports=o,this.map.isDefine&&!this.ignore&&(f[r]=o,req.onResourceLoad)){var a=[];each(this.depMaps,function(e){a.push(e.normalizedMap||e)}),req.onResourceLoad(i,this.map,a)}O(r),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else hasProp(i.defQueueMap,r)||this.fetch()}},callPlugin:function(){var e=this.map,t=e.id,r=_(e.prefix);this.depMaps.push(r),k(r,"defined",bind(this,function(r){var n,o,u,c=getOwn(p,this.map.id),l=this.map.name,f=this.map.parentMap?this.map.parentMap.name:null,d=i.makeRequire(e.parentMap,{enableBuildCallback:!0});return this.map.unnormalized?(r.normalize&&(l=r.normalize(l,function(e){return g(e,f,!0)})||""),k(o=_(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(a,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=i.nameToUrl(c),void this.load()):((n=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(a,function(e){0===e.map.id.indexOf(t+"_unnormalized")&&O(e.map.id)}),w(e)}),n.fromText=bind(this,function(r,o){var a=e.name,u=_(a),c=useInteractive;o&&(r=o),c&&(useInteractive=!1),x(u),hasProp(s.config,t)&&(s.config[a]=s.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),i.completeLoad(a),d([a],n)}),void r.load(e.name,d,n,s))})),i.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,s;if("string"==typeof e){if(e=_(e,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[t]=e,s=getOwn(n,e.id))return void(this.depExports[t]=s(this));this.depCount+=1,k(e,"defined",bind(this,function(e){this.undefed||(this.defineDep(t,e),this.check())})),this.errback?k(e,"error",bind(this,this.errback)):this.events.error&&k(e,"error",bind(this,function(e){this.emit("error",e)}))}r=e.id,o=a[r],hasProp(n,r)||!o||o.enabled||i.enable(e,this)})),eachProp(this.pluginMaps,bind(this,function(e){var t=getOwn(a,e.id);t&&!t.enabled&&i.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]}},i={config:s,contextName:e,registry:a,defined:f,urlFetched:d,defQueue:l,defQueueMap:{},Module:r,makeModuleMap:_,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=s.shim,n={paths:!0,bundles:!0,config:!0,map:!0};eachProp(e,function(e,t){n[t]?(s[t]||(s[t]={}),mixin(s[t],e,!0,!0)):s[t]=e}),e.bundles&&eachProp(e.bundles,function(e,t){each(e,function(e){e!==t&&(p[e]=t)})}),e.shim&&(eachProp(e.shim,function(e,t){isArray(e)&&(e={deps:e}),!e.exports&&!e.init||e.exportsFn||(e.exportsFn=i.makeShimExports(e)),r[t]=e}),s.shim=r),e.packages&&each(e.packages,function(e){var t;t=(e="string"==typeof e?{name:e}:e).name,e.location&&(s.paths[t]=e.location),s.pkgs[t]=e.name+"/"+(e.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}),eachProp(a,function(e,t){e.inited||e.map.unnormalized||(e.map=_(t,null,!0))}),(e.deps||e.callback)&&i.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(s,u,c){var l,d;return r.enableBuildCallback&&u&&isFunction(u)&&(u.__requireJsBuild=!0),"string"==typeof s?isFunction(u)?w(makeError("requireargs","Invalid require call"),c):t&&hasProp(n,s)?n[s](a[t.id]):req.get?req.get(i,s,t,o):(l=_(s,t,!1,!0).id,hasProp(f,l)?f[l]:w(makeError("notloaded",'Module name "'+l+'" has not been loaded yet for context: '+e+(t?"":". Use require([])")))):(T(),i.nextTick(function(){T(),(d=x(_(null,t))).skipMap=r.skipMap,d.init(s,u,c,{enabled:!0}),P()}),o)}return r=r||{},mixin(o,{isBrowser:isBrowser,toUrl:function(e){var r,n=e.lastIndexOf("."),o=e.split("/")[0];return-1!==n&&(!("."===o||".."===o)||n>1)&&(r=e.substring(n,e.length),e=e.substring(0,n)),i.nameToUrl(g(e,t&&t.id,!0),r,!0)},defined:function(e){return hasProp(f,_(e,t,!1,!0).id)},specified:function(e){return e=_(e,t,!1,!0).id,hasProp(f,e)||hasProp(a,e)}}),t||(o.undef=function(e){q();var r=_(e,t,!0),n=getOwn(a,e);n.undefed=!0,v(e),delete f[e],delete d[r.url],delete c[e],eachReverse(l,function(t,r){t[0]===e&&l.splice(r,1)}),delete i.defQueueMap[e],n&&(n.events.defined&&(c[e]=n.events),O(e))}),o},enable:function(e){getOwn(a,e.id)&&x(e).enable()},completeLoad:function(e){var t,r,n,o=getOwn(s.shim,e)||{},u=o.exports;for(q();l.length;){if(null===(r=l.shift())[0]){if(r[0]=e,t)break;t=!0}else r[0]===e&&(t=!0);A(r)}if(i.defQueueMap={},n=getOwn(a,e),!t&&!hasProp(f,e)&&n&&!n.inited){if(!(!s.enforceDefine||u&&getGlobal(u)))return y(e)?void 0:w(makeError("nodefine","No define call for "+e,null,[e]));A([e,o.deps||[],o.exportsFn])}P()},nameToUrl:function(e,t,r){var n,o,a,u,c,l,f=getOwn(s.pkgs,e);if(f&&(e=f),l=getOwn(p,e))return i.nameToUrl(l,t,r);if(req.jsExtRegExp.test(e))u=e+(t||"");else{for(n=s.paths,a=(o=e.split("/")).length;a>0;a-=1)if(c=getOwn(n,o.slice(0,a).join("/"))){isArray(c)&&(c=c[0]),o.splice(0,a,c);break}u=o.join("/"),u=("/"===(u+=t||(/^data:|^blob:|\?/.test(u)||r?"":".js")).charAt(0)||u.match(/^[\w+.-]+:/)?"":s.baseUrl)+u}return s.urlArgs&&!/^blob:/.test(u)?u+s.urlArgs(e,u):u},load:function(e,t){req.load(i,e,t)},execCb:function(e,t,r,i){return t.apply(i,r)},onScriptLoad:function(e){if("load"===e.type||readyRegExp.test((e.currentTarget||e.srcElement).readyState)){interactiveScript=null;var t=j(e);i.completeLoad(t.id)}},onScriptError:function(e){var t=j(e);if(!y(t.id)){var r=[];return eachProp(a,function(e,i){0!==i.indexOf("_@r")&&each(e.depMaps,function(e){if(e.id===t.id)return r.push(i),!0})}),w(makeError("scripterror",'Script error for "'+t.id+(r.length?'", needed by: '+r.join(", "):'"'),e,[t.id]))}}},i.require=i.makeRequire(),i}function getInteractiveScript(){return interactiveScript&&"interactive"===interactiveScript.readyState||eachReverse(scripts(),function(e){if("interactive"===e.readyState)return interactiveScript=e}),interactiveScript}})("undefined"!=typeof window?window:globalThis,"undefined"==typeof setTimeout?void 0:setTimeout),function(e){if(!__requirejs.__requirejsAdapterApplied){__requirejs.__requirejsAdapterApplied=!0;var t=__requirejs.require,r=__requirejs.define,i=function(e,r,i,n){var o=e,s=r,a=i,u=n;if(Array.isArray(e)&&"function"==typeof r)t(s=e,a=r,u=i);else{!e&&Array.isArray(s)&&(o=[]),Array.isArray(o)&&Array.isArray(s)&&(o=o.join("/"));var c=o?[]:s;"string"==typeof o&&o&&Array.isArray(s)&&s.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,a,u)}},n=function(e,t,i){var n=e,o=t,s=i;if(Array.isArray(e)&&"function"==typeof t)r(o=e,s=t);else{!e&&Array.isArray(o)&&(n=[]),Array.isArray(n)&&Array.isArray(o)&&(n=n.join("/"));var a=n?[]:o;"string"==typeof n&&n&&Array.isArray(o)&&o.forEach(function(e){a.push("".concat(n).concat("/"===e.substr(0,1)?"":"/").concat(e))}),r(a,s)}};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&void 0===i[o]&&(i[o]=t[o]);i.__devfabAdapterApplied=!0,n.__devfabAdapterApplied=!0,__requirejs._require=t,__requirejs._define=r,__requirejs.require=i,__requirejs.define=n}}();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="",i=0;i<t.length;i++)r+=t[i].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 i=normalizePath(e[r]);if(!this._moduleIndex()[i])return{code:CODE_POLICY,message:"Module ".concat(i," 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 i="undefined"!=typeof globalThis&&globalThis.crypto&&globalThis.crypto.subtle;return i?this.fetch?Promise.resolve().then(function(){return r.fetch(e)}).then(function(e){return e&&e.ok?e.arrayBuffer().then(function(e){return i.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),i=String(t).toLowerCase();return r!==i?{ok:!1,message:"sha256 不匹配:期望 ".concat(i,",实际 ").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"],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(),i=[];if(!t)return i;r.forEach(function(r,n){var o=-1!==e.watch.indexOf(n);t.has(n)?t.get(n)!==r&&i.push({type:"overwritten",key:n,watched:o}):i.push({type:"added",key:n,watched:o})});var n=i.filter(function(e){return e.watched}).length,o=i.filter(function(e){return"added"===e.type}).length;return!n&&o<=this.maxPollution?[]:i}},{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,i){var n=e,o=t,s=r;Array.isArray(e)&&!Array.isArray(t)&&(n=null==i?void 0:i.path,o=e,s="function"==typeof t?t:r);var a=(o=Array.isArray(o)?o:[]).join(","),u={code:0,message:"",data:[],warnings:[]};return("require"===i.type&&"function"!=typeof i.require||"define"===i.type&&"function"!=typeof i.define)&&(u.code=404,u.message="requirejs is undefined, the fiels: ".concat(a)),{path:n,files:o,callback:s,filesStr:a,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;_classCallCheck(this,e);var i=t||{};void 0!==i.debug&&(this.debug=!!i.debug),this.__rootPath=void 0,this.__define=__requirejs.define,this.__require=__requirejs.require,this.__undef="function"==typeof(null===(r=this.__require)||void 0===r?void 0:r.undef)?this.__require.undef:null,this.__requireConfig=this._pickRequireConfig(this.__require),this.__import=i.importer||null,this._setTimer=i.setTimeout||function(e,t){return setTimeout(e,t)},this._clearTimer=i.clearTimeout||function(e){return clearTimeout(e)},this.options={version:i.version?String(i.version):DEFAULT_OPTIONS.version,timeout:void 0===i.timeout?DEFAULT_OPTIONS.timeout:Math.max(0,toNumber(i.timeout,0)),retry:void 0===i.retry?DEFAULT_OPTIONS.retry:Math.max(0,toNumber(i.retry,0)),strict:!!i.strict,baseUrl:i.baseUrl||DEFAULT_OPTIONS.baseUrl},this.policy=new LoadPolicy(i),this.guard=new GlobalGuard(this._guardOptions(i)),this.options.version&&this._applyUrlArgs()},[{key:"debug",get:function(){var e="undefined"!=typeof window?window.__devfab:null;return!(!e||!e.debug)},set:function(e){"undefined"!=typeof window&&(window.__devfab=window.__devfab||{},window.__devfab.debug=!!e)}},{key:"_pickRequireConfig",value:function(e){return e&&"function"==typeof e.config?e.config.bind(e):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:"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 i=parseArgs(e,t,r,{path:this.__rootPath,define:this.__define,type:"define"}),n=i.path,o=i.files,s=i.callback,a=i.result;404!==a.code?this.__define(n,o,s):null==s||s(a)}},{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 i=this,n=this.options,o=parseArgs(e,t,r,{path:this.__rootPath,require:this.__require,type:"require"}),s=o.path,a=o.files,u=o.callback,c=o.result,l=o.filesStr;if(404!==c.code){var f=toModuleIds(s,a),d=this.policy.checkModules(f);if(d)return c.code=d.code,c.message=d.message,void(null==u||u(c));var p=!1,h=0,m=null,g=null,v=function(){g&&(c.warnings=i._mergeWarnings(c.warnings,g.end()),g=null)},y=function(){p||(p=!0,null!==m&&(i._clearTimer(m),m=null),v(),n.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))},b=function(){h++,g=i.guard.begin(),n.timeout>0&&(m=i._setTimer(function(){if(!p){var e=new Error("load timeout after ".concat(n.timeout,"ms: ").concat(l));e.__devfabTimeout=!0,_(e,"files load timeout after ".concat(n.timeout,"ms, the files: ").concat(l))}},n.timeout)),i.__require(s,a,function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];c.data=t,y()},function(e){_(e)})},_=function(e,t){if(!p){if(null!==m&&(i._clearTimer(m),m=null),h<=n.retry)return v(),i._undefModules(f),void b();c.code=e&&e.__devfabTimeout?CODE_TIMEOUT:500,c.message=t||"files load error, the files: ".concat(l),c.error=e,y()}};b()}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),i=this.policy.checkOrigin(r);if(i)return Promise.resolve({ok:!1,code:i.code,message:i.message});var n=this.policy.entryOf(e),o=n&&n.sha256,s=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?s():{ok:!1,code:CODE_POLICY,message:"".concat(e.message,"(").concat(r,")")}}):s()}},{key:"loadModules",value:function(e,t,r){var i=this,n=parseArgs(e,t,r,{path:this.__rootPath,type:"module"}),o=n.path,s=n.files,a=n.callback,u=n.result,c=n.filesStr,l=toModuleIds(o,s),f=function(e){return null==a||a(e),e},d=this.policy.checkModules(l);if(d)return u.code=d.code,u.message=d.message,Promise.resolve(f(u));if(!s.length)return Promise.resolve(f(u));var p=this.guard.begin();return Promise.all(l.map(function(e){return i._importOne(e)})).then(function(e){u.warnings=p.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}),f(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:"provide",value:function(e,t,r){this._define(e,t,r)}},{key:"provideScript",value:function(e){var t=e;"function"!=typeof e&&(t=function(){return e}),this.provide([],t)}},{key:"inject",value:function(e,t,r){this._load(e,t,r)}},{key:"injectScript",value:function(e,t,r,i){var n=this,o=e,s=t,a=r,u=i;Array.isArray(e)&&"function"==typeof t&&(o=void 0,s=e,a=t,u=r),this.inject(o,s,function(e){if(0==e.code&&Array.isArray(e.data))for(var t=0,r=e.data.length;t<r;t++){var i,o=e.data[t];null===(i=a)||void 0===i||i(o,t)}else"function"==typeof u?u(e):n.debug&&console.error("[devfab][FileRequire][injectScript] error: ",e)})}}])}(),FileRequire=new FileRequireClass;window.__devfab=Object.assign({},window.__devfab),window.__devfab.FileRequire=FileRequire,exports.CODE_POLICY=CODE_POLICY,exports.CODE_TIMEOUT=CODE_TIMEOUT,exports.DEFAULT_WATCH=DEFAULT_WATCH,exports.FileRequire=FileRequire,exports.GlobalGuard=GlobalGuard,exports.LoadPolicy=LoadPolicy,exports.default=FileRequire;
|
package/dist/common/utils.esm.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function t(e,t,n,r,
|
|
1
|
+
function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function t(e,t,n,r,a,o,i){try{var s=e[o](i),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,a)}function n(e){return function(){var n=this,r=arguments;return new Promise(function(a,o){var i=e.apply(n,r);function s(e){t(i,a,o,s,u,"next",e)}function u(e){t(i,a,o,s,u,"throw",e)}s(void 0)})}}function r(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,l()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,_(r.key),r)}}function i(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e,t,n){return(t=_(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 c(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 l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(l=function(){return!!e})()}function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach(function(t){s(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function v(){
|
|
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:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var u=r&&r.prototype instanceof s?r:s,c=Object.create(u.prototype);return v(c,"_invoke",function(n,r,i){var o,s,u,c=0,l=i||[],f=!1,d={p:0,n:0,v:e,a:h,f:h.bind(e,4),d:function(t,n){return o=t,s=0,u=e,d.n=n,a}};function h(n,r){for(s=n,u=r,t=0;!f&&c&&!i&&t<l.length;t++){var i,o=l[t],h=d.p,v=o[2];n>3?(i=v===r)&&(u=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=h&&((i=n<2&&h<o[1])?(s=0,d.v=r,d.n=o[1]):h<v&&(i=n<3||o[0]>r||r>v)&&(o[4]=n,o[5]=r,d.n=v,s=0))}if(i||n>1)return a;throw f=!0,r}return function(i,l,v){if(c>1)throw TypeError("Generator is already running");for(f&&1===l&&h(l,v),s=l,u=v;(t=s<2?e:u)||!f;){o||(s?s<3?(s>1&&(d.n=-1),h(s,u)):d.n=u:d.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=(f=d.n<0)?u:n.call(r,d))!==a)break}catch(t){o=e,s=1,u=t}finally{c=1}}return{value:t,done:f}}}(n,i,o),!0),c}var a={};function s(){}function u(){}function c(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(v(t={},r,function(){return this}),t),f=c.prototype=s.prototype=Object.create(l);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,v(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,v(f,"constructor",c),v(c,"constructor",u),u.displayName="GeneratorFunction",v(c,i,"GeneratorFunction"),v(f),v(f,i,"Generator"),v(f,r,function(){return this}),v(f,"toString",function(){return"[object Generator]"}),(h=function(){return{w:o,m:d}})()}function v(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}v=function(e,t,n,r){function o(t,n){v(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},v(e,t,n,r)}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}function y(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 r,i,o,a,s=[],u=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);u=!0);}catch(e){c=!0,i=e}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||b(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 g(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)||b(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 _(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function m(e){return m="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},m(e)}function b(t,n){if(t){if("string"==typeof t)return e(t,n);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(t,n):void 0}}function k(e){return e||window.devfab&&window.devfab.debug}function w(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 r=(t=t.replace(/\+/g," ")).split("&"),i=0,o=r.length;i<o;i++){var a=r[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 x(e,t){if(!t)return e;var n=[],r=new w(e);for(var i in t)r.get(i)||n.push("".concat(i,"=").concat(t[i]));if(!n.length)return e;var o=n.join("&");return e.indexOf("?")>=0?"".concat(e,"&").concat(o):"".concat(e,"?").concat(o)}String.prototype.equalsIgnoreCase=function(e){return null!=e&&this.toLowerCase()===e.toLowerCase()};var P=function(e){return null!=e&&""!==e};var S=["children","render"],j=function(){return a(function e(){i(this,e),s(this,"_config",{componentField:["component"]}),s(this,"_components",{}),s(this,"_renderFactory",null)},[{key:"init",value:function(e,t,n){this._initConfig(e),this._initComponent(t),this._initRenderFactory(n)}},{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"===m(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 n=this;if(Array.isArray(e)){var r=[];return e.forEach(function(e,i){var o=d({},e),a=function(e,t,n){if(e){var r=n;"string"==typeof t&&Array.isArray(r)&&(r=s({},t,n));var i=r&&r[t];if(!i)return P(e[t])?e[t]:void 0;for(var o=0;o<i.length;o++){var a=e[i[o]];if(P(a))return a}}}(o,"component",n._config.componentField),u=o.children,c=o.render,l=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(o,S),f=n._getComponent(a);f||"function"==typeof c||console.log("[warning] Component ".concat(a," is not registered!"));var h={component:f,children:n._renderComponent(u,t)};l.index=i;var v=Object.assign({},null==t?void 0:t.props,{meta:l});"function"==typeof c?r.push(c({node:h,props:v})):"function"==typeof n._renderFactory?r.push(n._renderFactory({node:h,props:v})):(Object.assign(h,v),r.push(h))}),r}}},{key:"clear",value:function(){this._clearComponents(),this._renderFactory=null}}])}(),C=function(){function e(){return i(this,e),r(this,e,arguments)}return c(e,j),a(e,[{key:"initComponent",value:function(e,t){this._initComponent(e,t)}},{key:"getComponents",value:function(){return d({},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)}}])}();C.create=function(e){return new C(e)};var O={_xhrs:[],_jsonps:{index:0},doRequest:function(e){var t,n=e.method||"GET",r=e.url;try{null!=e&&e.requestHeaders&&(t=e.requestHeaders,e.requestHeaders=void 0,delete e.requestHeaders)}catch(e){k()&&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){k()&&console.log('[devfab][ajax]: [doRequest]: options.params["requestHeaders"] ERR : ',e)}var i=null;if(n.equalsIgnoreCase("get")||n.equalsIgnoreCase("delete")?r=x(r,e.params):(n.equalsIgnoreCase("post")||n.equalsIgnoreCase("put"))&&(i=JSON.stringify(e.params)),e.jsonp)return this.getJsonp(r,e.callback);var o=this.getXMLHttpRequest();if(o){var a;if(o.open(n,r,!1!==e.async),e.timeout&&(o.timeout=e.timeout,o.setRequestHeader("timeout",e.timeout),o.ontimeout=function(){O.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){k()&&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(){O.onreadystatechange(this,e)}}},onreadystatechange:function(e,t){if(4===e.readyState){if(200===e.status){var n;try{if("blob"===t.responseType){var r=function(e){var t=e.xhr.getAllResponseHeaders(),n={};return t.split("\r\n").map(function(e){var t=y(e.split(": "),2),r=t[0],i=t[1];n[r]=i}),n}({xhr:e});n={code:e.status,data:{data:e.response,headers:r}}}else n=JSON.parse(e.responseText)}catch(n){O.onerror(e,t,e.responseText)}if(!1===t.async)return e.isBusy=!1,t.onAfterRequest&&t.onAfterRequest(n),O.parseAjaxResult(n,!1,null,null,t,e);O.parseAjaxResult(n,t.async,t.callback,t.context,t,e),t.onAfterRequest&&t.onAfterRequest(n)}else if(0===e.status)O.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)O.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 O.onerror(e,t,i)}O.onerror(e,t,"Login information has expired. Please log in again or contact technical staff.")}e.isBusy=!1}},onerror:function(e,t,n){var r="[devfab][ajax]: [onerror]: api error \n [code]: ".concat(e.status," \n [error]: ").concat(("object"===m(n)?JSON.stringify(n):n)||"空"," \n [url]: ").concat(t.url," \n [token]: ").concat(document.cookie);k()&&console.log(r);var i="object"===m(n)?n:{code:500,message:n};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 n=e,r="callback"+this._jsonps.index++,i=document.createElement("script");this._jsonps[r]=function(e){try{t(e)}finally{document.body.removeChild(i)}},n+=-1===n.indexOf("?")?"?":"&callback=cb.rest.AjaxUtil._jsonps."+r,i.src=n,document.body.appendChild(i)},parseAjaxResult:function(e,t,n,r,i,o){if(e){if(!e.code)return!1===t?e:void(n&&n.call(r,null,e));if(200==e.code){if(!1===t)return{result:e.data};n&&n.call(r,null,e.data,e.message,e.errorDetail,e.code,e.displayCode&&e)}else{if(!1===t)return{error:e};n&&n.call(r,e)}}}};function A(e,t){this.init&&this.init(e),this.queryParams=t}A.create=function(e,t){return new A(e,t)},A.prototype.init=function(e){if(e)for(var t in this.config=e,this.config)this[t]=function(e){return function(t,n,r){return this.Do(e,t,n,null,r)}}(t),this["".concat(t,"Sync")]=function(e){return function(t){return this.Do(e,t,null,!1)}}(t)},A.prototype.Do=function(e,t,n,r,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=x(c,this.queryParams));var l=c,f=Object.assign({},u.options);return f.method=u.method||"GET","function"==typeof t?(f.callback=t,f.context=i||f.context||this):f.params=t,n&&(f.callback=n,f.context=i||f.context||this),!1===r&&(f.async=!1),this.ajax(l,f)}},A.prototype.ajax=function(e,t){return function(e,t){return t.url=e,O.doRequest(t)}(e,t)};var q=function(){return a(function e(t){i(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 r=this._events.get(e);Array.isArray(r)||(r=[]),r.push({callback:t,context:n}),this._events.set(e,r)}},{key:"onFirst",value:function(e,t,n){var r=this._firstevents.get(e);Array.isArray(r)||(r=[]),r.splice(0,0,{callback:t,context:n}),this._firstevents.set(e,r)}},{key:"execute",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var i=this._events.get(e),o=this._firstevents.get(e);if(!i&&!o)return!0;var a=!0;return[].concat(g(o||[]),g(i||[])).forEach(function(e){if(!1!==a){var t=e.callback.apply(e.context||void 0,n);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,n){if(e&&n.has(e))if(t){var r=n.get(e),i=null==r?void 0:r.findIndex(function(e){return e.callback===t});-1!==i&&(null==r||r.splice(i,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 r,i=this,o=n.resolve,a=n.reject,s=n.args,u=!0,c=t||[],l=!1,f=function(t){var n,r=c[t];if(!1===u)return 0;if(l)return{v:void 0};if("development"===process.env.nodeEnv)n=r.callback.apply(r.context||i,s);else try{n=r.callback.apply(r.context||i,s)}catch(e){throw e.isAddedMsg||(e.message="(领域扩展事件执行失败,请打开控制台查看详细错误信息并修复):".concat(e.message)),e.isAddedMsg=!0,e}n instanceof Promise?(l=!0,(u=n).callbacks&&u.callbacks.push({reject:function(){u.reject(),t===c.length-1&&(null==a||a())},resolve:function(n){t===c.length-1?(s.length>1&&(s[0]=n),null==o||o(s)):i._asyncExecute(e,c.slice(t+1),{resolve:o,reject:a,args:s})}})):(u=!1!==n&&u,t===c.length-1&&(u?null==o||o(s):null==a||a()))},d=0;d<c.length&&0!==(r=f(d));d++)if(r)return r.v;return u}},{key:"_asyncPromiseExecute",value:function(e,t,n,r){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(g(o||[]),g(i||[]));return this._asyncExecute(e,a,{resolve:t,reject:n,args:r})}},{key:"promiseExecute",value:function(e,t){var n=this,r=e,i=1;if("boolean"==typeof e&&(r=t,i=2),r){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,f=u[l];if("function"!=typeof f){if("object"!==m(f)||!f[0]||"function"!=typeof f[0]||!f[1]||"function"!=typeof f[1])return;c=f[1],f=f[0]}if(this.__ASYNC_EXECUTE__)return this._asyncPromiseExecute(r,function(e){f.apply(n,e)},function(){c&&"function"==typeof c&&c()},u);u.splice(l,1),u.unshift(r);var d=this.execute.apply(this,u);if(d instanceof Promise){var h=this;d.then(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];f.apply(h,t)},function(){c&&"function"==typeof c&&c()})}else if(!d)return void(c&&"function"==typeof c&&c())}}}},{key:"clear",value:function(){this._events.clear(),this._firstevents.clear()}}])}();q.create=function(e){return new q(e)};var E=function(){return a(function e(t){i(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={}}}])}();E.create=function(e){return new E};var M=function(){return a(function e(t){i(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 E,this._data.events=new q}},{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 E,events:new q}}},{key:"_set_data",value:function(e,t,n){if(e){if(n){var r=this._data.propertyNames||[];r.indexOf(e)<0&&r.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 r=(this._get_data("components")||[]).find(function(e){return e.ctrlName===t});return r?null===(n=r.getState)||void 0===n?void 0:n.call(r,e):this._get_data(e)}},{key:"setState",value:function(e,t,n){n||this._set_data(e,t,!0);var r={};r[e]=t,this.doPropertyChange("setState",r,n)}},{key:"doPropertyChange",value:function(e,t,n){var r=this,i=this._get_data("components")||[];if(!i.length)return i;var o=[];if(n){var a=i.find(function(e){return e.ctrlName===n});a&&!this.notifyComponent(a,e,t)&&o.push(a)}else i.forEach(function(n){r.notifyComponent(n,e,t)||o.push(n)});return o.length?o: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 r=this.getCache("name");e[t](n,r)}}},{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 r=this;n||this._set_data(e,t,!0);var i="set".concat(e.charAt(0).toUpperCase()).concat(e.slice(1)),o=this.doPropertyChange(i,t,n);if(o){var a={};a[e]=t,o.forEach(function(e){r.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,n){var r=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(){r._set_data("value",e,!0),r._applyState("value",e,n),r.execute("afterValueChange",o)},function(){r._set_data("value",i,!0),r._applyState("value",i,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,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return(t=this._get_data("events")).execute.apply(t,[e].concat(r))}},{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,r=arguments.length,i=new Array(r>2?r-2:0),o=2;o<r;o++)i[o-2]=arguments[o];(n=this._get_data("events")).promiseExecute.apply(n,[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 A)){var t,n=this._get_data("__requestHeaders__");for(var r in e){var i,o,a;if(n&&(null===(i=e[r])||void 0===i||null===(i=i.options)||void 0===i||!i.requestHeaders))null!==(a=e[r])&&void 0!==a&&a.options||(e[r].options={}),e[r].options.requestHeaders=n;null!==(o=this.getProxy())&&void 0!==o&&o[r]&&window.devfab.debug&&console.warn("[devfab][baseModel.prototype.setProxy]: Proxy ".concat(r," already exists on the model. Please change the name of ").concat(r," and try again"))}return this._set_data("proxy",A.create(d(d({},(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")}}])}(),R=function(){function e(){var t;i(this,e);for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return s(t=r(this,e,[].concat(o)),"modelType","SimpleModel"),t}return c(e,M),a(e,[{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)}}])}(),D=Array.isArray;function I(e){if(D(e))return e.map(I);if(e instanceof Date)return new Date(e.getTime());if(e&&"object"===m(e)){var t={};for(var n in e)t[n]=I(e[n]);return t}return e}function T(e,t,n){var r=this;this.promiseExecute("beforeQuery",{proxyConfig:e,queryParams:t},function(){var i=r,o=r.setProxy({queryData:e}),a=r._get_data("innerUsedAttrs").pageIndex,u={page:s(s({},r._get_data("innerUsedAttrs").pageSize,r.getPageSize()),a,r.getPageIndex())},c=Object.assign(t,u);r.setCache("proxyCache",{proxyConfig:e,params:c,callback:n});if(!1!==r.execute("beforeQueryData",c)){var l=I(c);o.queryData(l,function(e,t,r,i){if(!e){var o=t;this._set_data("dataSourceMode","remote");var a=function(e){if(!e)return[];if(D(e))return e;if(D(e.data))return e.data;if(D(e.records))return e.records;if(D(e.list))return e.list;if(D(e.rows))return e.rows;var t=e.data&&"object"===m(e.data)?e.data:e.result;return D(t)?t:t&&"object"===m(t)&&(t.records||t.list||t.rows||t.data)||[]}(o=Object.assign({},o));this.execute("afterQueryData",o),null==n||n.call(this,a)}},i)}})}function U(e){if(this.execute("beforeSetDataSource",e)){var t=this.getRowKeyField(),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 N=function(){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,e);var o,a=d(d({},{columns:{},dataSource:[],rows:[],readOnly:!0,dataSourceMode:"local",columnMode:"local",editMode:"cell",rowKeyField:"id",cellState:{},rowState:{},showCheckBox:!1,multiple:!0,showRowNo:!0,pagination:!0,pageInfo:s(s(s({},(o={id:"_id",selected:"_selected",status:"_status",pageIndex:"pageNo",pageSize:"pageSize",pageCount:"total"}).pageIndex,1),o.pageSize,20),o.pageCount,0),innerUsedAttrs:o,multiRowModel:!1,editRowModels:{},loading:!1,params:{},originalKeyMap:{},defaultRowDatas:new Map}),n);D(a.dataSource)||(a.dataSource=[]),D(a.rows)||(a.rows=[]);var u=function(){return d({},(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).proxyConfig||{})}(n);return a.proxyConfig=u,a.dataSourceMode=n.dataSourceMode||a.dataSourceMode,s(t=r(this,e,[a]),"modelType","GridModel"),t.initColumns(a.columns),t.initPageInfo(n.cPage||n.page),t.afterInit(),t}return c(e,M),a(e,[{key:"afterInit",value:function(){this.execute("afterInit")}},{key:"initColumns",value:function(e){var t=function(e){var t={};return(D(e)?e:Object.keys(e||{}).map(function(t){var n;return d(d({},e[t]||{}),{},{field:(null===(n=e[t])||void 0===n?void 0:n.field)||t})})).forEach(function(e,n){if(e){var r=e.field||e.cFieldName||e.cName||"col_".concat(n);t[r]=d(d({},e),{},{field:r,label:e.label||e.title||e.cCaption||r,index:void 0===e.index?n:e.index})}}),t}(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=d({},this.getPageInfo()),n=this._get_data("innerUsedAttrs").pageIndex,r=this._get_data("innerUsedAttrs").pageSize;t[n]=e.pageNo||e.pageIndex||t.pageIndex||1,t[r]=e.pageSize||t.pageSize||20,!1===this.get("pagination")&&(t[n]=-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 d(d({},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,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;if("local"===this._get_data("dataSourceMode")){U(D(e)?e:[])}else{if(!this.execute("beforeProxyLoad",n))return;this.setPageIndex(1),T.call(this,e,n,function(e){U.call(t,e),null==r||r.call(t)})}}},{key:"reloadData",value:function(){var e=this,t=this.getCache("proxyCache");if(t){var n=t.proxyConfig,r=t.params,i=t.callback;T.call(this,n,r,function(t){null==i||i.call(e,t)})}else k()&&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",d(d({},t),e)),this.reloadData()}},{key:"setPageIndex",value:function(e){if("number"==typeof e){var t=this._get_data("innerUsedAttrs").pageIndex;this._set_data("pageInfo",d(d({},this.getPageInfo()),{},s({},t,Math.max(1,e))))}}},{key:"setPageSize",value:function(e){if("number"==typeof e){var t=this._get_data("innerUsedAttrs").pageIndex,n=this._get_data("innerUsedAttrs").pageSize;this._set_data("pageInfo",d(d({},this.getPageInfo()),{},s(s({},n,Math.max(-1,e)),t,1)))}}},{key:"setTotalCount",value:function(e){var t=this._get_data("innerUsedAttrs").pageCount;this.getPageInfo()[t]=e}}])}(),H=function(){function e(){var t;i(this,e);for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return s(t=r(this,e,[].concat(o)),"modelType","ViewModel"),t}return c(e,M),a(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 M&&(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 r,i=e.get(t);i instanceof M&&!1!==i._get_data("needCollect")&&(n[t]=null===(r=i.getData)||void 0===r?void 0:r.call(i))}),n}},{key:"getAllData",value:function(e){var t=this,n=this._get_data("propertyNames")||[],r={};return n.forEach(function(n){var i,o=t.get(n);if(o instanceof M&&!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&&(r[n]=a)}}),r}},{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 r,i=t.get(n);i instanceof M&&!1!==i._get_data("needClear")&&(null===(r=i.clear)||void 0===r||r.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 n=this._get_data("gridModel");if(n)return n;var r=null===(t=this.getParams())||void 0===t?void 0:t.masterGridModelName;if(r)return this.get(r);for(var i=this._get_data("propertyNames"),o=0,a=i.length;o<a;o++){if((n=this.get(i[o]))instanceof N||"GridModel"==n.modelType)return this._set_data("gridModel",n),n}}},{key:"getGridModels",value:function(){for(var e=this._get_data("propertyNames"),t=[],n=0,r=e.length;n<r;n++){var i=this.get(e[n]);(i instanceof N||"GridModel"==i.modelType)&&t.push(i)}return t}},{key:"getGridFilterModel",value:function(e){return this.getGridModel(e).getCache("FilterViewModel")}}])}(),V=403;function F(e){return String(null==e?"":e).replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"")}var G=function(){return a(function e(t){i(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[F(t.path)]=t)}):t&&"object"===m(t)&&Object.keys(t).forEach(function(n){e[F(n)]=t[n]||{}}),this._index=e,e}},{key:"entryOf",value:function(e){return this.manifest&&this._moduleIndex()[F(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:V,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 n=0;n<e.length;n++){var r=F(e[n]);if(!this._moduleIndex()[r])return{code:V,message:"Module ".concat(r," not registered in the list, loading denied.")}}return null}},{key:"checkOrigin",value:function(e){if(!this.origins)return null;if(!function(e){return/^(?:[a-z][a-z0-9+.-]*:)?\/\//i.test(e)||/^(?:blob|data):/i.test(e)}(e))return null;var t;try{t=new URL(e).origin}catch(t){return{code:V,message:"无法解析的地址:".concat(e)}}return-1===this.origins.indexOf(t)?{code:V,message:"来源 ".concat(t," 不在白名单内(允许:").concat(this.origins.join(", "),")")}:null}},{key:"verify",value:function(e,t){var n=this;if(!this.verifyHash)return Promise.resolve({ok:!0,skipped:"disabled"});if(!t)return Promise.resolve({ok:!0});var r="undefined"!=typeof globalThis&&globalThis.crypto&&globalThis.crypto.subtle;return r?this.fetch?Promise.resolve().then(function(){return n.fetch(e)}).then(function(e){return e&&e.ok?e.arrayBuffer().then(function(e){return r.digest("SHA-256",e)}):{ok:!1,message:"完整性预检请求失败:HTTP ".concat(e&&e.status||"unknown")}}).then(function(e){if(!e||!1===e.ok)return e;var n=function(e){for(var t=new Uint8Array(e),n="",r=0;r<t.length;r++)n+=t[r].toString(16).padStart(2,"0");return n}(e),r=String(t).toLowerCase();return n!==r?{ok:!1,message:"sha256 不匹配:期望 ".concat(r,",实际 ").concat(n)}:{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}}}])}(),L=["$","jQuery","define","require","requirejs","devfab","__devfab","__devfab_requirejs"],z=function(){return a(function e(t){i(this,e);var n=t||{};this.maxPollution=void 0===n.maxPollution?3:Number(n.maxPollution),this.watch=[].concat(n.watch||L),this.target=n.target||("undefined"!=typeof window?window:null),this.enabled=void 0===n.enabled||!!n.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(n){e.set(n,t[n])}),e):e}},{key:"_diff",value:function(){var e=this,t=this._before,n=this._snapshot(),r=[];if(!t)return r;n.forEach(function(n,i){var o=-1!==e.watch.indexOf(i);t.has(i)?t.get(i)!==n&&r.push({type:"overwritten",key:i,watched:o}):r.push({type:"added",key:i,watched:o})});var i=r.filter(function(e){return e.watched}).length,o=r.filter(function(e){return"added"===e.type}).length;return!i&&o<=this.maxPollution?[]:r}},{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 n=e._diff();return e._before=null,e.lastWarnings=n,n}}}},{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}}])}(),B=null;try{B=new Function("s","return import(s)")}catch(e){B=null}function X(e,t,n,r){var i=e,o=t,a=n;Array.isArray(e)&&!Array.isArray(t)&&(i=null==r?void 0:r.path,o=e,a="function"==typeof t?t:n);var s=(o=Array.isArray(o)?o:[]).join(","),u={code:0,message:"",data:[],warnings:[]};return("require"===r.type&&"function"!=typeof r.require||"define"===r.type&&"function"!=typeof r.define)&&(u.code=404,u.message="requirejs is undefined, the fiels: ".concat(s)),{path:i,files:o,callback:a,filesStr:s,result:u}}function J(e,t){var n="";return Array.isArray(e)?n=e.filter(Boolean).join("/"):"string"==typeof e&&(n=e.replace(/\/+$/,"")),t.map(function(e){var t=String(e).replace(/^\/+/,"");return n?"".concat(n,"/").concat(t):t})}function K(e,t){var n=Number(e);return Number.isFinite(n)?n:t}var W="",Q=15e3,$=0,Y="",Z=function(){return a(function e(t){var n,r,o,a;i(this,e);var s=t||{};this.__debug=null!==(n=s.__debug)&&void 0!==n&&n,this.__rootPath=void 0,this.__define=s.define||(null===(r=window.__devfab_requirejs)||void 0===r?void 0:r.define),this.__require=s.require||(null===(o=window.__devfab_requirejs)||void 0===o?void 0:o.require),this.__undef=s.undef||("function"==typeof(null===(a=this.__require)||void 0===a?void 0:a.undef)?this.__require.undef:null),this.__requireConfig=s.requireConfig||this._pickRequireConfig(this.__require),this.__import=s.importer||null,this._setTimer=s.setTimeout||function(e,t){return setTimeout(e,t)},this._clearTimer=s.clearTimeout||function(e){return clearTimeout(e)},this.options={version:s.version?String(s.version):W,timeout:void 0===s.timeout?Q:Math.max(0,K(s.timeout,0)),retry:void 0===s.retry?$:Math.max(0,K(s.retry,0)),strict:!!s.strict,baseUrl:s.baseUrl||Y},this.policy=new G(s),this.guard=new z(this._guardOptions(s)),this.options.version&&this._applyUrlArgs()},[{key:"_pickRequireConfig",value:function(e){var t,n=e&&"function"==typeof e.config?e:null===(t=window.__devfab_requirejs)||void 0===t?void 0:t.require;return n&&"function"==typeof n.config?n.config.bind(n):null}},{key:"_guardOptions",value:function(e){return!1===e.pollution?{enabled:!1,target:e.target}:e.pollution&&"object"===m(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,K(t.timeout,this.options.timeout))),void 0!==t.retry&&(this.options.retry=Math.max(0,K(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||B)})}},{key:"_define",value:function(e,t,n){var r=X(e,t,n,{path:this.__rootPath,define:this.__define,type:"define"}),i=r.path,o=r.files,a=r.callback,s=r.result;404!==s.code?this.__define(i,o,a):null==a||a(s)}},{key:"_mergeWarnings",value:function(e,t){var n=(e||[]).slice();return(t||[]).forEach(function(e){n.some(function(t){return t.type===e.type&&t.key===e.key})||n.push(e)}),n}},{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,n){var r=this,i=this.options,o=X(e,t,n,{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 f=J(a,s),d=this.policy.checkModules(f);if(d)return c.code=d.code,c.message=d.message,void(null==u||u(c));var h=!1,v=0,p=null,y=null,g=function(){y&&(c.warnings=r._mergeWarnings(c.warnings,y.end()),y=null)},_=function(){h||(h=!0,null!==p&&(r._clearTimer(p),p=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(){v++,y=r.guard.begin(),i.timeout>0&&(p=r._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)),r.__require(a,s,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];c.data=t,_()},function(e){b(e)})},b=function(e,t){if(!h){if(null!==p&&(r._clearTimer(p),p=null),v<=i.retry)return g(),r._undefModules(f),void m();c.code=e&&e.__devfabTimeout?504: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,n){this._load(e,t,n)}},{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 n=this.options.baseUrl||("undefined"!=typeof document&&document.baseURI?document.baseURI:"");if(!n)return t;try{return new URL(t,n).href}catch(e){return t}}},{key:"_importOne",value:function(e){var t=this,n=this.resolveUrl(e),r=this.policy.checkOrigin(n);if(r)return Promise.resolve({ok:!1,code:r.code,message:r.message});var i=this.policy.entryOf(e),o=i&&i.sha256,a=function(){var e=t.__import||B;return"function"!=typeof e?Promise.resolve({ok:!1,code:500,message:"native import() is unavailable(CSP 是否禁用了 unsafe-eval?)"}):Promise.resolve().then(function(){return e(n)}).then(function(e){return{ok:!0,module:e}},function(e){return{ok:!1,code:500,message:"module load error: ".concat(n),error:e}})};return o?this.policy.verify(n,o).then(function(e){return e.ok?a():{ok:!1,code:V,message:"".concat(e.message,"(").concat(n,")")}}):a()}},{key:"loadModules",value:function(e,t,n){var r=this,i=X(e,t,n,{path:this.__rootPath,type:"module"}),o=i.path,a=i.files,s=i.callback,u=i.result,c=i.filesStr,l=J(o,a),f=function(e){return null==s||s(e),e},d=this.policy.checkModules(l);if(d)return u.code=d.code,u.message=d.message,Promise.resolve(f(u));if(!a.length)return Promise.resolve(f(u));var h=this.guard.begin();return Promise.all(l.map(function(e){return r._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}),f(u)})}},{key:"loadModule",value:function(e,t){return this.loadModules([e],t)}}])}(),ee=function(){function e(){return i(this,e),r(this,e,arguments)}return c(e,Z),a(e,[{key:"define",value:function(e,t,n){this._define(e,t,n)}},{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,n){this._load(e,t,n)}},{key:"injectScript",value:function(e,t,n,r){var i=this,o=e,a=t,s=n,u=r;Array.isArray(e)&&"function"==typeof t&&(o=void 0,a=e,s=t,u=n),this._load(o,a,function(e){if(0==e.code&&Array.isArray(e.data))for(var t=0,n=e.data.length;t<n;t++){var r,o=e.data[t];null===(r=s)||void 0===r||r(o,t)}else"function"==typeof u?u(e):i.__debug&&console.error("[devfab][FileRequire][injectScript] error: ",e)})}},{key:"requireScript",value:function(e,t,n){this.injectScript(e,t,n)}}])}(),te=new ee;function ne(e,t,n,r,i){var o,a=t,s=n,u=r,c=i;Array.isArray(t)&&"function"==typeof n&&(a=void 0,s=t,u=n,c=r);var l=(null===(o=c)||void 0===o?void 0:o.viewModel)||this,f=(s=Array.isArray(s)?s:[]).join(",");return te.create({require:e}).require(a,s,function(e){var t;if(0==e.code&&Array.isArray(e.data))for(var n=0,r=e.data.length;n<r;n++){var i=e.data[n];if(i&&i.doAction)try{i.doAction("init",l)}catch(t){e.code=500,e.message="".concat(f," 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,n)}catch(t){e.code=500,e.message="".concat(f," script customize execute error");break}}0!=e.code&&window.__devfab.debug&&console.info("[devfab][models][extend][loadScripts] ".concat(f," \n [message]: ").concat(e.message," \n").concat(e.error?" \n [error]: ":""),e.error),null===(t=u)||void 0===t||t(e)})}function re(e){var t=this;window.__devfab&&window.__devfab.__debugger_initExtendJs;var n=e.requirejs,r=e.extendScriptParams,i=e.readyEventName,o=void 0===i?"extendReady":i,a=r||{},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 f=c,d=[l];t.getEnv&&t.getEnv("everyCommonExtend")&&d.push(t.getEnv("everyCommonExtend")),ne.call(t,null==n?void 0:n.require,f,d,function(e){t.execute(o,t,e)})}te.create=function(e){return new ee(d(d({},this._snapshotConfig()),e))};var ie=function(){var e=n(h().m(function e(t,r,i){var o,a,s,u,c,l,f,d,v,p,y;return h().w(function(e){for(;;)switch(e.n){case 0:if(window.__devfab&&window.__devfab.__debugger_initExtJs,s=i.requirejs,u=i.extendScriptParams,l=(c=u||{}).enableExtJs,f=void 0!==l&&l,d=c.exturlsField,v=void 0===d?"extscripturls":d,f){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(p=null==t?void 0:t[v],y=Array.isArray(p)?p:[],y=(y=(r.getCache("localScripts")||[]).concat(y)).concat(window.__devfab__GLOBAL_EXT_SCRIPTS__||[]),null!==(o=r.getParams())&&void 0!==o&&o.selfExtUrls&&(y=y.concat([r.getParams().selfExtUrls])),null===(a=y)||void 0===a||!a.length){e.n=4;break}return y=g(new Set(y)),e.n=3,Promise.all(y.map(function(){var e=n(h().m(function e(t){return h().w(function(e){for(;;)if(0===e.n)return e.a(2,t)},e)}));return function(t){return e.apply(this,arguments)}}()));case 3:y=e.v;case 4:return t[v]=y,e.a(2,new Promise(function(e,t){ne.call(r,null==s?void 0:s.require,y,function(t){e(t)})}))}},e)}));return function(t,n,r){return e.apply(this,arguments)}}(),oe=M,ae=R,se=H,ue=N;function ce(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=n.modelNameField,s=void 0===o?"cName":o,u=function(e){function t(){return i(this,t),r(this,t,arguments)}return c(t,e),a(t,[{key:"init",value:function(e,t){var n=this.createModels(e,t);this.setData(n),this.setDirty(!1)}},{key:"createModels",value:function(e,t){var r={};return(Array.isArray(e)?e:[]).forEach(function(e){var t,i,o=function(e,t){var n=(null==t?void 0:t.SimpleModel)||R,r=e.cControlType||e.component||e.controlType||e.ctrlType;return r=r.toLowerCase(),new n(e)}(e,n),a={model:o,meta:e,childModel:!0,modelName:e[s]};null==n||null===(t=n.onBeforeInitModel)||void 0===t||t.call(n,a),r[a.modelName]=a.model,null==n||null===(i=n.onAfterInitModel)||void 0===i||i.call(n,a)}),r}},{key:"initData",value:function(){re.call(this,n)}}])}((null==n||null===(t=n.models)||void 0===t?void 0:t.ViewModel)||H);return u.prototype.modelType="ViewModel",u}var le={models:Object.freeze({__proto__:null,BaseModel:oe,SimpleModel:ae,GridModel:ue,ViewModel:se,initViewModel:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,i=function(e,t){var n,r,i,o=new(ce(e,t)),a={model:o,meta:e};return null==t||null===(n=t.onBeforeInitModel)||void 0===n||n.call(t,a),a.model=o,null==o||null===(r=o.init)||void 0===r||r.call(o,e.models,e),null==t||null===(i=t.onAfterInitModel)||void 0===i||i.call(t,a),o}(e,t);return i.on("destroyVM",function(){var e,t;null===(e=i)||void 0===e||null===(t=e.destroyVM)||void 0===t||t.call(e),i=null,window.devfab.debug&&console.info("[devfab][models][initVM]: destory vm ".concat((new Date).toString()))}),i.on("extendReady",n(h().m(function n(){var o;return h().w(function(n){for(;;)switch(n.n){case 0:return(o=[]).push(ie(e,i,t)),n.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(i,e);case 2:return n.a(2)}},n)}))),i.initData(),i},loadScripts:ne}),Builder:C,Cache:E,Event:q,Ajax:A};export{le as default};
|
|
3
|
+
var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var u=r&&r.prototype instanceof s?r:s,c=Object.create(u.prototype);return h(c,"_invoke",function(n,r,a){var o,s,u,c=0,l=a||[],f=!1,d={p:0,n:0,v:e,a:v,f:v.bind(e,4),d:function(t,n){return o=t,s=0,u=e,d.n=n,i}};function v(n,r){for(s=n,u=r,t=0;!f&&c&&!a&&t<l.length;t++){var a,o=l[t],v=d.p,h=o[2];n>3?(a=h===r)&&(u=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=v&&((a=n<2&&v<o[1])?(s=0,d.v=r,d.n=o[1]):v<h&&(a=n<3||o[0]>r||r>h)&&(o[4]=n,o[5]=r,d.n=h,s=0))}if(a||n>1)return i;throw f=!0,r}return function(a,l,h){if(c>1)throw TypeError("Generator is already running");for(f&&1===l&&v(l,h),s=l,u=h;(t=s<2?e:u)||!f;){o||(s?s<3?(s>1&&(d.n=-1),v(s,u)):d.n=u:d.v=u);try{if(c=2,o){if(s||(a="next"),t=o[a]){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 '"+a+"' method"),s=1);o=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==i)break}catch(t){o=e,s=1,u=t}finally{c=1}}return{value:t,done:f}}}(n,a,o),!0),c}var i={};function s(){}function u(){}function c(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(h(t={},r,function(){return this}),t),f=c.prototype=s.prototype=Object.create(l);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,h(e,a,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=c,h(f,"constructor",c),h(c,"constructor",u),u.displayName="GeneratorFunction",h(c,a,"GeneratorFunction"),h(f),h(f,a,"Generator"),h(f,r,function(){return this}),h(f,"toString",function(){return"[object Generator]"}),(v=function(){return{w:o,m:d}})()}function h(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}h=function(e,t,n,r){function o(t,n){h(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},h(e,t,n,r)}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 r,a,o,i,s=[],u=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);u=!0);}catch(e){c=!0,a=e}finally{try{if(!u&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return s}}(e,t)||b(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 g(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)||b(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 _(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function m(e){return m="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},m(e)}function b(t,n){if(t){if("string"==typeof t)return e(t,n);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(t,n):void 0}}function k(e){return e||!("undefined"==typeof window||!window.__devfab||!window.__devfab.debug)}function w(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 r=(t=t.replace(/\+/g," ")).split("&"),a=0,o=r.length;a<o;a++){var i=r[a]||"";if(i){var s=i.indexOf("="),u="",c="";s<0?c=u=window.decode(i):(u=window.decode(i.substr(0,s)),c=window.decode(i.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 x(e,t){return!(!e||!t)&&e.toLowerCase()===t.toLowerCase()}function S(e,t){if(!t)return e;var n=[],r=new w(e);for(var a in t)r.get(a)||n.push("".concat(a,"=").concat(t[a]));if(!n.length)return e;var o=n.join("&");return e.indexOf("?")>=0?"".concat(e,"&").concat(o):"".concat(e,"?").concat(o)}var P=function(e){return null!=e&&""!==e};var C=["children","render"],j=function(){return i(function e(){a(this,e),s(this,"_config",{componentField:["component"]}),s(this,"_components",{}),s(this,"_renderFactory",null)},[{key:"init",value:function(e,t,n){this._initConfig(e),this._initComponent(t),this._initRenderFactory(n)}},{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"===m(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 n=this;if(Array.isArray(e)){var r=[];return e.forEach(function(e,a){var o=d({},e),i=function(e,t,n){if(e){var r=n;"string"==typeof t&&Array.isArray(r)&&(r=s({},t,n));var a=r&&r[t];if(!a)return P(e[t])?e[t]:void 0;for(var o=0;o<a.length;o++){var i=e[a[o]];if(P(i))return i}}}(o,"component",n._config.componentField),u=o.children,c=o.render,l=function(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(o,C),f=n._getComponent(i);f||"function"==typeof c||console.log("[warning] Component ".concat(i," is not registered!"));var v={component:f,children:n._renderComponent(u,t)};l.index=a;var h=Object.assign({},null==t?void 0:t.props,{meta:l});"function"==typeof c?r.push(c({node:v,props:h})):"function"==typeof n._renderFactory?r.push(n._renderFactory({node:v,props:h})):(Object.assign(v,h),r.push(v))}),r}}},{key:"clear",value:function(){this._clearComponents(),this._renderFactory=null}}])}(),O=function(){function e(){return a(this,e),r(this,e,arguments)}return c(e,j),i(e,[{key:"initComponent",value:function(e,t){this._initComponent(e,t)}},{key:"getComponents",value:function(){return d({},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)}}])}();O.create=function(e){return new O(e)};var A={_xhrs:[],_jsonps:{index:0},doRequest:function(e){var t,n=e.method||"GET",r=e.url;try{null!=e&&e.requestHeaders&&(t=e.requestHeaders,e.requestHeaders=void 0,delete e.requestHeaders)}catch(e){k()&&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){k()&&console.log('[devfab][ajax]: [doRequest]: options.params["requestHeaders"] ERR : ',e)}var a=null;if(x(n,"get")||x(n,"delete")?r=S(r,e.params):(x(n,"post")||x(n,"put"))&&(a=JSON.stringify(e.params)),e.jsonp)return this.getJsonp(r,e.callback);var o=this.getXMLHttpRequest();if(o){var i;if(o.open(n,r,!1!==e.async),e.timeout&&(o.timeout=e.timeout,o.setRequestHeader("timeout",e.timeout),o.ontimeout=function(){A.onerror(this,e,"timeout")}),e.contentType){if(o.setRequestHeader("Content-Type",e.contentType),e.contentType.indexOf("x-www-form-urlencoded")>=0)a=null===(i=new URLSearchParams(e.params))||void 0===i?void 0:i.toString()}else e.dateType?a=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){k()&&console.log('[devfab][ajax]: [doRequest]: options.params["requestHeaders"] ERR : ',e)}o.withCredentials=null==e||!e.hasOwnProperty("withCredentials")||e.withCredentials,e.onBeforeRequest&&e.onBeforeRequest(o,a);try{o.send(a)}catch(t){return{error:"NetWorkError",options:e}}if(!1===e.async)return this.onreadystatechange(o,e);o.onreadystatechange=function(){A.onreadystatechange(this,e)}}},onreadystatechange:function(e,t){if(4===e.readyState){if(200===e.status){var n;try{if("blob"===t.responseType){var r=function(e){var t=e.xhr.getAllResponseHeaders(),n={};return t.split("\r\n").map(function(e){var t=p(e.split(": "),2),r=t[0],a=t[1];n[r]=a}),n}({xhr:e});n={code:e.status,data:{data:e.response,headers:r}}}else n=JSON.parse(e.responseText)}catch(n){A.onerror(e,t,e.responseText)}if(!1===t.async)return e.isBusy=!1,t.onAfterRequest&&t.onAfterRequest(n),A.parseAjaxResult(n,!1,null,null,t,e);A.parseAjaxResult(n,t.async,t.callback,t.context,t,e),t.onAfterRequest&&t.onAfterRequest(n)}else if(0===e.status)A.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)A.onerror(e,t,"An error has occurred with the service. Please try again later.");else{if(401!==e.status){var a={};try{a=JSON.parse(e.responseText)}catch(t){a={code:e.status,message:e.responseText}}return A.onerror(e,t,a)}A.onerror(e,t,"Login information has expired. Please log in again or contact technical staff.")}e.isBusy=!1}},onerror:function(e,t,n){var r="[devfab][ajax]: [onerror]: api error \n [code]: ".concat(e.status," \n [error]: ").concat(("object"===m(n)?JSON.stringify(n):n)||"空"," \n [url]: ").concat(t.url," \n [token]: ").concat(document.cookie);k()&&console.log(r);var a="object"===m(n)?n:{code:500,message:n};t.onAfterRequest&&t.onAfterRequest(a)},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,r="callback"+this._jsonps.index++,a=document.createElement("script");this._jsonps[r]=function(e){try{t(e)}finally{document.body.removeChild(a)}},n+=-1===n.indexOf("?")?"?":"&callback=cb.rest.AjaxUtil._jsonps."+r,a.src=n,document.body.appendChild(a)},parseAjaxResult:function(e,t,n,r,a,o){if(e){if(!e.code)return!1===t?e:void(n&&n.call(r,null,e));if(200==e.code){if(!1===t)return{result:e.data};n&&n.call(r,null,e.data,e.message,e.errorDetail,e.code,e.displayCode&&e)}else{if(!1===t)return{error:e};n&&n.call(r,e)}}}};function E(e,t){this.init&&this.init(e),this.queryParams=t}E.create=function(e,t){return new E(e,t)},E.prototype.init=function(e){if(e)for(var t in this.config=e,this.config)this[t]=function(e){return function(t,n,r){return this.Do(e,t,n,null,r)}}(t),this["".concat(t,"Sync")]=function(e){return function(t){return this.Do(e,t,null,!1)}}(t)},E.prototype.Do=function(e,t,n,r,a){var o,i,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!==(i=u.options)&&void 0!==i&&i.billnum&&(this.queryParams.billnum=u.options.billnum),null!==(s=this.queryParams)&&void 0!==s&&s.serviceCode&&(c=S(c,this.queryParams));var l=c,f=Object.assign({},u.options);return f.method=u.method||"GET","function"==typeof t?(f.callback=t,f.context=a||f.context||this):f.params=t,n&&(f.callback=n,f.context=a||f.context||this),!1===r&&(f.async=!1),this.ajax(l,f)}},E.prototype.ajax=function(e,t){return function(e,t){return t.url=e,A.doRequest(t)}(e,t)};var D=function(){return i(function e(t){a(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 r=this._events.get(e);Array.isArray(r)||(r=[]),r.push({callback:t,context:n}),this._events.set(e,r)}},{key:"onFirst",value:function(e,t,n){var r=this._firstevents.get(e);Array.isArray(r)||(r=[]),r.splice(0,0,{callback:t,context:n}),this._firstevents.set(e,r)}},{key:"execute",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var a=this._events.get(e),o=this._firstevents.get(e);if(!a&&!o)return!0;var i=!0;return[].concat(g(o||[]),g(a||[])).forEach(function(e){if(!1!==i){var t=e.callback.apply(e.context||void 0,n);i=!1!==t&&i}}),i}},{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 r=n.get(e),a=null==r?void 0:r.findIndex(function(e){return e.callback===t});-1!==a&&(null==r||r.splice(a,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 r,a=this,o=n.resolve,i=n.reject,s=n.args,u=!0,c=t||[],l=!1,f=function(t){var n,r=c[t];if(!1===u)return 0;if(l)return{v:void 0};if("development"===process.env.nodeEnv)n=r.callback.apply(r.context||a,s);else try{n=r.callback.apply(r.context||a,s)}catch(e){throw e.isAddedMsg||(e.message="(领域扩展事件执行失败,请打开控制台查看详细错误信息并修复):".concat(e.message)),e.isAddedMsg=!0,e}n instanceof Promise?(l=!0,(u=n).callbacks&&u.callbacks.push({reject:function(){u.reject(),t===c.length-1&&(null==i||i())},resolve:function(n){t===c.length-1?(s.length>1&&(s[0]=n),null==o||o(s)):a._asyncExecute(e,c.slice(t+1),{resolve:o,reject:i,args:s})}})):(u=!1!==n&&u,t===c.length-1&&(u?null==o||o(s):null==i||i()))},d=0;d<c.length&&0!==(r=f(d));d++)if(r)return r.v;return u}},{key:"_asyncPromiseExecute",value:function(e,t,n,r){var a=this._events.get(e),o=this._firstevents.get(e);if(!((Array.isArray(a)?a.length:a)||(Array.isArray(o)?o.length:o)))return null==t?void 0:t();var i=[].concat(g(o||[]),g(a||[]));return this._asyncExecute(e,i,{resolve:t,reject:n,args:r})}},{key:"promiseExecute",value:function(e,t){var n=this,r=e,a=1;if("boolean"==typeof e&&(r=t,a=2),r){for(var o=arguments.length,i=new Array(o>2?o-2:0),s=2;s<o;s++)i[s-2]=arguments[s];var u=2===a?i:[t].concat(i);if(u.length){var c,l=u.length-1,f=u[l];if("function"!=typeof f){if("object"!==m(f)||!f[0]||"function"!=typeof f[0]||!f[1]||"function"!=typeof f[1])return;c=f[1],f=f[0]}if(this.__ASYNC_EXECUTE__)return this._asyncPromiseExecute(r,function(e){f.apply(n,e)},function(){c&&"function"==typeof c&&c()},u);u.splice(l,1),u.unshift(r);var d=this.execute.apply(this,u);if(d instanceof Promise){var v=this;d.then(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];f.apply(v,t)},function(){c&&"function"==typeof c&&c()})}else if(!d)return void(c&&"function"==typeof c&&c())}}}},{key:"clear",value:function(){this._events.clear(),this._firstevents.clear()}}])}();D.create=function(e){return new D(e)};var M=function(){return i(function e(t){a(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={}}}])}();M.create=function(e){return new M};var R=function(){return i(function e(t){a(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 M,this._data.events=new D}},{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 M,events:new D}}},{key:"_set_data",value:function(e,t,n){if(e){if(n){var r=this._data.propertyNames||[];r.indexOf(e)<0&&r.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 r=(this._get_data("components")||[]).find(function(e){return e.ctrlName===t});return r?null===(n=r.getState)||void 0===n?void 0:n.call(r,e):this._get_data(e)}},{key:"setState",value:function(e,t,n){n||this._set_data(e,t,!0);var r={};r[e]=t,this.doPropertyChange("setState",r,n)}},{key:"doPropertyChange",value:function(e,t,n){var r=this,a=this._get_data("components")||[];if(!a.length)return a;var o=[];if(n){var i=a.find(function(e){return e.ctrlName===n});i&&!this.notifyComponent(i,e,t)&&o.push(i)}else a.forEach(function(n){r.notifyComponent(n,e,t)||o.push(n)});return o.length?o: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 r=this.getCache("name");e[t](n,r)}}},{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 r=this;n||this._set_data(e,t,!0);var a="set".concat(e.charAt(0).toUpperCase()).concat(e.slice(1)),o=this.doPropertyChange(a,t,n);if(o){var i={};i[e]=t,o.forEach(function(e){r.notifyComponent(e,"setState",i)})}}},{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 r=this,a=this.getValue();if(e!==a){var o={value:e,oldValue:a},i=this._get_data("forceFireEvent");t||i?this.promiseExecute("beforeValueChange",o,[function(){r._set_data("value",e,!0),r._applyState("value",e,n),r.execute("afterValueChange",o)},function(){r._set_data("value",a,!0),r._applyState("value",a,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,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return(t=this._get_data("events")).execute.apply(t,[e].concat(r))}},{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,r=arguments.length,a=new Array(r>2?r-2:0),o=2;o<r;o++)a[o-2]=arguments[o];(n=this._get_data("events")).promiseExecute.apply(n,[e,t].concat(a))}},{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 E)){var t,n=this._get_data("__requestHeaders__");for(var r in e){var a,o,i;if(n&&(null===(a=e[r])||void 0===a||null===(a=a.options)||void 0===a||!a.requestHeaders))null!==(i=e[r])&&void 0!==i&&i.options||(e[r].options={}),e[r].options.requestHeaders=n;null!==(o=this.getProxy())&&void 0!==o&&o[r]&&k()&&console.warn("[devfab][baseModel.prototype.setProxy]: Proxy ".concat(r," already exists on the model. Please change the name of ").concat(r," and try again"))}return this._set_data("proxy",E.create(d(d({},(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")}}])}(),q=function(){function e(){var t;a(this,e);for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return s(t=r(this,e,[].concat(o)),"modelType","SimpleModel"),t}return c(e,R),i(e,[{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)}}])}(),I=Array.isArray;function T(e){if(I(e))return e.map(T);if(e instanceof Date)return new Date(e.getTime());if(e&&"object"===m(e)){var t={};for(var n in e)t[n]=T(e[n]);return t}return e}function N(e,t,n){var r=this;this.promiseExecute("beforeQuery",{proxyConfig:e,queryParams:t},function(){var a=r,o=r.setProxy({queryData:e}),i=r._get_data("innerUsedAttrs").pageIndex,u={page:s(s({},r._get_data("innerUsedAttrs").pageSize,r.getPageSize()),i,r.getPageIndex())},c=Object.assign(t,u);r.setCache("proxyCache",{proxyConfig:e,params:c,callback:n});if(!1!==r.execute("beforeQueryData",c)){var l=T(c);o.queryData(l,function(e,t,r,a){if(!e){var o=t;this._set_data("dataSourceMode","remote");var i=function(e){if(!e)return[];if(I(e))return e;if(I(e.data))return e.data;if(I(e.records))return e.records;if(I(e.list))return e.list;if(I(e.rows))return e.rows;var t=e.data&&"object"===m(e.data)?e.data:e.result;return I(t)?t:t&&"object"===m(t)&&(t.records||t.list||t.rows||t.data)||[]}(o=Object.assign({},o));this.execute("afterQueryData",o),null==n||n.call(this,i)}},a)}})}function F(e){if(this.execute("beforeSetDataSource",e)){var t=this.getRowKeyField(),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 U=function(){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e);var o,i=d(d({},{columns:{},dataSource:[],rows:[],readOnly:!0,dataSourceMode:"local",columnMode:"local",editMode:"cell",rowKeyField:"id",cellState:{},rowState:{},showCheckBox:!1,multiple:!0,showRowNo:!0,pagination:!0,pageInfo:s(s(s({},(o={id:"_id",selected:"_selected",status:"_status",pageIndex:"pageNo",pageSize:"pageSize",pageCount:"total"}).pageIndex,1),o.pageSize,20),o.pageCount,0),innerUsedAttrs:o,multiRowModel:!1,editRowModels:{},loading:!1,params:{},originalKeyMap:{},defaultRowDatas:new Map}),n);I(i.dataSource)||(i.dataSource=[]),I(i.rows)||(i.rows=[]);var u=function(){return d({},(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).proxyConfig||{})}(n);return i.proxyConfig=u,i.dataSourceMode=n.dataSourceMode||i.dataSourceMode,s(t=r(this,e,[i]),"modelType","GridModel"),t.initColumns(i.columns),t.initPageInfo(n.cPage||n.page),t.afterInit(),t}return c(e,R),i(e,[{key:"afterInit",value:function(){this.execute("afterInit")}},{key:"initColumns",value:function(e){var t=function(e){var t={};return(I(e)?e:Object.keys(e||{}).map(function(t){var n;return d(d({},e[t]||{}),{},{field:(null===(n=e[t])||void 0===n?void 0:n.field)||t})})).forEach(function(e,n){if(e){var r=e.field||e.cFieldName||e.cName||"col_".concat(n);t[r]=d(d({},e),{},{field:r,label:e.label||e.title||e.cCaption||r,index:void 0===e.index?n:e.index})}}),t}(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=d({},this.getPageInfo()),n=this._get_data("innerUsedAttrs").pageIndex,r=this._get_data("innerUsedAttrs").pageSize;t[n]=e.pageNo||e.pageIndex||t.pageIndex||1,t[r]=e.pageSize||t.pageSize||20,!1===this.get("pagination")&&(t[n]=-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 d(d({},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,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;if("local"===this._get_data("dataSourceMode")){F(I(e)?e:[])}else{if(!this.execute("beforeProxyLoad",n))return;this.setPageIndex(1),N.call(this,e,n,function(e){F.call(t,e),null==r||r.call(t)})}}},{key:"reloadData",value:function(){var e=this,t=this.getCache("proxyCache");if(t){var n=t.proxyConfig,r=t.params,a=t.callback;N.call(this,n,r,function(t){null==a||a.call(e,t)})}else k()&&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",d(d({},t),e)),this.reloadData()}},{key:"setPageIndex",value:function(e){if("number"==typeof e){var t=this._get_data("innerUsedAttrs").pageIndex;this._set_data("pageInfo",d(d({},this.getPageInfo()),{},s({},t,Math.max(1,e))))}}},{key:"setPageSize",value:function(e){if("number"==typeof e){var t=this._get_data("innerUsedAttrs").pageIndex,n=this._get_data("innerUsedAttrs").pageSize;this._set_data("pageInfo",d(d({},this.getPageInfo()),{},s(s({},n,Math.max(-1,e)),t,1)))}}},{key:"setTotalCount",value:function(e){var t=this._get_data("innerUsedAttrs").pageCount;this.getPageInfo()[t]=e}}])}(),H=function(){function e(){var t;a(this,e);for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return s(t=r(this,e,[].concat(o)),"modelType","ViewModel"),t}return c(e,R),i(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 R&&(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 r,a=e.get(t);a instanceof R&&!1!==a._get_data("needCollect")&&(n[t]=null===(r=a.getData)||void 0===r?void 0:r.call(a))}),n}},{key:"getAllData",value:function(e){var t=this,n=this._get_data("propertyNames")||[],r={};return n.forEach(function(n){var a,o=t.get(n);if(o instanceof R&&!1!==o._get_data("needCollect")&&(!e||!o._get_data("isGrid"))){var i=null===(a=o.getData)||void 0===a?void 0:a.call(o);void 0!==i&&(r[n]=i)}}),r}},{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 r,a=t.get(n);a instanceof R&&!1!==a._get_data("needClear")&&(null===(r=a.clear)||void 0===r||r.call(a,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 r=null===(t=this.getParams())||void 0===t?void 0:t.masterGridModelName;if(r)return this.get(r);for(var a=this._get_data("propertyNames"),o=0,i=a.length;o<i;o++){if((n=this.get(a[o]))instanceof U||"GridModel"==n.modelType)return this._set_data("gridModel",n),n}}},{key:"getGridModels",value:function(){for(var e=this._get_data("propertyNames"),t=[],n=0,r=e.length;n<r;n++){var a=this.get(e[n]);(a instanceof U||"GridModel"==a.modelType)&&t.push(a)}return t}},{key:"getGridFilterModel",value:function(e){return this.getGridModel(e).getCache("FilterViewModel")}}])}();function G(e,t,n,r,a){var o,i=t,s=n,u=r,c=a;Array.isArray(t)&&"function"==typeof n&&(i=void 0,s=t,u=n,c=r);var l=(null===(o=c)||void 0===o?void 0:o.viewModel)||this,f=(s=Array.isArray(s)?s:[]).join(",");if(!e||"function"!=typeof e.inject){var d,v=function(e){return{code:404,message:"params.fileRequire is required, the files: ".concat(e),data:[],warnings:[]}}(f);return k()&&console.error("[devfab][models][extend][loadScripts] ".concat(v.message)),null===(d=u)||void 0===d||d(v),v}return e.inject(i,s,function(e){var t;if(0==e.code&&Array.isArray(e.data))for(var n=0,r=e.data.length;n<r;n++){var a=e.data[n];if(a&&a.doAction)try{a.doAction("init",l)}catch(t){e.code=500,e.message="".concat(f," 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(a,n)}catch(t){e.code=500,e.message="".concat(f," script customize execute error");break}}0!=e.code&&k()&&console.info("[devfab][models][extend][loadScripts] ".concat(f," \n [message]: ").concat(e.message," \n").concat(e.error?" \n [error]: ":""),e.error),null===(t=u)||void 0===t||t(e)})}function V(e){var t=this;window.__devfab&&window.__devfab.__debugger_initExtendJs;var n=e.fileRequire,r=e.extendScriptParams,a=e.readyEventName,o=void 0===a?"extendReady":a,i=r||{},s=i.enableJs,u=void 0!==s&&s,c=i.filepath,l=i.scriptUrl;if(!u)return k()&&console.info("[devfab][extend][js] not enable extend script"),void t.execute(o,t);if(!l)return k()&&console.info("[devfab][extend][js] extend script is not defined"),void t.execute(o,t);var f=c,d=[l];t.getEnv&&t.getEnv("everyCommonExtend")&&d.push(t.getEnv("everyCommonExtend")),G.call(t,n,f,d,function(e){t.execute(o,t,e)})}var L=function(){var e=n(v().m(function e(t,r,a){var o,i,s,u,c,l,f,d,h,y,p;return v().w(function(e){for(;;)switch(e.n){case 0:if(window.__devfab&&window.__devfab.__debugger_initExtJs,s=a.fileRequire,u=a.extendScriptParams,l=(c=u||{}).enableExtJs,f=void 0!==l&&l,d=c.exturlsField,h=void 0===d?"extscripturls":d,f){e.n=1;break}return k()&&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 k()&&console.info("[devfab][extend][exturls] script data is null"),e.a(2,Promise.resolve(!0));case 2:if(y=null==t?void 0:t[h],p=Array.isArray(y)?y:[],p=(p=(r.getCache("localScripts")||[]).concat(p)).concat(window.__devfab__GLOBAL_EXT_SCRIPTS__||[]),null!==(o=r.getParams())&&void 0!==o&&o.selfExtUrls&&(p=p.concat([r.getParams().selfExtUrls])),null===(i=p)||void 0===i||!i.length){e.n=4;break}return p=g(new Set(p)),e.n=3,Promise.all(p.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 3:p=e.v;case 4:return t[h]=p,e.a(2,new Promise(function(e,t){G.call(r,s,p,function(t){e(t)})}))}},e)}));return function(t,n,r){return e.apply(this,arguments)}}(),B=R,z=q,X=H,J=U;function K(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=n.modelNameField,s=void 0===o?"cName":o,u=function(e){function t(){return a(this,t),r(this,t,arguments)}return c(t,e),i(t,[{key:"init",value:function(e,t){var n=this.createModels(e,t);this.setData(n),this.setDirty(!1)}},{key:"createModels",value:function(e,t){var r={};return(Array.isArray(e)?e:[]).forEach(function(e){var t,a,o=function(e,t){var n=(null==t?void 0:t.SimpleModel)||q,r=e.cControlType||e.component||e.controlType||e.ctrlType;return r=r.toLowerCase(),new n(e)}(e,n),i={model:o,meta:e,childModel:!0,modelName:e[s]};null==n||null===(t=n.onBeforeInitModel)||void 0===t||t.call(n,i),r[i.modelName]=i.model,null==n||null===(a=n.onAfterInitModel)||void 0===a||a.call(n,i)}),r}},{key:"initData",value:function(){V.call(this,n)}}])}((null==n||null===(t=n.models)||void 0===t?void 0:t.ViewModel)||H);return u.prototype.modelType="ViewModel",u}var Q={models:Object.freeze({__proto__:null,BaseModel:B,SimpleModel:z,GridModel:J,ViewModel:X,initViewModel:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,a=function(e,t){var n,r,a,o=new(K(e,t)),i={model:o,meta:e};return null==t||null===(n=t.onBeforeInitModel)||void 0===n||n.call(t,i),i.model=o,null==o||null===(r=o.init)||void 0===r||r.call(o,e.models,e),null==t||null===(a=t.onAfterInitModel)||void 0===a||a.call(t,i),o}(e,t);return a.on("destroyVM",function(){var e,t;null===(e=a)||void 0===e||null===(t=e.destroyVM)||void 0===t||t.call(e),a=null,k()&&console.info("[devfab][models][initVM]: destory vm ".concat((new Date).toString()))}),a.on("extendReady",n(v().m(function n(){var o;return v().w(function(n){for(;;)switch(n.n){case 0:return(o=[]).push(L(e,a,t)),n.n=1,Promise.all(o);case 1:k()&&console.info("[devfab][models][initVM]: after vm init ".concat((new Date).toString())),null==r||r(a,e);case 2:return n.a(2)}},n)}))),a.initData(),a},loadScripts:G}),Builder:O,Cache:M,Event:D,Ajax:E};export{Q as default};
|