From c4125585cecbd125a9992411a63a2ef7dcf5e1e9 Mon Sep 17 00:00:00 2001 From: Teo <2642673902@qq.com> Date: Mon, 31 Mar 2025 18:00:54 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=88=97=E8=A1=A8=E5=92=8C?= =?UTF-8?q?=E5=88=86=E5=8C=85=E5=8D=95=E4=BD=8D=E4=BB=A5=E5=8F=8A=E8=BF=81?= =?UTF-8?q?=E7=A7=BB=E4=BA=BA=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- node_modules/.package-lock.json | 13 + .../amap-jsapi-loader/.vscode/settings.json | 4 + .../@amap/amap-jsapi-loader/README.md | 111 ++++++ .../@amap/amap-jsapi-loader/dist/index.js | 11 + .../amap-jsapi-loader/example/AMapUI.html | 69 ++++ .../@amap/amap-jsapi-loader/example/Loca.html | 76 ++++ .../amap-jsapi-loader/example/Multi.html | 94 +++++ .../example/example-es6.html | 36 ++ .../amap-jsapi-loader/example/example.html | 46 +++ .../example/libs/chai.min.js | 2 + .../example/libs/mocha.min.css | 1 + .../example/libs/mocha.min.js | 2 + .../@amap/amap-jsapi-loader/example/test.html | 287 ++++++++++++++ .../@amap/amap-jsapi-loader/index.d.ts | 15 + .../@amap/amap-jsapi-loader/package.json | 37 ++ .../@amap/amap-jsapi-loader/rollup.config.js | 25 ++ .../@amap/amap-jsapi-loader/src/global.d.ts | 5 + .../@amap/amap-jsapi-loader/src/index.ts | 367 ++++++++++++++++++ .../@amap/amap-jsapi-loader/test/demo.ts | 17 + .../@amap/amap-jsapi-loader/test/test.ts | 7 + package-lock.json | 18 + package.json | 5 + .../src/api/project/constructionUser/index.ts | 24 +- .../src/api/project/constructionUser/types.ts | 40 ++ plus-ui/src/api/project/contractor/types.ts | 5 + plus-ui/src/api/project/project/types.ts | 62 ++- plus-ui/src/components/amap/index.vue | 136 +++++++ .../views/project/constructionUser/index.vue | 73 +++- .../src/views/project/contractor/index.vue | 15 +- plus-ui/src/views/project/project/index.vue | 258 +++++++++--- 30 files changed, 1780 insertions(+), 81 deletions(-) create mode 100644 node_modules/.package-lock.json create mode 100644 node_modules/@amap/amap-jsapi-loader/.vscode/settings.json create mode 100644 node_modules/@amap/amap-jsapi-loader/README.md create mode 100644 node_modules/@amap/amap-jsapi-loader/dist/index.js create mode 100644 node_modules/@amap/amap-jsapi-loader/example/AMapUI.html create mode 100644 node_modules/@amap/amap-jsapi-loader/example/Loca.html create mode 100644 node_modules/@amap/amap-jsapi-loader/example/Multi.html create mode 100644 node_modules/@amap/amap-jsapi-loader/example/example-es6.html create mode 100644 node_modules/@amap/amap-jsapi-loader/example/example.html create mode 100644 node_modules/@amap/amap-jsapi-loader/example/libs/chai.min.js create mode 100644 node_modules/@amap/amap-jsapi-loader/example/libs/mocha.min.css create mode 100644 node_modules/@amap/amap-jsapi-loader/example/libs/mocha.min.js create mode 100644 node_modules/@amap/amap-jsapi-loader/example/test.html create mode 100644 node_modules/@amap/amap-jsapi-loader/index.d.ts create mode 100644 node_modules/@amap/amap-jsapi-loader/package.json create mode 100644 node_modules/@amap/amap-jsapi-loader/rollup.config.js create mode 100644 node_modules/@amap/amap-jsapi-loader/src/global.d.ts create mode 100644 node_modules/@amap/amap-jsapi-loader/src/index.ts create mode 100644 node_modules/@amap/amap-jsapi-loader/test/demo.ts create mode 100644 node_modules/@amap/amap-jsapi-loader/test/test.ts create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 plus-ui/src/components/amap/index.vue diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json new file mode 100644 index 00000000..9d75f6ec --- /dev/null +++ b/node_modules/.package-lock.json @@ -0,0 +1,13 @@ +{ + "name": "xinnengy", + "lockfileVersion": 3, + "requires": true, + "packages": { + "node_modules/@amap/amap-jsapi-loader": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/@amap/amap-jsapi-loader/-/amap-jsapi-loader-1.0.1.tgz", + "integrity": "sha512-nPyLKt7Ow/ThHLkSvn2etQlUzqxmTVgK7bIgwdBRTg2HK5668oN7xVxkaiRe3YZEzGzfV2XgH5Jmu2T73ljejw==", + "license": "MIT" + } + } +} diff --git a/node_modules/@amap/amap-jsapi-loader/.vscode/settings.json b/node_modules/@amap/amap-jsapi-loader/.vscode/settings.json new file mode 100644 index 00000000..4bc65fb8 --- /dev/null +++ b/node_modules/@amap/amap-jsapi-loader/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "editor.tabSize": 4, + "prettier.tabWidth": 4 +} \ No newline at end of file diff --git a/node_modules/@amap/amap-jsapi-loader/README.md b/node_modules/@amap/amap-jsapi-loader/README.md new file mode 100644 index 00000000..cbb3b55a --- /dev/null +++ b/node_modules/@amap/amap-jsapi-loader/README.md @@ -0,0 +1,111 @@ +# amap-jsapi-loader +amap-jsapi-loader 是高德开放平台官网提供的地图 JSAPI 的加载器,可帮助开发者快速定位、有效避免加载引用地图 JSAPI 各种错误用法。 + + +该加载器具有以下特性: +* 支持以 普通JS 和 npm包 两种方式使用; +* 有效避免错误异步加载导致的 JSAPI 资源加载不完整问题; +* 对于加载混用多个版本 JSAPI 的错误用法给予报错处理; +* 对于不合法加载引用 JSAPI 给予报错处理; +* 支持指定 JSAPI 版本; +* 支持插件加载; +* 允许多次执行加载操作,网络资源不会重复请求,便于大型工程模块管理; + + +# USAGE + +## AMapLoader.load方法参数说明 +```js +AMapLoader.load({ + "key": "", // 申请好的Web端开发者Key,首次调用 load 时必填 + "version": "2.0", // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15 + "plugins": [] // 需要使用的的插件列表,如比例尺'AMap.Scale'等 + "AMapUI": { // 是否加载 AMapUI,缺省不加载 + "version": '1.1', // AMapUI 缺省 1.1 + "plugins":[], // 需要加载的 AMapUI ui插件 + }, + "Loca":{ // 是否加载 Loca, 缺省不加载 + "version": '1.3.2' // Loca 版本,缺省 1.3.2 + }, +}).then(()=>{ + window.AMap.xx; + window.AMapUI.xx; + window.Loca.xx +}); + +``` + +## AMapUI + +AMapUI 用法和官网有一点点区别。通过 AMapUI.xx 来获取组件 +```js +AMapLoader.load({ + key: '',//首次load必填 + version: '2.0', + AMapUI: { + version: '1.1', + plugins: ['overlay/SimpleMarker'], + } +}).then((AMap) => { + map = new AMap.Map('container'); + + // !!! 通过 AMap.SimpleMarker 获取组件 + new AMapUI.SimpleMarker({ + //前景文字 + iconLabel: 'A', + //图标主题 + iconTheme: 'default', + //背景图标样式 + iconStyle: 'red', + map: map, + position: map.getCenter() + }); +}).catch((e) => { + console.error(e); +}); +``` + + +# 使用 +#### 以普通 JS 方式使用 Loader +尚未发布在线Loader,可将 dist/index.js 复制到项目下 +``` + + +``` +#### 以 NPM 包方式使用 Loader +安装 +``` +tnpm i @alife/amap-jsapi-loader --save-dev +``` +使用 +``` +import AMapLoader from '@alife/amap-jsapi-loader'; + +AMapLoader.load().then((AMap)=>{ + map = new AMap.Map('container'); +}).catch(e=>{ + console.log(e); +}) + +``` + +# 相关链接: +地               图 JSAPI:   [示例中心](https://lbs.amap.com/demo-center/js-api)    [教程](https://lbs.amap.com/api/javascript-api/summary)    [参考手册](https://lbs.amap.com/api/javascript-api/reference/map) + + + +数据可视化 JSAPI:   [示例中心](https://lbs.amap.com/demo-center/loca-api)    [教程](https://lbs.amap.com/api/loca-api/prod_intro)    [参考手册](https://lbs.amap.com/api/loca-api/guide/baselayer) + + diff --git a/node_modules/@amap/amap-jsapi-loader/dist/index.js b/node_modules/@amap/amap-jsapi-loader/dist/index.js new file mode 100644 index 00000000..b0daa689 --- /dev/null +++ b/node_modules/@amap/amap-jsapi-loader/dist/index.js @@ -0,0 +1,11 @@ +'use strict';(function(m,p){"object"===typeof exports&&"undefined"!==typeof module?module.exports=p():"function"===typeof define&&define.amd?define(p):(m=m||self,m.AMapLoader=p())})(this,function(){function m(a){var b=[];a.AMapUI&&b.push(p(a.AMapUI));a.Loca&&b.push(r(a.Loca));return Promise.all(b)}function p(a){return new Promise(function(h,c){var f=[];if(a.plugins)for(var e=0;e + + + + + + + JSAPI Loader + + + + +
+ + + + + + + + + \ No newline at end of file diff --git a/node_modules/@amap/amap-jsapi-loader/example/Loca.html b/node_modules/@amap/amap-jsapi-loader/example/Loca.html new file mode 100644 index 00000000..c6b791fb --- /dev/null +++ b/node_modules/@amap/amap-jsapi-loader/example/Loca.html @@ -0,0 +1,76 @@ + + + + + + + + JSAPI Loader + + + + +
+ + + + + + + + + \ No newline at end of file diff --git a/node_modules/@amap/amap-jsapi-loader/example/Multi.html b/node_modules/@amap/amap-jsapi-loader/example/Multi.html new file mode 100644 index 00000000..a5c76954 --- /dev/null +++ b/node_modules/@amap/amap-jsapi-loader/example/Multi.html @@ -0,0 +1,94 @@ + + + + + + + + JSAPI Loader + + + + +
+ + + + + + + + + \ No newline at end of file diff --git a/node_modules/@amap/amap-jsapi-loader/example/example-es6.html b/node_modules/@amap/amap-jsapi-loader/example/example-es6.html new file mode 100644 index 00000000..1580448b --- /dev/null +++ b/node_modules/@amap/amap-jsapi-loader/example/example-es6.html @@ -0,0 +1,36 @@ + + + + + + + JSAPI Loader - ES6 + + + +
+ + + + + + \ No newline at end of file diff --git a/node_modules/@amap/amap-jsapi-loader/example/example.html b/node_modules/@amap/amap-jsapi-loader/example/example.html new file mode 100644 index 00000000..a08b8e60 --- /dev/null +++ b/node_modules/@amap/amap-jsapi-loader/example/example.html @@ -0,0 +1,46 @@ + + + + + + + AMap JSAPI Loader + + + +
+ + + + + \ No newline at end of file diff --git a/node_modules/@amap/amap-jsapi-loader/example/libs/chai.min.js b/node_modules/@amap/amap-jsapi-loader/example/libs/chai.min.js new file mode 100644 index 00000000..1bea938b --- /dev/null +++ b/node_modules/@amap/amap-jsapi-loader/example/libs/chai.min.js @@ -0,0 +1,2 @@ +!function(){function require(e){var t=require.modules[e];if(!t)throw new Error('failed to require "'+e+'"');return"exports"in t||"function"!=typeof t.definition||(t.client=t.component=!0,t.definition.call(this,t.exports={},t),delete t.definition),t.exports}require.loader="component",require.helper={},require.helper.semVerSort=function(e,t){for(var i=e.version.split("."),r=t.version.split("."),n=0;ns?1:-1;var a=i[n].substr((""+o).length),c=r[n].substr((""+s).length);if(""===a&&""!==c)return 1;if(""!==a&&""===c)return-1;if(""!==a&&""!==c)return a>c?1:-1}return 0},require.latest=function(e,t){function i(e){throw new Error('failed to find latest module of "'+e+'"')}var r=/(.*)~(.*)@v?(\d+\.\d+\.\d+[^\/]*)$/,n=/(.*)~(.*)/;n.test(e)||i(e);for(var o=Object.keys(require.modules),s=[],a=[],c=0;c0){var f=s.sort(require.helper.semVerSort).pop().name;return t===!0?f:require(f)}var f=a.pop().name;return t===!0?f:require(f)},require.modules={},require.register=function(e,t){require.modules[e]={definition:t}},require.define=function(e,t){require.modules[e]={exports:t}},require.register("chaijs~assertion-error@1.0.0",function(e,t){function i(){function e(e,i){Object.keys(i).forEach(function(r){~t.indexOf(r)||(e[r]=i[r])})}var t=[].slice.call(arguments);return function(){for(var t=[].slice.call(arguments),i=0,r={};i=0;n--)if(h=o[n],!i(e[h],t[h],r))return!1;return!0}var p,d=require("chaijs~type-detect@0.1.1");try{p=require("buffer").Buffer}catch(b){p={},p.isBuffer=function(){return!1}}t.exports=i}),require.register("chai",function(e,t){t.exports=require("chai/lib/chai.js")}),require.register("chai/lib/chai.js",function(e,t){var i=[],e=t.exports={};e.version="1.10.0",e.AssertionError=require("chaijs~assertion-error@1.0.0");var r=require("chai/lib/chai/utils/index.js");e.use=function(e){return~i.indexOf(e)||(e(this,r),i.push(e)),this};var n=require("chai/lib/chai/config.js");e.config=n;var o=require("chai/lib/chai/assertion.js");e.use(o);var s=require("chai/lib/chai/core/assertions.js");e.use(s);var a=require("chai/lib/chai/interface/expect.js");e.use(a);var c=require("chai/lib/chai/interface/should.js");e.use(c);var u=require("chai/lib/chai/interface/assert.js");e.use(u)}),require.register("chai/lib/chai/assertion.js",function(e,t){var i=require("chai/lib/chai/config.js"),r=function(){};t.exports=function(e,t){function n(e,t,i){s(this,"ssfi",i||arguments.callee),s(this,"object",e),s(this,"message",t)}var o=e.AssertionError,s=t.flag;e.Assertion=n,Object.defineProperty(n,"includeStack",{get:function(){return console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),i.includeStack},set:function(e){console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),i.includeStack=e}}),Object.defineProperty(n,"showDiff",{get:function(){return console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),i.showDiff},set:function(e){console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),i.showDiff=e}}),n.addProperty=function(e,i){t.addProperty(this.prototype,e,i)},n.addMethod=function(e,i){t.addMethod(this.prototype,e,i)},n.addChainableMethod=function(e,i,r){t.addChainableMethod(this.prototype,e,i,r)},n.addChainableNoop=function(e,i){t.addChainableMethod(this.prototype,e,r,i)},n.overwriteProperty=function(e,i){t.overwriteProperty(this.prototype,e,i)},n.overwriteMethod=function(e,i){t.overwriteMethod(this.prototype,e,i)},n.overwriteChainableMethod=function(e,i,r){t.overwriteChainableMethod(this.prototype,e,i,r)},n.prototype.assert=function(e,r,n,a,c,u){var h=t.test(this,arguments);if(!0!==u&&(u=!1),!0!==i.showDiff&&(u=!1),!h){var r=t.getMessage(this,arguments),l=t.getActual(this,arguments);throw new o(r,{actual:l,expected:a,showDiff:u},i.includeStack?this.assert:s(this,"ssfi"))}},Object.defineProperty(n.prototype,"_obj",{get:function(){return s(this,"object")},set:function(e){s(this,"object",e)}})}}),require.register("chai/lib/chai/config.js",function(e,t){t.exports={includeStack:!1,showDiff:!0,truncateThreshold:40}}),require.register("chai/lib/chai/core/assertions.js",function(e,t){t.exports=function(e,t){function i(e,i){i&&x(this,"message",i),e=e.toLowerCase();var r=x(this,"object"),n=~["a","e","i","o","u"].indexOf(e.charAt(0))?"an ":"a ";this.assert(e===t.type(r),"expected #{this} to be "+n+e,"expected #{this} not to be "+n+e)}function r(){x(this,"contains",!0)}function n(e,i){i&&x(this,"message",i);var r=x(this,"object"),n=!1;if("array"===t.type(r)&&"object"===t.type(e)){for(var o in r)if(t.eql(r[o],e)){n=!0;break}}else if("object"===t.type(e)){if(!x(this,"negate")){for(var s in e)new j(r).property(s,e[s]);return}var a={};for(var s in e)a[s]=r[s];n=t.eql(a,e)}else n=r&&~r.indexOf(e);this.assert(n,"expected #{this} to include "+t.inspect(e),"expected #{this} to not include "+t.inspect(e))}function o(){var e=x(this,"object"),t=Object.prototype.toString.call(e);this.assert("[object Arguments]"===t,"expected #{this} to be arguments but got "+t,"expected #{this} to not be arguments")}function s(e,t){t&&x(this,"message",t);var i=x(this,"object");return x(this,"deep")?this.eql(e):void this.assert(e===i,"expected #{this} to equal #{exp}","expected #{this} to not equal #{exp}",e,this._obj,!0)}function a(e,i){i&&x(this,"message",i),this.assert(t.eql(e,x(this,"object")),"expected #{this} to deeply equal #{exp}","expected #{this} to not deeply equal #{exp}",e,this._obj,!0)}function c(e,t){t&&x(this,"message",t);var i=x(this,"object");if(x(this,"doLength")){new j(i,t).to.have.property("length");var r=i.length;this.assert(r>e,"expected #{this} to have a length above #{exp} but got #{act}","expected #{this} to not have a length above #{exp}",e,r)}else this.assert(i>e,"expected #{this} to be above "+e,"expected #{this} to be at most "+e)}function u(e,t){t&&x(this,"message",t);var i=x(this,"object");if(x(this,"doLength")){new j(i,t).to.have.property("length");var r=i.length;this.assert(r>=e,"expected #{this} to have a length at least #{exp} but got #{act}","expected #{this} to have a length below #{exp}",e,r)}else this.assert(i>=e,"expected #{this} to be at least "+e,"expected #{this} to be below "+e)}function h(e,t){t&&x(this,"message",t);var i=x(this,"object");if(x(this,"doLength")){new j(i,t).to.have.property("length");var r=i.length;this.assert(e>r,"expected #{this} to have a length below #{exp} but got #{act}","expected #{this} to not have a length below #{exp}",e,r)}else this.assert(e>i,"expected #{this} to be below "+e,"expected #{this} to be at least "+e)}function l(e,t){t&&x(this,"message",t);var i=x(this,"object");if(x(this,"doLength")){new j(i,t).to.have.property("length");var r=i.length;this.assert(e>=r,"expected #{this} to have a length at most #{exp} but got #{act}","expected #{this} to have a length above #{exp}",e,r)}else this.assert(e>=i,"expected #{this} to be at most "+e,"expected #{this} to be above "+e)}function f(e,i){i&&x(this,"message",i);var r=t.getName(e);this.assert(x(this,"object")instanceof e,"expected #{this} to be an instance of "+r,"expected #{this} to not be an instance of "+r)}function p(e,i){i&&x(this,"message",i);var r=x(this,"object");this.assert(r.hasOwnProperty(e),"expected #{this} to have own property "+t.inspect(e),"expected #{this} to not have own property "+t.inspect(e))}function d(){x(this,"doLength",!0)}function b(e,t){t&&x(this,"message",t);var i=x(this,"object");new j(i,t).to.have.property("length");var r=i.length;this.assert(r==e,"expected #{this} to have a length of #{exp} but got #{act}","expected #{this} to not have a length of #{act}",e,r)}function g(e){var i,r=x(this,"object"),n=!0;if(e=e instanceof Array?e:Array.prototype.slice.call(arguments),!e.length)throw new Error("keys required");var o=Object.keys(r),s=e,a=e.length;if(n=e.every(function(e){return~o.indexOf(e)}),x(this,"negate")||x(this,"contains")||(n=n&&e.length==o.length),a>1){e=e.map(function(e){return t.inspect(e)});var c=e.pop();i=e.join(", ")+", and "+c}else i=t.inspect(e[0]);i=(a>1?"keys ":"key ")+i,i=(x(this,"contains")?"contain ":"have ")+i,this.assert(n,"expected #{this} to "+i,"expected #{this} to not "+i,s.sort(),o.sort(),!0)}function v(e,i,r){r&&x(this,"message",r);var n=x(this,"object");new j(n,r).is.a("function");var o=!1,s=null,a=null,c=null;0===arguments.length?(i=null,e=null):e&&(e instanceof RegExp||"string"==typeof e)?(i=e,e=null):e&&e instanceof Error?(s=e,e=null,i=null):"function"==typeof e?(a=e.prototype.name||e.name,"Error"===a&&e!==Error&&(a=(new e).name)):e=null;try{n()}catch(u){if(s)return this.assert(u===s,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp}",s instanceof Error?s.toString():s,u instanceof Error?u.toString():u),x(this,"object",u),this;if(e&&(this.assert(u instanceof e,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp} but #{act} was thrown",a,u instanceof Error?u.toString():u),!i))return x(this,"object",u),this;var h="object"===t.type(u)&&"message"in u?u.message:""+u;if(null!=h&&i&&i instanceof RegExp)return this.assert(i.exec(h),"expected #{this} to throw error matching #{exp} but got #{act}","expected #{this} to throw error not matching #{exp}",i,h),x(this,"object",u),this;if(null!=h&&i&&"string"==typeof i)return this.assert(~h.indexOf(i),"expected #{this} to throw error including #{exp} but got #{act}","expected #{this} to throw error not including #{act}",i,h),x(this,"object",u),this;o=!0,c=u}var l="",f=null!==a?a:s?"#{exp}":"an error";o&&(l=" but #{act} was thrown"),this.assert(o===!0,"expected #{this} to throw "+f+l,"expected #{this} to not throw "+f+l,s instanceof Error?s.toString():s,c instanceof Error?c.toString():c),x(this,"object",c)}function y(e,t,i){return e.every(function(e){return i?t.some(function(t){return i(e,t)}):-1!==t.indexOf(e)})}var j=e.Assertion,x=(Object.prototype.toString,t.flag);["to","be","been","is","and","has","have","with","that","at","of","same"].forEach(function(e){j.addProperty(e,function(){return this})}),j.addProperty("not",function(){x(this,"negate",!0)}),j.addProperty("deep",function(){x(this,"deep",!0)}),j.addChainableMethod("an",i),j.addChainableMethod("a",i),j.addChainableMethod("include",n,r),j.addChainableMethod("contain",n,r),j.addChainableNoop("ok",function(){this.assert(x(this,"object"),"expected #{this} to be truthy","expected #{this} to be falsy")}),j.addChainableNoop("true",function(){this.assert(!0===x(this,"object"),"expected #{this} to be true","expected #{this} to be false",this.negate?!1:!0)}),j.addChainableNoop("false",function(){this.assert(!1===x(this,"object"),"expected #{this} to be false","expected #{this} to be true",this.negate?!0:!1)}),j.addChainableNoop("null",function(){this.assert(null===x(this,"object"),"expected #{this} to be null","expected #{this} not to be null")}),j.addChainableNoop("undefined",function(){this.assert(void 0===x(this,"object"),"expected #{this} to be undefined","expected #{this} not to be undefined")}),j.addChainableNoop("exist",function(){this.assert(null!=x(this,"object"),"expected #{this} to exist","expected #{this} to not exist")}),j.addChainableNoop("empty",function(){var e=x(this,"object"),t=e;Array.isArray(e)||"string"==typeof object?t=e.length:"object"==typeof e&&(t=Object.keys(e).length),this.assert(!t,"expected #{this} to be empty","expected #{this} not to be empty")}),j.addChainableNoop("arguments",o),j.addChainableNoop("Arguments",o),j.addMethod("equal",s),j.addMethod("equals",s),j.addMethod("eq",s),j.addMethod("eql",a),j.addMethod("eqls",a),j.addMethod("above",c),j.addMethod("gt",c),j.addMethod("greaterThan",c),j.addMethod("least",u),j.addMethod("gte",u),j.addMethod("below",h),j.addMethod("lt",h),j.addMethod("lessThan",h),j.addMethod("most",l),j.addMethod("lte",l),j.addMethod("within",function(e,t,i){i&&x(this,"message",i);var r=x(this,"object"),n=e+".."+t;if(x(this,"doLength")){new j(r,i).to.have.property("length");var o=r.length;this.assert(o>=e&&t>=o,"expected #{this} to have a length within "+n,"expected #{this} to not have a length within "+n)}else this.assert(r>=e&&t>=r,"expected #{this} to be within "+n,"expected #{this} to not be within "+n)}),j.addMethod("instanceof",f),j.addMethod("instanceOf",f),j.addMethod("property",function(e,i,r){r&&x(this,"message",r);var n=x(this,"deep")?"deep property ":"property ",o=x(this,"negate"),s=x(this,"object"),a=x(this,"deep")?t.getPathValue(e,s):s[e];if(o&&void 0!==i){if(void 0===a)throw r=null!=r?r+": ":"",new Error(r+t.inspect(s)+" has no "+n+t.inspect(e))}else this.assert(void 0!==a,"expected #{this} to have a "+n+t.inspect(e),"expected #{this} to not have "+n+t.inspect(e));void 0!==i&&this.assert(i===a,"expected #{this} to have a "+n+t.inspect(e)+" of #{exp}, but got #{act}","expected #{this} to not have a "+n+t.inspect(e)+" of #{act}",i,a),x(this,"object",a)}),j.addMethod("ownProperty",p),j.addMethod("haveOwnProperty",p),j.addChainableMethod("length",b,d),j.addMethod("lengthOf",b),j.addMethod("match",function(e,t){t&&x(this,"message",t);var i=x(this,"object");this.assert(e.exec(i),"expected #{this} to match "+e,"expected #{this} not to match "+e)}),j.addMethod("string",function(e,i){i&&x(this,"message",i);var r=x(this,"object");new j(r,i).is.a("string"),this.assert(~r.indexOf(e),"expected #{this} to contain "+t.inspect(e),"expected #{this} to not contain "+t.inspect(e))}),j.addMethod("keys",g),j.addMethod("key",g),j.addMethod("throw",v),j.addMethod("throws",v),j.addMethod("Throw",v),j.addMethod("respondTo",function(e,i){i&&x(this,"message",i);var r=x(this,"object"),n=x(this,"itself"),o="function"!==t.type(r)||n?r[e]:r.prototype[e];this.assert("function"==typeof o,"expected #{this} to respond to "+t.inspect(e),"expected #{this} to not respond to "+t.inspect(e))}),j.addProperty("itself",function(){x(this,"itself",!0)}),j.addMethod("satisfy",function(e,i){i&&x(this,"message",i);var r=x(this,"object"),n=e(r);this.assert(n,"expected #{this} to satisfy "+t.objDisplay(e),"expected #{this} to not satisfy"+t.objDisplay(e),this.negate?!1:!0,n)}),j.addMethod("closeTo",function(e,i,r){r&&x(this,"message",r);var n=x(this,"object");if(new j(n,r).is.a("number"),"number"!==t.type(e)||"number"!==t.type(i))throw new Error("the arguments to closeTo must be numbers");this.assert(Math.abs(n-e)<=i,"expected #{this} to be close to "+e+" +/- "+i,"expected #{this} not to be close to "+e+" +/- "+i)}),j.addMethod("members",function(e,i){i&&x(this,"message",i);var r=x(this,"object");new j(r).to.be.an("array"),new j(e).to.be.an("array");var n=x(this,"deep")?t.eql:void 0;return x(this,"contains")?this.assert(y(e,r,n),"expected #{this} to be a superset of #{act}","expected #{this} to not be a superset of #{act}",r,e):void this.assert(y(r,e,n)&&y(e,r,n),"expected #{this} to have the same members as #{act}","expected #{this} to not have the same members as #{act}",r,e)})}}),require.register("chai/lib/chai/interface/assert.js",function(exports,module){module.exports=function(chai,util){var Assertion=chai.Assertion,flag=util.flag,assert=chai.assert=function(e,t){var i=new Assertion(null,null,chai.assert);i.assert(e,t,"[ negation message unavailable ]")};assert.fail=function(e,t,i,r){throw i=i||"assert.fail()",new chai.AssertionError(i,{actual:e,expected:t,operator:r},assert.fail)},assert.ok=function(e,t){new Assertion(e,t).is.ok},assert.notOk=function(e,t){new Assertion(e,t).is.not.ok},assert.equal=function(e,t,i){var r=new Assertion(e,i,assert.equal);r.assert(t==flag(r,"object"),"expected #{this} to equal #{exp}","expected #{this} to not equal #{act}",t,e)},assert.notEqual=function(e,t,i){var r=new Assertion(e,i,assert.notEqual);r.assert(t!=flag(r,"object"),"expected #{this} to not equal #{exp}","expected #{this} to equal #{act}",t,e)},assert.strictEqual=function(e,t,i){new Assertion(e,i).to.equal(t)},assert.notStrictEqual=function(e,t,i){new Assertion(e,i).to.not.equal(t)},assert.deepEqual=function(e,t,i){new Assertion(e,i).to.eql(t)},assert.notDeepEqual=function(e,t,i){new Assertion(e,i).to.not.eql(t)},assert.isTrue=function(e,t){new Assertion(e,t).is["true"]},assert.isFalse=function(e,t){new Assertion(e,t).is["false"]},assert.isNull=function(e,t){new Assertion(e,t).to.equal(null)},assert.isNotNull=function(e,t){new Assertion(e,t).to.not.equal(null)},assert.isUndefined=function(e,t){new Assertion(e,t).to.equal(void 0)},assert.isDefined=function(e,t){new Assertion(e,t).to.not.equal(void 0)},assert.isFunction=function(e,t){new Assertion(e,t).to.be.a("function")},assert.isNotFunction=function(e,t){new Assertion(e,t).to.not.be.a("function")},assert.isObject=function(e,t){new Assertion(e,t).to.be.a("object")},assert.isNotObject=function(e,t){new Assertion(e,t).to.not.be.a("object")},assert.isArray=function(e,t){new Assertion(e,t).to.be.an("array")},assert.isNotArray=function(e,t){new Assertion(e,t).to.not.be.an("array")},assert.isString=function(e,t){new Assertion(e,t).to.be.a("string")},assert.isNotString=function(e,t){new Assertion(e,t).to.not.be.a("string")},assert.isNumber=function(e,t){new Assertion(e,t).to.be.a("number")},assert.isNotNumber=function(e,t){new Assertion(e,t).to.not.be.a("number")},assert.isBoolean=function(e,t){new Assertion(e,t).to.be.a("boolean")},assert.isNotBoolean=function(e,t){new Assertion(e,t).to.not.be.a("boolean")},assert.typeOf=function(e,t,i){new Assertion(e,i).to.be.a(t)},assert.notTypeOf=function(e,t,i){new Assertion(e,i).to.not.be.a(t)},assert.instanceOf=function(e,t,i){new Assertion(e,i).to.be.instanceOf(t)},assert.notInstanceOf=function(e,t,i){new Assertion(e,i).to.not.be.instanceOf(t)},assert.include=function(e,t,i){new Assertion(e,i,assert.include).include(t)},assert.notInclude=function(e,t,i){new Assertion(e,i,assert.notInclude).not.include(t)},assert.match=function(e,t,i){new Assertion(e,i).to.match(t)},assert.notMatch=function(e,t,i){new Assertion(e,i).to.not.match(t)},assert.property=function(e,t,i){new Assertion(e,i).to.have.property(t)},assert.notProperty=function(e,t,i){new Assertion(e,i).to.not.have.property(t)},assert.deepProperty=function(e,t,i){new Assertion(e,i).to.have.deep.property(t)},assert.notDeepProperty=function(e,t,i){new Assertion(e,i).to.not.have.deep.property(t)},assert.propertyVal=function(e,t,i,r){new Assertion(e,r).to.have.property(t,i)},assert.propertyNotVal=function(e,t,i,r){new Assertion(e,r).to.not.have.property(t,i)},assert.deepPropertyVal=function(e,t,i,r){new Assertion(e,r).to.have.deep.property(t,i)},assert.deepPropertyNotVal=function(e,t,i,r){new Assertion(e,r).to.not.have.deep.property(t,i)},assert.lengthOf=function(e,t,i){new Assertion(e,i).to.have.length(t)},assert.Throw=function(e,t,i,r){("string"==typeof t||t instanceof RegExp)&&(i=t,t=null);var n=new Assertion(e,r).to.Throw(t,i);return flag(n,"object")},assert.doesNotThrow=function(e,t,i){"string"==typeof t&&(i=t,t=null),new Assertion(e,i).to.not.Throw(t)},assert.operator=function(val,operator,val2,msg){if(!~["==","===",">",">=","<","<=","!=","!=="].indexOf(operator))throw new Error('Invalid operator "'+operator+'"');var test=new Assertion(eval(val+operator+val2),msg);test.assert(!0===flag(test,"object"),"expected "+util.inspect(val)+" to be "+operator+" "+util.inspect(val2),"expected "+util.inspect(val)+" to not be "+operator+" "+util.inspect(val2))},assert.closeTo=function(e,t,i,r){new Assertion(e,r).to.be.closeTo(t,i)},assert.sameMembers=function(e,t,i){new Assertion(e,i).to.have.same.members(t)},assert.includeMembers=function(e,t,i){new Assertion(e,i).to.include.members(t)},assert.ifError=function(e,t){new Assertion(e,t).to.not.be.ok},function e(t,i){return assert[i]=assert[t],e}("Throw","throw")("Throw","throws")}}),require.register("chai/lib/chai/interface/expect.js",function(e,t){t.exports=function(e){e.expect=function(t,i){return new e.Assertion(t,i)}}}),require.register("chai/lib/chai/interface/should.js",function(e,t){t.exports=function(e){function t(){function e(){return this instanceof String||this instanceof Number?new i(this.constructor(this),null,e):this instanceof Boolean?new i(1==this,null,e):new i(this,null,e)}function t(e){Object.defineProperty(this,"should",{value:e,enumerable:!0,configurable:!0,writable:!0})}Object.defineProperty(Object.prototype,"should",{set:t,get:e,configurable:!0});var r={};return r.equal=function(e,t,r){new i(e,r).to.equal(t)},r.Throw=function(e,t,r,n){new i(e,n).to.Throw(t,r)},r.exist=function(e,t){new i(e,t).to.exist},r.not={},r.not.equal=function(e,t,r){new i(e,r).to.not.equal(t)},r.not.Throw=function(e,t,r,n){new i(e,n).to.not.Throw(t,r)},r.not.exist=function(e,t){new i(e,t).to.not.exist},r["throw"]=r.Throw,r.not["throw"]=r.not.Throw,r}var i=e.Assertion;e.should=t,e.Should=t}}),require.register("chai/lib/chai/utils/addChainableMethod.js",function(e,t){var i=require("chai/lib/chai/utils/transferFlags.js"),r=require("chai/lib/chai/utils/flag.js"),n=require("chai/lib/chai/config.js"),o="__proto__"in Object,s=/^(?:length|name|arguments|caller)$/,a=Function.prototype.call,c=Function.prototype.apply;t.exports=function(e,t,u,h){"function"!=typeof h&&(h=function(){});var l={method:u,chainingBehavior:h};e.__methods||(e.__methods={}),e.__methods[t]=l,Object.defineProperty(e,t,{get:function(){l.chainingBehavior.call(this);var t=function f(){var e=r(this,"ssfi");e&&n.includeStack===!1&&r(this,"ssfi",f);var t=l.method.apply(this,arguments);return void 0===t?this:t};if(o){var u=t.__proto__=Object.create(this);u.call=a,u.apply=c}else{var h=Object.getOwnPropertyNames(e);h.forEach(function(i){if(!s.test(i)){var r=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,r)}})}return i(this,t),t},configurable:!0})}}),require.register("chai/lib/chai/utils/addMethod.js",function(e,t){var i=require("chai/lib/chai/config.js"),r=require("chai/lib/chai/utils/flag.js");t.exports=function(e,t,n){e[t]=function(){var o=r(this,"ssfi");o&&i.includeStack===!1&&r(this,"ssfi",e[t]);var s=n.apply(this,arguments);return void 0===s?this:s}}}),require.register("chai/lib/chai/utils/addProperty.js",function(e,t){t.exports=function(e,t,i){Object.defineProperty(e,t,{get:function(){var e=i.call(this);return void 0===e?this:e},configurable:!0})}}),require.register("chai/lib/chai/utils/flag.js",function(e,t){t.exports=function(e,t,i){var r=e.__flags||(e.__flags=Object.create(null));return 3!==arguments.length?r[t]:void(r[t]=i)}}),require.register("chai/lib/chai/utils/getActual.js",function(e,t){t.exports=function(e,t){return t.length>4?t[4]:e._obj}}),require.register("chai/lib/chai/utils/getEnumerableProperties.js",function(e,t){t.exports=function(e){var t=[];for(var i in e)t.push(i);return t}}),require.register("chai/lib/chai/utils/getMessage.js",function(e,t){var i=require("chai/lib/chai/utils/flag.js"),r=require("chai/lib/chai/utils/getActual.js"),n=(require("chai/lib/chai/utils/inspect.js"),require("chai/lib/chai/utils/objDisplay.js"));t.exports=function(e,t){var o=i(e,"negate"),s=i(e,"object"),a=t[3],c=r(e,t),u=o?t[2]:t[1],h=i(e,"message");return"function"==typeof u&&(u=u()),u=u||"",u=u.replace(/#{this}/g,n(s)).replace(/#{act}/g,n(c)).replace(/#{exp}/g,n(a)),h?h+": "+u:u}}),require.register("chai/lib/chai/utils/getName.js",function(e,t){t.exports=function(e){if(e.name)return e.name;var t=/^\s?function ([^(]*)\(/.exec(e);return t&&t[1]?t[1]:""}}),require.register("chai/lib/chai/utils/getPathValue.js",function(e,t){function i(e){var t=e.replace(/\[/g,".["),i=t.match(/(\\\.|[^.]+?)+/g);return i.map(function(e){var t=/\[(\d+)\]$/,i=t.exec(e);return i?{i:parseFloat(i[1])}:{p:e}})}function r(e,t){for(var i,r=t,n=0,o=e.length;o>n;n++){var s=e[n];r?("undefined"!=typeof s.p?r=r[s.p]:"undefined"!=typeof s.i&&(r=r[s.i]),n==o-1&&(i=r)):i=void 0}return i}t.exports=function(e,t){var n=i(e);return r(n,t)}}),require.register("chai/lib/chai/utils/getProperties.js",function(e,t){t.exports=function(){function e(e){-1===t.indexOf(e)&&t.push(e)}for(var t=Object.getOwnPropertyNames(subject),i=Object.getPrototypeOf(subject);null!==i;)Object.getOwnPropertyNames(i).forEach(e),i=Object.getPrototypeOf(i);return t}}),require.register("chai/lib/chai/utils/index.js",function(e,t){var e=t.exports={};e.test=require("chai/lib/chai/utils/test.js"),e.type=require("chai/lib/chai/utils/type.js"),e.getMessage=require("chai/lib/chai/utils/getMessage.js"),e.getActual=require("chai/lib/chai/utils/getActual.js"),e.inspect=require("chai/lib/chai/utils/inspect.js"),e.objDisplay=require("chai/lib/chai/utils/objDisplay.js"),e.flag=require("chai/lib/chai/utils/flag.js"),e.transferFlags=require("chai/lib/chai/utils/transferFlags.js"),e.eql=require("chaijs~deep-eql@0.1.3"),e.getPathValue=require("chai/lib/chai/utils/getPathValue.js"),e.getName=require("chai/lib/chai/utils/getName.js"),e.addProperty=require("chai/lib/chai/utils/addProperty.js"),e.addMethod=require("chai/lib/chai/utils/addMethod.js"),e.overwriteProperty=require("chai/lib/chai/utils/overwriteProperty.js"),e.overwriteMethod=require("chai/lib/chai/utils/overwriteMethod.js"),e.addChainableMethod=require("chai/lib/chai/utils/addChainableMethod.js"),e.overwriteChainableMethod=require("chai/lib/chai/utils/overwriteChainableMethod.js")}),require.register("chai/lib/chai/utils/inspect.js",function(e,t){function i(e,t,i){var n={showHidden:t,seen:[],stylize:function(e){return e}};return r(n,e,"undefined"==typeof i?2:i)}function r(t,i,p){if(i&&"function"==typeof i.inspect&&i.inspect!==e.inspect&&(!i.constructor||i.constructor.prototype!==i)){var y=i.inspect(p);return"string"!=typeof y&&(y=r(t,y,p)),y}var j=n(t,i);if(j)return j;if(v(i)){if("outerHTML"in i)return i.outerHTML;try{if(document.xmlVersion){var x=new XMLSerializer;return x.serializeToString(i)}var w="http://www.w3.org/1999/xhtml",m=document.createElementNS(w,"_");return m.appendChild(i.cloneNode(!1)),html=m.innerHTML.replace("><",">"+i.innerHTML+"<"),m.innerHTML="",html}catch(q){}}var A=g(i),O=t.showHidden?b(i):A;if(0===O.length||f(i)&&(1===O.length&&"stack"===O[0]||2===O.length&&"description"===O[0]&&"stack"===O[1])){if("function"==typeof i){var M=d(i),S=M?": "+M:"";return t.stylize("[Function"+S+"]","special")}if(h(i))return t.stylize(RegExp.prototype.toString.call(i),"regexp");if(l(i))return t.stylize(Date.prototype.toUTCString.call(i),"date");if(f(i))return o(i)}var _="",E=!1,P=["{","}"];if(u(i)&&(E=!0,P=["[","]"]),"function"==typeof i){var M=d(i),S=M?": "+M:"";_=" [Function"+S+"]"}if(h(i)&&(_=" "+RegExp.prototype.toString.call(i)),l(i)&&(_=" "+Date.prototype.toUTCString.call(i)),f(i))return o(i);if(0===O.length&&(!E||0==i.length))return P[0]+_+P[1];if(0>p)return h(i)?t.stylize(RegExp.prototype.toString.call(i),"regexp"):t.stylize("[Object]","special");t.seen.push(i);var k;return k=E?s(t,i,p,A,O):O.map(function(e){return a(t,i,p,A,e,E)}),t.seen.pop(),c(k,_,P)}function n(e,t){switch(typeof t){case"undefined":return e.stylize("undefined","undefined");case"string":var i="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(i,"string");case"number":return 0===t&&1/t===-1/0?e.stylize("-0","number"):e.stylize(""+t,"number");case"boolean":return e.stylize(""+t,"boolean")}return null===t?e.stylize("null","null"):void 0}function o(e){return"["+Error.prototype.toString.call(e)+"]"}function s(e,t,i,r,n){for(var o=[],s=0,c=t.length;c>s;++s)o.push(Object.prototype.hasOwnProperty.call(t,String(s))?a(e,t,i,r,String(s),!0):"");return n.forEach(function(n){n.match(/^\d+$/)||o.push(a(e,t,i,r,n,!0))}),o}function a(e,t,i,n,o,s){var a,c;if(t.__lookupGetter__&&(t.__lookupGetter__(o)?c=t.__lookupSetter__(o)?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):t.__lookupSetter__(o)&&(c=e.stylize("[Setter]","special"))),n.indexOf(o)<0&&(a="["+o+"]"),c||(e.seen.indexOf(t[o])<0?(c=null===i?r(e,t[o],null):r(e,t[o],i-1),c.indexOf("\n")>-1&&(c=s?c.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+c.split("\n").map(function(e){return" "+e}).join("\n"))):c=e.stylize("[Circular]","special")),"undefined"==typeof a){if(s&&o.match(/^\d+$/))return c;a=JSON.stringify(""+o),a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+c}function c(e,t,i){var r=0,n=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.length+1},0);return n>60?i[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+i[1]:i[0]+t+" "+e.join(", ")+" "+i[1]}function u(e){return Array.isArray(e)||"object"==typeof e&&"[object Array]"===p(e)}function h(e){return"object"==typeof e&&"[object RegExp]"===p(e)}function l(e){return"object"==typeof e&&"[object Date]"===p(e)}function f(e){return"object"==typeof e&&"[object Error]"===p(e)}function p(e){return Object.prototype.toString.call(e)}var d=require("chai/lib/chai/utils/getName.js"),b=require("chai/lib/chai/utils/getProperties.js"),g=require("chai/lib/chai/utils/getEnumerableProperties.js");t.exports=i;var v=function(e){return"object"==typeof HTMLElement?e instanceof HTMLElement:e&&"object"==typeof e&&1===e.nodeType&&"string"==typeof e.nodeName}}),require.register("chai/lib/chai/utils/objDisplay.js",function(e,t){var i=require("chai/lib/chai/utils/inspect.js"),r=require("chai/lib/chai/config.js");t.exports=function(e){var t=i(e),n=Object.prototype.toString.call(e);if(r.truncateThreshold&&t.length>=r.truncateThreshold){if("[object Function]"===n)return e.name&&""!==e.name?"[Function: "+e.name+"]":"[Function]"; +if("[object Array]"===n)return"[ Array("+e.length+") ]";if("[object Object]"===n){var o=Object.keys(e),s=o.length>2?o.splice(0,2).join(", ")+", ...":o.join(", ");return"{ Object ("+s+") }"}return t}return t}}),require.register("chai/lib/chai/utils/overwriteMethod.js",function(e,t){t.exports=function(e,t,i){var r=e[t],n=function(){return this};r&&"function"==typeof r&&(n=r),e[t]=function(){var e=i(n).apply(this,arguments);return void 0===e?this:e}}}),require.register("chai/lib/chai/utils/overwriteProperty.js",function(e,t){t.exports=function(e,t,i){var r=Object.getOwnPropertyDescriptor(e,t),n=function(){};r&&"function"==typeof r.get&&(n=r.get),Object.defineProperty(e,t,{get:function(){var e=i(n).call(this);return void 0===e?this:e},configurable:!0})}}),require.register("chai/lib/chai/utils/overwriteChainableMethod.js",function(e,t){t.exports=function(e,t,i,r){var n=e.__methods[t],o=n.chainingBehavior;n.chainingBehavior=function(){var e=r(o).call(this);return void 0===e?this:e};var s=n.method;n.method=function(){var e=i(s).apply(this,arguments);return void 0===e?this:e}}}),require.register("chai/lib/chai/utils/test.js",function(e,t){var i=require("chai/lib/chai/utils/flag.js");t.exports=function(e,t){var r=i(e,"negate"),n=t[0];return r?!n:n}}),require.register("chai/lib/chai/utils/transferFlags.js",function(e,t){t.exports=function(e,t,i){var r=e.__flags||(e.__flags=Object.create(null));t.__flags||(t.__flags=Object.create(null)),i=3===arguments.length?i:!0;for(var n in r)(i||"object"!==n&&"ssfi"!==n&&"message"!=n)&&(t.__flags[n]=r[n])}}),require.register("chai/lib/chai/utils/type.js",function(e,t){var i={"[object Arguments]":"arguments","[object Array]":"array","[object Date]":"date","[object Function]":"function","[object Number]":"number","[object RegExp]":"regexp","[object String]":"string"};t.exports=function(e){var t=Object.prototype.toString.call(e);return i[t]?i[t]:null===e?"null":void 0===e?"undefined":e===Object(e)?"object":typeof e}}),"object"==typeof exports?module.exports=require("chai"):"function"==typeof define&&define.amd?define("chai",[],function(){return require("chai")}):(this||window).chai=require("chai")}(); \ No newline at end of file diff --git a/node_modules/@amap/amap-jsapi-loader/example/libs/mocha.min.css b/node_modules/@amap/amap-jsapi-loader/example/libs/mocha.min.css new file mode 100644 index 00000000..ee35e3a6 --- /dev/null +++ b/node_modules/@amap/amap-jsapi-loader/example/libs/mocha.min.css @@ -0,0 +1 @@ +@charset "utf-8";body{margin:0}#mocha{font:20px/1.5 "Helvetica Neue",Helvetica,Arial,sans-serif;margin:60px 50px}#mocha li,#mocha ul{margin:0;padding:0}#mocha ul{list-style:none}#mocha h1,#mocha h2{margin:0}#mocha h1{margin-top:15px;font-size:1em;font-weight:200}#mocha h1 a{text-decoration:none;color:inherit}#mocha h1 a:hover{text-decoration:underline}#mocha .suite .suite h1{margin-top:0;font-size:.8em}#mocha .hidden{display:none}#mocha h2{font-size:12px;font-weight:400;cursor:pointer}#mocha .suite{margin-left:15px}#mocha .test{margin-left:15px;overflow:hidden}#mocha .test.pending:hover h2::after{content:'(pending)';font-family:arial,sans-serif}#mocha .test.pass.medium .duration{background:#c09853}#mocha .test.pass.slow .duration{background:#b94a48}#mocha .test.pass::before{content:'✓';font-size:12px;display:block;float:left;margin-right:5px;color:#00d6b2}#mocha .test.pass .duration{font-size:9px;margin-left:5px;padding:2px 5px;color:#fff;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.2);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.2);box-shadow:inset 0 1px 1px rgba(0,0,0,.2);-webkit-border-radius:5px;-moz-border-radius:5px;-ms-border-radius:5px;-o-border-radius:5px;border-radius:5px}#mocha .test.pass.fast .duration{display:none}#mocha .test.pending{color:#0b97c4}#mocha .test.pending::before{content:'◦';color:#0b97c4}#mocha .test.fail{color:#c00}#mocha .test.fail pre{color:#000}#mocha .test.fail::before{content:'✖';font-size:12px;display:block;float:left;margin-right:5px;color:#c00}#mocha .test pre.error{color:#c00;max-height:300px;overflow:auto}#mocha .test pre{display:block;float:left;clear:left;font:12px/1.5 monaco,monospace;margin:5px;padding:15px;border:1px solid #eee;max-width:85%;max-width:calc(100% - 42px);word-wrap:break-word;border-bottom-color:#ddd;-webkit-border-radius:3px;-webkit-box-shadow:0 1px 3px #eee;-moz-border-radius:3px;-moz-box-shadow:0 1px 3px #eee;border-radius:3px}#mocha .test h2{position:relative}#mocha .test a.replay{position:absolute;top:3px;right:0;text-decoration:none;vertical-align:middle;display:block;width:15px;height:15px;line-height:15px;text-align:center;background:#eee;font-size:15px;-moz-border-radius:15px;border-radius:15px;-webkit-transition:opacity 200ms;-moz-transition:opacity 200ms;transition:opacity 200ms;opacity:.3;color:#888}#mocha .test:hover a.replay{opacity:1}#mocha-report.fail .test.pass,#mocha-report.pass .test.fail,#mocha-report.pending .test.fail,#mocha-report.pending .test.pass{display:none}#mocha-report.pending .test.pass.pending{display:block}#mocha-error{color:#c00;font-size:1.5em;font-weight:100;letter-spacing:1px}#mocha-stats{position:fixed;top:15px;right:10px;font-size:12px;margin:0;color:#888;z-index:1}#mocha-stats .progress{float:right;padding-top:0}#mocha-stats em{color:#000}#mocha-stats a{text-decoration:none;color:inherit}#mocha-stats a:hover{border-bottom:1px solid #eee}#mocha-stats li{display:inline-block;margin:0 5px;list-style:none;padding-top:11px}#mocha-stats canvas{width:40px;height:40px}#mocha code .comment{color:#ddd}#mocha code .init{color:#2f6fad}#mocha code .string{color:#5890ad}#mocha code .keyword{color:#8a6343}#mocha code .number{color:#2f6fad}@media screen and (max-device-width:480px){#mocha{margin:60px 0}#mocha #stats{position:absolute}} \ No newline at end of file diff --git a/node_modules/@amap/amap-jsapi-loader/example/libs/mocha.min.js b/node_modules/@amap/amap-jsapi-loader/example/libs/mocha.min.js new file mode 100644 index 00000000..b5542b4c --- /dev/null +++ b/node_modules/@amap/amap-jsapi-loader/example/libs/mocha.min.js @@ -0,0 +1,2 @@ +!function(){function t(e){var n=t.resolve(e),r=t.modules[n];if(!r)throw new Error('failed to require "'+e+'"');return r.exports||(r.exports={},r.call(r.exports,r,r.exports,t.relative(n))),r.exports}function e(){for(var t=(new r).getTime();f.length&&(new r).getTime()-t<100;)f.shift()();l=f.length?o(e,0):null}t.modules={},t.resolve=function(e){var n=e,r=e+".js",o=e+"/index.js";return t.modules[r]&&r||t.modules[o]&&o||n},t.register=function(e,n){t.modules[e]=n},t.relative=function(e){return function(n){if("."!=n.charAt(0))return t(n);var r=e.split("/"),o=n.split("/");r.pop();for(var i=0;i/g,">"),e=e.replace(/"/g,""")}var r=function(t){this.ignoreWhitespace=t};r.prototype={diff:function(e,n){if(n===e)return[{value:n}];if(!n)return[{value:e,removed:!0}];if(!e)return[{value:n,added:!0}];n=this.tokenize(n),e=this.tokenize(e);var r=n.length,o=e.length,i=r+o,s=[{newPos:-1,components:[]}],a=this.extractCommon(s[0],n,e,0);if(s[0].newPos+1>=r&&a+1>=o)return s[0].components;for(var u=1;i>=u;u++)for(var c=-1*u;u>=c;c+=2){var l,f=s[c-1],p=s[c+1];a=(p?p.newPos:0)-c,f&&(s[c-1]=void 0);var h=f&&f.newPos+1=0&&o>a;if(h||d){!h||d&&f.newPos=r&&a+1>=o)return l.components;s[c]=l}else s[c]=void 0}},pushComponent:function(t,e,n,r){var o=t[t.length-1];o&&o.added===n&&o.removed===r?t[t.length-1]={value:this.join(o.value,e),added:n,removed:r}:t.push({value:e,added:n,removed:r})},extractCommon:function(t,e,n,r){for(var o=e.length,i=n.length,s=t.newPos,a=s-r;o>s+1&&i>a+1&&this.equals(e[s+1],n[a+1]);)s++,a++,this.pushComponent(t.components,e[s],void 0,void 0);return t.newPos=s,a},equals:function(t,e){var n=/\S/;return!this.ignoreWhitespace||n.test(t)||n.test(e)?t===e:!0},join:function(t,e){return t+e},tokenize:function(t){return t}};var o=new r,i=new r(!0),s=new r;i.tokenize=s.tokenize=function(t){return e(t.split(/(\s+|\b)/))};var a=new r(!0);a.tokenize=function(t){return e(t.split(/([{}:;,]|\s+)/))};var u=new r;return u.tokenize=function(t){for(var e=[],n=t.split(/^/m),r=0;r=0;s--){for(var c=r[s],l=0;l"):o.removed&&e.push(""),e.push(n(o.value)),o.added?e.push(""):o.removed&&e.push("")}return e.join("")},convertChangesToDMP:function(t){for(var e,n=[],r=0;ri;i++)if(r[i]===e||r[i].listener&&r[i].listener===e){o=i;break}if(0>o)return this;r.splice(o,1),r.length||delete this.$events[t]}else(r===e||r.listener&&r.listener===e)&&delete this.$events[t]}return this},r.prototype.removeAllListeners=function(t){return void 0===t?(this.$events={},this):(this.$events&&this.$events[t]&&(this.$events[t]=null),this)},r.prototype.listeners=function(t){return this.$events||(this.$events={}),this.$events[t]||(this.$events[t]=[]),n(this.$events[t])||(this.$events[t]=[this.$events[t]]),this.$events[t]},r.prototype.emit=function(t){if(!this.$events)return!1;var e=this.$events[t];if(!e)return!1;var r=[].slice.call(arguments,1);if("function"==typeof e)e.apply(this,r);else{if(!n(e))return!1;for(var o=e.slice(),i=0,s=o.length;s>i;i++)o[i].apply(this,r)}return!0}}),t.register("browser/fs.js",function(){}),t.register("browser/glob.js",function(){}),t.register("browser/path.js",function(){}),t.register("browser/progress.js",function(t){function e(){this.percent=0,this.size(0),this.fontSize(11),this.font("helvetica, arial, sans-serif")}t.exports=e,e.prototype.size=function(t){return this._size=t,this},e.prototype.text=function(t){return this._text=t,this},e.prototype.fontSize=function(t){return this._fontSize=t,this},e.prototype.font=function(t){return this._font=t,this},e.prototype.update=function(t){return this.percent=t,this},e.prototype.draw=function(t){try{var e=Math.min(this.percent,100),n=this._size,r=n/2,o=r,i=r,s=r-1,a=this._fontSize;t.font=a+"px "+this._font;var u=2*Math.PI*(e/100);t.clearRect(0,0,n,n),t.strokeStyle="#9f9f9f",t.beginPath(),t.arc(o,i,s,0,u,!1),t.stroke(),t.strokeStyle="#eee",t.beginPath(),t.arc(o,i,s-1,0,u,!0),t.stroke();var c=this._text||(0|e)+"%",l=t.measureText(c).width;t.fillText(c,o-l/2+1,i+a/2-1)}catch(f){}return this}}),t.register("browser/tty.js",function(t,e){e.isatty=function(){return!0},e.getWindowSize=function(){return"innerHeight"in n?[n.innerHeight,n.innerWidth]:[640,480]}}),t.register("context.js",function(t){function e(){}t.exports=e,e.prototype.runnable=function(t){return 0==arguments.length?this._runnable:(this.test=this._runnable=t,this)},e.prototype.timeout=function(t){return 0===arguments.length?this.runnable().timeout():(this.runnable().timeout(t),this)},e.prototype.enableTimeouts=function(t){return this.runnable().enableTimeouts(t),this},e.prototype.slow=function(t){return this.runnable().slow(t),this},e.prototype.inspect=function(){return JSON.stringify(this,function(t,e){return"_runnable"!=t&&"test"!=t?e:void 0},2)}}),t.register("hook.js",function(t,e,n){function r(t,e){i.call(this,t,e),this.type="hook"}function o(){}var i=n("./runnable");t.exports=r,o.prototype=i.prototype,r.prototype=new o,r.prototype.constructor=r,r.prototype.error=function(t){if(0==arguments.length){var t=this._error;return this._error=null,t}this._error=t}}),t.register("interfaces/bdd.js",function(t,e,n){var r=n("../suite"),o=n("../test"),i=(n("../utils"),n("browser/escape-string-regexp"));t.exports=function(t){var e=[t];t.on("pre-require",function(t,n,s){t.before=function(t,n){e[0].beforeAll(t,n)},t.after=function(t,n){e[0].afterAll(t,n)},t.beforeEach=function(t,n){e[0].beforeEach(t,n)},t.afterEach=function(t,n){e[0].afterEach(t,n)},t.describe=t.context=function(t,o){var i=r.create(e[0],t);return i.file=n,e.unshift(i),o.call(i),e.shift(),i},t.xdescribe=t.xcontext=t.describe.skip=function(t,n){var o=r.create(e[0],t);o.pending=!0,e.unshift(o),n.call(o),e.shift()},t.describe.only=function(e,n){var r=t.describe(e,n);return s.grep(r.fullTitle()),r},t.it=t.specify=function(t,r){var i=e[0];i.pending&&(r=null);var s=new o(t,r);return s.file=n,i.addTest(s),s},t.it.only=function(e,n){var r=t.it(e,n),o="^"+i(r.fullTitle())+"$";return s.grep(new RegExp(o)),r},t.xit=t.xspecify=t.it.skip=function(e){t.it(e)}})}}),t.register("interfaces/exports.js",function(t,e,n){var r=n("../suite"),o=n("../test");t.exports=function(t){function e(t,i){var s;for(var a in t)if("function"==typeof t[a]){var u=t[a];switch(a){case"before":n[0].beforeAll(u);break;case"after":n[0].afterAll(u);break;case"beforeEach":n[0].beforeEach(u);break;case"afterEach":n[0].afterEach(u);break;default:var c=new o(a,u);c.file=i,n[0].addTest(c)}}else s=r.create(n[0],a),n.unshift(s),e(t[a]),n.shift()}var n=[t];t.on("require",e)}}),t.register("interfaces/index.js",function(t,e,n){e.bdd=n("./bdd"),e.tdd=n("./tdd"),e.qunit=n("./qunit"),e.exports=n("./exports")}),t.register("interfaces/qunit.js",function(t,e,n){{var r=n("../suite"),o=n("../test"),i=n("browser/escape-string-regexp");n("../utils")}t.exports=function(t){var e=[t];t.on("pre-require",function(t,n,s){t.before=function(t,n){e[0].beforeAll(t,n)},t.after=function(t,n){e[0].afterAll(t,n)},t.beforeEach=function(t,n){e[0].beforeEach(t,n)},t.afterEach=function(t,n){e[0].afterEach(t,n)},t.suite=function(t){e.length>1&&e.shift();var o=r.create(e[0],t);return o.file=n,e.unshift(o),o},t.suite.only=function(e,n){var r=t.suite(e,n);s.grep(r.fullTitle())},t.test=function(t,r){var i=new o(t,r);return i.file=n,e[0].addTest(i),i},t.test.only=function(e,n){var r=t.test(e,n),o="^"+i(r.fullTitle())+"$";s.grep(new RegExp(o))},t.test.skip=function(e){t.test(e)}})}}),t.register("interfaces/tdd.js",function(t,e,n){{var r=n("../suite"),o=n("../test"),i=n("browser/escape-string-regexp");n("../utils")}t.exports=function(t){var e=[t];t.on("pre-require",function(t,n,s){t.setup=function(t,n){e[0].beforeEach(t,n)},t.teardown=function(t,n){e[0].afterEach(t,n)},t.suiteSetup=function(t,n){e[0].beforeAll(t,n)},t.suiteTeardown=function(t,n){e[0].afterAll(t,n)},t.suite=function(t,o){var i=r.create(e[0],t);return i.file=n,e.unshift(i),o.call(i),e.shift(),i},t.suite.skip=function(t,n){var o=r.create(e[0],t);o.pending=!0,e.unshift(o),n.call(o),e.shift()},t.suite.only=function(e,n){var r=t.suite(e,n);s.grep(r.fullTitle())},t.test=function(t,r){var i=e[0];i.pending&&(r=null);var s=new o(t,r);return s.file=n,i.addTest(s),s},t.test.only=function(e,n){var r=t.test(e,n),o="^"+i(r.fullTitle())+"$";s.grep(new RegExp(o))},t.test.skip=function(e){t.test(e)}})}}),t.register("mocha.js",function(t,e,r){function o(t){return __dirname+"/../images/"+t+".png"}function s(t){t=t||{},this.files=[],this.options=t,this.grep(t.grep),this.suite=new e.Suite("",new e.Context),this.ui(t.ui),this.bail(t.bail),this.reporter(t.reporter,t.reporterOptions),null!=t.timeout&&this.timeout(t.timeout),this.useColors(t.useColors),null!==t.enableTimeouts&&this.enableTimeouts(t.enableTimeouts),t.slow&&this.slow(t.slow),this.suite.on("pre-require",function(t){e.afterEach=t.afterEach||t.teardown,e.after=t.after||t.suiteTeardown,e.beforeEach=t.beforeEach||t.setup,e.before=t.before||t.suiteSetup,e.describe=t.describe||t.suite,e.it=t.it||t.test,e.setup=t.setup||t.beforeEach,e.suiteSetup=t.suiteSetup||t.before,e.suiteTeardown=t.suiteTeardown||t.after,e.suite=t.suite||t.describe,e.teardown=t.teardown||t.afterEach,e.test=t.test||t.it})}var a=r("browser/path"),u=r("browser/escape-string-regexp"),c=r("./utils");if(e=t.exports=s,"undefined"!=typeof i&&"function"==typeof i.cwd){var l=a.join,f=i.cwd();t.paths.push(f,l(f,"node_modules"))}e.utils=c,e.interfaces=r("./interfaces"),e.reporters=r("./reporters"),e.Runnable=r("./runnable"),e.Context=r("./context"),e.Runner=r("./runner"),e.Suite=r("./suite"),e.Hook=r("./hook"),e.Test=r("./test"),s.prototype.bail=function(t){return 0==arguments.length&&(t=!0),this.suite.bail(t),this},s.prototype.addFile=function(t){return this.files.push(t),this},s.prototype.reporter=function(t,e){if("function"==typeof t)this._reporter=t;else{t=t||"spec";var n;try{n=r("./reporters/"+t)}catch(o){}if(!n)try{n=r(t)}catch(o){}if(n||"teamcity"!==t||console.warn("The Teamcity reporter was moved to a package named mocha-teamcity-reporter (https://npmjs.org/package/mocha-teamcity-reporter)."),!n)throw new Error('invalid reporter "'+t+'"');this._reporter=n}return this.options.reporterOptions=e,this},s.prototype.ui=function(t){if(t=t||"bdd",this._ui=e.interfaces[t],!this._ui)try{this._ui=r(t)}catch(n){}if(!this._ui)throw new Error('invalid interface "'+t+'"');return this._ui=this._ui(this.suite),this},s.prototype.loadFiles=function(t){var e=this,o=this.suite,i=this.files.length;this.files.forEach(function(s){s=a.resolve(s),o.emit("pre-require",n,s,e),o.emit("require",r(s),s,e),o.emit("post-require",n,s,e),--i||t&&t()})},s.prototype._growl=function(t,e){var n=r("growl");t.on("end",function(){var r=e.stats;if(r.failures){var i=r.failures+" of "+t.total+" tests failed";n(i,{name:"mocha",title:"Failed",image:o("error")})}else n(r.passes+" tests passed in "+r.duration+"ms",{name:"mocha",title:"Passed",image:o("ok")})})},s.prototype.grep=function(t){return this.options.grep="string"==typeof t?new RegExp(u(t)):t,this},s.prototype.invert=function(){return this.options.invert=!0,this},s.prototype.ignoreLeaks=function(t){return this.options.ignoreLeaks=!!t,this},s.prototype.checkLeaks=function(){return this.options.ignoreLeaks=!1,this},s.prototype.growl=function(){return this.options.growl=!0,this},s.prototype.globals=function(t){return this.options.globals=(this.options.globals||[]).concat(t),this},s.prototype.useColors=function(t){return void 0!==t&&(this.options.useColors=t),this},s.prototype.useInlineDiffs=function(t){return this.options.useInlineDiffs=arguments.length&&void 0!=t?t:!1,this},s.prototype.timeout=function(t){return this.suite.timeout(t),this},s.prototype.slow=function(t){return this.suite.slow(t),this},s.prototype.enableTimeouts=function(t){return this.suite.enableTimeouts(arguments.length&&void 0!==t?t:!0),this},s.prototype.asyncOnly=function(){return this.options.asyncOnly=!0,this},s.prototype.noHighlighting=function(){return this.options.noHighlighting=!0,this},s.prototype.run=function(t){function n(e){s.done?s.done(e,t):t(e)}this.files.length&&this.loadFiles();var r=this.suite,o=this.options;o.files=this.files;var i=new e.Runner(r),s=new this._reporter(i,o);return i.ignoreLeaks=!1!==o.ignoreLeaks,i.asyncOnly=o.asyncOnly,o.grep&&i.grep(o.grep,o.invert),o.globals&&i.globals(o.globals),o.growl&&this._growl(i,s),void 0!==o.useColors&&(e.reporters.Base.useColors=o.useColors),e.reporters.Base.inlineDiffs=o.useInlineDiffs,i.run(n)}}),t.register("ms.js",function(t){function e(t){var e=/^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"y":return n*c;case"days":case"day":case"d":return n*u;case"hours":case"hour":case"h":return n*a;case"minutes":case"minute":case"m":return n*s;case"seconds":case"second":case"s":return n*i;case"ms":return n}}}function n(t){return t>=u?Math.round(t/u)+"d":t>=a?Math.round(t/a)+"h":t>=s?Math.round(t/s)+"m":t>=i?Math.round(t/i)+"s":t+"ms"}function r(t){return o(t,u,"day")||o(t,a,"hour")||o(t,s,"minute")||o(t,i,"second")||t+" ms"}function o(t,e,n){return e>t?void 0:1.5*e>t?Math.floor(t/e)+" "+n:Math.ceil(t/e)+" "+n+"s"}var i=1e3,s=60*i,a=60*s,u=24*a,c=365.25*u;t.exports=function(t,o){return o=o||{},"string"==typeof t?e(t):o["long"]?r(t):n(t)}}),t.register("reporters/base.js",function(t,e,r){function o(t){var e=this.stats={suites:0,tests:0,passes:0,pending:0,failures:0},n=this.failures=[];t&&(this.runner=t,t.stats=e,t.on("start",function(){e.start=new v}),t.on("suite",function(t){e.suites=e.suites||0,t.root||e.suites++}),t.on("test end",function(){e.tests=e.tests||0,e.tests++}),t.on("pass",function(t){e.passes=e.passes||0;var n=t.slow()/2;t.speed=t.duration>t.slow()?"slow":t.duration>n?"medium":"fast",e.passes++}),t.on("fail",function(t,r){e.failures=e.failures||0,e.failures++,t.err=r,n.push(t)}),t.on("end",function(){e.end=new v,e.duration=new v-e.start}),t.on("pending",function(){e.pending++}))}function s(t,e){return t=String(t),Array(e-t.length+1).join(" ")+t}function a(t,e){var n=c(t,"WordsWithSpace",e),r=n.split("\n");if(r.length>4){var o=String(r.length).length;n=r.map(function(t,e){return s(++e,o)+" | "+t}).join("\n")}return n="\n"+w("diff removed","actual")+" "+w("diff added","expected")+"\n\n"+n+"\n",n=n.replace(/^/gm," ")}function u(t,e){function n(t){return e&&(t=l(t)),"+"===t[0]?o+f("diff added",t):"-"===t[0]?o+f("diff removed",t):t.match(/\@\@/)?null:t.match(/\\ No newline/)?null:o+t}function r(t){return null!=t}var o=" ";msg=d.createPatch("string",t.actual,t.expected);var i=msg.split("\n").splice(4);return"\n "+f("diff added","+ expected")+" "+f("diff removed","- actual")+"\n\n"+i.map(n).filter(r).join("\n")}function c(t,e,n){var r=n?l(t.actual):t.actual,o=n?l(t.expected):t.expected;return d["diff"+e](r,o).map(function(t){return t.added?f("diff added",t.value):t.removed?f("diff removed",t.value):t.value}).join("")}function l(t){return t.replace(/\t/g,"").replace(/\r/g,"").replace(/\n/g,"\n")}function f(t,e){return e.split("\n").map(function(e){return w(t,e)}).join("\n")}function p(t,e){return t=Object.prototype.toString.call(t),e=Object.prototype.toString.call(e),t==e}var h=r("browser/tty"),d=r("browser/diff"),g=r("../ms"),m=r("../utils"),v=n.Date,y=(n.setTimeout,n.setInterval,n.clearTimeout,n.clearInterval,h.isatty(1)&&h.isatty(2));e=t.exports=o,e.useColors=y||void 0!==i.env.MOCHA_COLORS,e.inlineDiffs=!1,e.colors={pass:90,fail:31,"bright pass":92,"bright fail":91,"bright yellow":93,pending:36,suite:0,"error title":0,"error message":31,"error stack":90,checkmark:32,fast:90,medium:33,slow:31,green:32,light:90,"diff gutter":90,"diff added":42,"diff removed":41},e.symbols={ok:"✓",err:"✖",dot:"․"},"win32"==i.platform&&(e.symbols.ok="√",e.symbols.err="×",e.symbols.dot=".");var w=e.color=function(t,n){return e.useColors?"["+e.colors[t]+"m"+n+"":String(n)};e.window={width:y?i.stdout.getWindowSize?i.stdout.getWindowSize(1)[0]:h.getWindowSize()[1]:75},e.cursor={hide:function(){y&&i.stdout.write("[?25l")},show:function(){y&&i.stdout.write("[?25h")},deleteLine:function(){y&&i.stdout.write("")},beginningOfLine:function(){y&&i.stdout.write("")},CR:function(){y?(e.cursor.deleteLine(),e.cursor.beginningOfLine()):i.stdout.write("\r")}},e.list=function(t){console.log(),t.forEach(function(t,n){var r=w("error title"," %s) %s:\n")+w("error message"," %s")+w("error stack","\n%s\n"),o=t.err,i=o.message||"",s=o.stack||i,c=s.indexOf(i)+i.length,l=s.slice(0,c),f=o.actual,h=o.expected,d=!0;if(o.uncaught&&(l="Uncaught "+l),o.showDiff&&p(f,h)){"string"!=typeof f&&(d=!1,o.actual=f=m.stringify(f),o.expected=h=m.stringify(h)),r=w("error title"," %s) %s:\n%s")+w("error stack","\n%s\n");var g=i.match(/^([^:]+): expected/);l="\n "+w("error message",g?g[1]:l),l+=e.inlineDiffs?a(o,d):u(o,d)}s=s.slice(c?c+1:c).replace(/^/gm," "),console.log(r,n+1,t.fullTitle(),l,s)})},o.prototype.epilogue=function(){var t,e=this.stats;console.log(),t=w("bright pass"," ")+w("green"," %d passing")+w("light"," (%s)"),console.log(t,e.passes||0,g(e.duration)),e.pending&&(t=w("pending"," ")+w("pending"," %d pending"),console.log(t,e.pending)),e.failures&&(t=w("fail"," %d failing"),console.log(t,e.failures),o.list(this.failures),console.log()),console.log()}}),t.register("reporters/doc.js",function(t,e,n){function r(t){function e(){return Array(n).join(" ")}o.call(this,t);var n=(this.stats,t.total,2);t.on("suite",function(t){t.root||(++n,console.log('%s
',e()),++n,console.log("%s

%s

",e(),i.escape(t.title)),console.log("%s
",e()))}),t.on("suite end",function(t){t.root||(console.log("%s
",e()),--n,console.log("%s
",e()),--n)}),t.on("pass",function(t){console.log("%s
%s
",e(),i.escape(t.title));var n=i.escape(i.clean(t.fn.toString()));console.log("%s
%s
",e(),n)}),t.on("fail",function(t,n){console.log('%s
%s
',e(),i.escape(t.title));var r=i.escape(i.clean(t.fn.toString()));console.log('%s
%s
',e(),r),console.log('%s
%s
',e(),i.escape(n))})}var o=n("./base"),i=n("../utils");e=t.exports=r}),t.register("reporters/dot.js",function(t,e,n){function r(t){s.call(this,t);var e=this,n=(this.stats,.75*s.window.width|0),r=-1;t.on("start",function(){i.stdout.write("\n ")}),t.on("pending",function(){++r%n==0&&i.stdout.write("\n "),i.stdout.write(a("pending",s.symbols.dot))}),t.on("pass",function(t){++r%n==0&&i.stdout.write("\n "),i.stdout.write("slow"==t.speed?a("bright yellow",s.symbols.dot):a(t.speed,s.symbols.dot))}),t.on("fail",function(){++r%n==0&&i.stdout.write("\n "),i.stdout.write(a("fail",s.symbols.dot))}),t.on("end",function(){console.log(),e.epilogue()})}function o(){}var s=n("./base"),a=s.color;e=t.exports=r,o.prototype=s.prototype,r.prototype=new o,r.prototype.constructor=r}),t.register("reporters/html-cov.js",function(t,e,n){function r(t){var e=n("jade"),r=__dirname+"/templates/coverage.jade",u=a.readFileSync(r,"utf8"),c=e.compile(u,{filename:r}),l=this;s.call(this,t,!1),t.on("end",function(){i.stdout.write(c({cov:l.cov,coverageClass:o}))})}function o(t){return t>=75?"high":t>=50?"medium":t>=25?"low":"terrible"}var s=n("./json-cov"),a=n("browser/fs");e=t.exports=r}),t.register("reporters/html.js",function(t,e,r){function o(t){f.call(this,t);var e,n,r=this,o=this.stats,v=(t.total,s(m)),y=v.getElementsByTagName("li"),w=y[1].getElementsByTagName("em")[0],b=y[1].getElementsByTagName("a")[0],x=y[2].getElementsByTagName("em")[0],T=y[2].getElementsByTagName("a")[0],k=y[3].getElementsByTagName("em")[0],E=v.getElementsByTagName("canvas")[0],j=s('
    '),_=[j],S=document.getElementById("mocha");if(E.getContext){var C=window.devicePixelRatio||1;E.style.width=E.width,E.style.height=E.height,E.width*=C,E.height*=C,n=E.getContext("2d"),n.scale(C,C),e=new h}return S?(l(b,"click",function(){u();var t=/pass/.test(j.className)?"":" pass";j.className=j.className.replace(/fail|pass/g,"")+t,j.className.trim()&&a("test pass")}),l(T,"click",function(){u();var t=/fail/.test(j.className)?"":" fail";j.className=j.className.replace(/fail|pass/g,"")+t,j.className.trim()&&a("test fail")}),S.appendChild(v),S.appendChild(j),e&&e.size(40),t.on("suite",function(t){if(!t.root){var e=r.suiteURL(t),n=s('
  • %s

  • ',e,d(t.title));_[0].appendChild(n),_.unshift(document.createElement("ul")),n.appendChild(_[0])}}),t.on("suite end",function(t){t.root||_.shift()}),t.on("fail",function(e){"hook"==e.type&&t.emit("test end",e)}),void t.on("test end",function(t){var i=o.tests/this.total*100|0;e&&e.update(i).draw(n);var a=new g-o.start;if(c(w,o.passes),c(x,o.failures),c(k,(a/1e3).toFixed(2)),"passed"==t.state)var u=r.testURL(t),f=s('
  • %e%ems

  • ',t.speed,t.title,t.duration,u);else if(t.pending)var f=s('
  • %e

  • ',t.title);else{var f=s('
  • %e

  • ',t.title,r.testURL(t)),h=t.err.stack||t.err.toString();~h.indexOf(t.err.message)||(h=t.err.message+"\n"+h),"[object Error]"==h&&(h=t.err.message),!t.err.stack&&t.err.sourceURL&&void 0!==t.err.line&&(h+="\n("+t.err.sourceURL+":"+t.err.line+")"),f.appendChild(s('
    %e
    ',h))}if(!t.pending){var d=f.getElementsByTagName("h2")[0];l(d,"click",function(){m.style.display="none"==m.style.display?"block":"none"});var m=s("
    %e
    ",p.clean(t.fn.toString()));f.appendChild(m),m.style.display="none"}_[0]&&_[0].appendChild(f)})):i("#mocha div missing, add it to your document")}function i(t){document.body.appendChild(s('
    %s
    ',t))}function s(t){var e=arguments,n=document.createElement("div"),r=1;return n.innerHTML=t.replace(/%([se])/g,function(t,n){switch(n){case"s":return String(e[r++]);case"e":return d(e[r++])}}),n.firstChild}function a(t){for(var e=document.getElementsByClassName("suite"),n=0;n0&&(e.coverage=e.hits/e.sloc*100),e}function a(t,e){var n={filename:t,coverage:0,hits:0,misses:0,sloc:0,source:{}};return e.source.forEach(function(t,r){r++,0===e[r]?(n.misses++,n.sloc++):void 0!==e[r]&&(n.hits++,n.sloc++),n.source[r]={source:t,coverage:void 0===e[r]?"":e[r]}}),n.coverage=n.hits/n.sloc*100,n}function u(t){return{title:t.title,fullTitle:t.fullTitle(),duration:t.duration}}var c=r("./base");e=t.exports=o}),t.register("reporters/json-stream.js",function(t,e,n){function r(t){s.call(this,t);var e=this,n=(this.stats,t.total);t.on("start",function(){console.log(JSON.stringify(["start",{total:n}]))}),t.on("pass",function(t){console.log(JSON.stringify(["pass",o(t)]))}),t.on("fail",function(t,e){t=o(t),t.err=e.message,console.log(JSON.stringify(["fail",t]))}),t.on("end",function(){i.stdout.write(JSON.stringify(["end",e.stats]))})}function o(t){return{title:t.title,fullTitle:t.fullTitle(),duration:t.duration}}{var s=n("./base");s.color}e=t.exports=r}),t.register("reporters/json.js",function(t,e,n){function r(t){var e=this;a.call(this,t);var n=[],r=[],s=[],u=[];t.on("test end",function(t){n.push(t)}),t.on("pass",function(t){u.push(t)}),t.on("fail",function(t){s.push(t)}),t.on("pending",function(t){r.push(t)}),t.on("end",function(){var a={stats:e.stats,tests:n.map(o),pending:r.map(o),failures:s.map(o),passes:u.map(o)};t.testResults=a,i.stdout.write(JSON.stringify(a,null,2))})}function o(t){return{title:t.title,fullTitle:t.fullTitle(),duration:t.duration,err:s(t.err||{})}}function s(t){var e={};return Object.getOwnPropertyNames(t).forEach(function(n){e[n]=t[n]},t),e}{var a=n("./base");a.cursor,a.color}e=t.exports=r}),t.register("reporters/landing.js",function(t,e,n){function r(t){function e(){var t=Array(r).join("-");return" "+u("runway",t)}s.call(this,t);var n=this,r=(this.stats,.75*s.window.width|0),o=t.total,c=i.stdout,l=u("plane","✈"),f=-1,p=0;t.on("start",function(){c.write("\n\n\n "),a.hide()}),t.on("test end",function(t){var n=-1==f?r*++p/o|0:f;"failed"==t.state&&(l=u("plane crash","✈"),f=n),c.write("["+(r+1)+"D"),c.write(e()),c.write("\n "),c.write(u("runway",Array(n).join("⋅"))),c.write(l),c.write(u("runway",Array(r-n).join("⋅")+"\n")),c.write(e()),c.write("")}),t.on("end",function(){a.show(),console.log(),n.epilogue()})}function o(){}var s=n("./base"),a=s.cursor,u=s.color;e=t.exports=r,s.colors.plane=0,s.colors["plane crash"]=31,s.colors.runway=90,o.prototype=s.prototype,r.prototype=new o,r.prototype.constructor=r}),t.register("reporters/list.js",function(t,e,n){function r(t){s.call(this,t);var e=this,n=(this.stats,0);t.on("start",function(){console.log()}),t.on("test",function(t){i.stdout.write(u("pass"," "+t.fullTitle()+": "))}),t.on("pending",function(t){var e=u("checkmark"," -")+u("pending"," %s");console.log(e,t.fullTitle())}),t.on("pass",function(t){var e=u("checkmark"," "+s.symbols.dot)+u("pass"," %s: ")+u(t.speed,"%dms");a.CR(),console.log(e,t.fullTitle(),t.duration)}),t.on("fail",function(t){a.CR(),console.log(u("fail"," %d) %s"),++n,t.fullTitle())}),t.on("end",e.epilogue.bind(e))}function o(){}var s=n("./base"),a=s.cursor,u=s.color;e=t.exports=r,o.prototype=s.prototype,r.prototype=new o,r.prototype.constructor=r}),t.register("reporters/markdown.js",function(t,e,n){function r(t){function e(t){return Array(c).join("#")+" "+t}function n(t,e){var r=e,o=a+t.title;return e=e[o]=e[o]||{suite:t},t.suites.forEach(function(t){n(t,e)}),r}function r(t,e){++e;var n,o="";for(var i in t)"suite"!=i&&(i!==a&&(n=" - ["+i.substring(1)+"]",n+="(#"+s.slug(t[i].suite.fullTitle())+")\n",o+=Array(e).join(" ")+n),o+=r(t[i],e));return o}function u(t){var e=n(t,{});return r(e,0)}o.call(this,t);var c=(this.stats,0),l="";u(t.suite),t.on("suite",function(t){++c;var n=s.slug(t.fullTitle()); +l+='\n',l+=e(t.title)+"\n"}),t.on("suite end",function(){--c}),t.on("pass",function(t){var e=s.clean(t.fn.toString());l+=t.title+".\n",l+="\n```js\n",l+=e+"\n",l+="```\n\n"}),t.on("end",function(){i.stdout.write("# TOC\n"),i.stdout.write(u(t.suite)),i.stdout.write(l)})}var o=n("./base"),s=n("../utils"),a="$";e=t.exports=r}),t.register("reporters/min.js",function(t,e,n){function r(t){s.call(this,t),t.on("start",function(){i.stdout.write(""),i.stdout.write("")}),t.on("end",this.epilogue.bind(this))}function o(){}var s=n("./base");e=t.exports=r,o.prototype=s.prototype,r.prototype=new o,r.prototype.constructor=r}),t.register("reporters/nyan.js",function(t,e,n){function r(t){a.call(this,t);{var e=this,n=(this.stats,.75*a.window.width|0),r=(this.rainbowColors=e.generateColors(),this.colorIndex=0,this.numberOfLines=4,this.trajectories=[[],[],[],[]],this.nyanCatWidth=11);this.trajectoryWidthMax=n-r,this.scoreboardWidth=5,this.tick=0}t.on("start",function(){a.cursor.hide(),e.draw()}),t.on("pending",function(){e.draw()}),t.on("pass",function(){e.draw()}),t.on("fail",function(){e.draw()}),t.on("end",function(){a.cursor.show();for(var t=0;t=this.trajectoryWidthMax&&r.shift(),r.push(e)}},r.prototype.drawRainbow=function(){var t=this;this.trajectories.forEach(function(e){o("["+t.scoreboardWidth+"C"),o(e.join("")),o("\n")}),this.cursorUp(this.numberOfLines)},r.prototype.drawNyanCat=function(){var t=this,e=this.scoreboardWidth+this.trajectories[0].length,n="["+e+"C",r="";o(n),o("_,------,"),o("\n"),o(n),r=t.tick?" ":" ",o("_|"+r+"/\\_/\\ "),o("\n"),o(n),r=t.tick?"_":"__";var i=t.tick?"~":"^";o(i+"|"+r+this.face()+" "),o("\n"),o(n),r=t.tick?" ":" ",o(r+'"" "" '),o("\n"),this.cursorUp(this.numberOfLines)},r.prototype.face=function(){var t=this.stats;return t.failures?"( x .x)":t.pending?"( o .o)":t.passes?"( ^ .^)":"( - .-)"},r.prototype.cursorUp=function(t){o("["+t+"A")},r.prototype.cursorDown=function(t){o("["+t+"B")},r.prototype.generateColors=function(){for(var t=[],e=0;42>e;e++){var n=Math.floor(Math.PI/3),r=e*(1/6),o=Math.floor(3*Math.sin(r)+3),i=Math.floor(3*Math.sin(r+2*n)+3),s=Math.floor(3*Math.sin(r+4*n)+3);t.push(36*o+6*i+s+16)}return t},r.prototype.rainbowify=function(t){if(!a.useColors)return t;var e=this.rainbowColors[this.colorIndex%this.rainbowColors.length];return this.colorIndex+=1,"[38;5;"+e+"m"+t+""},s.prototype=a.prototype,r.prototype=new s,r.prototype.constructor=r}),t.register("reporters/progress.js",function(t,e,n){function r(t,e){s.call(this,t);var n=this,e=e||{},r=(this.stats,.5*s.window.width|0),o=t.total,c=0,l=(Math.max,-1);e.open=e.open||"[",e.complete=e.complete||"▬",e.incomplete=e.incomplete||s.symbols.dot,e.close=e.close||"]",e.verbose=!1,t.on("start",function(){console.log(),a.hide()}),t.on("test end",function(){c++;var t=c/o,n=r*t|0,s=r-n;(l!==n||e.verbose)&&(l=n,a.CR(),i.stdout.write(""),i.stdout.write(u("progress"," "+e.open)),i.stdout.write(Array(n).join(e.complete)),i.stdout.write(Array(s).join(e.incomplete)),i.stdout.write(u("progress",e.close)),e.verbose&&i.stdout.write(u("progress"," "+c+" of "+o)))}),t.on("end",function(){a.show(),console.log(),n.epilogue()})}function o(){}var s=n("./base"),a=s.cursor,u=s.color;e=t.exports=r,s.colors.progress=90,o.prototype=s.prototype,r.prototype=new o,r.prototype.constructor=r}),t.register("reporters/spec.js",function(t,e,n){function r(t){function e(){return Array(r).join(" ")}i.call(this,t);var n=this,r=(this.stats,0),o=0;t.on("start",function(){console.log()}),t.on("suite",function(t){++r,console.log(a("suite","%s%s"),e(),t.title)}),t.on("suite end",function(){--r,1==r&&console.log()}),t.on("pending",function(t){var n=e()+a("pending"," - %s");console.log(n,t.title)}),t.on("pass",function(t){if("fast"==t.speed){var n=e()+a("checkmark"," "+i.symbols.ok)+a("pass"," %s ");s.CR(),console.log(n,t.title)}else{var n=e()+a("checkmark"," "+i.symbols.ok)+a("pass"," %s ")+a(t.speed,"(%dms)");s.CR(),console.log(n,t.title,t.duration)}}),t.on("fail",function(t){s.CR(),console.log(e()+a("fail"," %d) %s"),++o,t.title)}),t.on("end",n.epilogue.bind(n))}function o(){}var i=n("./base"),s=i.cursor,a=i.color;e=t.exports=r,o.prototype=i.prototype,r.prototype=new o,r.prototype.constructor=r}),t.register("reporters/tap.js",function(t,e,n){function r(t){i.call(this,t);var e=(this.stats,1),n=0,r=0;t.on("start",function(){var e=t.grepTotal(t.suite);console.log("%d..%d",1,e)}),t.on("test end",function(){++e}),t.on("pending",function(t){console.log("ok %d %s # SKIP -",e,o(t))}),t.on("pass",function(t){n++,console.log("ok %d %s",e,o(t))}),t.on("fail",function(t,n){r++,console.log("not ok %d %s",e,o(t)),n.stack&&console.log(n.stack.replace(/^/gm," "))}),t.on("end",function(){console.log("# tests "+(n+r)),console.log("# pass "+n),console.log("# fail "+r)})}function o(t){return t.fullTitle().replace(/#/g,"")}{var i=n("./base");i.cursor,i.color}e=t.exports=r}),t.register("reporters/xunit.js",function(t,e,r){function o(t,e){u.call(this,t);var n=this.stats,r=[],o=this;if(e.reporterOptions&&e.reporterOptions.output){if(!l.createWriteStream)throw new Error("file output not supported in browser");o.fileStream=l.createWriteStream(e.reporterOptions.output)}t.on("pending",function(t){r.push(t)}),t.on("pass",function(t){r.push(t)}),t.on("fail",function(t){r.push(t)}),t.on("end",function(){o.write(s("testsuite",{name:"Mocha Tests",tests:n.tests,failures:n.failures,errors:n.failures,skipped:n.tests-n.failures-n.passes,timestamp:(new p).toUTCString(),time:n.duration/1e3||0},!1)),r.forEach(function(t){o.test(t)}),o.write("")})}function i(){}function s(t,e,n,r){var o,i=n?"/>":">",s=[];for(var a in e)s.push(a+'="'+f(e[a])+'"');return o="<"+t+(s.length?" "+s.join(" "):"")+i,r&&(o+=r+""}{var u=r("./base"),c=r("../utils"),l=r("browser/fs"),f=c.escape,p=n.Date;n.setTimeout,n.setInterval,n.clearTimeout,n.clearInterval}e=t.exports=o,o.prototype.done=function(t,e){this.fileStream?this.fileStream.end(function(){e(t)}):e(t)},i.prototype=u.prototype,o.prototype=new i,o.prototype.constructor=o,o.prototype.write=function(t){this.fileStream?this.fileStream.write(t+"\n"):console.log(t)},o.prototype.test=function(t){var e={classname:t.parent.fullTitle(),name:t.title,time:t.duration/1e3||0};if("failed"==t.state){var n=t.err;this.write(s("testcase",e,!1,s("failure",{},!1,a(f(n.message)+"\n"+n.stack))))}else this.write(t.pending?s("testcase",e,!1,s("skipped",{},!0)):s("testcase",e,!0))}}),t.register("runnable.js",function(t,e,r){function o(t,e){this.title=t,this.fn=e,this.async=e&&e.length,this.sync=!this.async,this._timeout=2e3,this._slow=75,this._enableTimeouts=!0,this.timedOut=!1,this._trace=new Error("done() called multiple times")}function i(){}var s=r("browser/events").EventEmitter,a=r("browser/debug")("mocha:runnable"),u=r("./ms"),c=r("./utils"),l=n.Date,f=n.setTimeout,p=(n.setInterval,n.clearTimeout),h=(n.clearInterval,Object.prototype.toString);t.exports=o,i.prototype=s.prototype,o.prototype=new i,o.prototype.constructor=o,o.prototype.timeout=function(t){return 0==arguments.length?this._timeout:(0===t&&(this._enableTimeouts=!1),"string"==typeof t&&(t=u(t)),a("timeout %d",t),this._timeout=t,this.timer&&this.resetTimeout(),this)},o.prototype.slow=function(t){return 0===arguments.length?this._slow:("string"==typeof t&&(t=u(t)),a("timeout %d",t),this._slow=t,this)},o.prototype.enableTimeouts=function(t){return 0===arguments.length?this._enableTimeouts:(a("enableTimeouts %s",t),this._enableTimeouts=t,this)},o.prototype.fullTitle=function(){return this.parent.fullTitle()+" "+this.title},o.prototype.clearTimeout=function(){p(this.timer)},o.prototype.inspect=function(){return JSON.stringify(this,function(t,e){return"_"!=t[0]?"parent"==t?"#":"ctx"==t?"#":e:void 0},2)},o.prototype.resetTimeout=function(){var t=this,e=this.timeout()||1e9;this._enableTimeouts&&(this.clearTimeout(),this.timer=f(function(){t._enableTimeouts&&(t.callback(new Error("timeout of "+e+"ms exceeded")),t.timedOut=!0)},e))},o.prototype.globals=function(t){this._allowedGlobals=t},o.prototype.run=function(t){function e(t){i||(i=!0,s.emit("error",t||new Error("done() called multiple times; stacktrace may be inaccurate")))}function n(n){var r=s.timeout();if(!s.timedOut){if(o)return e(n||s._trace);s.clearTimeout(),s.duration=new l-a,o=!0,!n&&s.duration>r&&s._enableTimeouts&&(n=new Error("timeout of "+r+"ms exceeded")),t(n)}}function r(t){var e=t.call(u);e&&"function"==typeof e.then?(s.resetTimeout(),e.then(function(){n()},function(t){n(t||new Error("Promise rejected with no or falsy reason"))})):n()}var o,i,s=this,a=new l,u=this.ctx;if(u&&u.runnable&&u.runnable(this),this.callback=n,this.async){this.resetTimeout();try{this.fn.call(u,function(t){return t instanceof Error||"[object Error]"===h.call(t)?n(t):null!=t?n("[object Object]"===Object.prototype.toString.call(t)?new Error("done() invoked with non-Error: "+JSON.stringify(t)):new Error("done() invoked with non-Error: "+t)):void n()})}catch(f){n(c.getError(f))}}else{if(this.asyncOnly)return n(new Error("--async-only option in use without declaring `done()`"));try{this.pending?n():r(this.fn)}catch(f){n(c.getError(f))}}}}),t.register("runner.js",function(t,e,r){function o(t){var e=this;this._globals=[],this._abort=!1,this.suite=t,this.total=t.total(),this.failures=0,this.on("test end",function(t){e.checkGlobals(t)}),this.on("hook end",function(t){e.checkGlobals(t)}),this.grep(/.*/),this.globals(this.globalProps().concat(u()))}function s(){}function a(t,e){return p(e,function(e){if(/^d+/.test(e))return!1;if(n.navigator&&/^getInterface/.test(e))return!1;if(n.navigator&&/^\d+/.test(e))return!1;if(/^mocha-/.test(e))return!1;var r=p(t,function(t){return~t.indexOf("*")?0==e.indexOf(t.split("*")[0]):e==t});return 0==r.length&&(!n.navigator||"onerror"!==e)})}function u(){if("object"==typeof i&&"string"==typeof i.version){var t=i.version.split(".").reduce(function(t,e){return t<<8|e});if(2315>t)return["errno"]}return[]}var c=r("browser/events").EventEmitter,l=r("browser/debug")("mocha:runner"),f=(r("./test"),r("./utils")),p=f.filter,h=(f.keys,["setTimeout","clearTimeout","setInterval","clearInterval","XMLHttpRequest","Date","setImmediate","clearImmediate"]);t.exports=o,o.immediately=n.setImmediate||i.nextTick,s.prototype=c.prototype,o.prototype=new s,o.prototype.constructor=o,o.prototype.grep=function(t,e){return l("grep %s",t),this._grep=t,this._invert=e,this.total=this.grepTotal(this.suite),this},o.prototype.grepTotal=function(t){var e=this,n=0;return t.eachTest(function(t){var r=e._grep.test(t.fullTitle());e._invert&&(r=!r),r&&n++}),n},o.prototype.globalProps=function(){for(var t=f.keys(n),e=0;e1?this.fail(t,new Error("global leaks detected: "+e.join(", "))):e.length&&this.fail(t,new Error("global leak detected: "+e[0])))}},o.prototype.fail=function(t,e){++this.failures,t.state="failed","string"==typeof e&&(e=new Error('the string "'+e+'" was thrown, throw an Error :)')),this.emit("fail",t,e)},o.prototype.failHook=function(t,e){this.fail(t,e),this.suite.bail()&&this.emit("end")},o.prototype.hook=function(t,e){function n(t){var r=i[t];return r?(s.currentRunnable=r,r.ctx.currentTest=s.test,s.emit("hook",r),r.on("error",function(t){s.failHook(r,t)}),void r.run(function(o){r.removeAllListeners("error");var i=r.error();return i&&s.fail(s.test,i),o?(s.failHook(r,o),e(o)):(s.emit("hook end",r),delete r.ctx.currentTest,void n(++t))})):e()}var r=this.suite,i=r["_"+t],s=this;o.immediately(function(){n(0)})},o.prototype.hooks=function(t,e,n){function r(s){return o.suite=s,s?void o.hook(t,function(t){if(t){var s=o.suite;return o.suite=i,n(t,s)}r(e.pop())}):(o.suite=i,n())}var o=this,i=this.suite;r(e.pop())},o.prototype.hookUp=function(t,e){var n=[this.suite].concat(this.parents()).reverse();this.hooks(t,n,e)},o.prototype.hookDown=function(t,e){var n=[this.suite].concat(this.parents());this.hooks(t,n,e)},o.prototype.parents=function(){for(var t=this.suite,e=[];t=t.parent;)e.push(t);return e},o.prototype.runTest=function(t){var e=this.test,n=this;this.asyncOnly&&(e.asyncOnly=!0);try{e.on("error",function(t){n.fail(e,t)}),e.run(t)}catch(r){t(r)}},o.prototype.runTests=function(t,e){function n(t,r,o){var s=i.suite;i.suite=o?r.parent:r,i.suite?i.hookUp("afterEach",function(t,o){return i.suite=s,t?n(t,o,!0):void e(r)}):(i.suite=s,e(r))}function r(a,u){if(i.failures&&t._bail)return e();if(i._abort)return e();if(a)return n(a,u,!0);if(o=s.shift(),!o)return e();var c=i._grep.test(o.fullTitle());return i._invert&&(c=!c),c?o.pending?(i.emit("pending",o),i.emit("test end",o),r()):(i.emit("test",i.test=o),void i.hookDown("beforeEach",function(t,e){return t?n(t,e,!1):(i.currentRunnable=i.test,void i.runTest(function(t){return o=i.test,t?(i.fail(o,t),i.emit("test end",o),i.hookUp("afterEach",r)):(o.state="passed",i.emit("pass",o),i.emit("test end",o),void i.hookUp("afterEach",r))}))})):r()}var o,i=this,s=t.tests.slice();this.next=r,r()},o.prototype.runSuite=function(t,e){function n(e){if(e)return e==t?r():r(e);if(i._abort)return r();var o=t.suites[s++];return o?void i.runSuite(o,n):r()}function r(n){i.suite=t,i.hook("afterAll",function(){i.emit("suite end",t),e(n)})}var o=this.grepTotal(t),i=this,s=0;return l("run suite %s",t.fullTitle()),o?(this.emit("suite",this.suite=t),void this.hook("beforeAll",function(e){return e?r():void i.runTests(t,n)})):e()},o.prototype.uncaught=function(t){t?l("uncaught exception %s",t!==function(){return this}.call(t)?t:t.message||t):(l("uncaught undefined exception"),t=f.undefinedError()),t.uncaught=!0;var e=this.currentRunnable;if(e){var n=e.state;if(this.fail(e,t),e.clearTimeout(),!n)return"test"==e.type?(this.emit("test end",e),void this.hookUp("afterEach",this.next)):void this.emit("end")}},o.prototype.run=function(t){function e(t){n.uncaught(t)}var n=this,t=t||function(){};return l("start"),this.on("end",function(){l("end"),i.removeListener("uncaughtException",e),t(n.failures)}),this.emit("start"),this.runSuite(this.suite,function(){l("finished running"),n.emit("end")}),i.on("uncaughtException",e),this},o.prototype.abort=function(){l("aborting"),this._abort=!0}}),t.register("suite.js",function(t,e,n){function r(t,e){this.title=t;var n=function(){};n.prototype=e,this.ctx=new n,this.suites=[],this.tests=[],this.pending=!1,this._beforeEach=[],this._beforeAll=[],this._afterEach=[],this._afterAll=[],this.root=!t,this._timeout=2e3,this._enableTimeouts=!0,this._slow=75,this._bail=!1}function o(){}var i=n("browser/events").EventEmitter,s=n("browser/debug")("mocha:suite"),a=n("./ms"),u=n("./utils"),c=n("./hook");e=t.exports=r,e.create=function(t,e){var n=new r(e,t.ctx);return n.parent=t,t.pending&&(n.pending=!0),e=n.fullTitle(),t.addSuite(n),n},o.prototype=i.prototype,r.prototype=new o,r.prototype.constructor=r,r.prototype.clone=function(){var t=new r(this.title);return s("clone"),t.ctx=this.ctx,t.timeout(this.timeout()),t.enableTimeouts(this.enableTimeouts()),t.slow(this.slow()),t.bail(this.bail()),t},r.prototype.timeout=function(t){return 0==arguments.length?this._timeout:("0"===t.toString()&&(this._enableTimeouts=!1),"string"==typeof t&&(t=a(t)),s("timeout %d",t),this._timeout=parseInt(t,10),this)},r.prototype.enableTimeouts=function(t){return 0===arguments.length?this._enableTimeouts:(s("enableTimeouts %s",t),this._enableTimeouts=t,this)},r.prototype.slow=function(t){return 0===arguments.length?this._slow:("string"==typeof t&&(t=a(t)),s("slow %d",t),this._slow=t,this)},r.prototype.bail=function(t){return 0==arguments.length?this._bail:(s("bail %s",t),this._bail=t,this)},r.prototype.beforeAll=function(t,e){if(this.pending)return this;"function"==typeof t&&(e=t,t=e.name),t='"before all" hook'+(t?": "+t:"");var n=new c(t,e);return n.parent=this,n.timeout(this.timeout()),n.enableTimeouts(this.enableTimeouts()),n.slow(this.slow()),n.ctx=this.ctx,this._beforeAll.push(n),this.emit("beforeAll",n),this},r.prototype.afterAll=function(t,e){if(this.pending)return this;"function"==typeof t&&(e=t,t=e.name),t='"after all" hook'+(t?": "+t:"");var n=new c(t,e);return n.parent=this,n.timeout(this.timeout()),n.enableTimeouts(this.enableTimeouts()),n.slow(this.slow()),n.ctx=this.ctx,this._afterAll.push(n),this.emit("afterAll",n),this},r.prototype.beforeEach=function(t,e){if(this.pending)return this;"function"==typeof t&&(e=t,t=e.name),t='"before each" hook'+(t?": "+t:"");var n=new c(t,e);return n.parent=this,n.timeout(this.timeout()),n.enableTimeouts(this.enableTimeouts()),n.slow(this.slow()),n.ctx=this.ctx,this._beforeEach.push(n),this.emit("beforeEach",n),this},r.prototype.afterEach=function(t,e){if(this.pending)return this;"function"==typeof t&&(e=t,t=e.name),t='"after each" hook'+(t?": "+t:"");var n=new c(t,e);return n.parent=this,n.timeout(this.timeout()),n.enableTimeouts(this.enableTimeouts()),n.slow(this.slow()),n.ctx=this.ctx,this._afterEach.push(n),this.emit("afterEach",n),this},r.prototype.addSuite=function(t){return t.parent=this,t.timeout(this.timeout()),t.enableTimeouts(this.enableTimeouts()),t.slow(this.slow()),t.bail(this.bail()),this.suites.push(t),this.emit("suite",t),this},r.prototype.addTest=function(t){return t.parent=this,t.timeout(this.timeout()),t.enableTimeouts(this.enableTimeouts()),t.slow(this.slow()),t.ctx=this.ctx,this.tests.push(t),this.emit("test",t),this},r.prototype.fullTitle=function(){if(this.parent){var t=this.parent.fullTitle();if(t)return t+" "+this.title}return this.title},r.prototype.total=function(){return u.reduce(this.suites,function(t,e){return t+e.total()},0)+this.tests.length},r.prototype.eachTest=function(t){return u.forEach(this.tests,t),u.forEach(this.suites,function(e){e.eachTest(t)}),this}}),t.register("test.js",function(t,e,n){function r(t,e){i.call(this,t,e),this.pending=!e,this.type="test"}function o(){}var i=n("./runnable");t.exports=r,o.prototype=i.prototype,r.prototype=new o,r.prototype.constructor=r}),t.register("utils.js",function(t,e,n){function r(t){return!~p.indexOf(t)}function o(t){return t.replace(//g,">").replace(/\/\/(.*)/gm,'//$1').replace(/('.*?')/gm,'$1').replace(/(\d+\.\d+)/gm,'$1').replace(/(\d+)/gm,'$1').replace(/\bnew[ \t]+(\w+)/gm,'new $1').replace(/\b(function|new|throw|return|var|if|else)\b/gm,'$1')}var i=n("browser/fs"),s=n("browser/path"),a=s.basename,u=i.existsSync||s.existsSync,c=n("browser/glob"),l=s.join,f=n("browser/debug")("mocha:watch"),p=["node_modules",".git"];e.escape=function(t){return String(t).replace(/&/g,"&").replace(/"/g,""").replace(//g,">")},e.forEach=function(t,e,n){for(var r=0,o=t.length;o>r;r++)e.call(n,t[r],r)},e.map=function(t,e,n){for(var r=[],o=0,i=t.length;i>o;o++)r.push(e.call(n,t[o],o));return r},e.indexOf=function(t,e,n){for(var r=n||0,o=t.length;o>r;r++)if(t[r]===e)return r;return-1},e.reduce=function(t,e,n){for(var r=n,o=0,i=t.length;i>o;o++)r=e(r,t[o],o,t);return r},e.filter=function(t,e){for(var n=[],r=0,o=t.length;o>r;r++){var i=t[r];e(i,r,t)&&n.push(i)}return n},e.keys=Object.keys||function(t){var e=[],n=Object.prototype.hasOwnProperty;for(var r in t)n.call(t,r)&&e.push(r);return e},e.watch=function(t,e){var n={interval:100};t.forEach(function(t){f("file %s",t),i.watchFile(t,n,function(n,r){r.mtime *{?/,"").replace(/\s+\}$/,"");var n=t.match(/^\n?( *)/)[1].length,r=t.match(/^\n?(\t*)/)[1].length,o=new RegExp("^\n?"+(r?" ":" ")+"{"+(r?r:n)+"}","gm");return t=t.replace(o,""),e.trim(t)},e.trim=function(t){return t.replace(/^\s+|\s+$/g,"")},e.parseQuery=function(t){return e.reduce(t.replace("?","").split("&"),function(t,e){var n=e.indexOf("="),r=e.slice(0,n),o=e.slice(++n);return t[r]=decodeURIComponent(o),t},{})},e.highlightTags=function(t){for(var e=document.getElementById("mocha").getElementsByTagName(t),n=0,r=e.length;r>n;++n)e[n].innerHTML=o(e[n].innerHTML)};var h=function(t,n){switch(n=n||e.type(t)){case"function":return"[Function]";case"object":return"{}";case"array":return"[]";default:return t.toString()}};e.type=function(t){return"undefined"!=typeof Buffer&&Buffer.isBuffer(t)?"buffer":Object.prototype.toString.call(t).replace(/^\[.+\s(.+?)\]$/,"$1").toLowerCase()},e.stringify=function(t){var n,r=e.type(t);if("null"===r||"undefined"===r)return"["+r+"]";if("date"===r)return"[Date: "+t.toISOString()+"]";if(!~e.indexOf(["object","array","function"],r))return t.toString();for(n in t)if(t.hasOwnProperty(n))return JSON.stringify(e.canonicalize(t),null,2).replace(/,(\n|$)/g,"$1");return h(t,r)},e.isBuffer=function(t){return"undefined"!=typeof Buffer&&Buffer.isBuffer(t)},e.canonicalize=function(t,n){var r,o,i=e.type(t),s=function(t,e){n.push(t),e(),n.pop()};if(n=n||[],-1!==e.indexOf(n,t))return"[Circular]";switch(i){case"undefined":r="[undefined]";break;case"buffer":case"null":r=t;break;case"array":s(t,function(){r=e.map(t,function(t){return e.canonicalize(t,n)})});break;case"date":r="[Date: "+t.toISOString()+"]";break;case"function":for(o in t){r={};break}if(!r){r=h(t,i);break}case"object":r=r||{},s(t,function(){e.forEach(e.keys(t).sort(),function(o){r[o]=e.canonicalize(t[o],n)})});break;case"number":case"boolean":r=t;break;default:r=t.toString()}return r},e.lookupFiles=function d(t,e,n){var r=[],o=new RegExp("\\.("+e.join("|")+")$");if(!u(t)){if(!u(t+".js")){if(r=c.sync(t),!r.length)throw new Error("cannot resolve path (or pattern) '"+t+"'");return r}t+=".js"}try{var s=i.statSync(t);if(s.isFile())return t}catch(f){return}return i.readdirSync(t).forEach(function(s){s=l(t,s);try{var u=i.statSync(s);if(u.isDirectory())return void(n&&(r=r.concat(d(s,e,n))))}catch(c){return}u.isFile()&&o.test(s)&&"."!==a(s)[0]&&r.push(s)}),r},e.undefinedError=function(){return new Error("Caught undefined error, did you throw without specifying what?")},e.getError=function(t){return t||e.undefinedError()}});var n=function(){return this}(),r=n.Date,o=n.setTimeout,i=(n.setInterval,n.clearTimeout,n.clearInterval,{});i.exit=function(){},i.stdout={};var s=[],a=n.onerror;i.removeListener=function(t,e){if("uncaughtException"==t){n.onerror=a?a:function(){};var r=u.utils.indexOf(s,e);-1!=r&&s.splice(r,1)}},i.on=function(t,e){"uncaughtException"==t&&(n.onerror=function(t,n,r){return e(new Error(t+" ("+n+":"+r+")")),!0},s.push(e))};var u=n.Mocha=t("mocha"),c=n.mocha=new u({reporter:"html"});c.suite.removeAllListeners("pre-require");var l,f=[];u.Runner.immediately=function(t){f.push(t),l||(l=o(e,0))},c.throwError=function(t){throw u.utils.forEach(s,function(e){e(t)}),t},c.ui=function(t){return u.prototype.ui.call(this,t),this.suite.emit("pre-require",n,null,this),this},c.setup=function(t){"string"==typeof t&&(t={ui:t});for(var e in t)this[e](t[e]);return this},c.run=function(t){var e=c.options;c.globals("location");var r=u.utils.parseQuery(n.location.search||"");return r.grep&&c.grep(r.grep),r.invert&&c.invert(),u.prototype.run.call(c,function(r){var o=n.document;o&&o.getElementById("mocha")&&e.noHighlighting!==!0&&u.utils.highlightTags("code"),t&&t(r)})},u.process=i}(); \ No newline at end of file diff --git a/node_modules/@amap/amap-jsapi-loader/example/test.html b/node_modules/@amap/amap-jsapi-loader/example/test.html new file mode 100644 index 00000000..19931e75 --- /dev/null +++ b/node_modules/@amap/amap-jsapi-loader/example/test.html @@ -0,0 +1,287 @@ + + + + + + + + JSAPI Loader + + + + +
    + + + + + + +
    + + + + + + + + + \ No newline at end of file diff --git a/node_modules/@amap/amap-jsapi-loader/index.d.ts b/node_modules/@amap/amap-jsapi-loader/index.d.ts new file mode 100644 index 00000000..dfad98c1 --- /dev/null +++ b/node_modules/@amap/amap-jsapi-loader/index.d.ts @@ -0,0 +1,15 @@ +declare var load: (options: { + key: string; // 申请好的Web端开发者Key,首次调用 load 时必填 + version: string; // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15 + plugins?: string[]; //插件列表 + // 是否加载 AMapUI,缺省不加载 + AMapUI?: { + version?: string; // AMapUI 缺省 1.1 + plugins?: string[]; // 需要加载的 AMapUI ui插件 + }; + // 是否加载 Loca, 缺省不加载 + Loca?: { + version?: string; // Loca 版本,缺省 1.3.2 + }; +}) => Promise; +export { load }; diff --git a/node_modules/@amap/amap-jsapi-loader/package.json b/node_modules/@amap/amap-jsapi-loader/package.json new file mode 100644 index 00000000..55639d6a --- /dev/null +++ b/node_modules/@amap/amap-jsapi-loader/package.json @@ -0,0 +1,37 @@ +{ + "name": "@amap/amap-jsapi-loader", + "version": "1.0.1", + "description": "高德官网提供的地图JSAPI加载器,可以避免多种异步加载API的错误用法", + "main": "dist/index.js", + "types": "index.d.ts", + "directories": { + "test": "test" + }, + "scripts": { + "build": "rollup -c rollup.config.js" + }, + "repository": { + "type": "git", + "url": "git@gitlab.alibaba-inc.com:amap-web/amap-jsapi-loader.git" + }, + "keywords": [ + "amap", + "jsapi", + "sdk", + "loader", + "地图", + "高德" + ], + "author": "mengmeng.du@alibaba-inc.com", + "license": "MIT", + "devDependencies": { + "@ampproject/rollup-plugin-closure-compiler": "^0.23.0", + "@babel/core": "^7.8.7", + "@babel/preset-env": "^7.8.7", + "rollup": "^1.32.0", + "rollup-plugin-babel": "^4.3.3", + "rollup-plugin-server": "^0.7.0", + "rollup-plugin-typescript2": "^0.27.1", + "typescript": "^3.9.7" + } +} diff --git a/node_modules/@amap/amap-jsapi-loader/rollup.config.js b/node_modules/@amap/amap-jsapi-loader/rollup.config.js new file mode 100644 index 00000000..81e98e32 --- /dev/null +++ b/node_modules/@amap/amap-jsapi-loader/rollup.config.js @@ -0,0 +1,25 @@ +import server from "rollup-plugin-server"; +import babel from "rollup-plugin-babel"; +import compiler from "@ampproject/rollup-plugin-closure-compiler"; +import rollupTypescript from 'rollup-plugin-typescript2'; + +export default { + input: "src/index.ts", + output: { + file: "dist/index.js", + format: "umd", + name: "AMapLoader", + }, + plugins: [ + rollupTypescript(), + babel({ + presets: [["@babel/env", { targets: { ie: 9 } }]], + }), + compiler(), + server({ + contentBase: "./", + host: "127.0.0.1", + port: 3601, + }), + ], +}; diff --git a/node_modules/@amap/amap-jsapi-loader/src/global.d.ts b/node_modules/@amap/amap-jsapi-loader/src/global.d.ts new file mode 100644 index 00000000..184d90e3 --- /dev/null +++ b/node_modules/@amap/amap-jsapi-loader/src/global.d.ts @@ -0,0 +1,5 @@ +declare var AMap: any; +declare var AMapUI: any; +declare var Loca: any; + +declare var ___onAPILoaded: any; diff --git a/node_modules/@amap/amap-jsapi-loader/src/index.ts b/node_modules/@amap/amap-jsapi-loader/src/index.ts new file mode 100644 index 00000000..229d4675 --- /dev/null +++ b/node_modules/@amap/amap-jsapi-loader/src/index.ts @@ -0,0 +1,367 @@ +if (!window) { + throw Error("AMap JSAPI can only be used in Browser."); +} +enum LoadStatus { + notload = "notload", + loading = "loading", + loaded = "loaded", + failed = "failed", +} +let config = { + key: "", + AMap: { + version: "1.4.15", + plugins: [], + }, + AMapUI: { + version: "1.1", + plugins: [], + }, + Loca: { + version: "1.3.2", + }, +}; + +let Status = { + AMap: LoadStatus.notload, + AMapUI: LoadStatus.notload, + Loca: LoadStatus.notload, +}; +let Callback = { + AMap: [], + AMapUI: [], + Loca: [], +}; + +let onloadCBKs = []; +const onload = function (callback) { + if (typeof callback == "function") { + if (Status.AMap === LoadStatus.loaded) { + callback(window.AMap); + return; + } + onloadCBKs.push(callback); + } +}; + +interface LoadOption { + key: string; + version?: string; + plugins?: string[]; + AMapUI?: { + version?: string; + plugins?: string[]; + }; + Loca?: { + version?: string; + }; +} +function appendOther(option: LoadOption): Promise { + let pros: Promise[] = []; + if (option.AMapUI) { + pros.push(loadAMapUI(option.AMapUI)); + } + if (option.Loca) { + pros.push(loadLoca(option.Loca)); + } + return Promise.all(pros); +} +function loadAMapUI(params: { version?: string; plugins?: string[] }): Promise { + return new Promise((res, rej) => { + const newPlugins: string[] = []; + if (params.plugins) { + for (var i = 0; i < params.plugins.length; i += 1) { + if (config.AMapUI.plugins.indexOf(params.plugins[i]) == -1) { + newPlugins.push(params.plugins[i]); + } + } + } + if (Status.AMapUI === LoadStatus.failed) { + rej("前次请求 AMapUI 失败"); + } else if (Status.AMapUI === LoadStatus.notload) { + Status.AMapUI = LoadStatus.loading; + config.AMapUI.version = params.version || config.AMapUI.version; + const version = config.AMapUI.version; + const parentNode = document.body || document.head; + const script = document.createElement("script"); + script.type = "text/javascript"; + script.src = `https://webapi.amap.com/ui/${version}/main.js`; + + script.onerror = (e) => { + Status.AMapUI = LoadStatus.failed; + rej("请求 AMapUI 失败"); + }; + script.onload = () => { + Status.AMapUI = LoadStatus.loaded; + if (newPlugins.length) { + window.AMapUI.loadUI(newPlugins, function () { + for (let i = 0, len = newPlugins.length; i < len; i++) { + const path = newPlugins[i]; + const name = path.split("/").slice(-1)[0]; + window.AMapUI[name] = arguments[i]; + } + res(); + while (Callback.AMapUI.length) { + Callback.AMapUI.splice(0, 1)[0](); + } + }); + } else { + res(); + while (Callback.AMapUI.length) { + Callback.AMapUI.splice(0, 1)[0](); + } + } + }; + parentNode.appendChild(script); + } else if (Status.AMapUI === LoadStatus.loaded) { + if (params.version && params.version !== config.AMapUI.version) { + rej("不允许多个版本 AMapUI 混用"); + } else { + if (newPlugins.length) { + window.AMapUI.loadUI(newPlugins, function () { + for (let i = 0, len = newPlugins.length; i < len; i++) { + const path = newPlugins[i]; + const name = path.split("/").slice(-1)[0]; + window.AMapUI[name] = arguments[i]; + } + res(); + }); + } else { + res(); + } + } + } else { + if (params.version && params.version !== config.AMapUI.version) { + rej("不允许多个版本 AMapUI 混用"); + } else { + Callback.AMapUI.push((err) => { + if (err) { + rej(err); + } else { + if (newPlugins.length) { + window.AMapUI.loadUI(newPlugins, function () { + for (let i = 0, len = newPlugins.length; i < len; i++) { + const path = newPlugins[i]; + const name = path.split("/").slice(-1)[0]; + window.AMapUI[name] = arguments[i]; + } + res(); + }); + } else { + res(); + } + } + }); + } + } + }); +} + +function loadLoca(params: { version?: string }): Promise { + return new Promise((res, rej) => { + if (Status.Loca === LoadStatus.failed) { + rej("前次请求 Loca 失败"); + } else if (Status.Loca === LoadStatus.notload) { + Status.Loca = LoadStatus.loading; + config.Loca.version = params.version || config.Loca.version; + const version = config.Loca.version; + const isApiV2 = config.AMap.version.startsWith("2"); + const isLocaV2 = version.startsWith("2"); + if ((isApiV2 && !isLocaV2) || (!isApiV2 && isLocaV2)) { + rej("JSAPI 与 Loca 版本不对应!!"); + return; + } + const key = config.key; + const parentNode = document.body || document.head; + const script = document.createElement("script"); + script.type = "text/javascript"; + script.src = `https://webapi.amap.com/loca?v=${version}&key=${key}`; + + script.onerror = (e) => { + Status.Loca = LoadStatus.failed; + rej("请求 AMapUI 失败"); + }; + script.onload = () => { + Status.Loca = LoadStatus.loaded; + res(); + while (Callback.Loca.length) { + Callback.Loca.splice(0, 1)[0](); + } + }; + parentNode.appendChild(script); + } else if (Status.Loca === LoadStatus.loaded) { + if (params.version && params.version !== config.Loca.version) { + rej("不允许多个版本 Loca 混用"); + } else { + res(); + } + } else { + if (params.version && params.version !== config.Loca.version) { + rej("不允许多个版本 Loca 混用"); + } else { + Callback.Loca.push((err) => { + if (err) { + rej(err); + } else { + rej(); + } + }); + } + } + }); +} + +const load = function (options: LoadOption) { + return new Promise((resolve, reject) => { + if (Status.AMap == LoadStatus.failed) { + reject(""); + } else if (Status.AMap == LoadStatus.notload) { + //初次加载 + let { key, version, plugins } = options; + if (!key) { + reject("请填写key"); + return; + } + if (window.AMap && location.host !== "lbs.amap.com") { + reject("禁止多种API加载方式混用"); + } + config.key = key; + config.AMap.version = version || config.AMap.version; + config.AMap.plugins = plugins || config.AMap.plugins; + Status.AMap = LoadStatus.loading; + + const parentNode = document.body || document.head; + + window.___onAPILoaded = function (err) { + delete window.___onAPILoaded; + if (err) { + Status.AMap = LoadStatus.failed; + reject(err); + } else { + Status.AMap = LoadStatus.loaded; + appendOther(options) + .then(() => { + resolve(window.AMap); + }) + .catch(reject); + while (onloadCBKs.length) { + onloadCBKs.splice(0, 1)[0](); + } + } + }; + const script = document.createElement("script"); + script.type = "text/javascript"; + + script.src = + "https://webapi.amap.com/maps?callback=___onAPILoaded&v=" + + config.AMap.version + + "&key=" + + key + + "&plugin=" + + config.AMap.plugins.join(","); + script.onerror = (e) => { + Status.AMap = LoadStatus.failed; + reject(e); + }; + parentNode.appendChild(script); + } else if (Status.AMap == LoadStatus.loaded) { + //deal multi load + if (options.key && options.key !== config.key) { + reject("多个不一致的 key"); + return; + } + if (options.version && options.version !== config.AMap.version) { + reject("不允许多个版本 JSAPI 混用"); + return; + } + const newPlugins = []; + if (options.plugins) { + for (var i = 0; i < options.plugins.length; i += 1) { + if (config.AMap.plugins.indexOf(options.plugins[i]) == -1) { + newPlugins.push(options.plugins[i]); + } + } + } + if (newPlugins.length) { + window.AMap.plugin(newPlugins, () => { + appendOther(options) + .then(() => { + resolve(window.AMap); + }) + .catch(reject); + }); + } else { + appendOther(options) + .then(() => { + resolve(window.AMap); + }) + .catch(reject); + } + } else { + // loading + if (options.key && options.key !== config.key) { + reject("多个不一致的 key"); + return; + } + if (options.version && options.version !== config.AMap.version) { + reject("不允许多个版本 JSAPI 混用"); + return; + } + const newPlugins = []; + if (options.plugins) { + for (var i = 0; i < options.plugins.length; i += 1) { + if (config.AMap.plugins.indexOf(options.plugins[i]) == -1) { + newPlugins.push(options.plugins[i]); + } + } + } + onload(() => { + if (newPlugins.length) { + window.AMap.plugin(newPlugins, () => { + appendOther(options) + .then(() => { + resolve(window.AMap); + }) + .catch(reject); + }); + } else { + appendOther(options) + .then(() => { + resolve(window.AMap); + }) + .catch(reject); + } + }); + } + }); +}; +function reset() { + delete window.AMap; + delete window.AMapUI; + delete window.Loca; + config = { + key: "", + AMap: { + version: "1.4.15", + plugins: [], + }, + AMapUI: { + version: "1.1", + plugins: [], + }, + Loca: { + version: "1.3.2", + }, + }; + Status = { + AMap: LoadStatus.notload, + AMapUI: LoadStatus.notload, + Loca: LoadStatus.notload, + }; + Callback = { + AMap: [], + AMapUI: [], + Loca: [], + }; +} +export default { load, reset }; diff --git a/node_modules/@amap/amap-jsapi-loader/test/demo.ts b/node_modules/@amap/amap-jsapi-loader/test/demo.ts new file mode 100644 index 00000000..73d43ab5 --- /dev/null +++ b/node_modules/@amap/amap-jsapi-loader/test/demo.ts @@ -0,0 +1,17 @@ +import AMapLoader from "../"; +// import { } from "@ali/test-amap-jsapi"; + +AMapLoader.load({ + key: "test", + version: "2.0" +}).then(() => { + new AMap.Circle({}) + const map = new AMap.Map("div"); + map.on("complete", () => { + const circle = new AMap.Circle({ + center: [135, 45], + radius: 40 + }); + map.add(circle); + }); +}); diff --git a/node_modules/@amap/amap-jsapi-loader/test/test.ts b/node_modules/@amap/amap-jsapi-loader/test/test.ts new file mode 100644 index 00000000..9d9d3df9 --- /dev/null +++ b/node_modules/@amap/amap-jsapi-loader/test/test.ts @@ -0,0 +1,7 @@ +import AMapLoader from "../"; +import "@amap/amap-jsapi-loader"; + +AMapLoader.load({ + key: "test", + version: "2.0" +}).then(() => {}); diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..3cba66c7 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,18 @@ +{ + "name": "xinnengy", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "@amap/amap-jsapi-loader": "^1.0.1" + } + }, + "node_modules/@amap/amap-jsapi-loader": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/@amap/amap-jsapi-loader/-/amap-jsapi-loader-1.0.1.tgz", + "integrity": "sha512-nPyLKt7Ow/ThHLkSvn2etQlUzqxmTVgK7bIgwdBRTg2HK5668oN7xVxkaiRe3YZEzGzfV2XgH5Jmu2T73ljejw==", + "license": "MIT" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 00000000..0813acd9 --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "@amap/amap-jsapi-loader": "^1.0.1" + } +} diff --git a/plus-ui/src/api/project/constructionUser/index.ts b/plus-ui/src/api/project/constructionUser/index.ts index d8a162a0..f86ff148 100644 --- a/plus-ui/src/api/project/constructionUser/index.ts +++ b/plus-ui/src/api/project/constructionUser/index.ts @@ -1,6 +1,6 @@ import request from '@/utils/request'; import { AxiosPromise } from 'axios'; -import { ConstructionUserForm, ConstructionUserQuery, ConstructionUserVO } from '@/api/project/constructionUser/types'; +import { ConstructionUserForm, ConstructionUserQuery, ConstructionUserVO, skipType } from '@/api/project/constructionUser/types'; /** * 查询施工人员列表 @@ -27,6 +27,28 @@ export const getConstructionUser = (id: string | number): AxiosPromise { + return request({ + url: '/project/constructionUser/change/project', + method: 'put', + data: data + }); +}; + +/** + * 查询项目以及项目下的分包公司列表 + */ +export const getProjectContractorList = () => { + return request({ + url: '/project/project/list/project/contractorList', + method: 'get' + }); +}; + /** * 新增施工人员 * @param data diff --git a/plus-ui/src/api/project/constructionUser/types.ts b/plus-ui/src/api/project/constructionUser/types.ts index 7e85a84c..502fb622 100644 --- a/plus-ui/src/api/project/constructionUser/types.ts +++ b/plus-ui/src/api/project/constructionUser/types.ts @@ -183,6 +183,46 @@ export interface ConstructionUserVO { createTime: string; } +export interface skipType { + /** + * 项目id + */ + projectId: string | number; + + /** + * 分包id + */ + contractorId: string | number; + id: string | number; +} + +export interface skipOptionType { + /** + * 名称 + */ + projectName: string | number; + + /** + * id + */ + id: string | number; + /** + * 子项 + */ + contractorList: Array; +} +export interface skipTeamType { + /** + * 名称 + */ + name: string | number; + + /** + * id + */ + id: string | number; +} + export interface ConstructionUserForm extends BaseEntity { /** * 主键id diff --git a/plus-ui/src/api/project/contractor/types.ts b/plus-ui/src/api/project/contractor/types.ts index eb7658b2..ed0421d2 100644 --- a/plus-ui/src/api/project/contractor/types.ts +++ b/plus-ui/src/api/project/contractor/types.ts @@ -51,6 +51,11 @@ export interface ContractorForm extends BaseEntity { */ id?: string | number; + /** + * 主键id + */ + projectId?: string | number; + /** * 公司名称 */ diff --git a/plus-ui/src/api/project/project/types.ts b/plus-ui/src/api/project/project/types.ts index a789b4ea..e7c9cdb9 100644 --- a/plus-ui/src/api/project/project/types.ts +++ b/plus-ui/src/api/project/project/types.ts @@ -37,12 +37,12 @@ export interface ProjectVO { /** * 项目类型 */ - type: string; + projectType: string; /** * 项目类型(1光伏 2风电) */ - isType: number; + projectCategory: number; /** * 删除时间 @@ -115,6 +115,18 @@ export interface ProjectVO { createTime: string; } +export interface locationType { + /** + * 经度 + */ + lng: string; + // 纬度 + lat: string; + // 逆地理编码地址 + + projectSite: string; +} + export interface ProjectForm extends BaseEntity { /** * @@ -146,6 +158,16 @@ export interface ProjectForm extends BaseEntity { */ picUrl?: string; + /** + * 经度 + */ + lng?: string; + + /** + * 纬度 + */ + lat?: string; + /** * 备注 */ @@ -154,12 +176,12 @@ export interface ProjectForm extends BaseEntity { /** * 项目类型 */ - type?: string; + projectType?: string; /** * 项目类型(1光伏 2风电) */ - isType?: number; + projectCategory?: number; /** * 删除时间 @@ -197,9 +219,14 @@ export interface ProjectForm extends BaseEntity { onStreamTime?: string; /** - * 打卡范围(09:00,18:00) + * 打卡开始时间(09:00,18:00) */ - punchRange?: string; + playCardStart?: string; + + /** + * 打卡结束时间(09:00,18:00) + */ + playCardEnd?: string; /** * 设计总量 @@ -256,12 +283,12 @@ export interface ProjectQuery extends PageQuery { /** * 项目类型 */ - type?: string; + projectType?: string; /** * 项目类型(1光伏 2风电) */ - isType?: number; + projectCategory?: number; /** * 删除时间 @@ -273,6 +300,16 @@ export interface ProjectQuery extends PageQuery { */ projectSite?: string; + /** + * 经度 + */ + lng?: string; + + /** + * 纬度 + */ + lat?: string; + /** * 负责人 */ @@ -299,9 +336,14 @@ export interface ProjectQuery extends PageQuery { onStreamTime?: string; /** - * 打卡范围(09:00,18:00) + * 打卡开始时间(09:00,18:00) */ - punchRange?: string; + playCardStart?: string; + + /** + * 打卡结束时间(09:00,18:00) + */ + playCardEnd?: string; /** * 设计总量 diff --git a/plus-ui/src/components/amap/index.vue b/plus-ui/src/components/amap/index.vue new file mode 100644 index 00000000..73c6c2cc --- /dev/null +++ b/plus-ui/src/components/amap/index.vue @@ -0,0 +1,136 @@ + + + + diff --git a/plus-ui/src/views/project/constructionUser/index.vue b/plus-ui/src/views/project/constructionUser/index.vue index c078ed73..07972405 100644 --- a/plus-ui/src/views/project/constructionUser/index.vue +++ b/plus-ui/src/views/project/constructionUser/index.vue @@ -115,6 +115,9 @@ 黑名单 + + 人员迁移 + 删除 @@ -265,6 +268,24 @@ + + + + + + + + + + + + + @@ -274,9 +295,18 @@ import { delConstructionUser, getConstructionUser, listConstructionUser, - updateConstructionUser + updateConstructionUser, + getProjectContractorList, + transferConstructionUser } from '@/api/project/constructionUser'; -import { ConstructionUserForm, ConstructionUserQuery, ConstructionUserVO } from '@/api/project/constructionUser/types'; +import { + ConstructionUserForm, + ConstructionUserQuery, + ConstructionUserVO, + skipType, + skipOptionType, + skipTeamType +} from '@/api/project/constructionUser/types'; import { useUserStoreHook } from '@/store/modules/user'; import { listContractor } from '@/api/project/contractor'; import { listProjectTeam } from '@/api/project/projectTeam'; @@ -300,15 +330,25 @@ const ids = ref>([]); const single = ref(true); const multiple = ref(true); const total = ref(0); - +const skip = ref(false); const queryFormRef = ref(); const constructionUserFormRef = ref(); - +const skipName = ref(''); const dialog = reactive({ visible: false, title: '' }); +//人员迁移条件 +const skipObject: skipType = reactive({ + id: '', + projectId: '', + contractorId: '' +}); +const contractorList = ref>([]); +//项目列表 +const skipOptions = ref>([]); + const initFormData: ConstructionUserForm = { id: undefined, openid: undefined, @@ -392,6 +432,21 @@ const getList = async () => { loading.value = false; }; +const selectProject = (e: any) => { + //选中项目筛选出项目下的分包单位 + contractorList.value = skipOptions.value.filter((item) => item.id == e)[0].contractorList; +}; + +const setUnits = async () => { + //人员迁移 + console.log('🚀 ~ setUnits ~ skipObject:', skipObject); + let res = await transferConstructionUser(skipObject); + if (res.code == 200) { + ElMessage.success(res.msg); + skip.value = false; + getList(); + } +}; const contractorOpt = ref(); /** 查询当前项目下的分包公司列表 */ @@ -489,6 +544,16 @@ const handleShowDrawer = (row?: ConstructionUserVO) => { showDetailDrawer.value = true; }; +/** 人员迁移 */ +const handleChange = async (row: ConstructionUserVO) => { + const _id = row?.id || ids.value[0]; + skipName.value = row?.userName; + skipObject.id = _id; + const res = await getProjectContractorList(); + skipOptions.value = res.data; + skip.value = true; +}; + /** 提交按钮 */ const submitForm = () => { constructionUserFormRef.value?.validate(async (valid: boolean) => { diff --git a/plus-ui/src/views/project/contractor/index.vue b/plus-ui/src/views/project/contractor/index.vue index 26580402..96e44091 100644 --- a/plus-ui/src/views/project/contractor/index.vue +++ b/plus-ui/src/views/project/contractor/index.vue @@ -122,16 +122,6 @@ const contractorFormRef = ref(); const userStore = useUserStoreHook(); // 从 store 中获取项目列表和当前选中的项目 const currentProject = computed(() => userStore.selectedProject); -//监听项目改变 -// watch( -// () => currentProject.value, -// (newId, oldId) => { -// /* ... */ -// queryParams.value.projectId=newId.id -// // getList() - -// } -// ) const dialog = reactive({ visible: false, title: '' @@ -145,7 +135,8 @@ const initFormData: ContractorForm = { custodian: undefined, custodianPhone: undefined, fileMap: undefined, - remark: undefined + remark: undefined, + projectId: currentProject.value.id }; const data = reactive>({ form: { ...initFormData }, @@ -172,7 +163,7 @@ const { queryParams, form, rules } = toRefs(data); /** 查询分包单位列表 */ const getList = async () => { loading.value = true; - + const res = await listContractor(queryParams.value); contractorList.value = res.rows; total.value = res.total; diff --git a/plus-ui/src/views/project/project/index.vue b/plus-ui/src/views/project/project/index.vue index f6e2dbe4..92d710d3 100644 --- a/plus-ui/src/views/project/project/index.vue +++ b/plus-ui/src/views/project/project/index.vue @@ -52,10 +52,14 @@ - - + + + + @@ -82,44 +86,136 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
    +
    基础信息
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 获取经纬度 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    打卡设置
    + + + + + + + + + + + + + + + + + + + +
    + + + + +