From 6b3c3306197cf7810355795997b231d67b52886f Mon Sep 17 00:00:00 2001 From: Oliver Foster Date: Mon, 17 Feb 2020 15:36:20 +0000 Subject: [PATCH 01/18] issue/2647 --- grunt/config/babel.js | 30 ++++++++++++++++++++++ grunt/config/clean.js | 5 ++++ grunt/config/javascript.js | 6 ++--- grunt/helpers.js | 8 ++++++ grunt/tasks/build.js | 2 ++ grunt/tasks/dev.js | 2 ++ grunt/tasks/diff.js | 4 ++- grunt/tasks/server-build.js | 4 ++- package.json | 8 ++++-- src/core/libraries/backbone.controller.js | 3 +++ src/core/libraries/backbone.min.js | 4 +-- src/core/libraries/polyfill.min.js | 1 + src/core/libraries/promise-polyfill.min.js | 2 -- src/core/required/adapt/js/scriptLoader.js | 4 +-- 14 files changed, 70 insertions(+), 13 deletions(-) create mode 100644 grunt/config/babel.js create mode 100644 src/core/libraries/polyfill.min.js delete mode 100644 src/core/libraries/promise-polyfill.min.js diff --git a/grunt/config/babel.js b/grunt/config/babel.js new file mode 100644 index 000000000..dd9178c5e --- /dev/null +++ b/grunt/config/babel.js @@ -0,0 +1,30 @@ +module.exports = { + options: { + sourceMap: true, + inputSourceMap: true, + sourceType: 'script', + minified: true, + comments: false, + presets: [ + [ + '@babel/preset-env', + { + "targets": { + "ie": "11" + } + } + ] + ] + }, + dist: { + files: [{ + "expand": true, + "cwd": "<%= tempdir %>", + "src": [ + "adapt.min.js" + ], + "dest": "<%= outputdir %>adapt/js/", + "ext": ".min.js" + }] + } +}; \ No newline at end of file diff --git a/grunt/config/clean.js b/grunt/config/clean.js index 86c8835ff..d1213eea0 100644 --- a/grunt/config/clean.js +++ b/grunt/config/clean.js @@ -15,5 +15,10 @@ module.exports = { src: [ '<%= outputdir %>' ] + }, + temp: { + src: [ + '<%= tempdir %>' + ] } } diff --git a/grunt/config/javascript.js b/grunt/config/javascript.js index 9f6f075a6..f39f80e76 100644 --- a/grunt/config/javascript.js +++ b/grunt/config/javascript.js @@ -5,7 +5,7 @@ module.exports = function(grunt, options) { name: 'core/js/app', baseUrl: '<%= sourcedir %>', mainConfigFile: './config.js', - out: '<%= outputdir %>adapt/js/adapt.min.js', + out: '<%= tempdir %>adapt.min.js', //fetch these bower plugins an add them as dependencies to the app.js plugins: [ '<%= sourcedir %>components/*/bower.json', @@ -37,7 +37,7 @@ module.exports = function(grunt, options) { name: 'core/js/app', baseUrl: '<%= sourcedir %>', mainConfigFile: './config.js', - out: '<%= outputdir %>adapt/js/adapt.min.js', + out: '<%= tempdir %>adapt.min.js', //fetch these bower plugins an add them as dependencies to the app.js plugins: [ '<%= sourcedir %>components/*/bower.json', @@ -51,7 +51,7 @@ module.exports = function(grunt, options) { return grunt.config('helpers').includedFilter(filepath); }, preserveLicenseComments: false, - optimize: 'uglify2', + optimize: 'none', uglify2: { compress: false } diff --git a/grunt/helpers.js b/grunt/helpers.js index c84aa0316..e189f9c0e 100644 --- a/grunt/helpers.js +++ b/grunt/helpers.js @@ -121,12 +121,17 @@ module.exports = function(grunt) { return configValue || grunt.config('scriptSafeRegExp', generateScriptSafeRegExp()); }; +var getTempFolder = function() { + return require('shortid').generate(); +} + // exported var exports = {}; exports.defaults = { sourcedir: 'src' + path.sep, + tempdir: '.temp/' + getTempFolder() + path.sep, outputdir: 'build' + path.sep, jsonext: 'json', theme: '**', @@ -149,6 +154,7 @@ module.exports = function(grunt) { // Convert the directory paths so that they work cross platform exports.defaults.sourcedir = exports.defaults.sourcedir.replace(convertSlashes, "/"); + exports.defaults.tempdir = exports.defaults.tempdir.replace(convertSlashes, "/"); exports.defaults.outputdir = exports.defaults.outputdir.replace(convertSlashes, "/"); exports.getIncludes = function(buildIncludes, configData) { @@ -178,6 +184,7 @@ module.exports = function(grunt) { var root = __dirname.split(path.sep).slice(0, -1).join(path.sep); var sourcedir = appendSlash(grunt.option('sourcedir')) || exports.defaults.sourcedir; + var tempdir = appendSlash(grunt.option('tempdir')) || exports.defaults.tempdir; var outputdir = appendSlash(grunt.option('outputdir')) || exports.defaults.outputdir; var jsonext = grunt.option('jsonext') || exports.defaults.jsonext; @@ -204,6 +211,7 @@ module.exports = function(grunt) { var data = { root: root, sourcedir: sourcedir, + tempdir: tempdir, outputdir: outputdir, jsonext: jsonext, theme: grunt.option('theme') || exports.defaults.theme, diff --git a/grunt/tasks/build.js b/grunt/tasks/build.js index 23a79e1ec..05f6ffced 100644 --- a/grunt/tasks/build.js +++ b/grunt/tasks/build.js @@ -13,10 +13,12 @@ module.exports = function(grunt) { 'create-json-config', 'tracking-insert', 'javascript:compile', + 'babel', 'clean:dist', 'less:compile', 'replace', 'scripts:adaptpostbuild', + 'clean:temp', 'minify' ]); }; diff --git a/grunt/tasks/dev.js b/grunt/tasks/dev.js index 728d67c68..3377122a0 100644 --- a/grunt/tasks/dev.js +++ b/grunt/tasks/dev.js @@ -12,9 +12,11 @@ module.exports = function(grunt) { 'create-json-config', 'tracking-insert', 'javascript:dev', + 'babel', 'less:dev', 'replace', 'scripts:adaptpostbuild', + 'clean:temp', 'watch' ]); }; diff --git a/grunt/tasks/diff.js b/grunt/tasks/diff.js index 98183869a..5dc97e9b1 100644 --- a/grunt/tasks/diff.js +++ b/grunt/tasks/diff.js @@ -12,8 +12,10 @@ module.exports = function(grunt) { 'create-json-config', 'tracking-insert', 'newer:javascript:dev', + 'babel', 'newer:less:dev', 'replace', - 'scripts:adaptpostbuild' + 'scripts:adaptpostbuild', + 'clean:temp' ]); }; diff --git a/grunt/tasks/server-build.js b/grunt/tasks/server-build.js index cfe70ac81..ff82e5983 100644 --- a/grunt/tasks/server-build.js +++ b/grunt/tasks/server-build.js @@ -12,8 +12,10 @@ module.exports = function(grunt) { 'less:' + requireMode, 'handlebars', 'javascript:' + requireMode, + 'babel', 'replace', - 'scripts:adaptpostbuild' + 'scripts:adaptpostbuild', + 'clean:temp' ]); }); }; diff --git a/package.json b/package.json index 8fa7d4a1b..e7a77d579 100644 --- a/package.json +++ b/package.json @@ -12,11 +12,16 @@ "url": "https://github.com/adaptlearning/adapt_framework/issues" }, "dependencies": { + "@babel/core": "^7.8.4", + "@babel/preset-env": "^7.8.4", + "@types/backbone": "^1.4.1", + "@types/jquery": "^3.3.31", "async": "^2.6.1", "chalk": "^2.4.1", "columnify": "^1.5.4", "csv": "^5.0.0", "grunt": "^1.0.3", + "grunt-babel": "^8.0.0", "grunt-concurrent": "^2.3.1", "grunt-contrib-clean": "^2.0.0", "grunt-contrib-connect": "^2.0.0", @@ -35,12 +40,11 @@ "jit-grunt": "^0.10.0", "jschardet": "^1.6.0", "jshint-stylish": "^2.2.1", - "@types/jquery": "^3.3.31", - "@types/backbone": "^1.4.1", "less": "^3.9.0", "load-grunt-config": "^1.0.1", "nsdeclare": "^0.1.0", "requirejs": "^2.3.6", + "shortid": "^2.2.15", "time-grunt": "^2.0.0", "underscore": "^1.9.1", "underscore-deep-extend": "^1.1.5" diff --git a/src/core/libraries/backbone.controller.js b/src/core/libraries/backbone.controller.js index f2ce6b6a3..1f239961e 100644 --- a/src/core/libraries/backbone.controller.js +++ b/src/core/libraries/backbone.controller.js @@ -10,6 +10,7 @@ define("backbone.controller", [ var Controller = Backbone.Controller = function(options) { options || (options = {}); + this.preinitialize.apply(this, arguments); _.extend(this, _.pick(options, controllerOptions)); this.initialize.apply(this, arguments); }; @@ -18,6 +19,8 @@ define("backbone.controller", [ _.extend(Controller.prototype, Backbone.Events, { + preinitialize: function() {}, + initialize: function() {} }); diff --git a/src/core/libraries/backbone.min.js b/src/core/libraries/backbone.min.js index 36ea258a9..c8c33e0d7 100644 --- a/src/core/libraries/backbone.min.js +++ b/src/core/libraries/backbone.min.js @@ -1,2 +1,2 @@ -//Backbone.js v1.3.3 -(function(t){var e=typeof self=="object"&&self.self===self&&self||typeof global=="object"&&global.global===global&&global;if(typeof define==="function"&&define.amd){define(["underscore","jquery","exports"],function(i,r,n){e.Backbone=t(e,n,i,r)})}else if(typeof exports!=="undefined"){var i=require("underscore"),r;try{r=require("jquery")}catch(n){}t(e,exports,i,r)}else{e.Backbone=t(e,{},e._,e.jQuery||e.Zepto||e.ender||e.$)}})(function(t,e,i,r){var n=t.Backbone;var s=Array.prototype.slice;e.VERSION="1.3.3";e.$=r;e.noConflict=function(){t.Backbone=n;return this};e.emulateHTTP=false;e.emulateJSON=false;var a=function(t,e,r){switch(t){case 1:return function(){return i[e](this[r])};case 2:return function(t){return i[e](this[r],t)};case 3:return function(t,n){return i[e](this[r],o(t,this),n)};case 4:return function(t,n,s){return i[e](this[r],o(t,this),n,s)};default:return function(){var t=s.call(arguments);t.unshift(this[r]);return i[e].apply(i,t)}}};var h=function(t,e,r){i.each(e,function(e,n){if(i[n])t.prototype[n]=a(e,n,r)})};var o=function(t,e){if(i.isFunction(t))return t;if(i.isObject(t)&&!e._isModel(t))return l(t);if(i.isString(t))return function(e){return e.get(t)};return t};var l=function(t){var e=i.matches(t);return function(t){return e(t.attributes)}};var u=e.Events={};var c=/\s+/;var f=function(t,e,r,n,s){var a=0,h;if(r&&typeof r==="object"){if(n!==void 0&&"context"in s&&s.context===void 0)s.context=n;for(h=i.keys(r);athis.length)n=this.length;if(n<0)n+=this.length+1;var s=[];var a=[];var h=[];var o=[];var l={};var u=e.add;var c=e.merge;var f=e.remove;var d=false;var v=this.comparator&&n==null&&e.sort!==false;var g=i.isString(this.comparator)?this.comparator:null;var p,m;for(m=0;m7);this._useHashChange=this._wantsHashChange&&this._hasHashChange;this._wantsPushState=!!this.options.pushState;this._hasPushState=!!(this.history&&this.history.pushState);this._usePushState=this._wantsPushState&&this._hasPushState;this.fragment=this.getFragment();this.root=("/"+this.root+"/").replace(O,"/");if(this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var e=this.root.slice(0,-1)||"/";this.location.replace(e+"#"+this.getPath());return true}else if(this._hasPushState&&this.atRoot()){this.navigate(this.getHash(),{replace:true})}}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe");this.iframe.src="javascript:0";this.iframe.style.display="none";this.iframe.tabIndex=-1;var r=document.body;var n=r.insertBefore(this.iframe,r.firstChild).contentWindow;n.document.open();n.document.close();n.location.hash="#"+this.fragment}var s=window.addEventListener||function(t,e){return attachEvent("on"+t,e)};if(this._usePushState){s("popstate",this.checkUrl,false)}else if(this._useHashChange&&!this.iframe){s("hashchange",this.checkUrl,false)}else if(this._wantsHashChange){this._checkUrlInterval=setInterval(this.checkUrl,this.interval)}if(!this.options.silent)return this.loadUrl()},stop:function(){var t=window.removeEventListener||function(t,e){return detachEvent("on"+t,e)};if(this._usePushState){t("popstate",this.checkUrl,false)}else if(this._useHashChange&&!this.iframe){t("hashchange",this.checkUrl,false)}if(this.iframe){document.body.removeChild(this.iframe);this.iframe=null}if(this._checkUrlInterval)clearInterval(this._checkUrlInterval);N.started=false},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(t){var e=this.getFragment();if(e===this.fragment&&this.iframe){e=this.getHash(this.iframe.contentWindow)}if(e===this.fragment)return false;if(this.iframe)this.navigate(e);this.loadUrl()},loadUrl:function(t){if(!this.matchRoot())return false;t=this.fragment=this.getFragment(t);return i.some(this.handlers,function(e){if(e.route.test(t)){e.callback(t);return true}})},navigate:function(t,e){if(!N.started)return false;if(!e||e===true)e={trigger:!!e};t=this.getFragment(t||"");var i=this.root;if(t===""||t.charAt(0)==="?"){i=i.slice(0,-1)||"/"}var r=i+t;t=this.decodeFragment(t.replace(U,""));if(this.fragment===t)return;this.fragment=t;if(this._usePushState){this.history[e.replace?"replaceState":"pushState"]({},document.title,r)}else if(this._wantsHashChange){this._updateHash(this.location,t,e.replace);if(this.iframe&&t!==this.getHash(this.iframe.contentWindow)){var n=this.iframe.contentWindow;if(!e.replace){n.document.open();n.document.close()}this._updateHash(n.location,t,e.replace)}}else{return this.location.assign(r)}if(e.trigger)return this.loadUrl(t)},_updateHash:function(t,e,i){if(i){var r=t.href.replace(/(javascript:|#).*$/,"");t.replace(r+"#"+e)}else{t.hash="#"+e}}});e.history=new N;var q=function(t,e){var r=this;var n;if(t&&i.has(t,"constructor")){n=t.constructor}else{n=function(){return r.apply(this,arguments)}}i.extend(n,r,e);n.prototype=i.create(r.prototype,t);n.prototype.constructor=n;n.__super__=r.prototype;return n};y.extend=x.extend=$.extend=k.extend=N.extend=q;var F=function(){throw new Error('A "url" property or function must be specified')};var B=function(t,e){var i=e.error;e.error=function(r){if(i)i.call(e.context,t,r,e);t.trigger("error",t,r,e)}};return e}); \ No newline at end of file +(function(t){var e=typeof self=="object"&&self.self===self&&self||typeof global=="object"&&global.global===global&&global;if(typeof define==="function"&&define.amd){define(["underscore","jquery","exports"],function(i,n,r){e.Backbone=t(e,r,i,n)})}else if(typeof exports!=="undefined"){var i=require("underscore"),n;try{n=require("jquery")}catch(r){}t(e,exports,i,n)}else{e.Backbone=t(e,{},e._,e.jQuery||e.Zepto||e.ender||e.$)}})(function(t,e,i,n){var r=t.Backbone;var s=Array.prototype.slice;e.VERSION="1.4.0";e.$=n;e.noConflict=function(){t.Backbone=r;return this};e.emulateHTTP=false;e.emulateJSON=false;var a=e.Events={};var o=/\s+/;var h;var u=function(t,e,n,r,s){var a=0,h;if(n&&typeof n==="object"){if(r!==void 0&&"context"in s&&s.context===void 0)s.context=r;for(h=i.keys(n);athis.length)r=this.length;if(r<0)r+=this.length+1;var s=[];var a=[];var o=[];var h=[];var u={};var l=e.add;var c=e.merge;var f=e.remove;var d=false;var v=this.comparator&&r==null&&e.sort!==false;var p=i.isString(this.comparator)?this.comparator:null;var g,m;for(m=0;m7);this._useHashChange=this._wantsHashChange&&this._hasHashChange;this._wantsPushState=!!this.options.pushState;this._hasPushState=!!(this.history&&this.history.pushState);this._usePushState=this._wantsPushState&&this._hasPushState;this.fragment=this.getFragment();this.root=("/"+this.root+"/").replace(L,"/");if(this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var e=this.root.slice(0,-1)||"/";this.location.replace(e+"#"+this.getPath());return true}else if(this._hasPushState&&this.atRoot()){this.navigate(this.getHash(),{replace:true})}}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe");this.iframe.src="javascript:0";this.iframe.style.display="none";this.iframe.tabIndex=-1;var n=document.body;var r=n.insertBefore(this.iframe,n.firstChild).contentWindow;r.document.open();r.document.close();r.location.hash="#"+this.fragment}var s=window.addEventListener||function(t,e){return attachEvent("on"+t,e)};if(this._usePushState){s("popstate",this.checkUrl,false)}else if(this._useHashChange&&!this.iframe){s("hashchange",this.checkUrl,false)}else if(this._wantsHashChange){this._checkUrlInterval=setInterval(this.checkUrl,this.interval)}if(!this.options.silent)return this.loadUrl()},stop:function(){var t=window.removeEventListener||function(t,e){return detachEvent("on"+t,e)};if(this._usePushState){t("popstate",this.checkUrl,false)}else if(this._useHashChange&&!this.iframe){t("hashchange",this.checkUrl,false)}if(this.iframe){document.body.removeChild(this.iframe);this.iframe=null}if(this._checkUrlInterval)clearInterval(this._checkUrlInterval);B.started=false},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(t){var e=this.getFragment();if(e===this.fragment&&this.iframe){e=this.getHash(this.iframe.contentWindow)}if(e===this.fragment)return false;if(this.iframe)this.navigate(e);this.loadUrl()},loadUrl:function(t){if(!this.matchRoot())return false;t=this.fragment=this.getFragment(t);return i.some(this.handlers,function(e){if(e.route.test(t)){e.callback(t);return true}})},navigate:function(t,e){if(!B.started)return false;if(!e||e===true)e={trigger:!!e};t=this.getFragment(t||"");var i=this.root;if(t===""||t.charAt(0)==="?"){i=i.slice(0,-1)||"/"}var n=i+t;t=t.replace(W,"");var r=this.decodeFragment(t);if(this.fragment===r)return;this.fragment=r;if(this._usePushState){this.history[e.replace?"replaceState":"pushState"]({},document.title,n)}else if(this._wantsHashChange){this._updateHash(this.location,t,e.replace);if(this.iframe&&t!==this.getHash(this.iframe.contentWindow)){var s=this.iframe.contentWindow;if(!e.replace){s.document.open();s.document.close()}this._updateHash(s.location,t,e.replace)}}else{return this.location.assign(n)}if(e.trigger)return this.loadUrl(t)},_updateHash:function(t,e,i){if(i){var n=t.href.replace(/(javascript:|#).*$/,"");t.replace(n+"#"+e)}else{t.hash="#"+e}}});e.history=new B;var D=function(t,e){var n=this;var r;if(t&&i.has(t,"constructor")){r=t.constructor}else{r=function(){return n.apply(this,arguments)}}i.extend(r,n,e);r.prototype=i.create(n.prototype,t);r.prototype.constructor=r;r.__super__=n.prototype;return r};m.extend=_.extend=O.extend=T.extend=B.extend=D;var V=function(){throw new Error('A "url" property or function must be specified')};var G=function(t,e){var i=e.error;e.error=function(n){if(i)i.call(e.context,t,n,e);t.trigger("error",t,n,e)}};return e}); +//# sourceMappingURL=backbone-min.map \ No newline at end of file diff --git a/src/core/libraries/polyfill.min.js b/src/core/libraries/polyfill.min.js new file mode 100644 index 000000000..1b822b0ea --- /dev/null +++ b/src/core/libraries/polyfill.min.js @@ -0,0 +1 @@ +!function r(c,a,f){function o(n,t){if(!a[n]){if(!c[n]){var e="function"==typeof require&&require;if(!t&&e)return e(n,!0);if(s)return s(n,!0);var i=new Error("Cannot find module '"+n+"'");throw i.code="MODULE_NOT_FOUND",i}var u=a[n]={exports:{}};c[n][0].call(u.exports,function(t){return o(c[n][1][t]||t)},u,u.exports,r,c,a,f)}return a[n].exports}for(var s="function"==typeof require&&require,t=0;tu;)o.call(t,e=i[u++])&&n.push(e);return n}},{104:104,107:107,108:108}],62:[function(t,n,r){var g=t(70),y=t(52),d=t(72),x=t(118),m=t(54),S="prototype",b=function(t,n,r){var e,i,o,u,c=t&b.F,a=t&b.G,f=t&b.S,s=t&b.P,l=t&b.B,h=a?g:f?g[n]||(g[n]={}):(g[n]||{})[S],p=a?y:y[n]||(y[n]={}),v=p[S]||(p[S]={});for(e in a&&(r=n),r)o=((i=!c&&h&&void 0!==h[e])?h:r)[e],u=l&&i?m(o,g):s&&"function"==typeof o?m(Function.call,o):o,h&&x(h,e,o,t&b.U),p[e]!=o&&d(p,e,u),s&&v[e]!=o&&(v[e]=o)};g.core=y,b.F=1,b.G=2,b.S=4,b.P=8,b.B=16,b.W=32,b.U=64,b.R=128,n.exports=b},{118:118,52:52,54:54,70:70,72:72}],63:[function(t,n,r){var e=t(152)("match");n.exports=function(n){var r=/./;try{"/./"[n](r)}catch(t){try{return r[e]=!1,!"/./"[n](r)}catch(t){}}return!0}},{152:152}],64:[function(t,n,r){arguments[4][23][0].apply(r,arguments)},{23:23}],65:[function(t,n,r){"use strict";t(248);var s=t(118),l=t(72),h=t(64),p=t(57),v=t(152),g=t(120),y=v("species"),d=!h(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$")}),x=function(){var t=/(?:)/,n=t.exec;t.exec=function(){return n.apply(this,arguments)};var r="ab".split(t);return 2===r.length&&"a"===r[0]&&"b"===r[1]}();n.exports=function(r,t,n){var e=v(r),o=!h(function(){var t={};return t[e]=function(){return 7},7!=""[r](t)}),i=o?!h(function(){var t=!1,n=/a/;return n.exec=function(){return t=!0,null},"split"===r&&(n.constructor={},n.constructor[y]=function(){return n}),n[e](""),!t}):void 0;if(!o||!i||"replace"===r&&!d||"split"===r&&!x){var u=/./[e],c=n(p,e,""[r],function maybeCallNative(t,n,r,e,i){return n.exec===g?o&&!i?{done:!0,value:u.call(n,r,e)}:{done:!0,value:t.call(r,n,e)}:{done:!1}}),a=c[0],f=c[1];s(String.prototype,r,a),l(RegExp.prototype,e,2==t?function(t,n){return f.call(t,this,n)}:function(t){return f.call(t,this)})}}},{118:118,120:120,152:152,248:248,57:57,64:64,72:72}],66:[function(t,n,r){"use strict";var e=t(38);n.exports=function(){var t=e(this),n="";return t.global&&(n+="g"),t.ignoreCase&&(n+="i"),t.multiline&&(n+="m"),t.unicode&&(n+="u"),t.sticky&&(n+="y"),n}},{38:38}],67:[function(t,n,r){"use strict";var p=t(79),v=t(81),g=t(141),y=t(54),d=t(152)("isConcatSpreadable");n.exports=function flattenIntoArray(t,n,r,e,i,o,u,c){for(var a,f,s=i,l=0,h=!!u&&y(u,c,3);ldocument.F=Object<\/script>"),t.close(),f=t.F;r--;)delete f[a][u[r]];return f()};t.exports=Object.create||function create(t,n){var r;return null!==t?(Pq[a]=i(t),r=new Pq,Pq[a]=null,r[c]=t):r=f(),void 0===n?r:o(r,n)}},{100:100,125:125,38:38,59:59,60:60,73:73}],99:[function(t,n,r){arguments[4][29][0].apply(r,arguments)},{143:143,29:29,38:38,58:58,74:74}],100:[function(t,n,r){var u=t(99),c=t(38),a=t(107);n.exports=t(58)?Object.defineProperties:function defineProperties(t,n){c(t);for(var r,e=a(n),i=e.length,o=0;oi;)u(e,r=n[i++])&&(~a(o,r)||o.push(r));return o}},{125:125,140:140,41:41,71:71}],107:[function(t,n,r){var e=t(106),i=t(60);n.exports=Object.keys||function keys(t){return e(t,i)}},{106:106,60:60}],108:[function(t,n,r){r.f={}.propertyIsEnumerable},{}],109:[function(t,n,r){var i=t(62),o=t(52),u=t(64);n.exports=function(t,n){var r=(o.Object||{})[t]||Object[t],e={};e[t]=n(r),i(i.S+i.F*u(function(){r(1)}),"Object",e)}},{52:52,62:62,64:64}],110:[function(t,n,r){var a=t(58),f=t(107),s=t(140),l=t(108).f;n.exports=function(c){return function(t){for(var n,r=s(t),e=f(r),i=e.length,o=0,u=[];o>>0||(u.test(r)?16:10))}:e},{134:134,135:135,70:70}],114:[function(t,n,r){n.exports=function(t){try{return{e:!1,v:t()}}catch(t){return{e:!0,v:t}}}},{}],115:[function(t,n,r){var e=t(38),i=t(81),o=t(96);n.exports=function(t,n){if(e(t),i(n)&&n.constructor===t)return n;var r=o.f(t);return(0,r.resolve)(n),r.promise}},{38:38,81:81,96:96}],116:[function(t,n,r){arguments[4][30][0].apply(r,arguments)},{30:30}],117:[function(t,n,r){var i=t(118);n.exports=function(t,n,r){for(var e in n)i(t,e,n[e],r);return t}},{118:118}],118:[function(t,n,r){var o=t(70),u=t(72),c=t(71),a=t(147)("src"),e=t(69),i="toString",f=(""+e).split(i);t(52).inspectSource=function(t){return e.call(t)},(n.exports=function(t,n,r,e){var i="function"==typeof r;i&&(c(r,"name")||u(r,"name",n)),t[n]!==r&&(i&&(c(r,a)||u(r,a,t[n]?""+t[n]:f.join(String(n)))),t===o?t[n]=r:e?t[n]?t[n]=r:u(t,n,r):(delete t[n],u(t,n,r)))})(Function.prototype,i,function toString(){return"function"==typeof this&&this[a]||e.call(this)})},{147:147,52:52,69:69,70:70,71:71,72:72}],119:[function(t,n,r){"use strict";var i=t(47),o=RegExp.prototype.exec;n.exports=function(t,n){var r=t.exec;if("function"==typeof r){var e=r.call(t,n);if("object"!=typeof e)throw new TypeError("RegExp exec method returned something other than an Object or null");return e}if("RegExp"!==i(t))throw new TypeError("RegExp#exec called on incompatible receiver");return o.call(t,n)}},{47:47}],120:[function(t,n,r){"use strict";var e,i,u=t(66),c=RegExp.prototype.exec,a=String.prototype.replace,o=c,f="lastIndex",s=(e=/a/,i=/b*/g,c.call(e,"a"),c.call(i,"a"),0!==e[f]||0!==i[f]),l=void 0!==/()??/.exec("")[1];(s||l)&&(o=function exec(t){var n,r,e,i,o=this;return l&&(r=new RegExp("^"+o.source+"$(?!\\s)",u.call(o))),s&&(n=o[f]),e=c.call(o,t),s&&e&&(o[f]=o.global?e.index+e[0].length:n),l&&e&&1"+i+""}var e=t(62),i=t(64),u=t(57),c=/"/g;n.exports=function(n,t){var r={};r[n]=t(Aw),e(e.P+e.F*i(function(){var t=""[n]('"');return t!==t.toLowerCase()||3a&&(f=f.slice(0,a)),e?f+i:i+f}},{133:133,141:141,57:57}],133:[function(t,n,r){"use strict";var i=t(139),o=t(57);n.exports=function repeat(t){var n=String(o(this)),r="",e=i(t);if(e<0||e==1/0)throw RangeError("Count can't be negative");for(;0>>=1)&&(n+=n))1&e&&(r+=n);return r}},{139:139,57:57}],134:[function(t,n,r){function tx(t,n,r){var e={},i=c(function(){return!!a[t]()||"​…"!="​…"[t]()}),o=e[t]=i?n(s):a[t];r&&(e[r]=o),u(u.P+u.F*i,"String",e)}var u=t(62),e=t(57),c=t(64),a=t(135),i="["+a+"]",o=RegExp("^"+i+i+"*"),f=RegExp(i+i+"*$"),s=tx.trim=function(t,n){return t=String(e(t)),1&n&&(t=t.replace(o,"")),2&n&&(t=t.replace(f,"")),t};n.exports=tx},{135:135,57:57,62:62,64:64}],135:[function(t,n,r){n.exports="\t\n\v\f\r   ᠎              \u2028\u2029\ufeff"},{}],136:[function(t,n,r){function Zx(){var t=+this;if(d.hasOwnProperty(t)){var n=d[t];delete d[t],n()}}function $x(t){Zx.call(t.data)}var e,i,o,u=t(54),c=t(76),a=t(73),f=t(59),s=t(70),l=s.process,h=s.setImmediate,p=s.clearImmediate,v=s.MessageChannel,g=s.Dispatch,y=0,d={},x="onreadystatechange";h&&p||(h=function setImmediate(t){for(var n=[],r=1;r>1,s=23===n?A(2,-24)-A(2,-77):0,l=0,h=t<0||0===t&&1/t<0?1:0;for((t=P(t))!=t||t===F?(i=t!=t?1:0,e=a):(e=M(k(t)/N),t*(o=A(2,-e))<1&&(e--,o*=2),2<=(t+=1<=e+f?s/o:s*A(2,1-f))*o&&(e++,o/=2),a<=e+f?(i=0,e=a):1<=e+f?(i=(t*o-1)*A(2,n),e+=f):(i=t*A(2,f-1)*A(2,n),e=0));8<=n;u[l++]=255&i,i/=256,n-=8);for(e=e<>1,c=i-7,a=r-1,f=t[a--],s=127&f;for(f>>=7;0>=-c,c+=n;0>8&255]}function packI32(t){return[255&t,t>>8&255,t>>16&255,t>>24&255]}function packF64(t){return packIEEE754(t,52,8)}function packF32(t){return packIEEE754(t,23,4)}function addGetter(t,n,r){g(t[S],n,{get:function(){return this[r]}})}function get(t,n,r,e){var i=p(+r);if(i+n>t[L])throw O(b);var o=t[T]._b,u=i+t[C],c=o.slice(u,u+n);return e?c:c.reverse()}function set(t,n,r,e,i,o){var u=p(+r);if(u+n>t[L])throw O(b);for(var c=t[T]._b,a=u+t[C],f=e(+i),s=0;sW;)(G=U[W++])in w||c(w,G,I[G]);o||(D.constructor=w)}var V=new _(new w(2)),B=_[S].setInt8;V.setInt8(0,2147483648),V.setInt8(1,2147483649),!V.getInt8(0)&&V.getInt8(1)||a(_[S],{setInt8:function setInt8(t,n){B.call(this,t,n<<24>>24)},setUint8:function setUint8(t,n){B.call(this,t,n<<24>>24)}},!0)}else w=function ArrayBuffer(t){s(this,w,x);var n=p(t);this._b=y.call(new Array(n),0),this[L]=n},_=function DataView(t,n,r){s(this,_,m),s(t,w,m);var e=t[L],i=l(n);if(i<0||e>24},getUint8:function getUint8(t){return get(this,1,t)[0]},getInt16:function getInt16(t){var n=get(this,2,t,arguments[1]);return(n[1]<<8|n[0])<<16>>16},getUint16:function getUint16(t){var n=get(this,2,t,arguments[1]);return n[1]<<8|n[0]},getInt32:function getInt32(t){return unpackI32(get(this,4,t,arguments[1]))},getUint32:function getUint32(t){return unpackI32(get(this,4,t,arguments[1]))>>>0},getFloat32:function getFloat32(t){return unpackIEEE754(get(this,4,t,arguments[1]),23,4)},getFloat64:function getFloat64(t){return unpackIEEE754(get(this,8,t,arguments[1]),52,8)},setInt8:function setInt8(t,n){set(this,1,t,packI8,n)},setUint8:function setUint8(t,n){set(this,1,t,packI8,n)},setInt16:function setInt16(t,n){set(this,2,t,packI16,n,arguments[2])},setUint16:function setUint16(t,n){set(this,2,t,packI16,n,arguments[2])},setInt32:function setInt32(t,n){set(this,4,t,packI32,n,arguments[2])},setUint32:function setUint32(t,n){set(this,4,t,packI32,n,arguments[2])},setFloat32:function setFloat32(t,n){set(this,4,t,packF32,n,arguments[2])},setFloat64:function setFloat64(t,n){set(this,8,t,packF64,n,arguments[2])}});d(w,x),d(_,m),c(_[S],u.VIEW,!0),r[x]=w,r[m]=_},{103:103,117:117,124:124,138:138,139:139,141:141,146:146,37:37,40:40,58:58,64:64,70:70,72:72,89:89,99:99}],146:[function(t,n,r){for(var e,i=t(70),o=t(72),u=t(147),c=u("typed_array"),a=u("view"),f=!(!i.ArrayBuffer||!i.DataView),s=f,l=0,h="Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array".split(",");l<9;)(e=i[h[l++]])?(o(e.prototype,c,!0),o(e.prototype,a,!0)):s=!1;n.exports={ABV:f,CONSTR:s,TYPED:c,VIEW:a}},{147:147,70:70,72:72}],147:[function(t,n,r){var e=0,i=Math.random();n.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++e+i).toString(36))}},{}],148:[function(t,n,r){var e=t(70).navigator;n.exports=e&&e.userAgent||""},{70:70}],149:[function(t,n,r){var e=t(81);n.exports=function(t,n){if(!e(t)||t._t!==n)throw TypeError("Incompatible receiver, "+n+" required!");return t}},{81:81}],150:[function(t,n,r){var e=t(70),i=t(52),o=t(89),u=t(151),c=t(99).f;n.exports=function(t){var n=i.Symbol||(i.Symbol=o?{}:e.Symbol||{});"_"==t.charAt(0)||t in n||c(n,t,{value:u.f(t)})}},{151:151,52:52,70:70,89:89,99:99}],151:[function(t,n,r){r.f=t(152)},{152:152}],152:[function(t,n,r){var e=t(126)("wks"),i=t(147),o=t(70).Symbol,u="function"==typeof o;(n.exports=function(t){return e[t]||(e[t]=u&&o[t]||(u?o:i)("Symbol."+t))}).store=e},{126:126,147:147,70:70}],153:[function(t,n,r){var e=t(47),i=t(152)("iterator"),o=t(88);n.exports=t(52).getIteratorMethod=function(t){if(null!=t)return t[i]||t["@@iterator"]||o[e(t)]}},{152:152,47:47,52:52,88:88}],154:[function(t,n,r){var e=t(62);e(e.P,"Array",{copyWithin:t(39)}),t(35)("copyWithin")},{35:35,39:39,62:62}],155:[function(t,n,r){"use strict";var e=t(62),i=t(42)(4);e(e.P+e.F*!t(128)([].every,!0),"Array",{every:function every(t){return i(this,t,arguments[1])}})},{128:128,42:42,62:62}],156:[function(t,n,r){var e=t(62);e(e.P,"Array",{fill:t(40)}),t(35)("fill")},{35:35,40:40,62:62}],157:[function(t,n,r){"use strict";var e=t(62),i=t(42)(2);e(e.P+e.F*!t(128)([].filter,!0),"Array",{filter:function filter(t){return i(this,t,arguments[1])}})},{128:128,42:42,62:62}],158:[function(t,n,r){"use strict";var e=t(62),i=t(42)(6),o="findIndex",u=!0;o in[]&&Array(1)[o](function(){u=!1}),e(e.P+e.F*u,"Array",{findIndex:function findIndex(t){return i(this,t,1=t.length?(this._t=void 0,i(1)):i(0,"keys"==n?r:"values"==n?t[r]:[r,t[r]])},"values"),o.Arguments=o.Array,e("keys"),e("values"),e("entries")},{140:140,35:35,85:85,87:87,88:88}],165:[function(t,n,r){"use strict";var e=t(62),i=t(140),o=[].join;e(e.P+e.F*(t(77)!=Object||!t(128)(o)),"Array",{join:function join(t){return o.call(i(this),void 0===t?",":t)}})},{128:128,140:140,62:62,77:77}],166:[function(t,n,r){"use strict";var e=t(62),i=t(140),o=t(139),u=t(141),c=[].lastIndexOf,a=!!c&&1/[1].lastIndexOf(1,-0)<0;e(e.P+e.F*(a||!t(128)(c)),"Array",{lastIndexOf:function lastIndexOf(t){if(a)return c.apply(this,arguments)||0;var n=i(this),r=u(n.length),e=r-1;for(1>>=0)?31-Math.floor(Math.log(t+.5)*Math.LOG2E):32}})},{62:62}],189:[function(t,n,r){var e=t(62),i=Math.exp;e(e.S,"Math",{cosh:function cosh(t){return(i(t=+t)+i(-t))/2}})},{62:62}],190:[function(t,n,r){var e=t(62),i=t(90);e(e.S+e.F*(i!=Math.expm1),"Math",{expm1:i})},{62:62,90:90}],191:[function(t,n,r){var e=t(62);e(e.S,"Math",{fround:t(91)})},{62:62,91:91}],192:[function(t,n,r){var e=t(62),a=Math.abs;e(e.S,"Math",{hypot:function hypot(t,n){for(var r,e,i=0,o=0,u=arguments.length,c=0;o>>16)*u+o*(r&i>>>16)<<16>>>0)}})},{62:62,64:64}],194:[function(t,n,r){var e=t(62);e(e.S,"Math",{log10:function log10(t){return Math.log(t)*Math.LOG10E}})},{62:62}],195:[function(t,n,r){var e=t(62);e(e.S,"Math",{log1p:t(92)})},{62:62,92:92}],196:[function(t,n,r){var e=t(62);e(e.S,"Math",{log2:function log2(t){return Math.log(t)/Math.LN2}})},{62:62}],197:[function(t,n,r){var e=t(62);e(e.S,"Math",{sign:t(93)})},{62:62,93:93}],198:[function(t,n,r){var e=t(62),i=t(90),o=Math.exp;e(e.S+e.F*t(64)(function(){return-2e-17!=!Math.sinh(-2e-17)}),"Math",{sinh:function sinh(t){return Math.abs(t=+t)<1?(i(t)-i(-t))/2:(o(t-1)-o(-t-1))*(Math.E/2)}})},{62:62,64:64,90:90}],199:[function(t,n,r){var e=t(62),i=t(90),o=Math.exp;e(e.S,"Math",{tanh:function tanh(t){var n=i(t=+t),r=i(-t);return n==1/0?1:r==1/0?-1:(n-r)/(o(t)+o(-t))}})},{62:62,90:90}],200:[function(t,n,r){var e=t(62);e(e.S,"Math",{trunc:function trunc(t){return(0b;b++)i(g,m=S[b])&&!i(v,m)&&l(v,m,f(g,m));(v.prototype=y).constructor=v,t(118)(e,p,v)}},{101:101,103:103,118:118,134:134,143:143,48:48,58:58,64:64,70:70,71:71,75:75,98:98,99:99}],202:[function(t,n,r){var e=t(62);e(e.S,"Number",{EPSILON:Math.pow(2,-52)})},{62:62}],203:[function(t,n,r){var e=t(62),i=t(70).isFinite;e(e.S,"Number",{isFinite:function isFinite(t){return"number"==typeof t&&i(t)}})},{62:62,70:70}],204:[function(t,n,r){var e=t(62);e(e.S,"Number",{isInteger:t(80)})},{62:62,80:80}],205:[function(t,n,r){var e=t(62);e(e.S,"Number",{isNaN:function isNaN(t){return t!=t}})},{62:62}],206:[function(t,n,r){var e=t(62),i=t(80),o=Math.abs;e(e.S,"Number",{isSafeInteger:function isSafeInteger(t){return i(t)&&o(t)<=9007199254740991}})},{62:62,80:80}],207:[function(t,n,r){var e=t(62);e(e.S,"Number",{MAX_SAFE_INTEGER:9007199254740991})},{62:62}],208:[function(t,n,r){var e=t(62);e(e.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991})},{62:62}],209:[function(t,n,r){var e=t(62),i=t(112);e(e.S+e.F*(Number.parseFloat!=i),"Number",{parseFloat:i})},{112:112,62:62}],210:[function(t,n,r){var e=t(62),i=t(113);e(e.S+e.F*(Number.parseInt!=i),"Number",{parseInt:i})},{113:113,62:62}],211:[function(t,n,r){"use strict";function XO(t,n){for(var r=-1,e=n;++r<6;)e+=t*u[r],u[r]=e%1e7,e=o(e/1e7)}function YO(t){for(var n=6,r=0;0<=--n;)r+=u[n],u[n]=o(r/t),r=r%t*1e7}function ZO(){for(var t=6,n="";0<=--t;)if(""!==n||0===t||0!==u[t]){var r=String(u[t]);n=""===n?r:n+l.call("0",7-r.length)+r}return n}var e=t(62),f=t(139),s=t(34),l=t(133),i=1..toFixed,o=Math.floor,u=[0,0,0,0,0,0],h="Number.toFixed: incorrect invocation!",p=function(t,n,r){return 0===n?r:n%2==1?p(t,n-1,r*t):p(t*t,n/2,r)};e(e.P+e.F*(!!i&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==(0xde0b6b3a7640080).toFixed(0))||!t(64)(function(){i.call({})})),"Number",{toFixed:function toFixed(t){var n,r,e,i,o=s(this,h),u=f(t),c="",a="0";if(u<0||20t;)n(e[t++]);s._c=[],s._n=!1,r&&!s._h&&N(s)})}}function kS(t){var n=this;n._d||(n._d=!0,(n=n._w||n)._v=t,n._s=2,n._a||(n._a=n._c.slice()),gS(n,!0))}var e,i,o,u,c=r(89),a=r(70),f=r(54),s=r(47),l=r(62),h=r(81),p=r(33),v=r(37),g=r(68),y=r(127),d=r(136).set,x=r(95)(),m=r(96),S=r(114),b=r(148),w=r(115),_="Promise",E=a.TypeError,O=a.process,F=O&&O.versions,I=F&&F.v8||"",P=a[_],A="process"==s(O),M=i=m.f,k=!!function(){try{var t=P.resolve(1),n=(t.constructor={})[r(152)("species")]=function(t){t($R,$R)};return(A||"function"==typeof PromiseRejectionEvent)&&t.then($R)instanceof n&&0!==I.indexOf("6.6")&&-1===b.indexOf("Chrome/66")}catch(t){}}(),N=function(o){d.call(a,function(){var t,n,r,e=o._v,i=j(o);if(i&&(t=S(function(){A?O.emit("unhandledRejection",e,o):(n=a.onunhandledrejection)?n({promise:o,reason:e}):(r=a.console)&&r.error&&r.error("Unhandled promise rejection",e)}),o._h=A||j(o)?2:1),o._a=void 0,i&&t.e)throw t.v})},j=function(t){return 1!==t._h&&0===(t._a||t._c).length},R=function(n){d.call(a,function(){var t;A?O.emit("rejectionHandled",n):(t=a.onrejectionhandled)&&t({promise:n,reason:n._v})})},T=function(t){var r,e=this;if(!e._d){e._d=!0,e=e._w||e;try{if(e===t)throw E("Promise can't be resolved itself");(r=fS(t))?x(function(){var n={_w:e,_d:!1};try{r.call(t,f(T,n,1),f(kS,n,1))}catch(t){kS.call(n,t)}}):(e._v=t,e._s=1,gS(e,!1))}catch(t){kS.call({_w:e,_d:!1},t)}}};k||(P=function Promise(t){v(this,P,_,"_h"),p(t),e.call(this);try{t(f(T,this,1),f(kS,this,1))}catch(t){kS.call(this,t)}},(e=function Promise(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=r(117)(P.prototype,{then:function then(t,n){var r=M(y(this,P));return r.ok="function"!=typeof t||t,r.fail="function"==typeof n&&n,r.domain=A?O.domain:void 0,this._c.push(r),this._a&&this._a.push(r),this._s&&gS(this,!1),r.promise},catch:function(t){return this.then(void 0,t)}}),o=function(){var t=new e;this.promise=t,this.resolve=f(T,t,1),this.reject=f(kS,t,1)},m.f=M=function(t){return t===P||t===u?new o(t):i(t)}),l(l.G+l.W+l.F*!k,{Promise:P}),r(124)(P,_),r(123)(_),u=r(52)[_],l(l.S+l.F*!k,_,{reject:function reject(t){var n=M(this);return(0,n.reject)(t),n.promise}}),l(l.S+l.F*(c||!k),_,{resolve:function resolve(t){return w(c&&this===u?P:this,t)}}),l(l.S+l.F*!(k&&r(86)(function(t){P.all(t).catch($R)})),_,{all:function all(t){var u=this,n=M(u),c=n.resolve,a=n.reject,r=S(function(){var e=[],i=0,o=1;g(t,!1,function(t){var n=i++,r=!1;e.push(void 0),o++,u.resolve(t).then(function(t){r||(r=!0,e[n]=t,--o||c(e))},a)}),--o||c(e)});return r.e&&a(r.v),n.promise},race:function race(t){var n=this,r=M(n),e=r.reject,i=S(function(){g(t,!1,function(t){n.resolve(t).then(r.resolve,e)})});return i.e&&e(i.v),r.promise}})},{114:114,115:115,117:117,123:123,124:124,127:127,136:136,148:148,152:152,33:33,37:37,47:47,52:52,54:54,62:62,68:68,70:70,81:81,86:86,89:89,95:95,96:96}],233:[function(t,n,r){var e=t(62),o=t(33),u=t(38),c=(t(70).Reflect||{}).apply,a=Function.apply;e(e.S+e.F*!t(64)(function(){c(function(){})}),"Reflect",{apply:function apply(t,n,r){var e=o(t),i=u(r);return c?c(e,n,i):a.call(e,n,i)}})},{33:33,38:38,62:62,64:64,70:70}],234:[function(t,n,r){var e=t(62),c=t(98),a=t(33),f=t(38),s=t(81),i=t(64),l=t(46),h=(t(70).Reflect||{}).construct,p=i(function(){function F(){}return!(h(function(){},[],F)instanceof F)}),v=!i(function(){h(function(){})});e(e.S+e.F*(p||v),"Reflect",{construct:function construct(t,n){a(t),f(n);var r=arguments.length<3?t:a(arguments[2]);if(v&&!p)return h(t,n,r);if(t==r){switch(n.length){case 0:return new t;case 1:return new t(n[0]);case 2:return new t(n[0],n[1]);case 3:return new t(n[0],n[1],n[2]);case 4:return new t(n[0],n[1],n[2],n[3])}var e=[null];return e.push.apply(e,n),new(l.apply(t,e))}var i=r.prototype,o=c(s(i)?i:Object.prototype),u=Function.apply.call(t,o,n);return s(u)?u:o}})},{33:33,38:38,46:46,62:62,64:64,70:70,81:81,98:98}],235:[function(t,n,r){var e=t(99),i=t(62),o=t(38),u=t(143);i(i.S+i.F*t(64)(function(){Reflect.defineProperty(e.f({},1,{value:1}),1,{value:2})}),"Reflect",{defineProperty:function defineProperty(t,n,r){o(t),n=u(n,!0),o(r);try{return e.f(t,n,r),!0}catch(t){return!1}}})},{143:143,38:38,62:62,64:64,99:99}],236:[function(t,n,r){var e=t(62),i=t(101).f,o=t(38);e(e.S,"Reflect",{deleteProperty:function deleteProperty(t,n){var r=i(o(t),n);return!(r&&!r.configurable)&&delete t[n]}})},{101:101,38:38,62:62}],237:[function(t,n,r){"use strict";function IU(t){this._t=i(t),this._i=0;var n,r=this._k=[];for(n in t)r.push(n)}var e=t(62),i=t(38);t(84)(IU,"Object",function(){var t,n=this._k;do{if(this._i>=n.length)return{value:void 0,done:!0}}while(!((t=n[this._i++])in this._t));return{value:t,done:!1}}),e(e.S,"Reflect",{enumerate:function enumerate(t){return new IU(t)}})},{38:38,62:62,84:84}],238:[function(t,n,r){var e=t(101),i=t(62),o=t(38);i(i.S,"Reflect",{getOwnPropertyDescriptor:function getOwnPropertyDescriptor(t,n){return e.f(o(t),n)}})},{101:101,38:38,62:62}],239:[function(t,n,r){var e=t(62),i=t(105),o=t(38);e(e.S,"Reflect",{getPrototypeOf:function getPrototypeOf(t){return i(o(t))}})},{105:105,38:38,62:62}],240:[function(t,n,r){var o=t(101),u=t(105),c=t(71),e=t(62),a=t(81),f=t(38);e(e.S,"Reflect",{get:function get(t,n){var r,e,i=arguments.length<3?t:arguments[2];return f(t)===i?t[n]:(r=o.f(t,n))?c(r,"value")?r.value:void 0!==r.get?r.get.call(i):void 0:a(e=u(t))?get(e,n,i):void 0}})},{101:101,105:105,38:38,62:62,71:71,81:81}],241:[function(t,n,r){var e=t(62);e(e.S,"Reflect",{has:function has(t,n){return n in t}})},{62:62}],242:[function(t,n,r){var e=t(62),i=t(38),o=Object.isExtensible;e(e.S,"Reflect",{isExtensible:function isExtensible(t){return i(t),!o||o(t)}})},{38:38,62:62}],243:[function(t,n,r){var e=t(62);e(e.S,"Reflect",{ownKeys:t(111)})},{111:111,62:62}],244:[function(t,n,r){var e=t(62),i=t(38),o=Object.preventExtensions;e(e.S,"Reflect",{preventExtensions:function preventExtensions(t){i(t);try{return o&&o(t),!0}catch(t){return!1}}})},{38:38,62:62}],245:[function(t,n,r){var e=t(62),i=t(122);i&&e(e.S,"Reflect",{setPrototypeOf:function setPrototypeOf(t,n){i.check(t,n);try{return i.set(t,n),!0}catch(t){return!1}}})},{122:122,62:62}],246:[function(t,n,r){var c=t(99),a=t(101),f=t(105),s=t(71),e=t(62),l=t(116),h=t(38),p=t(81);e(e.S,"Reflect",{set:function set(t,n,r){var e,i,o=arguments.length<4?t:arguments[3],u=a.f(h(t),n);if(!u){if(p(i=f(t)))return set(i,n,r,o);u=l(0)}if(s(u,"value")){if(!1===u.writable||!p(o))return!1;if(e=a.f(o,n)){if(e.get||e.set||!1===e.writable)return!1;e.value=r,c.f(o,n,e)}else c.f(o,n,l(0,r));return!0}return void 0!==u.set&&(u.set.call(o,r),!0)}})},{101:101,105:105,116:116,38:38,62:62,71:71,81:81,99:99}],247:[function(t,n,r){var e=t(70),o=t(75),i=t(99).f,u=t(103).f,c=t(82),a=t(66),f=e.RegExp,s=f,l=f.prototype,h=/a/g,p=/a/g,v=new f(h)!==h;if(t(58)&&(!v||t(64)(function(){return p[t(152)("match")]=!1,f(h)!=h||f(p)==p||"/a/i"!=f(h,"i")}))){f=function RegExp(t,n){var r=this instanceof f,e=c(t),i=void 0===n;return!r&&e&&t.constructor===f&&i?t:o(v?new s(e&&!i?t.source:t,n):s((e=t instanceof f)?t.source:t,e&&i?a.call(t):n),r?this:l,f)};function DW(n){n in f||i(f,n,{configurable:!0,get:function(){return s[n]},set:function(t){s[n]=t}})}for(var g=u(s),y=0;g.length>y;)DW(g[y++]);(l.constructor=f).prototype=l,t(118)(e,"RegExp",f)}t(123)("RegExp")},{103:103,118:118,123:123,152:152,58:58,64:64,66:66,70:70,75:75,82:82,99:99}],248:[function(t,n,r){"use strict";var e=t(120);t(62)({target:"RegExp",proto:!0,forced:e!==/./.exec},{exec:e})},{120:120,62:62}],249:[function(t,n,r){t(58)&&"g"!=/./g.flags&&t(99).f(RegExp.prototype,"flags",{configurable:!0,get:t(66)})},{58:58,66:66,99:99}],250:[function(t,n,r){"use strict";var l=t(38),h=t(141),p=t(36),v=t(119);t(65)("match",1,function(e,i,f,s){return[function match(t){var n=e(this),r=null==t?void 0:t[i];return void 0!==r?r.call(t,n):new RegExp(t)[i](String(n))},function(t){var n=s(f,t,this);if(n.done)return n.value;var r=l(t),e=String(this);if(!r.global)return v(r,e);for(var i,o=r.unicode,u=[],c=r.lastIndex=0;null!==(i=v(r,e));){var a=String(i[0]);""===(u[c]=a)&&(r.lastIndex=p(e,h(r.lastIndex),o)),c++}return 0===c?null:u}]})},{119:119,141:141,36:36,38:38,65:65}],251:[function(t,n,r){"use strict";var _=t(38),e=t(142),E=t(141),O=t(139),F=t(36),I=t(119),P=Math.max,A=Math.min,h=Math.floor,p=/\$([$&`']|\d\d?|<[^>]*>)/g,v=/\$([$&`']|\d\d?)/g;t(65)("replace",2,function(i,o,b,w){return[function replace(t,n){var r=i(this),e=null==t?void 0:t[o];return void 0!==e?e.call(t,r,n):b.call(String(r),t,n)},function(t,n){var r=w(b,t,this,n);if(r.done)return r.value;var e=_(t),i=String(this),o="function"==typeof n;o||(n=String(n));var u=e.global;if(u){var c=e.unicode;e.lastIndex=0}for(var a=[];;){var f=I(e,i);if(null===f)break;if(a.push(f),!u)break;""===String(f[0])&&(e.lastIndex=F(i,E(e.lastIndex),c))}for(var s,l="",h=0,p=0;p>>0,s=new RegExp(t.source,c+"g");(e=h.call(s,r))&&!(a<(i=s[g])&&(u.push(r.slice(a,e.index)),1=f));)s[g]===e.index&&s[g]++;return a===r[v]?!o&&s.test("")||u.push(""):u.push(r.slice(a)),u[v]>f?u.slice(0,f):u}:"0"[u](void 0,0)[v]?function(t,n){return void 0===t&&0===n?[]:y.call(this,t,n)}:y,[function split(t,n){var r=i(this),e=null==t?void 0:t[o];return void 0!==e?e.call(t,r,n):x.call(String(r),t,n)},function(t,n){var r=d(x,t,this,n,x!==y);if(r.done)return r.value;var e=m(t),i=String(this),o=S(e,RegExp),u=e.unicode,c=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(F?"y":"g"),a=new o(F?e:"^(?:"+e.source+")",c),f=void 0===n?O:n>>>0;if(0==f)return[];if(0===i.length)return null===_(a,i)?[i]:[];for(var s=0,l=0,h=[];l>10),n%1024+56320))}return r.join("")}})},{137:137,62:62}],266:[function(t,n,r){"use strict";var e=t(62),i=t(130),o="includes";e(e.P+e.F*t(63)(o),"String",{includes:function includes(t){return!!~i(this,t,o).indexOf(t,1=n.length?{value:void 0,done:!0}:(t=e(n,r),this._i+=t.length,{value:t,done:!1})})},{129:129,85:85}],269:[function(t,n,r){"use strict";t(131)("link",function(n){return function link(t){return n(this,"a","href",t)}})},{131:131}],270:[function(t,n,r){var e=t(62),u=t(140),c=t(141);e(e.S,"String",{raw:function raw(t){for(var n=u(t.raw),r=c(n.length),e=arguments.length,i=[],o=0;oi;)u(W,n=r[i++])||n==C||n==a||e.push(n);return e}function J1(t){for(var n,r=t===B,e=N(r?V:b(t)),i=[],o=0;e.length>o;)!u(W,n=e[o++])||r&&!u(B,n)||i.push(W[n]);return i}var e=t(70),u=t(71),i=t(58),o=t(62),c=t(118),a=t(94).KEY,f=t(64),s=t(126),l=t(124),h=t(147),p=t(152),v=t(151),g=t(150),y=t(61),d=t(79),x=t(38),m=t(81),S=t(142),b=t(140),w=t(143),_=t(116),E=t(98),O=t(102),F=t(101),I=t(104),P=t(99),A=t(107),M=F.f,k=P.f,N=O.f,j=e.Symbol,R=e.JSON,T=R&&R.stringify,L="prototype",C=p("_hidden"),G=p("toPrimitive"),D={}.propertyIsEnumerable,U=s("symbol-registry"),W=s("symbols"),V=s("op-symbols"),B=Object[L],q="function"==typeof j&&!!I.f,Y=e.QObject,z=!Y||!Y[L]||!Y[L].findChild,X=i&&f(function(){return 7!=E(k({},"a",{get:function(){return k(this,"a",{value:7}).a}})).a})?function(t,n,r){var e=M(B,n);e&&delete B[n],k(t,n,r),e&&t!==B&&k(B,n,e)}:k,$=q&&"symbol"==typeof j.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof j},Q=function defineProperty(t,n,r){return t===B&&Q(V,n,r),x(t),n=w(n,!0),x(r),u(W,n)?(r.enumerable?(u(t,C)&&t[C][n]&&(t[C][n]=!1),r=E(r,{enumerable:_(0,!1)})):(u(t,C)||k(t,C,_(1,{})),t[C][n]=!0),X(t,n,r)):k(t,n,r)};q||(c((j=function Symbol(){if(this instanceof j)throw TypeError("Symbol is not a constructor!");var n=h(0J;)p(Z[J++]);for(var H=A(p.store),K=0;H.length>K;)g(H[K++]);o(o.S+o.F*!q,"Symbol",{for:function(t){return u(U,t+="")?U[t]:U[t]=j(t)},keyFor:function keyFor(t){if(!$(t))throw TypeError(t+" is not a symbol!");for(var n in U)if(U[n]===t)return n},useSetter:function(){z=!0},useSimple:function(){z=!1}}),o(o.S+o.F*!q,"Object",{create:function create(t,n){return void 0===n?E(t):E1(E(t),n)},defineProperty:Q,defineProperties:E1,getOwnPropertyDescriptor:H1,getOwnPropertyNames:I1,getOwnPropertySymbols:J1});var tt=f(function(){I.f(1)});o(o.S+o.F*tt,"Object",{getOwnPropertySymbols:function getOwnPropertySymbols(t){return I.f(S(t))}}),R&&o(o.S+o.F*(!q||f(function(){var t=j();return"[null]"!=T([t])||"{}"!=T({a:t})||"{}"!=T(Object(t))})),"JSON",{stringify:function stringify(t){for(var n,r,e=[t],i=1;ic;)void 0!==(r=i(e,n=o[c++]))&&l(u,n,r);return u}})},{101:101,111:111,140:140,53:53,62:62}],296:[function(t,n,r){var e=t(62),i=t(110)(!1);e(e.S,"Object",{values:function values(t){return i(t)}})},{110:110,62:62}],297:[function(t,n,r){"use strict";var e=t(62),i=t(52),o=t(70),u=t(127),c=t(115);e(e.P+e.R,"Promise",{finally:function(n){var r=u(this,i.Promise||o.Promise),t="function"==typeof n;return this.then(t?function(t){return c(r,n()).then(function(){return t})}:n,t?function(t){return c(r,n()).then(function(){throw t})}:n)}})},{115:115,127:127,52:52,62:62,70:70}],298:[function(t,n,r){"use strict";var e=t(62),i=t(132),o=t(148),u=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(o);e(e.P+e.F*u,"String",{padEnd:function padEnd(t){return i(this,t,1n;n++)o(e,e._deferreds[n]);e._deferreds=null}function u(e,n){var t=!1;try{e(function(e){t||(t=!0,r(n,e))},function(e){t||(t=!0,i(n,e))})}catch(o){if(t)return;t=!0,i(n,o)}}var c=setTimeout;t.prototype["catch"]=function(e){return this.then(null,e)},t.prototype.then=function(e,t){var r=new this.constructor(n);return o(this,new function(e,n,t){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof n?n:null,this.promise=t}(e,t,r)),r},t.prototype["finally"]=e,t.all=function(e){return new t(function(n,t){function o(e,f){try{if(f&&("object"==typeof f||"function"==typeof f)){var u=f.then;if("function"==typeof u)return void u.call(f,function(n){o(e,n)},t)}r[e]=f,0==--i&&n(r)}catch(c){t(c)}}if(!e||"undefined"==typeof e.length)throw new TypeError("Promise.all accepts an array");var r=Array.prototype.slice.call(e);if(0===r.length)return n([]);for(var i=r.length,f=0;r.length>f;f++)o(f,r[f])})},t.resolve=function(e){return e&&"object"==typeof e&&e.constructor===t?e:new t(function(n){n(e)})},t.reject=function(e){return new t(function(n,t){t(e)})},t.race=function(e){return new t(function(n,t){for(var o=0,r=e.length;r>o;o++)e[o].then(n,t)})},t._immediateFn="function"==typeof setImmediate&&function(e){setImmediate(e)}||function(e){c(e,0)},t._unhandledRejectionFn=function(e){void 0!==console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};var l=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw Error("unable to locate global object")}();"Promise"in l?l.Promise.prototype["finally"]||(l.Promise.prototype["finally"]=e):l.Promise=t}); diff --git a/src/core/required/adapt/js/scriptLoader.js b/src/core/required/adapt/js/scriptLoader.js index 57122f964..3d0b71699 100644 --- a/src/core/required/adapt/js/scriptLoader.js +++ b/src/core/required/adapt/js/scriptLoader.js @@ -62,7 +62,7 @@ } }, paths: { - promise: 'libraries/promise-polyfill.min', + polyfill: 'libraries/polyfill.min', jquery: 'libraries/jquery.min', underscore: 'libraries/underscore.min', 'underscore.results': 'libraries/underscore.results', @@ -108,7 +108,7 @@ function loadFoundationLibraries() { require([ 'handlebars', - 'promise', + 'polyfill', 'underscore', 'underscore.results', 'backbone', From 63431509e471d2f414235934c9bb2826baac8f82 Mon Sep 17 00:00:00 2001 From: Oliver Foster Date: Mon, 17 Feb 2020 15:48:09 +0000 Subject: [PATCH 02/18] Added .gitignore and source comment for polyfill.min.js --- .gitignore | 1 + src/core/libraries/polyfill.min.js | 1 + 2 files changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index ab2d9cfb3..a8c4bbefc 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,5 @@ bower_components node_modules .DS_Store .idea +.temp package-lock.json \ No newline at end of file diff --git a/src/core/libraries/polyfill.min.js b/src/core/libraries/polyfill.min.js index 1b822b0ea..5060bfdf4 100644 --- a/src/core/libraries/polyfill.min.js +++ b/src/core/libraries/polyfill.min.js @@ -1 +1,2 @@ +// source: https://registry.npmjs.org/@babel/polyfill/-/polyfill-7.8.3.tgz dist/polyfill.min.js !function r(c,a,f){function o(n,t){if(!a[n]){if(!c[n]){var e="function"==typeof require&&require;if(!t&&e)return e(n,!0);if(s)return s(n,!0);var i=new Error("Cannot find module '"+n+"'");throw i.code="MODULE_NOT_FOUND",i}var u=a[n]={exports:{}};c[n][0].call(u.exports,function(t){return o(c[n][1][t]||t)},u,u.exports,r,c,a,f)}return a[n].exports}for(var s="function"==typeof require&&require,t=0;tu;)o.call(t,e=i[u++])&&n.push(e);return n}},{104:104,107:107,108:108}],62:[function(t,n,r){var g=t(70),y=t(52),d=t(72),x=t(118),m=t(54),S="prototype",b=function(t,n,r){var e,i,o,u,c=t&b.F,a=t&b.G,f=t&b.S,s=t&b.P,l=t&b.B,h=a?g:f?g[n]||(g[n]={}):(g[n]||{})[S],p=a?y:y[n]||(y[n]={}),v=p[S]||(p[S]={});for(e in a&&(r=n),r)o=((i=!c&&h&&void 0!==h[e])?h:r)[e],u=l&&i?m(o,g):s&&"function"==typeof o?m(Function.call,o):o,h&&x(h,e,o,t&b.U),p[e]!=o&&d(p,e,u),s&&v[e]!=o&&(v[e]=o)};g.core=y,b.F=1,b.G=2,b.S=4,b.P=8,b.B=16,b.W=32,b.U=64,b.R=128,n.exports=b},{118:118,52:52,54:54,70:70,72:72}],63:[function(t,n,r){var e=t(152)("match");n.exports=function(n){var r=/./;try{"/./"[n](r)}catch(t){try{return r[e]=!1,!"/./"[n](r)}catch(t){}}return!0}},{152:152}],64:[function(t,n,r){arguments[4][23][0].apply(r,arguments)},{23:23}],65:[function(t,n,r){"use strict";t(248);var s=t(118),l=t(72),h=t(64),p=t(57),v=t(152),g=t(120),y=v("species"),d=!h(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$")}),x=function(){var t=/(?:)/,n=t.exec;t.exec=function(){return n.apply(this,arguments)};var r="ab".split(t);return 2===r.length&&"a"===r[0]&&"b"===r[1]}();n.exports=function(r,t,n){var e=v(r),o=!h(function(){var t={};return t[e]=function(){return 7},7!=""[r](t)}),i=o?!h(function(){var t=!1,n=/a/;return n.exec=function(){return t=!0,null},"split"===r&&(n.constructor={},n.constructor[y]=function(){return n}),n[e](""),!t}):void 0;if(!o||!i||"replace"===r&&!d||"split"===r&&!x){var u=/./[e],c=n(p,e,""[r],function maybeCallNative(t,n,r,e,i){return n.exec===g?o&&!i?{done:!0,value:u.call(n,r,e)}:{done:!0,value:t.call(r,n,e)}:{done:!1}}),a=c[0],f=c[1];s(String.prototype,r,a),l(RegExp.prototype,e,2==t?function(t,n){return f.call(t,this,n)}:function(t){return f.call(t,this)})}}},{118:118,120:120,152:152,248:248,57:57,64:64,72:72}],66:[function(t,n,r){"use strict";var e=t(38);n.exports=function(){var t=e(this),n="";return t.global&&(n+="g"),t.ignoreCase&&(n+="i"),t.multiline&&(n+="m"),t.unicode&&(n+="u"),t.sticky&&(n+="y"),n}},{38:38}],67:[function(t,n,r){"use strict";var p=t(79),v=t(81),g=t(141),y=t(54),d=t(152)("isConcatSpreadable");n.exports=function flattenIntoArray(t,n,r,e,i,o,u,c){for(var a,f,s=i,l=0,h=!!u&&y(u,c,3);ldocument.F=Object<\/script>"),t.close(),f=t.F;r--;)delete f[a][u[r]];return f()};t.exports=Object.create||function create(t,n){var r;return null!==t?(Pq[a]=i(t),r=new Pq,Pq[a]=null,r[c]=t):r=f(),void 0===n?r:o(r,n)}},{100:100,125:125,38:38,59:59,60:60,73:73}],99:[function(t,n,r){arguments[4][29][0].apply(r,arguments)},{143:143,29:29,38:38,58:58,74:74}],100:[function(t,n,r){var u=t(99),c=t(38),a=t(107);n.exports=t(58)?Object.defineProperties:function defineProperties(t,n){c(t);for(var r,e=a(n),i=e.length,o=0;oi;)u(e,r=n[i++])&&(~a(o,r)||o.push(r));return o}},{125:125,140:140,41:41,71:71}],107:[function(t,n,r){var e=t(106),i=t(60);n.exports=Object.keys||function keys(t){return e(t,i)}},{106:106,60:60}],108:[function(t,n,r){r.f={}.propertyIsEnumerable},{}],109:[function(t,n,r){var i=t(62),o=t(52),u=t(64);n.exports=function(t,n){var r=(o.Object||{})[t]||Object[t],e={};e[t]=n(r),i(i.S+i.F*u(function(){r(1)}),"Object",e)}},{52:52,62:62,64:64}],110:[function(t,n,r){var a=t(58),f=t(107),s=t(140),l=t(108).f;n.exports=function(c){return function(t){for(var n,r=s(t),e=f(r),i=e.length,o=0,u=[];o>>0||(u.test(r)?16:10))}:e},{134:134,135:135,70:70}],114:[function(t,n,r){n.exports=function(t){try{return{e:!1,v:t()}}catch(t){return{e:!0,v:t}}}},{}],115:[function(t,n,r){var e=t(38),i=t(81),o=t(96);n.exports=function(t,n){if(e(t),i(n)&&n.constructor===t)return n;var r=o.f(t);return(0,r.resolve)(n),r.promise}},{38:38,81:81,96:96}],116:[function(t,n,r){arguments[4][30][0].apply(r,arguments)},{30:30}],117:[function(t,n,r){var i=t(118);n.exports=function(t,n,r){for(var e in n)i(t,e,n[e],r);return t}},{118:118}],118:[function(t,n,r){var o=t(70),u=t(72),c=t(71),a=t(147)("src"),e=t(69),i="toString",f=(""+e).split(i);t(52).inspectSource=function(t){return e.call(t)},(n.exports=function(t,n,r,e){var i="function"==typeof r;i&&(c(r,"name")||u(r,"name",n)),t[n]!==r&&(i&&(c(r,a)||u(r,a,t[n]?""+t[n]:f.join(String(n)))),t===o?t[n]=r:e?t[n]?t[n]=r:u(t,n,r):(delete t[n],u(t,n,r)))})(Function.prototype,i,function toString(){return"function"==typeof this&&this[a]||e.call(this)})},{147:147,52:52,69:69,70:70,71:71,72:72}],119:[function(t,n,r){"use strict";var i=t(47),o=RegExp.prototype.exec;n.exports=function(t,n){var r=t.exec;if("function"==typeof r){var e=r.call(t,n);if("object"!=typeof e)throw new TypeError("RegExp exec method returned something other than an Object or null");return e}if("RegExp"!==i(t))throw new TypeError("RegExp#exec called on incompatible receiver");return o.call(t,n)}},{47:47}],120:[function(t,n,r){"use strict";var e,i,u=t(66),c=RegExp.prototype.exec,a=String.prototype.replace,o=c,f="lastIndex",s=(e=/a/,i=/b*/g,c.call(e,"a"),c.call(i,"a"),0!==e[f]||0!==i[f]),l=void 0!==/()??/.exec("")[1];(s||l)&&(o=function exec(t){var n,r,e,i,o=this;return l&&(r=new RegExp("^"+o.source+"$(?!\\s)",u.call(o))),s&&(n=o[f]),e=c.call(o,t),s&&e&&(o[f]=o.global?e.index+e[0].length:n),l&&e&&1"+i+""}var e=t(62),i=t(64),u=t(57),c=/"/g;n.exports=function(n,t){var r={};r[n]=t(Aw),e(e.P+e.F*i(function(){var t=""[n]('"');return t!==t.toLowerCase()||3a&&(f=f.slice(0,a)),e?f+i:i+f}},{133:133,141:141,57:57}],133:[function(t,n,r){"use strict";var i=t(139),o=t(57);n.exports=function repeat(t){var n=String(o(this)),r="",e=i(t);if(e<0||e==1/0)throw RangeError("Count can't be negative");for(;0>>=1)&&(n+=n))1&e&&(r+=n);return r}},{139:139,57:57}],134:[function(t,n,r){function tx(t,n,r){var e={},i=c(function(){return!!a[t]()||"​…"!="​…"[t]()}),o=e[t]=i?n(s):a[t];r&&(e[r]=o),u(u.P+u.F*i,"String",e)}var u=t(62),e=t(57),c=t(64),a=t(135),i="["+a+"]",o=RegExp("^"+i+i+"*"),f=RegExp(i+i+"*$"),s=tx.trim=function(t,n){return t=String(e(t)),1&n&&(t=t.replace(o,"")),2&n&&(t=t.replace(f,"")),t};n.exports=tx},{135:135,57:57,62:62,64:64}],135:[function(t,n,r){n.exports="\t\n\v\f\r   ᠎              \u2028\u2029\ufeff"},{}],136:[function(t,n,r){function Zx(){var t=+this;if(d.hasOwnProperty(t)){var n=d[t];delete d[t],n()}}function $x(t){Zx.call(t.data)}var e,i,o,u=t(54),c=t(76),a=t(73),f=t(59),s=t(70),l=s.process,h=s.setImmediate,p=s.clearImmediate,v=s.MessageChannel,g=s.Dispatch,y=0,d={},x="onreadystatechange";h&&p||(h=function setImmediate(t){for(var n=[],r=1;r>1,s=23===n?A(2,-24)-A(2,-77):0,l=0,h=t<0||0===t&&1/t<0?1:0;for((t=P(t))!=t||t===F?(i=t!=t?1:0,e=a):(e=M(k(t)/N),t*(o=A(2,-e))<1&&(e--,o*=2),2<=(t+=1<=e+f?s/o:s*A(2,1-f))*o&&(e++,o/=2),a<=e+f?(i=0,e=a):1<=e+f?(i=(t*o-1)*A(2,n),e+=f):(i=t*A(2,f-1)*A(2,n),e=0));8<=n;u[l++]=255&i,i/=256,n-=8);for(e=e<>1,c=i-7,a=r-1,f=t[a--],s=127&f;for(f>>=7;0>=-c,c+=n;0>8&255]}function packI32(t){return[255&t,t>>8&255,t>>16&255,t>>24&255]}function packF64(t){return packIEEE754(t,52,8)}function packF32(t){return packIEEE754(t,23,4)}function addGetter(t,n,r){g(t[S],n,{get:function(){return this[r]}})}function get(t,n,r,e){var i=p(+r);if(i+n>t[L])throw O(b);var o=t[T]._b,u=i+t[C],c=o.slice(u,u+n);return e?c:c.reverse()}function set(t,n,r,e,i,o){var u=p(+r);if(u+n>t[L])throw O(b);for(var c=t[T]._b,a=u+t[C],f=e(+i),s=0;sW;)(G=U[W++])in w||c(w,G,I[G]);o||(D.constructor=w)}var V=new _(new w(2)),B=_[S].setInt8;V.setInt8(0,2147483648),V.setInt8(1,2147483649),!V.getInt8(0)&&V.getInt8(1)||a(_[S],{setInt8:function setInt8(t,n){B.call(this,t,n<<24>>24)},setUint8:function setUint8(t,n){B.call(this,t,n<<24>>24)}},!0)}else w=function ArrayBuffer(t){s(this,w,x);var n=p(t);this._b=y.call(new Array(n),0),this[L]=n},_=function DataView(t,n,r){s(this,_,m),s(t,w,m);var e=t[L],i=l(n);if(i<0||e>24},getUint8:function getUint8(t){return get(this,1,t)[0]},getInt16:function getInt16(t){var n=get(this,2,t,arguments[1]);return(n[1]<<8|n[0])<<16>>16},getUint16:function getUint16(t){var n=get(this,2,t,arguments[1]);return n[1]<<8|n[0]},getInt32:function getInt32(t){return unpackI32(get(this,4,t,arguments[1]))},getUint32:function getUint32(t){return unpackI32(get(this,4,t,arguments[1]))>>>0},getFloat32:function getFloat32(t){return unpackIEEE754(get(this,4,t,arguments[1]),23,4)},getFloat64:function getFloat64(t){return unpackIEEE754(get(this,8,t,arguments[1]),52,8)},setInt8:function setInt8(t,n){set(this,1,t,packI8,n)},setUint8:function setUint8(t,n){set(this,1,t,packI8,n)},setInt16:function setInt16(t,n){set(this,2,t,packI16,n,arguments[2])},setUint16:function setUint16(t,n){set(this,2,t,packI16,n,arguments[2])},setInt32:function setInt32(t,n){set(this,4,t,packI32,n,arguments[2])},setUint32:function setUint32(t,n){set(this,4,t,packI32,n,arguments[2])},setFloat32:function setFloat32(t,n){set(this,4,t,packF32,n,arguments[2])},setFloat64:function setFloat64(t,n){set(this,8,t,packF64,n,arguments[2])}});d(w,x),d(_,m),c(_[S],u.VIEW,!0),r[x]=w,r[m]=_},{103:103,117:117,124:124,138:138,139:139,141:141,146:146,37:37,40:40,58:58,64:64,70:70,72:72,89:89,99:99}],146:[function(t,n,r){for(var e,i=t(70),o=t(72),u=t(147),c=u("typed_array"),a=u("view"),f=!(!i.ArrayBuffer||!i.DataView),s=f,l=0,h="Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array".split(",");l<9;)(e=i[h[l++]])?(o(e.prototype,c,!0),o(e.prototype,a,!0)):s=!1;n.exports={ABV:f,CONSTR:s,TYPED:c,VIEW:a}},{147:147,70:70,72:72}],147:[function(t,n,r){var e=0,i=Math.random();n.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++e+i).toString(36))}},{}],148:[function(t,n,r){var e=t(70).navigator;n.exports=e&&e.userAgent||""},{70:70}],149:[function(t,n,r){var e=t(81);n.exports=function(t,n){if(!e(t)||t._t!==n)throw TypeError("Incompatible receiver, "+n+" required!");return t}},{81:81}],150:[function(t,n,r){var e=t(70),i=t(52),o=t(89),u=t(151),c=t(99).f;n.exports=function(t){var n=i.Symbol||(i.Symbol=o?{}:e.Symbol||{});"_"==t.charAt(0)||t in n||c(n,t,{value:u.f(t)})}},{151:151,52:52,70:70,89:89,99:99}],151:[function(t,n,r){r.f=t(152)},{152:152}],152:[function(t,n,r){var e=t(126)("wks"),i=t(147),o=t(70).Symbol,u="function"==typeof o;(n.exports=function(t){return e[t]||(e[t]=u&&o[t]||(u?o:i)("Symbol."+t))}).store=e},{126:126,147:147,70:70}],153:[function(t,n,r){var e=t(47),i=t(152)("iterator"),o=t(88);n.exports=t(52).getIteratorMethod=function(t){if(null!=t)return t[i]||t["@@iterator"]||o[e(t)]}},{152:152,47:47,52:52,88:88}],154:[function(t,n,r){var e=t(62);e(e.P,"Array",{copyWithin:t(39)}),t(35)("copyWithin")},{35:35,39:39,62:62}],155:[function(t,n,r){"use strict";var e=t(62),i=t(42)(4);e(e.P+e.F*!t(128)([].every,!0),"Array",{every:function every(t){return i(this,t,arguments[1])}})},{128:128,42:42,62:62}],156:[function(t,n,r){var e=t(62);e(e.P,"Array",{fill:t(40)}),t(35)("fill")},{35:35,40:40,62:62}],157:[function(t,n,r){"use strict";var e=t(62),i=t(42)(2);e(e.P+e.F*!t(128)([].filter,!0),"Array",{filter:function filter(t){return i(this,t,arguments[1])}})},{128:128,42:42,62:62}],158:[function(t,n,r){"use strict";var e=t(62),i=t(42)(6),o="findIndex",u=!0;o in[]&&Array(1)[o](function(){u=!1}),e(e.P+e.F*u,"Array",{findIndex:function findIndex(t){return i(this,t,1=t.length?(this._t=void 0,i(1)):i(0,"keys"==n?r:"values"==n?t[r]:[r,t[r]])},"values"),o.Arguments=o.Array,e("keys"),e("values"),e("entries")},{140:140,35:35,85:85,87:87,88:88}],165:[function(t,n,r){"use strict";var e=t(62),i=t(140),o=[].join;e(e.P+e.F*(t(77)!=Object||!t(128)(o)),"Array",{join:function join(t){return o.call(i(this),void 0===t?",":t)}})},{128:128,140:140,62:62,77:77}],166:[function(t,n,r){"use strict";var e=t(62),i=t(140),o=t(139),u=t(141),c=[].lastIndexOf,a=!!c&&1/[1].lastIndexOf(1,-0)<0;e(e.P+e.F*(a||!t(128)(c)),"Array",{lastIndexOf:function lastIndexOf(t){if(a)return c.apply(this,arguments)||0;var n=i(this),r=u(n.length),e=r-1;for(1>>=0)?31-Math.floor(Math.log(t+.5)*Math.LOG2E):32}})},{62:62}],189:[function(t,n,r){var e=t(62),i=Math.exp;e(e.S,"Math",{cosh:function cosh(t){return(i(t=+t)+i(-t))/2}})},{62:62}],190:[function(t,n,r){var e=t(62),i=t(90);e(e.S+e.F*(i!=Math.expm1),"Math",{expm1:i})},{62:62,90:90}],191:[function(t,n,r){var e=t(62);e(e.S,"Math",{fround:t(91)})},{62:62,91:91}],192:[function(t,n,r){var e=t(62),a=Math.abs;e(e.S,"Math",{hypot:function hypot(t,n){for(var r,e,i=0,o=0,u=arguments.length,c=0;o>>16)*u+o*(r&i>>>16)<<16>>>0)}})},{62:62,64:64}],194:[function(t,n,r){var e=t(62);e(e.S,"Math",{log10:function log10(t){return Math.log(t)*Math.LOG10E}})},{62:62}],195:[function(t,n,r){var e=t(62);e(e.S,"Math",{log1p:t(92)})},{62:62,92:92}],196:[function(t,n,r){var e=t(62);e(e.S,"Math",{log2:function log2(t){return Math.log(t)/Math.LN2}})},{62:62}],197:[function(t,n,r){var e=t(62);e(e.S,"Math",{sign:t(93)})},{62:62,93:93}],198:[function(t,n,r){var e=t(62),i=t(90),o=Math.exp;e(e.S+e.F*t(64)(function(){return-2e-17!=!Math.sinh(-2e-17)}),"Math",{sinh:function sinh(t){return Math.abs(t=+t)<1?(i(t)-i(-t))/2:(o(t-1)-o(-t-1))*(Math.E/2)}})},{62:62,64:64,90:90}],199:[function(t,n,r){var e=t(62),i=t(90),o=Math.exp;e(e.S,"Math",{tanh:function tanh(t){var n=i(t=+t),r=i(-t);return n==1/0?1:r==1/0?-1:(n-r)/(o(t)+o(-t))}})},{62:62,90:90}],200:[function(t,n,r){var e=t(62);e(e.S,"Math",{trunc:function trunc(t){return(0b;b++)i(g,m=S[b])&&!i(v,m)&&l(v,m,f(g,m));(v.prototype=y).constructor=v,t(118)(e,p,v)}},{101:101,103:103,118:118,134:134,143:143,48:48,58:58,64:64,70:70,71:71,75:75,98:98,99:99}],202:[function(t,n,r){var e=t(62);e(e.S,"Number",{EPSILON:Math.pow(2,-52)})},{62:62}],203:[function(t,n,r){var e=t(62),i=t(70).isFinite;e(e.S,"Number",{isFinite:function isFinite(t){return"number"==typeof t&&i(t)}})},{62:62,70:70}],204:[function(t,n,r){var e=t(62);e(e.S,"Number",{isInteger:t(80)})},{62:62,80:80}],205:[function(t,n,r){var e=t(62);e(e.S,"Number",{isNaN:function isNaN(t){return t!=t}})},{62:62}],206:[function(t,n,r){var e=t(62),i=t(80),o=Math.abs;e(e.S,"Number",{isSafeInteger:function isSafeInteger(t){return i(t)&&o(t)<=9007199254740991}})},{62:62,80:80}],207:[function(t,n,r){var e=t(62);e(e.S,"Number",{MAX_SAFE_INTEGER:9007199254740991})},{62:62}],208:[function(t,n,r){var e=t(62);e(e.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991})},{62:62}],209:[function(t,n,r){var e=t(62),i=t(112);e(e.S+e.F*(Number.parseFloat!=i),"Number",{parseFloat:i})},{112:112,62:62}],210:[function(t,n,r){var e=t(62),i=t(113);e(e.S+e.F*(Number.parseInt!=i),"Number",{parseInt:i})},{113:113,62:62}],211:[function(t,n,r){"use strict";function XO(t,n){for(var r=-1,e=n;++r<6;)e+=t*u[r],u[r]=e%1e7,e=o(e/1e7)}function YO(t){for(var n=6,r=0;0<=--n;)r+=u[n],u[n]=o(r/t),r=r%t*1e7}function ZO(){for(var t=6,n="";0<=--t;)if(""!==n||0===t||0!==u[t]){var r=String(u[t]);n=""===n?r:n+l.call("0",7-r.length)+r}return n}var e=t(62),f=t(139),s=t(34),l=t(133),i=1..toFixed,o=Math.floor,u=[0,0,0,0,0,0],h="Number.toFixed: incorrect invocation!",p=function(t,n,r){return 0===n?r:n%2==1?p(t,n-1,r*t):p(t*t,n/2,r)};e(e.P+e.F*(!!i&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==(0xde0b6b3a7640080).toFixed(0))||!t(64)(function(){i.call({})})),"Number",{toFixed:function toFixed(t){var n,r,e,i,o=s(this,h),u=f(t),c="",a="0";if(u<0||20t;)n(e[t++]);s._c=[],s._n=!1,r&&!s._h&&N(s)})}}function kS(t){var n=this;n._d||(n._d=!0,(n=n._w||n)._v=t,n._s=2,n._a||(n._a=n._c.slice()),gS(n,!0))}var e,i,o,u,c=r(89),a=r(70),f=r(54),s=r(47),l=r(62),h=r(81),p=r(33),v=r(37),g=r(68),y=r(127),d=r(136).set,x=r(95)(),m=r(96),S=r(114),b=r(148),w=r(115),_="Promise",E=a.TypeError,O=a.process,F=O&&O.versions,I=F&&F.v8||"",P=a[_],A="process"==s(O),M=i=m.f,k=!!function(){try{var t=P.resolve(1),n=(t.constructor={})[r(152)("species")]=function(t){t($R,$R)};return(A||"function"==typeof PromiseRejectionEvent)&&t.then($R)instanceof n&&0!==I.indexOf("6.6")&&-1===b.indexOf("Chrome/66")}catch(t){}}(),N=function(o){d.call(a,function(){var t,n,r,e=o._v,i=j(o);if(i&&(t=S(function(){A?O.emit("unhandledRejection",e,o):(n=a.onunhandledrejection)?n({promise:o,reason:e}):(r=a.console)&&r.error&&r.error("Unhandled promise rejection",e)}),o._h=A||j(o)?2:1),o._a=void 0,i&&t.e)throw t.v})},j=function(t){return 1!==t._h&&0===(t._a||t._c).length},R=function(n){d.call(a,function(){var t;A?O.emit("rejectionHandled",n):(t=a.onrejectionhandled)&&t({promise:n,reason:n._v})})},T=function(t){var r,e=this;if(!e._d){e._d=!0,e=e._w||e;try{if(e===t)throw E("Promise can't be resolved itself");(r=fS(t))?x(function(){var n={_w:e,_d:!1};try{r.call(t,f(T,n,1),f(kS,n,1))}catch(t){kS.call(n,t)}}):(e._v=t,e._s=1,gS(e,!1))}catch(t){kS.call({_w:e,_d:!1},t)}}};k||(P=function Promise(t){v(this,P,_,"_h"),p(t),e.call(this);try{t(f(T,this,1),f(kS,this,1))}catch(t){kS.call(this,t)}},(e=function Promise(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=r(117)(P.prototype,{then:function then(t,n){var r=M(y(this,P));return r.ok="function"!=typeof t||t,r.fail="function"==typeof n&&n,r.domain=A?O.domain:void 0,this._c.push(r),this._a&&this._a.push(r),this._s&&gS(this,!1),r.promise},catch:function(t){return this.then(void 0,t)}}),o=function(){var t=new e;this.promise=t,this.resolve=f(T,t,1),this.reject=f(kS,t,1)},m.f=M=function(t){return t===P||t===u?new o(t):i(t)}),l(l.G+l.W+l.F*!k,{Promise:P}),r(124)(P,_),r(123)(_),u=r(52)[_],l(l.S+l.F*!k,_,{reject:function reject(t){var n=M(this);return(0,n.reject)(t),n.promise}}),l(l.S+l.F*(c||!k),_,{resolve:function resolve(t){return w(c&&this===u?P:this,t)}}),l(l.S+l.F*!(k&&r(86)(function(t){P.all(t).catch($R)})),_,{all:function all(t){var u=this,n=M(u),c=n.resolve,a=n.reject,r=S(function(){var e=[],i=0,o=1;g(t,!1,function(t){var n=i++,r=!1;e.push(void 0),o++,u.resolve(t).then(function(t){r||(r=!0,e[n]=t,--o||c(e))},a)}),--o||c(e)});return r.e&&a(r.v),n.promise},race:function race(t){var n=this,r=M(n),e=r.reject,i=S(function(){g(t,!1,function(t){n.resolve(t).then(r.resolve,e)})});return i.e&&e(i.v),r.promise}})},{114:114,115:115,117:117,123:123,124:124,127:127,136:136,148:148,152:152,33:33,37:37,47:47,52:52,54:54,62:62,68:68,70:70,81:81,86:86,89:89,95:95,96:96}],233:[function(t,n,r){var e=t(62),o=t(33),u=t(38),c=(t(70).Reflect||{}).apply,a=Function.apply;e(e.S+e.F*!t(64)(function(){c(function(){})}),"Reflect",{apply:function apply(t,n,r){var e=o(t),i=u(r);return c?c(e,n,i):a.call(e,n,i)}})},{33:33,38:38,62:62,64:64,70:70}],234:[function(t,n,r){var e=t(62),c=t(98),a=t(33),f=t(38),s=t(81),i=t(64),l=t(46),h=(t(70).Reflect||{}).construct,p=i(function(){function F(){}return!(h(function(){},[],F)instanceof F)}),v=!i(function(){h(function(){})});e(e.S+e.F*(p||v),"Reflect",{construct:function construct(t,n){a(t),f(n);var r=arguments.length<3?t:a(arguments[2]);if(v&&!p)return h(t,n,r);if(t==r){switch(n.length){case 0:return new t;case 1:return new t(n[0]);case 2:return new t(n[0],n[1]);case 3:return new t(n[0],n[1],n[2]);case 4:return new t(n[0],n[1],n[2],n[3])}var e=[null];return e.push.apply(e,n),new(l.apply(t,e))}var i=r.prototype,o=c(s(i)?i:Object.prototype),u=Function.apply.call(t,o,n);return s(u)?u:o}})},{33:33,38:38,46:46,62:62,64:64,70:70,81:81,98:98}],235:[function(t,n,r){var e=t(99),i=t(62),o=t(38),u=t(143);i(i.S+i.F*t(64)(function(){Reflect.defineProperty(e.f({},1,{value:1}),1,{value:2})}),"Reflect",{defineProperty:function defineProperty(t,n,r){o(t),n=u(n,!0),o(r);try{return e.f(t,n,r),!0}catch(t){return!1}}})},{143:143,38:38,62:62,64:64,99:99}],236:[function(t,n,r){var e=t(62),i=t(101).f,o=t(38);e(e.S,"Reflect",{deleteProperty:function deleteProperty(t,n){var r=i(o(t),n);return!(r&&!r.configurable)&&delete t[n]}})},{101:101,38:38,62:62}],237:[function(t,n,r){"use strict";function IU(t){this._t=i(t),this._i=0;var n,r=this._k=[];for(n in t)r.push(n)}var e=t(62),i=t(38);t(84)(IU,"Object",function(){var t,n=this._k;do{if(this._i>=n.length)return{value:void 0,done:!0}}while(!((t=n[this._i++])in this._t));return{value:t,done:!1}}),e(e.S,"Reflect",{enumerate:function enumerate(t){return new IU(t)}})},{38:38,62:62,84:84}],238:[function(t,n,r){var e=t(101),i=t(62),o=t(38);i(i.S,"Reflect",{getOwnPropertyDescriptor:function getOwnPropertyDescriptor(t,n){return e.f(o(t),n)}})},{101:101,38:38,62:62}],239:[function(t,n,r){var e=t(62),i=t(105),o=t(38);e(e.S,"Reflect",{getPrototypeOf:function getPrototypeOf(t){return i(o(t))}})},{105:105,38:38,62:62}],240:[function(t,n,r){var o=t(101),u=t(105),c=t(71),e=t(62),a=t(81),f=t(38);e(e.S,"Reflect",{get:function get(t,n){var r,e,i=arguments.length<3?t:arguments[2];return f(t)===i?t[n]:(r=o.f(t,n))?c(r,"value")?r.value:void 0!==r.get?r.get.call(i):void 0:a(e=u(t))?get(e,n,i):void 0}})},{101:101,105:105,38:38,62:62,71:71,81:81}],241:[function(t,n,r){var e=t(62);e(e.S,"Reflect",{has:function has(t,n){return n in t}})},{62:62}],242:[function(t,n,r){var e=t(62),i=t(38),o=Object.isExtensible;e(e.S,"Reflect",{isExtensible:function isExtensible(t){return i(t),!o||o(t)}})},{38:38,62:62}],243:[function(t,n,r){var e=t(62);e(e.S,"Reflect",{ownKeys:t(111)})},{111:111,62:62}],244:[function(t,n,r){var e=t(62),i=t(38),o=Object.preventExtensions;e(e.S,"Reflect",{preventExtensions:function preventExtensions(t){i(t);try{return o&&o(t),!0}catch(t){return!1}}})},{38:38,62:62}],245:[function(t,n,r){var e=t(62),i=t(122);i&&e(e.S,"Reflect",{setPrototypeOf:function setPrototypeOf(t,n){i.check(t,n);try{return i.set(t,n),!0}catch(t){return!1}}})},{122:122,62:62}],246:[function(t,n,r){var c=t(99),a=t(101),f=t(105),s=t(71),e=t(62),l=t(116),h=t(38),p=t(81);e(e.S,"Reflect",{set:function set(t,n,r){var e,i,o=arguments.length<4?t:arguments[3],u=a.f(h(t),n);if(!u){if(p(i=f(t)))return set(i,n,r,o);u=l(0)}if(s(u,"value")){if(!1===u.writable||!p(o))return!1;if(e=a.f(o,n)){if(e.get||e.set||!1===e.writable)return!1;e.value=r,c.f(o,n,e)}else c.f(o,n,l(0,r));return!0}return void 0!==u.set&&(u.set.call(o,r),!0)}})},{101:101,105:105,116:116,38:38,62:62,71:71,81:81,99:99}],247:[function(t,n,r){var e=t(70),o=t(75),i=t(99).f,u=t(103).f,c=t(82),a=t(66),f=e.RegExp,s=f,l=f.prototype,h=/a/g,p=/a/g,v=new f(h)!==h;if(t(58)&&(!v||t(64)(function(){return p[t(152)("match")]=!1,f(h)!=h||f(p)==p||"/a/i"!=f(h,"i")}))){f=function RegExp(t,n){var r=this instanceof f,e=c(t),i=void 0===n;return!r&&e&&t.constructor===f&&i?t:o(v?new s(e&&!i?t.source:t,n):s((e=t instanceof f)?t.source:t,e&&i?a.call(t):n),r?this:l,f)};function DW(n){n in f||i(f,n,{configurable:!0,get:function(){return s[n]},set:function(t){s[n]=t}})}for(var g=u(s),y=0;g.length>y;)DW(g[y++]);(l.constructor=f).prototype=l,t(118)(e,"RegExp",f)}t(123)("RegExp")},{103:103,118:118,123:123,152:152,58:58,64:64,66:66,70:70,75:75,82:82,99:99}],248:[function(t,n,r){"use strict";var e=t(120);t(62)({target:"RegExp",proto:!0,forced:e!==/./.exec},{exec:e})},{120:120,62:62}],249:[function(t,n,r){t(58)&&"g"!=/./g.flags&&t(99).f(RegExp.prototype,"flags",{configurable:!0,get:t(66)})},{58:58,66:66,99:99}],250:[function(t,n,r){"use strict";var l=t(38),h=t(141),p=t(36),v=t(119);t(65)("match",1,function(e,i,f,s){return[function match(t){var n=e(this),r=null==t?void 0:t[i];return void 0!==r?r.call(t,n):new RegExp(t)[i](String(n))},function(t){var n=s(f,t,this);if(n.done)return n.value;var r=l(t),e=String(this);if(!r.global)return v(r,e);for(var i,o=r.unicode,u=[],c=r.lastIndex=0;null!==(i=v(r,e));){var a=String(i[0]);""===(u[c]=a)&&(r.lastIndex=p(e,h(r.lastIndex),o)),c++}return 0===c?null:u}]})},{119:119,141:141,36:36,38:38,65:65}],251:[function(t,n,r){"use strict";var _=t(38),e=t(142),E=t(141),O=t(139),F=t(36),I=t(119),P=Math.max,A=Math.min,h=Math.floor,p=/\$([$&`']|\d\d?|<[^>]*>)/g,v=/\$([$&`']|\d\d?)/g;t(65)("replace",2,function(i,o,b,w){return[function replace(t,n){var r=i(this),e=null==t?void 0:t[o];return void 0!==e?e.call(t,r,n):b.call(String(r),t,n)},function(t,n){var r=w(b,t,this,n);if(r.done)return r.value;var e=_(t),i=String(this),o="function"==typeof n;o||(n=String(n));var u=e.global;if(u){var c=e.unicode;e.lastIndex=0}for(var a=[];;){var f=I(e,i);if(null===f)break;if(a.push(f),!u)break;""===String(f[0])&&(e.lastIndex=F(i,E(e.lastIndex),c))}for(var s,l="",h=0,p=0;p>>0,s=new RegExp(t.source,c+"g");(e=h.call(s,r))&&!(a<(i=s[g])&&(u.push(r.slice(a,e.index)),1=f));)s[g]===e.index&&s[g]++;return a===r[v]?!o&&s.test("")||u.push(""):u.push(r.slice(a)),u[v]>f?u.slice(0,f):u}:"0"[u](void 0,0)[v]?function(t,n){return void 0===t&&0===n?[]:y.call(this,t,n)}:y,[function split(t,n){var r=i(this),e=null==t?void 0:t[o];return void 0!==e?e.call(t,r,n):x.call(String(r),t,n)},function(t,n){var r=d(x,t,this,n,x!==y);if(r.done)return r.value;var e=m(t),i=String(this),o=S(e,RegExp),u=e.unicode,c=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(F?"y":"g"),a=new o(F?e:"^(?:"+e.source+")",c),f=void 0===n?O:n>>>0;if(0==f)return[];if(0===i.length)return null===_(a,i)?[i]:[];for(var s=0,l=0,h=[];l>10),n%1024+56320))}return r.join("")}})},{137:137,62:62}],266:[function(t,n,r){"use strict";var e=t(62),i=t(130),o="includes";e(e.P+e.F*t(63)(o),"String",{includes:function includes(t){return!!~i(this,t,o).indexOf(t,1=n.length?{value:void 0,done:!0}:(t=e(n,r),this._i+=t.length,{value:t,done:!1})})},{129:129,85:85}],269:[function(t,n,r){"use strict";t(131)("link",function(n){return function link(t){return n(this,"a","href",t)}})},{131:131}],270:[function(t,n,r){var e=t(62),u=t(140),c=t(141);e(e.S,"String",{raw:function raw(t){for(var n=u(t.raw),r=c(n.length),e=arguments.length,i=[],o=0;oi;)u(W,n=r[i++])||n==C||n==a||e.push(n);return e}function J1(t){for(var n,r=t===B,e=N(r?V:b(t)),i=[],o=0;e.length>o;)!u(W,n=e[o++])||r&&!u(B,n)||i.push(W[n]);return i}var e=t(70),u=t(71),i=t(58),o=t(62),c=t(118),a=t(94).KEY,f=t(64),s=t(126),l=t(124),h=t(147),p=t(152),v=t(151),g=t(150),y=t(61),d=t(79),x=t(38),m=t(81),S=t(142),b=t(140),w=t(143),_=t(116),E=t(98),O=t(102),F=t(101),I=t(104),P=t(99),A=t(107),M=F.f,k=P.f,N=O.f,j=e.Symbol,R=e.JSON,T=R&&R.stringify,L="prototype",C=p("_hidden"),G=p("toPrimitive"),D={}.propertyIsEnumerable,U=s("symbol-registry"),W=s("symbols"),V=s("op-symbols"),B=Object[L],q="function"==typeof j&&!!I.f,Y=e.QObject,z=!Y||!Y[L]||!Y[L].findChild,X=i&&f(function(){return 7!=E(k({},"a",{get:function(){return k(this,"a",{value:7}).a}})).a})?function(t,n,r){var e=M(B,n);e&&delete B[n],k(t,n,r),e&&t!==B&&k(B,n,e)}:k,$=q&&"symbol"==typeof j.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof j},Q=function defineProperty(t,n,r){return t===B&&Q(V,n,r),x(t),n=w(n,!0),x(r),u(W,n)?(r.enumerable?(u(t,C)&&t[C][n]&&(t[C][n]=!1),r=E(r,{enumerable:_(0,!1)})):(u(t,C)||k(t,C,_(1,{})),t[C][n]=!0),X(t,n,r)):k(t,n,r)};q||(c((j=function Symbol(){if(this instanceof j)throw TypeError("Symbol is not a constructor!");var n=h(0J;)p(Z[J++]);for(var H=A(p.store),K=0;H.length>K;)g(H[K++]);o(o.S+o.F*!q,"Symbol",{for:function(t){return u(U,t+="")?U[t]:U[t]=j(t)},keyFor:function keyFor(t){if(!$(t))throw TypeError(t+" is not a symbol!");for(var n in U)if(U[n]===t)return n},useSetter:function(){z=!0},useSimple:function(){z=!1}}),o(o.S+o.F*!q,"Object",{create:function create(t,n){return void 0===n?E(t):E1(E(t),n)},defineProperty:Q,defineProperties:E1,getOwnPropertyDescriptor:H1,getOwnPropertyNames:I1,getOwnPropertySymbols:J1});var tt=f(function(){I.f(1)});o(o.S+o.F*tt,"Object",{getOwnPropertySymbols:function getOwnPropertySymbols(t){return I.f(S(t))}}),R&&o(o.S+o.F*(!q||f(function(){var t=j();return"[null]"!=T([t])||"{}"!=T({a:t})||"{}"!=T(Object(t))})),"JSON",{stringify:function stringify(t){for(var n,r,e=[t],i=1;ic;)void 0!==(r=i(e,n=o[c++]))&&l(u,n,r);return u}})},{101:101,111:111,140:140,53:53,62:62}],296:[function(t,n,r){var e=t(62),i=t(110)(!1);e(e.S,"Object",{values:function values(t){return i(t)}})},{110:110,62:62}],297:[function(t,n,r){"use strict";var e=t(62),i=t(52),o=t(70),u=t(127),c=t(115);e(e.P+e.R,"Promise",{finally:function(n){var r=u(this,i.Promise||o.Promise),t="function"==typeof n;return this.then(t?function(t){return c(r,n()).then(function(){return t})}:n,t?function(t){return c(r,n()).then(function(){throw t})}:n)}})},{115:115,127:127,52:52,62:62,70:70}],298:[function(t,n,r){"use strict";var e=t(62),i=t(132),o=t(148),u=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(o);e(e.P+e.F*u,"String",{padEnd:function padEnd(t){return i(this,t,1 Date: Mon, 17 Feb 2020 15:50:28 +0000 Subject: [PATCH 03/18] Added watch directive --- grunt/config/watch.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grunt/config/watch.js b/grunt/config/watch.js index 74946c01f..09fdee870 100644 --- a/grunt/config/watch.js +++ b/grunt/config/watch.js @@ -26,7 +26,7 @@ module.exports = { }, js: { files: ['<%= sourcedir %>**/*.js'], - tasks: ['javascript:dev'] + tasks: ['javascript:dev', 'babel', 'clean:temp'] }, componentsAssets: { files: ['<%= sourcedir %>components/**/assets/**'], From 061a8aa8ffcf7e706ef7aebe5f81579e5e49e8d9 Mon Sep 17 00:00:00 2001 From: Oliver Foster Date: Mon, 17 Feb 2020 15:56:32 +0000 Subject: [PATCH 04/18] Added backbone version comment --- src/core/libraries/backbone.min.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/libraries/backbone.min.js b/src/core/libraries/backbone.min.js index c8c33e0d7..ca2d2f782 100644 --- a/src/core/libraries/backbone.min.js +++ b/src/core/libraries/backbone.min.js @@ -1,2 +1,3 @@ +//Backbone.js v1.4.0 (function(t){var e=typeof self=="object"&&self.self===self&&self||typeof global=="object"&&global.global===global&&global;if(typeof define==="function"&&define.amd){define(["underscore","jquery","exports"],function(i,n,r){e.Backbone=t(e,r,i,n)})}else if(typeof exports!=="undefined"){var i=require("underscore"),n;try{n=require("jquery")}catch(r){}t(e,exports,i,n)}else{e.Backbone=t(e,{},e._,e.jQuery||e.Zepto||e.ender||e.$)}})(function(t,e,i,n){var r=t.Backbone;var s=Array.prototype.slice;e.VERSION="1.4.0";e.$=n;e.noConflict=function(){t.Backbone=r;return this};e.emulateHTTP=false;e.emulateJSON=false;var a=e.Events={};var o=/\s+/;var h;var u=function(t,e,n,r,s){var a=0,h;if(n&&typeof n==="object"){if(r!==void 0&&"context"in s&&s.context===void 0)s.context=r;for(h=i.keys(n);athis.length)r=this.length;if(r<0)r+=this.length+1;var s=[];var a=[];var o=[];var h=[];var u={};var l=e.add;var c=e.merge;var f=e.remove;var d=false;var v=this.comparator&&r==null&&e.sort!==false;var p=i.isString(this.comparator)?this.comparator:null;var g,m;for(m=0;m7);this._useHashChange=this._wantsHashChange&&this._hasHashChange;this._wantsPushState=!!this.options.pushState;this._hasPushState=!!(this.history&&this.history.pushState);this._usePushState=this._wantsPushState&&this._hasPushState;this.fragment=this.getFragment();this.root=("/"+this.root+"/").replace(L,"/");if(this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var e=this.root.slice(0,-1)||"/";this.location.replace(e+"#"+this.getPath());return true}else if(this._hasPushState&&this.atRoot()){this.navigate(this.getHash(),{replace:true})}}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe");this.iframe.src="javascript:0";this.iframe.style.display="none";this.iframe.tabIndex=-1;var n=document.body;var r=n.insertBefore(this.iframe,n.firstChild).contentWindow;r.document.open();r.document.close();r.location.hash="#"+this.fragment}var s=window.addEventListener||function(t,e){return attachEvent("on"+t,e)};if(this._usePushState){s("popstate",this.checkUrl,false)}else if(this._useHashChange&&!this.iframe){s("hashchange",this.checkUrl,false)}else if(this._wantsHashChange){this._checkUrlInterval=setInterval(this.checkUrl,this.interval)}if(!this.options.silent)return this.loadUrl()},stop:function(){var t=window.removeEventListener||function(t,e){return detachEvent("on"+t,e)};if(this._usePushState){t("popstate",this.checkUrl,false)}else if(this._useHashChange&&!this.iframe){t("hashchange",this.checkUrl,false)}if(this.iframe){document.body.removeChild(this.iframe);this.iframe=null}if(this._checkUrlInterval)clearInterval(this._checkUrlInterval);B.started=false},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(t){var e=this.getFragment();if(e===this.fragment&&this.iframe){e=this.getHash(this.iframe.contentWindow)}if(e===this.fragment)return false;if(this.iframe)this.navigate(e);this.loadUrl()},loadUrl:function(t){if(!this.matchRoot())return false;t=this.fragment=this.getFragment(t);return i.some(this.handlers,function(e){if(e.route.test(t)){e.callback(t);return true}})},navigate:function(t,e){if(!B.started)return false;if(!e||e===true)e={trigger:!!e};t=this.getFragment(t||"");var i=this.root;if(t===""||t.charAt(0)==="?"){i=i.slice(0,-1)||"/"}var n=i+t;t=t.replace(W,"");var r=this.decodeFragment(t);if(this.fragment===r)return;this.fragment=r;if(this._usePushState){this.history[e.replace?"replaceState":"pushState"]({},document.title,n)}else if(this._wantsHashChange){this._updateHash(this.location,t,e.replace);if(this.iframe&&t!==this.getHash(this.iframe.contentWindow)){var s=this.iframe.contentWindow;if(!e.replace){s.document.open();s.document.close()}this._updateHash(s.location,t,e.replace)}}else{return this.location.assign(n)}if(e.trigger)return this.loadUrl(t)},_updateHash:function(t,e,i){if(i){var n=t.href.replace(/(javascript:|#).*$/,"");t.replace(n+"#"+e)}else{t.hash="#"+e}}});e.history=new B;var D=function(t,e){var n=this;var r;if(t&&i.has(t,"constructor")){r=t.constructor}else{r=function(){return n.apply(this,arguments)}}i.extend(r,n,e);r.prototype=i.create(n.prototype,t);r.prototype.constructor=r;r.__super__=n.prototype;return r};m.extend=_.extend=O.extend=T.extend=B.extend=D;var V=function(){throw new Error('A "url" property or function must be specified')};var G=function(t,e){var i=e.error;e.error=function(n){if(i)i.call(e.context,t,n,e);t.trigger("error",t,n,e)}};return e}); //# sourceMappingURL=backbone-min.map \ No newline at end of file From a0dcfbbdd03a142615fc4504481fefbace9edb52 Mon Sep 17 00:00:00 2001 From: Oliver Foster Date: Mon, 17 Feb 2020 17:30:07 +0000 Subject: [PATCH 05/18] Removed unnecessary option --- grunt/config/javascript.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/grunt/config/javascript.js b/grunt/config/javascript.js index f39f80e76..607dbaeff 100644 --- a/grunt/config/javascript.js +++ b/grunt/config/javascript.js @@ -51,10 +51,7 @@ module.exports = function(grunt, options) { return grunt.config('helpers').includedFilter(filepath); }, preserveLicenseComments: false, - optimize: 'none', - uglify2: { - compress: false - } + optimize: 'none' } } } From d61b2417163b837d46fa623b991561065ed937f8 Mon Sep 17 00:00:00 2001 From: Oliver Foster Date: Tue, 18 Feb 2020 10:24:31 +0000 Subject: [PATCH 06/18] Removed /.temp/ folder in favour of <%= outputdir %>/.temp/ --- grunt/helpers.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/grunt/helpers.js b/grunt/helpers.js index e189f9c0e..37b4e0e26 100644 --- a/grunt/helpers.js +++ b/grunt/helpers.js @@ -121,17 +121,12 @@ module.exports = function(grunt) { return configValue || grunt.config('scriptSafeRegExp', generateScriptSafeRegExp()); }; -var getTempFolder = function() { - return require('shortid').generate(); -} - // exported var exports = {}; exports.defaults = { sourcedir: 'src' + path.sep, - tempdir: '.temp/' + getTempFolder() + path.sep, outputdir: 'build' + path.sep, jsonext: 'json', theme: '**', @@ -154,7 +149,6 @@ var getTempFolder = function() { // Convert the directory paths so that they work cross platform exports.defaults.sourcedir = exports.defaults.sourcedir.replace(convertSlashes, "/"); - exports.defaults.tempdir = exports.defaults.tempdir.replace(convertSlashes, "/"); exports.defaults.outputdir = exports.defaults.outputdir.replace(convertSlashes, "/"); exports.getIncludes = function(buildIncludes, configData) { @@ -184,8 +178,8 @@ var getTempFolder = function() { var root = __dirname.split(path.sep).slice(0, -1).join(path.sep); var sourcedir = appendSlash(grunt.option('sourcedir')) || exports.defaults.sourcedir; - var tempdir = appendSlash(grunt.option('tempdir')) || exports.defaults.tempdir; var outputdir = appendSlash(grunt.option('outputdir')) || exports.defaults.outputdir; + var tempdir = outputdir + ".temp/"; var jsonext = grunt.option('jsonext') || exports.defaults.jsonext; var languageFolders = ""; @@ -211,8 +205,8 @@ var getTempFolder = function() { var data = { root: root, sourcedir: sourcedir, - tempdir: tempdir, outputdir: outputdir, + tempdir: tempdir, jsonext: jsonext, theme: grunt.option('theme') || exports.defaults.theme, menu: grunt.option('menu') || exports.defaults.menu, From f8c841094e76d7be4531a70341b2437ded32c252 Mon Sep 17 00:00:00 2001 From: Oliver Foster Date: Tue, 18 Feb 2020 10:26:13 +0000 Subject: [PATCH 07/18] Revert root .temp dir --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index a8c4bbefc..ab2d9cfb3 100644 --- a/.gitignore +++ b/.gitignore @@ -10,5 +10,4 @@ bower_components node_modules .DS_Store .idea -.temp package-lock.json \ No newline at end of file From f6f102da79a4330518b42812f7b598d4f03f26cc Mon Sep 17 00:00:00 2001 From: Oliver Foster Date: Wed, 19 Feb 2020 09:14:52 +0000 Subject: [PATCH 08/18] Removed shortid dependency --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index e7a77d579..3faf479e8 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,6 @@ "load-grunt-config": "^1.0.1", "nsdeclare": "^0.1.0", "requirejs": "^2.3.6", - "shortid": "^2.2.15", "time-grunt": "^2.0.0", "underscore": "^1.9.1", "underscore-deep-extend": "^1.1.5" From 3f6a73763b3898b7c460863754287bb335b2dabf Mon Sep 17 00:00:00 2001 From: Oliver Foster Date: Wed, 19 Feb 2020 10:43:48 +0000 Subject: [PATCH 09/18] Switched to single quotes --- grunt/helpers.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/grunt/helpers.js b/grunt/helpers.js index 37b4e0e26..9b20cf666 100644 --- a/grunt/helpers.js +++ b/grunt/helpers.js @@ -52,18 +52,18 @@ module.exports = function(grunt) { return exports.defaults.sourcedir + type + '\/' + plugin + '\/'; }).join('|'); }).join('|'); - return new RegExp(re, "i"); + return new RegExp(re, 'i'); }; var generateNestedIncludedRegExp = function() { var includes = grunt.config('includes') || []; - var folderRegEx = "less/plugins"; + var folderRegEx = 'less/plugins'; // Return a more specific plugin regExp including src path. var re = _.map(includes, function(plugin) { return exports.defaults.sourcedir + '([^\/]*)\/([^\/]*)\/' + folderRegEx + '\/' + plugin + '\/'; }).join('|'); - return new RegExp(re, "i"); + return new RegExp(re, 'i'); }; var generateExcludedRegExp = function() { @@ -76,7 +76,7 @@ module.exports = function(grunt) { return exports.defaults.sourcedir + type + '\/' + plugin + '\/'; }).join('|'); }).join('|'); - return new RegExp(re, "i"); + return new RegExp(re, 'i'); }; var generateScriptSafeRegExp = function() { @@ -86,7 +86,7 @@ module.exports = function(grunt) { re += '\/' + includes[i].toLowerCase() + '\/'; if (i < includes.length - 1) re += '|'; } - return new RegExp(re, "i"); + return new RegExp(re, 'i'); }; var appendSlash = function(dir) { @@ -97,7 +97,7 @@ module.exports = function(grunt) { }; var includedProcess = function(content, filepath) { - if (!exports.isPathIncluded(filepath)) return ""; + if (!exports.isPathIncluded(filepath)) return ''; else return content; }; @@ -148,8 +148,8 @@ module.exports = function(grunt) { }; // Convert the directory paths so that they work cross platform - exports.defaults.sourcedir = exports.defaults.sourcedir.replace(convertSlashes, "/"); - exports.defaults.outputdir = exports.defaults.outputdir.replace(convertSlashes, "/"); + exports.defaults.sourcedir = exports.defaults.sourcedir.replace(convertSlashes, '/'); + exports.defaults.outputdir = exports.defaults.outputdir.replace(convertSlashes, '/'); exports.getIncludes = function(buildIncludes, configData) { var dependencies = []; @@ -179,12 +179,12 @@ module.exports = function(grunt) { var root = __dirname.split(path.sep).slice(0, -1).join(path.sep); var sourcedir = appendSlash(grunt.option('sourcedir')) || exports.defaults.sourcedir; var outputdir = appendSlash(grunt.option('outputdir')) || exports.defaults.outputdir; - var tempdir = outputdir + ".temp/"; + var tempdir = outputdir + '.temp/'; var jsonext = grunt.option('jsonext') || exports.defaults.jsonext; - var languageFolders = ""; + var languageFolders = ''; if (grunt.option('languages') && grunt.option('languages').split(',').length > 1) { - languageFolders = "{" + grunt.option('languages') + "}"; + languageFolders = '{' + grunt.option('languages') + '}'; } else { languageFolders = grunt.option('languages'); } @@ -218,7 +218,7 @@ module.exports = function(grunt) { if (buildConfig.jsonext) data.jsonext = buildConfig.jsonext; if (buildConfig.includes) data.includes = exports.getIncludes(buildConfig.includes, data); if (buildConfig.excludes) data.excludes = buildConfig.excludes; - if (buildConfig.scriptSafe) data.scriptSafe = buildConfig.scriptSafe.split(",").map(function(item) { + if (buildConfig.scriptSafe) data.scriptSafe = buildConfig.scriptSafe.split(',').map(function(item) { return item.trim() }); } @@ -251,7 +251,7 @@ module.exports = function(grunt) { }; exports.isPathIncluded = function(pluginPath) { - pluginPath = pluginPath.replace(convertSlashes, "/"); + pluginPath = pluginPath.replace(convertSlashes, '/'); var includes = grunt.config('includes'); var excludes = grunt.config('excludes'); @@ -294,10 +294,10 @@ module.exports = function(grunt) { exports.isPluginScriptSafe = function(pluginPath) { - pluginPath = pluginPath.replace(convertSlashes, "/"); + pluginPath = pluginPath.replace(convertSlashes, '/'); var includes = grunt.config('scriptSafe'); var isExplicitlyDefined = (includes && pluginPath.search(getScriptSafeRegExp()) !== -1); - var isIncluded = grunt.option('allowscripts') || includes[0] === "*" || isExplicitlyDefined; + var isIncluded = grunt.option('allowscripts') || includes[0] === '*' || isExplicitlyDefined; if (!isIncluded) { //grunt.log.writeln('Excluded ' + chalk.red(pluginPath)); From fdf21c55818cce6640554579dee6778ba00cc195 Mon Sep 17 00:00:00 2001 From: Oliver Foster Date: Mon, 2 Mar 2020 11:38:29 +0000 Subject: [PATCH 10/18] issue/2647 Converted AdaptModel to ES Class (#2652) --- src/core/js/models/adaptModel.js | 431 +++++++++++++++---------------- src/core/js/models/blockModel.js | 4 +- 2 files changed, 215 insertions(+), 220 deletions(-) diff --git a/src/core/js/models/adaptModel.js b/src/core/js/models/adaptModel.js index 7107c7995..428adbfa2 100644 --- a/src/core/js/models/adaptModel.js +++ b/src/core/js/models/adaptModel.js @@ -4,46 +4,51 @@ define([ 'core/js/logging' ], function (Adapt, ModelEvent) { - var AdaptModel = Backbone.Model.extend({ - - defaults: { - _canShowFeedback: true, - _classes: '', - _canReset: false, - _isComplete: false, - _isInteractionComplete: false, - _isA11yRegionEnabled: false, - _isA11yCompletionDescriptionEnabled: true, - _requireCompletionOf: -1, - _isEnabled: true, - _isResetOnRevisit: false, - _isAvailable: true, - _isOptional: false, - _isReady: false, - _isVisible: true, - _isLocked: false, - _isHidden: false - }, - - trackable: [ - '_id', - '_isComplete', - '_isInteractionComplete' - ], - - bubblingEvents: [ - 'change:_isComplete', - 'change:_isInteractionComplete', - 'change:_isActive' - ], - - initialize: function () { + class AdaptModel extends Backbone.Model { + + defaults() { + return { + _canShowFeedback: true, + _classes: '', + _canReset: false, + _isComplete: false, + _isInteractionComplete: false, + _isA11yRegionEnabled: false, + _isA11yCompletionDescriptionEnabled: true, + _requireCompletionOf: -1, + _isEnabled: true, + _isResetOnRevisit: false, + _isAvailable: true, + _isOptional: false, + _isReady: false, + _isVisible: true, + _isLocked: false, + _isHidden: false + }; + } + + trackable() { + return [ + '_id', + '_isComplete', + '_isInteractionComplete' + ]; + } + + bubblingEvents() { + return [ + 'change:_isComplete', + 'change:_isInteractionComplete', + 'change:_isActive' + ]; + } + + initialize() { // Wait until data is loaded before setting up model this.listenToOnce(Adapt, 'app:dataLoaded', this.setupModel); + } - }, - - setupModel: function() { + setupModel() { if (this.get('_type') === 'page') { this._children = 'articles'; } @@ -56,7 +61,7 @@ define([ this.init(); - _.defer(function() { + _.defer(() => { if (this._children) { this.checkCompletionStatus(); @@ -67,22 +72,22 @@ define([ this.setupTrackables(); - }.bind(this)); + }); - }, + } - setupTrackables: function() { + setupTrackables() { // Limit state trigger calls and make state change callbacks batched-asynchronous - var originalTrackableStateFunction = this.triggerTrackableState; + const originalTrackableStateFunction = this.triggerTrackableState; this.triggerTrackableState = _.compose( - function() { + () => { // Flag that the function is awaiting trigger this.triggerTrackableState.isQueued = true; - }.bind(this), - _.debounce(function() { + }, + _.debounce(() => { // Trigger original function originalTrackableStateFunction.apply(this); @@ -90,11 +95,11 @@ define([ // Unset waiting flag this.triggerTrackableState.isQueued = false; - }.bind(this), 17) + }, 17) ); // Listen to model changes, trigger trackable state change when appropriate - this.listenTo(this, 'change', function(model, value) { + this.listenTo(this, 'change', ({ changed }) => { // Skip if trigger queued or adapt hasn't started yet if (this.triggerTrackableState.isQueued || !Adapt.attributes._isStarted) { @@ -102,10 +107,10 @@ define([ } // Check that property is trackable - var trackablePropertyNames = _.result(this, 'trackable', []); - var changedPropertyNames = _.keys(model.changed); - var isTrackable = _.find(changedPropertyNames, function(item, index) { - return _.contains(trackablePropertyNames, item); + const trackablePropertyNames = _.result(this, 'trackable', []); + const changedPropertyNames = Object.keys(changed); + const isTrackable = changedPropertyNames.find(item => { + return trackablePropertyNames.includes(item); }); if (isTrackable) { @@ -113,10 +118,10 @@ define([ this.triggerTrackableState(); } }); - }, + } - setupChildListeners: function() { - var children = this.getChildren(); + setupChildListeners() { + const children = this.getChildren(); if (!children.length) { return; } @@ -128,44 +133,44 @@ define([ 'change:_isComplete': this.onIsComplete, 'change:_isInteractionComplete': this.checkInteractionCompletionStatus }); - }, + } - init: function() {}, + init() {} - getTrackableState: function() { + getTrackableState() { - var trackable = this.resultExtend('trackable', []); - var json = this.toJSON(); + const trackable = this.resultExtend('trackable', []); + const json = this.toJSON(); - var args = trackable; + const args = trackable; args.unshift(json); - return _.pick.apply(_, args); + return _.pick(...args); - }, + } - setTrackableState: function(state) { + setTrackableState(state) { - var trackable = this.resultExtend('trackable', []); + const trackable = this.resultExtend('trackable', []); - var args = trackable; + const args = trackable; args.unshift(state); - state = _.pick.apply(_, args); + state = _.pick(...args); this.set(state); return this; - }, + } - triggerTrackableState: function() { + triggerTrackableState() { Adapt.trigger('state:change', this, this.getTrackableState()); - }, + } - reset: function(type, force) { + reset(type, force) { if (!this.get('_canReset') && !force) return; type = type || true; @@ -185,61 +190,60 @@ define([ }); break; } - }, + } - checkReadyStatus: function () { + checkReadyStatus() { // Filter children based upon whether they are available // Check if any return _isReady:false // If not - set this model to _isReady: true - var children = this.getAvailableChildModels(); - if (_.find(children, function(child) { return child.get('_isReady') === false; })) { + const children = this.getAvailableChildModels(); + if (children.find(child => child.get('_isReady') === false)) { return; } this.set('_isReady', true); - }, + } - setCompletionStatus: function() { + setCompletionStatus() { if (!this.get('_isVisible')) return; this.set({ _isComplete: true, _isInteractionComplete: true }); - }, + } - checkCompletionStatus: function () { + checkCompletionStatus() { // defer to allow other change:_isComplete handlers to fire before cascading to parent Adapt.checkingCompletion(); _.defer(this.checkCompletionStatusFor.bind(this), '_isComplete'); - }, + } - checkInteractionCompletionStatus: function () { + checkInteractionCompletionStatus() { // defer to allow other change:_isInteractionComplete handlers to fire before cascading to parent Adapt.checkingCompletion(); _.defer(this.checkCompletionStatusFor.bind(this), '_isInteractionComplete'); - }, + } /** * Function for checking whether the supplied completion attribute should be set to true or false. * It iterates over our immediate children, checking the same completion attribute on any mandatory child * to see if enough/all of them them have been completed. If enough/all have, we set our attribute to true; * if not, we set it to false. - * @param {string} [completionAttribute] Either "_isComplete" or "_isInteractionComplete". Defaults to "_isComplete" if not supplied. + * @param {string} [completionAttribute] Either '_isComplete' or '_isInteractionComplete'. Defaults to '_isComplete' if not supplied. */ - checkCompletionStatusFor: function(completionAttribute) { - if (!completionAttribute) completionAttribute = '_isComplete'; - var completed = false; - var children = this.getAvailableChildModels(); - var requireCompletionOf = this.get('_requireCompletionOf'); + checkCompletionStatusFor(completionAttribute = '_isComplete') { + let completed = false; + const children = this.getAvailableChildModels(); + const requireCompletionOf = this.get('_requireCompletionOf'); if (requireCompletionOf === -1) { // a value of -1 indicates that ALL mandatory children must be completed - completed = (_.find(children, function(child) { - return !child.get(completionAttribute) && !child.get('_isOptional'); - }) === undefined); + completed = children.every(child => { + return child.get(completionAttribute) || child.get('_isOptional'); + }); } else { - completed = (_.filter(children, function(child) { + completed = (children.filter(child => { return child.get(completionAttribute) && !child.get('_isOptional'); }).length >= requireCompletionOf); } @@ -247,7 +251,7 @@ define([ this.set(completionAttribute, completed); Adapt.checkedCompletion(); - }, + } /** * Searches the model's ancestors to find the first instance of the specified ancestor type @@ -255,8 +259,8 @@ define([ * If left blank, the immediate ancestor (if there is one) is returned * @return {object} Reference to the model of the first ancestor of the specified type that's found - or `undefined` if none found */ - findAncestor: function (ancestorType) { - var parent = this.getParent(); + findAncestor(ancestorType) { + const parent = this.getParent(); if (!parent) return; if (ancestorType === 'pages') { @@ -268,7 +272,7 @@ define([ } return parent.findAncestor(ancestorType); - }, + } /** * Returns all the descendant models of a specific type @@ -280,18 +284,18 @@ define([ * //find all available, non-optional components * this.findDescendantModels('components', { where: { _isAvailable: true, _isOptional: false }}); */ - findDescendantModels: function(descendants, options) { + findDescendantModels(descendants, options) { - var types = [ + const types = [ descendants.slice(0, -1) ]; if (descendants === 'contentObjects') { types.push('page', 'menu'); } - var allDescendantsModels = this.getAllDescendantModels(); - var returnedDescendants = allDescendantsModels.filter(function(model) { - return _.contains(types, model.get('_type')); + const allDescendantsModels = this.getAllDescendantModels(); + const returnedDescendants = allDescendantsModels.filter(model => { + return types.includes(model.get('_type')); }); if (!options) { @@ -299,9 +303,9 @@ define([ } if (options.where) { - return returnedDescendants.filter(function(descendant) { - for (var property in options.where) { - var value = options.where[property]; + return returnedDescendants.filter(descendant => { + for (let property in options.where) { + const value = options.where[property]; if (descendant.get(property) !== value) { return false; } @@ -309,7 +313,7 @@ define([ return true; }); } - }, + } /** * Fetches the sub structure of a model as a flattened array @@ -327,43 +331,41 @@ define([ * @param {boolean} [isParentFirst] * @return {array} */ - getAllDescendantModels: function(isParentFirst) { + getAllDescendantModels(isParentFirst) { - var descendants = []; + const descendants = []; if (this.get('_type') === 'component') { descendants.push(this); return descendants; } - var children = this.getChildren(); + const children = this.getChildren(); - for (var i = 0, l = children.models.length; i < l; i++) { + children.models.forEach(child => { - var child = children.models[i]; if (child.get('_type') === 'component') { descendants.push(child); - continue; + return; } - var subDescendants = child.getAllDescendantModels(isParentFirst); + const subDescendants = child.getAllDescendantModels(isParentFirst); if (isParentFirst === true) { descendants.push(child); } - descendants = descendants.concat(subDescendants); + descendants.push(...subDescendants); if (isParentFirst !== true) { descendants.push(child); } - - } + }); return descendants; - }, + } /** * Returns a relative model from the Adapt hierarchy @@ -371,8 +373,8 @@ define([ * Such that in the tree: * { a1: { b1: [ c1, c2 ], b2: [ c3, c4 ] }, a2: { b3: [ c5, c6 ] } } * - * c1.findRelativeModel("@block +1") = b2; - * c1.findRelativeModel("@component +4") = c5; + * c1.findRelativeModel('@block +1') = b2; + * c1.findRelativeModel('@component +4') = c5; * * @see Adapt.parseRelativeString for a description of relativeStrings * @param {string} relativeString @@ -382,38 +384,38 @@ define([ * @param {boolean} options.loop * @return {array} */ - findRelativeModel: function(relativeString, options) { + findRelativeModel(relativeString, options) { - var types = [ 'menu', 'page', 'article', 'block', 'component' ]; + const types = [ 'menu', 'page', 'article', 'block', 'component' ]; options = options || {}; - var modelId = this.get('_id'); - var modelType = this.get('_type'); + const modelId = this.get('_id'); + const modelType = this.get('_type'); // return a model relative to the specified one if opinionated - var rootModel = Adapt.course; + let rootModel = Adapt.course; if (options.limitParentId) { rootModel = Adapt.findById(options.limitParentId); } - var relativeDescriptor = Adapt.parseRelativeString(relativeString); + const relativeDescriptor = Adapt.parseRelativeString(relativeString); - var findAncestorType = (_.indexOf(types, modelType) > _.indexOf(types, relativeDescriptor.type)); - var findSiblingType = (modelType === relativeDescriptor.type); + const findAncestorType = (types.indexOf(modelType) > types.indexOf(relativeDescriptor.type)); + const findSiblingType = (modelType === relativeDescriptor.type); - var searchBackwards = (relativeDescriptor.offset < 0); - var moveBy = Math.abs(relativeDescriptor.offset); - var movementCount = 0; + const searchBackwards = (relativeDescriptor.offset < 0); + let moveBy = Math.abs(relativeDescriptor.offset); + let movementCount = 0; - var findDescendantType = (!findSiblingType && !findAncestorType); + const findDescendantType = (!findSiblingType && !findAncestorType); if (findDescendantType) { // move by one less as first found is considered next moveBy--; } - var pageDescendants; + let pageDescendants; if (searchBackwards) { // parents first [p1,a1,b1,c1,c2,a2,b2,c3,c4,p2,a3,b3,c6,c7,a4,b4,c8,c9] pageDescendants = rootModel.getAllDescendantModels(true); @@ -428,11 +430,11 @@ define([ // filter if opinionated if (typeof options.filter === 'function') { - pageDescendants = _.filter(pageDescendants, options.filter); + pageDescendants = pageDescendants.filter(options.filter); } // find current index in array - var modelIndex = _.findIndex(pageDescendants, function(pageDescendant) { + const modelIndex = pageDescendants.findIndex(pageDescendant => { if (pageDescendant.get('_id') === modelId) { return true; } @@ -442,9 +444,9 @@ define([ if (options.loop) { // normalize offset position to allow for overflow looping - var typeCounts = {}; - pageDescendants.forEach(function(model) { - var type = model.get('_type'); + const typeCounts = {}; + pageDescendants.forEach(model => { + const type = model.get('_type'); typeCounts[type] = typeCounts[type] || 0; typeCounts[type]++; }); @@ -455,8 +457,8 @@ define([ } - for (var i = modelIndex, l = pageDescendants.length; i < l; i++) { - var descendant = pageDescendants[i]; + for (let i = modelIndex, l = pageDescendants.length; i < l; i++) { + const descendant = pageDescendants[i]; if (descendant.get('_type') === relativeDescriptor.type) { if (movementCount === moveBy) { return Adapt.findById(descendant.get('_id')); @@ -466,17 +468,17 @@ define([ } return undefined; - }, + } - getChildren: function () { + getChildren() { if (this.get('_children')) return this.get('_children'); - var childrenCollection; + let childrenCollection; if (!this._children) { childrenCollection = new Backbone.Collection(); } else { - var children = Adapt[this._children].where({ _parentId: this.get('_id') }); + const children = Adapt[this._children].where({ _parentId: this.get('_id') }); childrenCollection = new Backbone.Collection(children); } @@ -494,29 +496,29 @@ define([ this.set('_children', childrenCollection); return childrenCollection; - }, + } - getAvailableChildModels: function() { + getAvailableChildModels() { return this.getChildren().where({ _isAvailable: true }); - }, + } - getParent: function () { + getParent() { if (this.get('_parent')) return this.get('_parent'); if (this._parent === 'course') { return Adapt.course; } - var parent = Adapt.findById(this.get('_parentId')); + const parent = Adapt.findById(this.get('_parentId')); this.set('_parent', parent); // returns a parent model return parent; - }, + } - getAncestorModels: function(shouldIncludeChild) { - var parents = []; - var context = this; + getAncestorModels(shouldIncludeChild) { + const parents = []; + let context = this; if (shouldIncludeChild) parents.push(context); @@ -526,20 +528,19 @@ define([ } return parents.length ? parents : null; - }, + } - getSiblings: function (passSiblingsAndIncludeSelf) { - var siblings; + getSiblings(passSiblingsAndIncludeSelf) { + let siblings; if (!passSiblingsAndIncludeSelf) { // returns a collection of siblings excluding self if (this._hasSiblingsAndSelf === false) { return this.get('_siblings'); } - siblings = _.reject(Adapt[this._siblings].where({ - _parentId: this.get('_parentId') - }), function (model) { - return model.get('_id') === this.get('_id'); - }.bind(this)); + siblings = Adapt[this._siblings].filter(model => { + return model.get('_parentId') === this.get('_parentId') && + model.get('_id') !== this.get('_id'); + }); this._hasSiblingsAndSelf = false; @@ -555,38 +556,37 @@ define([ this._hasSiblingsAndSelf = true; } - var siblingsCollection = new Backbone.Collection(siblings); + const siblingsCollection = new Backbone.Collection(siblings); this.set('_siblings', siblingsCollection); return siblingsCollection; - }, - - setOnChildren: function (key, value, options) { + } - var args = arguments; + /** + * @param {string} key + * @param {any} value + * @param {Object} options + */ + setOnChildren(...args) { - this.set.apply(this, args); + this.set(...args); if (!this._children) return; - var children = this.getChildren(); - var models = children.models; - for (var i = 0, len = models.length; i < len; i++) { - var child = models[i]; - child.setOnChildren.apply(child, args); - } + const children = this.getChildren(); + children.models.forEach(child => child.setOnChildren(...args)); - }, + } /** * @deprecated since v3.2.3 - please use `model.set('_isOptional', value)` instead */ - setOptional: function(value) { - Adapt.log.warn("DEPRECATED - Use model.set('_isOptional', value) as setOptional() may be removed in the future"); + setOptional(value) { + Adapt.log.warn(`DEPRECATED - Use model.set('_isOptional', value) as setOptional() may be removed in the future`); this.set({ _isOptional: value }); - }, + } - checkLocking: function() { - var lockType = this.get('_lockType'); + checkLocking() { + const lockType = this.get('_lockType'); if (!lockType) return; @@ -604,82 +604,77 @@ define([ this.setCustomLocking(); break; default: - console.warn('AdaptModel.checkLocking: unknown _lockType "' + - lockType + '" found on ' + this.get('_id')); + console.warn(`AdaptModel.checkLocking: unknown _lockType '${lockType}' found on ${this.get('_id')}`); } - }, + } - setSequentialLocking: function() { - var children = this.getAvailableChildModels(); + setSequentialLocking() { + const children = this.getAvailableChildModels(); - for (var i = 1, j = children.length; i < j; i++) { + for (let i = 1, j = children.length; i < j; i++) { children[i].set('_isLocked', !children[i - 1].get('_isComplete')); } - }, + } - setUnlockFirstLocking: function() { - var children = this.getAvailableChildModels(); - var isFirstChildComplete = children[0].get('_isComplete'); + setUnlockFirstLocking() { + const children = this.getAvailableChildModels(); + const isFirstChildComplete = children[0].get('_isComplete'); - for (var i = 1, j = children.length; i < j; i++) { + for (let i = 1, j = children.length; i < j; i++) { children[i].set('_isLocked', !isFirstChildComplete); } - }, + } - setLockLastLocking: function() { - var children = this.getAvailableChildModels(); - var lastIndex = children.length - 1; + setLockLastLocking() { + const children = this.getAvailableChildModels(); + const lastIndex = children.length - 1; - for (var i = lastIndex - 1; i >= 0; i--) { + for (let i = lastIndex - 1; i >= 0; i--) { if (!children[i].get('_isComplete')) { return children[lastIndex].set('_isLocked', true); } } children[lastIndex].set('_isLocked', false); - }, - - setCustomLocking: function() { - var children = this.getAvailableChildModels(); + } - for (var i = 0, j = children.length; i < j; i++) { - var child = children[i]; + setCustomLocking() { + const children = this.getAvailableChildModels(); + children.forEach(child => { child.set('_isLocked', this.shouldLock(child)); if (child.get('_type') === 'menu') { child.checkLocking(); } + }); + } - } - }, - - shouldLock: function(child) { - var lockedBy = child.get('_lockedBy'); + shouldLock(child) { + const lockedBy = child.get('_lockedBy'); if (!lockedBy) return false; - for (var i = lockedBy.length - 1; i >= 0; i--) { - var id = lockedBy[i]; + for (let i = lockedBy.length - 1; i >= 0; i--) { + const id = lockedBy[i]; try { - var model = Adapt.findById(id); + const model = Adapt.findById(id); if (!model.get('_isAvailable')) continue; if (!model.get('_isComplete')) return true; } catch (e) { - console.warn('AdaptModel.shouldLock: unknown _lockedBy ID "' + id + - '" found on ' + child.get('_id')); + console.warn(`AdaptModel.shouldLock: unknown _lockedBy ID '${id}' found on ${child.get('_id')}`); } } return false; - }, + } - onIsComplete: function() { + onIsComplete() { this.checkCompletionStatus(); this.checkLocking(); - }, + } /** * Internal event handler for all module events. Triggers event bubbling @@ -689,23 +684,23 @@ define([ * @param {Backbone.Model} model Origin backbone model * @param {*} value New property value */ - onAll: function(type, model, value) { - if (!_.contains(this.bubblingEvents, type)) return; - var event = new ModelEvent(type, model, value); + onAll(type, model, value) { + if (!_.result(this, 'bubblingEvents').includes(type)) return; + const event = new ModelEvent(type, model, value); this.bubble(event); - }, + } /** * Internal event handler for bubbling events. * @param {ModelEvent} event */ - bubble: function(event) { + bubble(event) { if (!event.canBubble) return; event.addPath(this); - this.trigger('bubble:' + event.type + ' bubble', event); + this.trigger(`bubble:${event.type} bubble`, event); } - }); + } return AdaptModel; diff --git a/src/core/js/models/blockModel.js b/src/core/js/models/blockModel.js index 0428eedb2..81702f4f8 100644 --- a/src/core/js/models/blockModel.js +++ b/src/core/js/models/blockModel.js @@ -8,9 +8,9 @@ define([ _children: 'components', defaults: function() { - return _.extend({ + return AdaptModel.resultExtend('defaults', { _sortComponents: true - }, AdaptModel.prototype.defaults); + }); } }); From f836ea0b06bce9e63a23a29cf4b2fb25e8bb898d Mon Sep 17 00:00:00 2001 From: Oliver Foster Date: Mon, 2 Mar 2020 16:43:58 +0000 Subject: [PATCH 11/18] Removed sourcemap from backbone --- src/core/libraries/backbone.min.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/core/libraries/backbone.min.js b/src/core/libraries/backbone.min.js index ca2d2f782..96eee2aac 100644 --- a/src/core/libraries/backbone.min.js +++ b/src/core/libraries/backbone.min.js @@ -1,3 +1,2 @@ //Backbone.js v1.4.0 -(function(t){var e=typeof self=="object"&&self.self===self&&self||typeof global=="object"&&global.global===global&&global;if(typeof define==="function"&&define.amd){define(["underscore","jquery","exports"],function(i,n,r){e.Backbone=t(e,r,i,n)})}else if(typeof exports!=="undefined"){var i=require("underscore"),n;try{n=require("jquery")}catch(r){}t(e,exports,i,n)}else{e.Backbone=t(e,{},e._,e.jQuery||e.Zepto||e.ender||e.$)}})(function(t,e,i,n){var r=t.Backbone;var s=Array.prototype.slice;e.VERSION="1.4.0";e.$=n;e.noConflict=function(){t.Backbone=r;return this};e.emulateHTTP=false;e.emulateJSON=false;var a=e.Events={};var o=/\s+/;var h;var u=function(t,e,n,r,s){var a=0,h;if(n&&typeof n==="object"){if(r!==void 0&&"context"in s&&s.context===void 0)s.context=r;for(h=i.keys(n);athis.length)r=this.length;if(r<0)r+=this.length+1;var s=[];var a=[];var o=[];var h=[];var u={};var l=e.add;var c=e.merge;var f=e.remove;var d=false;var v=this.comparator&&r==null&&e.sort!==false;var p=i.isString(this.comparator)?this.comparator:null;var g,m;for(m=0;m7);this._useHashChange=this._wantsHashChange&&this._hasHashChange;this._wantsPushState=!!this.options.pushState;this._hasPushState=!!(this.history&&this.history.pushState);this._usePushState=this._wantsPushState&&this._hasPushState;this.fragment=this.getFragment();this.root=("/"+this.root+"/").replace(L,"/");if(this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var e=this.root.slice(0,-1)||"/";this.location.replace(e+"#"+this.getPath());return true}else if(this._hasPushState&&this.atRoot()){this.navigate(this.getHash(),{replace:true})}}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe");this.iframe.src="javascript:0";this.iframe.style.display="none";this.iframe.tabIndex=-1;var n=document.body;var r=n.insertBefore(this.iframe,n.firstChild).contentWindow;r.document.open();r.document.close();r.location.hash="#"+this.fragment}var s=window.addEventListener||function(t,e){return attachEvent("on"+t,e)};if(this._usePushState){s("popstate",this.checkUrl,false)}else if(this._useHashChange&&!this.iframe){s("hashchange",this.checkUrl,false)}else if(this._wantsHashChange){this._checkUrlInterval=setInterval(this.checkUrl,this.interval)}if(!this.options.silent)return this.loadUrl()},stop:function(){var t=window.removeEventListener||function(t,e){return detachEvent("on"+t,e)};if(this._usePushState){t("popstate",this.checkUrl,false)}else if(this._useHashChange&&!this.iframe){t("hashchange",this.checkUrl,false)}if(this.iframe){document.body.removeChild(this.iframe);this.iframe=null}if(this._checkUrlInterval)clearInterval(this._checkUrlInterval);B.started=false},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(t){var e=this.getFragment();if(e===this.fragment&&this.iframe){e=this.getHash(this.iframe.contentWindow)}if(e===this.fragment)return false;if(this.iframe)this.navigate(e);this.loadUrl()},loadUrl:function(t){if(!this.matchRoot())return false;t=this.fragment=this.getFragment(t);return i.some(this.handlers,function(e){if(e.route.test(t)){e.callback(t);return true}})},navigate:function(t,e){if(!B.started)return false;if(!e||e===true)e={trigger:!!e};t=this.getFragment(t||"");var i=this.root;if(t===""||t.charAt(0)==="?"){i=i.slice(0,-1)||"/"}var n=i+t;t=t.replace(W,"");var r=this.decodeFragment(t);if(this.fragment===r)return;this.fragment=r;if(this._usePushState){this.history[e.replace?"replaceState":"pushState"]({},document.title,n)}else if(this._wantsHashChange){this._updateHash(this.location,t,e.replace);if(this.iframe&&t!==this.getHash(this.iframe.contentWindow)){var s=this.iframe.contentWindow;if(!e.replace){s.document.open();s.document.close()}this._updateHash(s.location,t,e.replace)}}else{return this.location.assign(n)}if(e.trigger)return this.loadUrl(t)},_updateHash:function(t,e,i){if(i){var n=t.href.replace(/(javascript:|#).*$/,"");t.replace(n+"#"+e)}else{t.hash="#"+e}}});e.history=new B;var D=function(t,e){var n=this;var r;if(t&&i.has(t,"constructor")){r=t.constructor}else{r=function(){return n.apply(this,arguments)}}i.extend(r,n,e);r.prototype=i.create(n.prototype,t);r.prototype.constructor=r;r.__super__=n.prototype;return r};m.extend=_.extend=O.extend=T.extend=B.extend=D;var V=function(){throw new Error('A "url" property or function must be specified')};var G=function(t,e){var i=e.error;e.error=function(n){if(i)i.call(e.context,t,n,e);t.trigger("error",t,n,e)}};return e}); -//# sourceMappingURL=backbone-min.map \ No newline at end of file +(function(t){var e=typeof self=="object"&&self.self===self&&self||typeof global=="object"&&global.global===global&&global;if(typeof define==="function"&&define.amd){define(["underscore","jquery","exports"],function(i,n,r){e.Backbone=t(e,r,i,n)})}else if(typeof exports!=="undefined"){var i=require("underscore"),n;try{n=require("jquery")}catch(r){}t(e,exports,i,n)}else{e.Backbone=t(e,{},e._,e.jQuery||e.Zepto||e.ender||e.$)}})(function(t,e,i,n){var r=t.Backbone;var s=Array.prototype.slice;e.VERSION="1.4.0";e.$=n;e.noConflict=function(){t.Backbone=r;return this};e.emulateHTTP=false;e.emulateJSON=false;var a=e.Events={};var o=/\s+/;var h;var u=function(t,e,n,r,s){var a=0,h;if(n&&typeof n==="object"){if(r!==void 0&&"context"in s&&s.context===void 0)s.context=r;for(h=i.keys(n);athis.length)r=this.length;if(r<0)r+=this.length+1;var s=[];var a=[];var o=[];var h=[];var u={};var l=e.add;var c=e.merge;var f=e.remove;var d=false;var v=this.comparator&&r==null&&e.sort!==false;var p=i.isString(this.comparator)?this.comparator:null;var g,m;for(m=0;m7);this._useHashChange=this._wantsHashChange&&this._hasHashChange;this._wantsPushState=!!this.options.pushState;this._hasPushState=!!(this.history&&this.history.pushState);this._usePushState=this._wantsPushState&&this._hasPushState;this.fragment=this.getFragment();this.root=("/"+this.root+"/").replace(L,"/");if(this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var e=this.root.slice(0,-1)||"/";this.location.replace(e+"#"+this.getPath());return true}else if(this._hasPushState&&this.atRoot()){this.navigate(this.getHash(),{replace:true})}}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe");this.iframe.src="javascript:0";this.iframe.style.display="none";this.iframe.tabIndex=-1;var n=document.body;var r=n.insertBefore(this.iframe,n.firstChild).contentWindow;r.document.open();r.document.close();r.location.hash="#"+this.fragment}var s=window.addEventListener||function(t,e){return attachEvent("on"+t,e)};if(this._usePushState){s("popstate",this.checkUrl,false)}else if(this._useHashChange&&!this.iframe){s("hashchange",this.checkUrl,false)}else if(this._wantsHashChange){this._checkUrlInterval=setInterval(this.checkUrl,this.interval)}if(!this.options.silent)return this.loadUrl()},stop:function(){var t=window.removeEventListener||function(t,e){return detachEvent("on"+t,e)};if(this._usePushState){t("popstate",this.checkUrl,false)}else if(this._useHashChange&&!this.iframe){t("hashchange",this.checkUrl,false)}if(this.iframe){document.body.removeChild(this.iframe);this.iframe=null}if(this._checkUrlInterval)clearInterval(this._checkUrlInterval);B.started=false},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(t){var e=this.getFragment();if(e===this.fragment&&this.iframe){e=this.getHash(this.iframe.contentWindow)}if(e===this.fragment)return false;if(this.iframe)this.navigate(e);this.loadUrl()},loadUrl:function(t){if(!this.matchRoot())return false;t=this.fragment=this.getFragment(t);return i.some(this.handlers,function(e){if(e.route.test(t)){e.callback(t);return true}})},navigate:function(t,e){if(!B.started)return false;if(!e||e===true)e={trigger:!!e};t=this.getFragment(t||"");var i=this.root;if(t===""||t.charAt(0)==="?"){i=i.slice(0,-1)||"/"}var n=i+t;t=t.replace(W,"");var r=this.decodeFragment(t);if(this.fragment===r)return;this.fragment=r;if(this._usePushState){this.history[e.replace?"replaceState":"pushState"]({},document.title,n)}else if(this._wantsHashChange){this._updateHash(this.location,t,e.replace);if(this.iframe&&t!==this.getHash(this.iframe.contentWindow)){var s=this.iframe.contentWindow;if(!e.replace){s.document.open();s.document.close()}this._updateHash(s.location,t,e.replace)}}else{return this.location.assign(n)}if(e.trigger)return this.loadUrl(t)},_updateHash:function(t,e,i){if(i){var n=t.href.replace(/(javascript:|#).*$/,"");t.replace(n+"#"+e)}else{t.hash="#"+e}}});e.history=new B;var D=function(t,e){var n=this;var r;if(t&&i.has(t,"constructor")){r=t.constructor}else{r=function(){return n.apply(this,arguments)}}i.extend(r,n,e);r.prototype=i.create(n.prototype,t);r.prototype.constructor=r;r.__super__=n.prototype;return r};m.extend=_.extend=O.extend=T.extend=B.extend=D;var V=function(){throw new Error('A "url" property or function must be specified')};var G=function(t,e){var i=e.error;e.error=function(n){if(i)i.call(e.context,t,n,e);t.trigger("error",t,n,e)}};return e}); \ No newline at end of file From 8b1d902195760705f8dbe7c25ce3c89db89d8785 Mon Sep 17 00:00:00 2001 From: Oliver Foster Date: Thu, 5 Mar 2020 09:51:47 +0000 Subject: [PATCH 12/18] Converted child models of AdaptModel to ES6 Class (#2674) --- src/core/js/data.js | 14 +++++++-- src/core/js/models/adaptModel.js | 6 ---- src/core/js/models/articleModel.js | 20 +++++++++---- src/core/js/models/blockModel.js | 21 ++++++++------ src/core/js/models/componentModel.js | 29 ++++++++++++------- src/core/js/models/contentObjectModel.js | 27 ++++++++++++++---- src/core/js/models/courseModel.js | 36 +++++++++++++++--------- src/core/js/models/menuModel.js | 15 ++++++++++ src/core/js/models/pageModel.js | 15 ++++++++++ 9 files changed, 131 insertions(+), 52 deletions(-) create mode 100644 src/core/js/models/menuModel.js create mode 100644 src/core/js/models/pageModel.js diff --git a/src/core/js/data.js b/src/core/js/data.js index 99e3a66cb..4aa0cd3c8 100644 --- a/src/core/js/data.js +++ b/src/core/js/data.js @@ -4,14 +4,15 @@ define([ 'core/js/models/articleModel', 'core/js/models/blockModel', 'core/js/models/configModel', - 'core/js/models/contentObjectModel', + 'core/js/models/menuModel', + 'core/js/models/pageModel', 'core/js/models/componentModel', 'core/js/models/courseModel', 'core/js/models/questionModel', 'core/js/models/lockingModel', 'core/js/models/buildModel', 'core/js/startController' -], function(Adapt, AdaptCollection, ArticleModel, BlockModel, ConfigModel, ContentObjectModel, ComponentModel, CourseModel, QuestionModel) { +], function(Adapt, AdaptCollection, ArticleModel, BlockModel, ConfigModel, MenuModel, PageModel, ComponentModel, CourseModel, QuestionModel) { var Data = Backbone.Controller.extend({ @@ -73,7 +74,14 @@ define([ Adapt.course = new CourseModel(null, { url: courseFolder + 'course.' + jsonext, reset: true }); Adapt.contentObjects = new AdaptCollection(null, { - model: ContentObjectModel, + model: function(json) { + switch (json._type) { + case 'page': + return new PageModel(json); + case 'menu': + return new MenuModel(json); + } + }, url: courseFolder + 'contentObjects.' + jsonext }); diff --git a/src/core/js/models/adaptModel.js b/src/core/js/models/adaptModel.js index 6e349d860..16fb36f22 100644 --- a/src/core/js/models/adaptModel.js +++ b/src/core/js/models/adaptModel.js @@ -49,12 +49,6 @@ define([ } setupModel() { - if (this.get('_type') === 'page') { - this._children = 'articles'; - } - if (this._siblings === 'contentObjects' && this.get('_parentId') !== Adapt.course.get('_id')) { - this._parent = 'contentObjects'; - } if (this._children) { this.setupChildListeners(); } diff --git a/src/core/js/models/articleModel.js b/src/core/js/models/articleModel.js index 2134a663d..3d514a61e 100644 --- a/src/core/js/models/articleModel.js +++ b/src/core/js/models/articleModel.js @@ -2,11 +2,21 @@ define([ 'core/js/models/adaptModel' ], function (AdaptModel) { - var ArticleModel = AdaptModel.extend({ - _parent: 'contentObjects', - _siblings: 'articles', - _children: 'blocks' - }); + class ArticleModel extends AdaptModel { + + get _parent() { + return 'contentObjects'; + } + + get _siblings() { + return 'articles' + } + + get _children() { + return 'blocks'; + } + + } return ArticleModel; diff --git a/src/core/js/models/blockModel.js b/src/core/js/models/blockModel.js index c093628fe..025bfa2a3 100644 --- a/src/core/js/models/blockModel.js +++ b/src/core/js/models/blockModel.js @@ -2,18 +2,21 @@ define([ 'core/js/models/adaptModel' ], function (AdaptModel) { - var BlockModel = AdaptModel.extend({ - _parent: 'articles', - _siblings: 'blocks', - _children: 'components', + class BlockModel extends AdaptModel { - defaults: function() { - return AdaptModel.resultExtend('defaults', { - _sortComponents: true - }); + get _parent() { + return 'articles'; } - }); + get _siblings() { + return 'blocks' + } + + get _children() { + return 'components'; + } + + } return BlockModel; diff --git a/src/core/js/models/componentModel.js b/src/core/js/models/componentModel.js index df67207b4..25a3ea820 100644 --- a/src/core/js/models/componentModel.js +++ b/src/core/js/models/componentModel.js @@ -2,19 +2,28 @@ define([ 'core/js/models/adaptModel' ], function (AdaptModel) { - var ComponentModel = AdaptModel.extend({ - _parent: 'blocks', - _siblings: 'components', + class ComponentModel extends AdaptModel { - defaults: AdaptModel.resultExtend('defaults', { - _isA11yComponentDescriptionEnabled: true - }), + get _parent() { + return 'blocks'; + } - trackable: AdaptModel.resultExtend('trackable', [ - '_userAnswer' - ]) + get _siblings() { + return 'components' + } - }); + defaults() { + return AdaptModel.resultExtend('defaults', { + _isA11yComponentDescriptionEnabled: true + }); + } + + trackable() { + return AdaptModel.resultExtend('trackable', [ + '_userAnswer' + ]); + } + } return ComponentModel; diff --git a/src/core/js/models/contentObjectModel.js b/src/core/js/models/contentObjectModel.js index 8615b3bd7..2a20ab9e9 100644 --- a/src/core/js/models/contentObjectModel.js +++ b/src/core/js/models/contentObjectModel.js @@ -1,12 +1,27 @@ define([ + 'core/js/adapt', 'core/js/models/adaptModel' -], function (AdaptModel) { +], function (Adapt, AdaptModel) { - var ContentObjectModel = AdaptModel.extend({ - _parent: 'course', - _siblings: 'contentObjects', - _children: 'contentObjects' - }); + class ContentObjectModel extends AdaptModel { + + get _parent() { + const isParentCourse = (this.get('_parentId') === Adapt.course.get('_id')); + if (isParentCourse) { + return 'course'; + } + return 'contentObjects'; + } + + get _siblings() { + return 'contentObjects' + } + + get _children() { + return null; + } + + } return ContentObjectModel; diff --git a/src/core/js/models/courseModel.js b/src/core/js/models/courseModel.js index 586c7fe08..65de446f8 100644 --- a/src/core/js/models/courseModel.js +++ b/src/core/js/models/courseModel.js @@ -1,12 +1,24 @@ define([ 'core/js/adapt', - 'core/js/models/adaptModel' -], function (Adapt, AdaptModel) { + 'core/js/models/contentObjectModel' +], function (Adapt, ContentObjectModel) { - var CourseModel = AdaptModel.extend({ + class CourseModel extends ContentObjectModel { - initialize: function(attrs, options) { - AdaptModel.prototype.initialize.apply(this, arguments); + get _parent() { + return null; + } + + get _siblings() { + return null; + } + + get _children() { + return 'contentObjects'; + } + + initialize(attrs, options) { + super.initialize(arguments); Adapt.trigger('courseModel:dataLoading'); this.url = options.url; @@ -14,20 +26,18 @@ define([ this.on('sync', this.loadedData, this); if (this.url) { this.fetch({ - error: _.bind(function(model, xhr, options) { + error: (model, xhr, options) => { console.error('ERROR: unable to load file ' + this.url); - }, this) + } }); } - }, + } - loadedData: function() { + loadedData() { Adapt.trigger('courseModel:dataLoaded'); - }, - - _children: 'contentObjects' + } - }); + }; return CourseModel; diff --git a/src/core/js/models/menuModel.js b/src/core/js/models/menuModel.js new file mode 100644 index 000000000..0d81319b2 --- /dev/null +++ b/src/core/js/models/menuModel.js @@ -0,0 +1,15 @@ +define([ + 'core/js/models/contentObjectModel' +], function (ContentObjectModel) { + + class MenuModel extends ContentObjectModel { + + get _children() { + return 'contentObjects'; + } + + } + + return MenuModel; + +}); diff --git a/src/core/js/models/pageModel.js b/src/core/js/models/pageModel.js new file mode 100644 index 000000000..d19f7dc7a --- /dev/null +++ b/src/core/js/models/pageModel.js @@ -0,0 +1,15 @@ +define([ + 'core/js/models/contentObjectModel' +], function (ContentObjectModel) { + + class PageModel extends ContentObjectModel { + + get _children() { + return 'articles'; + } + + } + + return PageModel; + +}); From f241841ce3cc3424048d0b46e180510bce70ac19 Mon Sep 17 00:00:00 2001 From: Oliver Foster Date: Thu, 5 Mar 2020 10:02:58 +0000 Subject: [PATCH 13/18] Made CourseModel inherit MenuModel rather than ContentObjectModel --- src/core/js/models/courseModel.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/core/js/models/courseModel.js b/src/core/js/models/courseModel.js index 65de446f8..7ce7930ff 100644 --- a/src/core/js/models/courseModel.js +++ b/src/core/js/models/courseModel.js @@ -1,9 +1,9 @@ define([ 'core/js/adapt', - 'core/js/models/contentObjectModel' -], function (Adapt, ContentObjectModel) { + 'core/js/models/menuModel' +], function (Adapt, MenuModel) { - class CourseModel extends ContentObjectModel { + class CourseModel extends MenuModel { get _parent() { return null; @@ -13,10 +13,6 @@ define([ return null; } - get _children() { - return 'contentObjects'; - } - initialize(attrs, options) { super.initialize(arguments); Adapt.trigger('courseModel:dataLoading'); From 0c70dcfc2e51e14f03dcc988b67b66c97ed072b4 Mon Sep 17 00:00:00 2001 From: Oliver foster Date: Mon, 9 Mar 2020 19:08:16 +0000 Subject: [PATCH 14/18] issue/2678 Added Adpt.log.removed and Adapt.log.deprecated --- src/core/js/a11y/log.js | 32 +++---- src/core/js/logging.js | 125 +++++++++++++++++----------- src/core/schema/config.model.schema | 7 ++ 3 files changed, 100 insertions(+), 64 deletions(-) diff --git a/src/core/js/a11y/log.js b/src/core/js/a11y/log.js index a5aa87e56..b78916c09 100644 --- a/src/core/js/a11y/log.js +++ b/src/core/js/a11y/log.js @@ -6,53 +6,55 @@ define([ * Controller for managing accessibilty logging, specifically used for * controlling the display of removed or deprecated API warnings. */ - var Log = Backbone.Controller.extend({ + class Log extends Backbone.Controller { - _warned: {}, + initialize() { + this._warned = {}; + } - _hasWarned: function(args) { + _hasWarned(args) { var config = Adapt.a11y.config; if (!config._options._warnFirstOnly) { return false; } - var hash = _.map(args, String).join(':'); + var hash = args.map(String).join(':'); if (this._warned[hash]) { return true; } this._warned[hash] = true; return false; - }, + } - _canWarn: function() { + _canWarn() { var config = Adapt.a11y.config; return Boolean(config._options._warn); - }, + } - removed: function() { + removed(...args) { if (!this._canWarn) { return; } - var args = Array.prototype.slice.call(arguments); + args = ['A11Y'].concat(args); if (this._hasWarned(args)) { return; } - Adapt.log.warn.apply(Adapt.log, ['A11Y REMOVED:'].concat(args)); + Adapt.log.removed(...args); return this; - }, + } - deprecated: function() { + deprecated(...args) { if (!this._canWarn) { return; } - var args = Array.prototype.slice.call(arguments); + args = ['A11Y'].concat(args); if (this._hasWarned(args)) { return; } - Adapt.log.warn.apply(Adapt.log, ['A11Y DEPRECATED:'].concat(args)); + Adapt.log.deprecated(...args); return this; } - }); + } return Log; diff --git a/src/core/js/logging.js b/src/core/js/logging.js index 07bba3f42..63afa4f86 100644 --- a/src/core/js/logging.js +++ b/src/core/js/logging.js @@ -3,21 +3,20 @@ define([ 'core/js/enums/logLevelEnum' ], function(Adapt, LOG_LEVEL) { - var Logging = Backbone.Controller.extend({ - - _config: { - _isEnabled: true, - _level: LOG_LEVEL.INFO.asLowerCase, // Default log level - _console: true // Log to console - }, - - initialize: function() { - - Adapt.once('configModel:dataLoaded', this.onLoadConfigData.bind(this)); - - }, + class Logging extends Backbone.Controller { + + initialize() { + this._config = { + _isEnabled: true, + _level: LOG_LEVEL.INFO.asLowerCase, // Default log level + _console: true, // Log to console + _warnFirstOnly: true // Show only first of identical removed and deprecated warnings + }; + this._warned = {}; + this.listenToOnce(Adapt, 'configModel:dataLoaded', this.onLoadConfigData); + } - onLoadConfigData: function() { + onLoadConfigData() { this.loadConfig(); @@ -25,9 +24,9 @@ define([ this.trigger('log:ready'); - }, + } - loadConfig: function() { + loadConfig() { if (Adapt.config.has('_logging')) { this._config = Adapt.config.get('_logging'); @@ -35,50 +34,66 @@ define([ this.checkQueryStringOverride(); - }, + } - checkQueryStringOverride: function() { + checkQueryStringOverride() { // Override default log level with level present in query string - var matches = window.location.search.match(/[?&]loglevel=([a-z]*)/i); + const matches = window.location.search.match(/[?&]loglevel=([a-z]*)/i); if (!matches || matches.length < 2) return; - var override = LOG_LEVEL(matches[1].toUpperCase()); + const override = LOG_LEVEL(matches[1].toUpperCase()); if (!override) return; this._config._level = override.asLowerCase; this.debug('Loglevel override in query string:', this._config._level); - }, + } + + debug(...args) { + this._log(LOG_LEVEL.DEBUG, args); + } + + info(...args) { + this._log(LOG_LEVEL.INFO, args); + } - debug: function() { - this._log(LOG_LEVEL.DEBUG, Array.prototype.slice.call(arguments)); - }, + warn(...args) { + this._log(LOG_LEVEL.WARN, args); + } - info: function() { - this._log(LOG_LEVEL.INFO, Array.prototype.slice.call(arguments)); - }, + error(...args) { + this._log(LOG_LEVEL.ERROR, args); + } - warn: function() { - this._log(LOG_LEVEL.WARN, Array.prototype.slice.call(arguments)); - }, + fatal(...args) { + this._log(LOG_LEVEL.FATAL, args); + } - error: function() { - this._log(LOG_LEVEL.ERROR, Array.prototype.slice.call(arguments)); - }, + removed(...args) { + args = ['REMOVED'].concat(args); + if (this._hasWarned(args)) { + return; + } + this._log(LOG_LEVEL.WARN, args); + } - fatal: function() { - this._log(LOG_LEVEL.FATAL, Array.prototype.slice.call(arguments)); - }, + deprecated(...args) { + args = ['DEPRECATED'].concat(args); + if (this._hasWarned(args)) { + return; + } + this._log(LOG_LEVEL.WARN, args); + } - _log: function(level, data) { + _log(level, data) { - var isEnabled = (this._config._isEnabled); + const isEnabled = (this._config._isEnabled); if (!isEnabled) return; - var configLevel = LOG_LEVEL(this._config._level.toUpperCase()); + const configLevel = LOG_LEVEL(this._config._level.toUpperCase()); - var isLogLevelAllowed = (level >= configLevel); + const isLogLevelAllowed = (level >= configLevel); if (!isLogLevelAllowed) return; this._logToConsole(level, data); @@ -87,26 +102,38 @@ define([ this.trigger('log', level, data); this.trigger('log:' + level.asLowerCase, level, data); - }, + } - _logToConsole: function(level, data) { + _logToConsole(level, data) { - var shouldLogToConsole = (this._config._console); + const shouldLogToConsole = (this._config._console); if (!shouldLogToConsole) return; - var log = [level.asUpperCase + ':']; - data && log.push.apply(log, data); + const log = [level.asUpperCase + ':']; + data && log.push(...data); // is there a matching console method we can use e.g. console.error()? if (console[level.asLowerCase]) { - console[level.asLowerCase].apply(console, log); + console[level.asLowerCase](...log); } else { - console.log.apply(console, log); + console.log(...log); + } + } + + _hasWarned(args) { + if (!this._config._warnFirstOnly) { + return false; + } + const hash = args.map(String).join(':'); + if (this._warned[hash]) { + return true; } + this._warned[hash] = true; + return false; } - }); + } - Adapt.log = new Logging(); + return (Adapt.log = new Logging()); }); diff --git a/src/core/schema/config.model.schema b/src/core/schema/config.model.schema index 200ff1d57..c3dde6d06 100644 --- a/src/core/schema/config.model.schema +++ b/src/core/schema/config.model.schema @@ -378,6 +378,13 @@ "inputType": "Checkbox", "validators": [], "title": "Log to browser console?" + }, + "_warnFirstOnly": { + "type": "boolean", + "default": true, + "inputType": "Checkbox", + "validators": [], + "title": "Show only first deprecated and removed warnings?" } } }, From 94c4afeded9a73740ae91741af543ebeb1638637 Mon Sep 17 00:00:00 2001 From: Oliver foster Date: Mon, 9 Mar 2020 20:10:32 +0000 Subject: [PATCH 15/18] Added config.json _warnFirstOnly: true --- src/course/config.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/course/config.json b/src/course/config.json index 4918edc2e..8006a02bd 100644 --- a/src/course/config.json +++ b/src/course/config.json @@ -5,7 +5,8 @@ "_logging": { "_isEnabled": true, "_level": "debug", - "_console": true + "_console": true, + "_warnFirstOnly": true }, "_accessibility": { "_isEnabled": true, From 76a6ea296c6549eec9b6ef52d1f66e28f525209f Mon Sep 17 00:00:00 2001 From: Oliver Foster Date: Tue, 10 Mar 2020 09:59:08 +0000 Subject: [PATCH 16/18] Linting fixes --- src/core/js/models/articleModel.js | 2 +- src/core/js/models/blockModel.js | 2 +- src/core/js/models/componentModel.js | 2 +- src/core/js/models/contentObjectModel.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/js/models/articleModel.js b/src/core/js/models/articleModel.js index 3d514a61e..9a657a3ae 100644 --- a/src/core/js/models/articleModel.js +++ b/src/core/js/models/articleModel.js @@ -9,7 +9,7 @@ define([ } get _siblings() { - return 'articles' + return 'articles'; } get _children() { diff --git a/src/core/js/models/blockModel.js b/src/core/js/models/blockModel.js index 025bfa2a3..5006f6589 100644 --- a/src/core/js/models/blockModel.js +++ b/src/core/js/models/blockModel.js @@ -9,7 +9,7 @@ define([ } get _siblings() { - return 'blocks' + return 'blocks'; } get _children() { diff --git a/src/core/js/models/componentModel.js b/src/core/js/models/componentModel.js index 25a3ea820..a581bbb56 100644 --- a/src/core/js/models/componentModel.js +++ b/src/core/js/models/componentModel.js @@ -9,7 +9,7 @@ define([ } get _siblings() { - return 'components' + return 'components'; } defaults() { diff --git a/src/core/js/models/contentObjectModel.js b/src/core/js/models/contentObjectModel.js index 2a20ab9e9..81f9a0125 100644 --- a/src/core/js/models/contentObjectModel.js +++ b/src/core/js/models/contentObjectModel.js @@ -14,7 +14,7 @@ define([ } get _siblings() { - return 'contentObjects' + return 'contentObjects'; } get _children() { From cee5d7a28bbba6fc02c21dccca7673d1762c3570 Mon Sep 17 00:00:00 2001 From: Oliver Foster Date: Tue, 10 Mar 2020 10:03:01 +0000 Subject: [PATCH 17/18] Linting fixes --- src/core/js/a11y/log.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/js/a11y/log.js b/src/core/js/a11y/log.js index b78916c09..e94d27d57 100644 --- a/src/core/js/a11y/log.js +++ b/src/core/js/a11y/log.js @@ -34,7 +34,7 @@ define([ if (!this._canWarn) { return; } - args = ['A11Y'].concat(args); + args = ['A11Y'].concat(args); if (this._hasWarned(args)) { return; } @@ -46,7 +46,7 @@ define([ if (!this._canWarn) { return; } - args = ['A11Y'].concat(args); + args = ['A11Y'].concat(args); if (this._hasWarned(args)) { return; } From d79024ba3fc80d23c141cd0f21bfd9f7c7abd949 Mon Sep 17 00:00:00 2001 From: Oliver Foster Date: Wed, 11 Mar 2020 09:24:30 +0000 Subject: [PATCH 18/18] issue/2677 Exposed router controller at Adapt.router, converted to ES6 (#2684) --- src/core/js/router.js | 245 ++++++++++++++++++++++-------------------- 1 file changed, 131 insertions(+), 114 deletions(-) diff --git a/src/core/js/router.js b/src/core/js/router.js index e841f554c..9e0c1e2fc 100644 --- a/src/core/js/router.js +++ b/src/core/js/router.js @@ -5,21 +5,22 @@ define([ 'core/js/startController' ], function(Adapt, RouterModel, PageView) { - Adapt.router = new RouterModel(null, { reset: true }); + class Router extends Backbone.Router { - var Router = Backbone.Router.extend({ + initialize({ model }) { - // Flag to indicate if the router has tried to redirect to the current location. - _isCircularNavigationInProgress: false, + this.model = model; + + // Flag to indicate if the router has tried to redirect to the current location. + this._isCircularNavigationInProgress = false; - initialize: function() { this.showLoading(); // Store #wrapper element and html to cache for later use. this.$wrapper = $('#wrapper'); this.$html = $('html'); - Adapt.once('app:dataReady', function() { + this.listenToOnce(Adapt, 'app:dataReady', () => { document.title = Adapt.course.get('title'); }); @@ -30,29 +31,29 @@ define([ 'navigation:parentButton': this.navigateToParent, 'router:navigateTo': this.navigateToArguments }); - }, - - routes: { - '': 'handleRoute', - 'id/:id': 'handleRoute', - ':pluginName(/*location)(/*action)': 'handleRoute' - }, + } - pruneArguments: function(args) { - var prunedArgs = _.toArray(args); + routes() { + return { + '': 'handleRoute', + 'id/:id': 'handleRoute', + ':pluginName(/*location)(/*action)': 'handleRoute' + }; + } - if (prunedArgs.length !== 0) { + pruneArguments(args) { + if (args.length !== 0) { // Remove any null arguments. - prunedArgs = _.without(args, null); + args = args.filter(v => v !== null); } - return prunedArgs; - }, + return args; + } - handleRoute: function() { - var args = this.pruneArguments(arguments); + handleRoute(...args) { + args = this.pruneArguments(args); - if (Adapt.router.get('_canNavigate')) { + if (this.model.get('_canNavigate')) { // Reset _isCircularNavigationInProgress protection as code is allowed to navigate away. this._isCircularNavigationInProgress = false; } @@ -65,17 +66,17 @@ define([ } // Re-check as _canNavigate can be set to false on 'router:navigate' event. - if (Adapt.router.get('_canNavigate')) { + if (this.model.get('_canNavigate')) { // Disable navigation whilst rendering. - Adapt.router.set('_canNavigate', false, { pluginName: 'adapt' }); + this.model.set('_canNavigate', false, { pluginName: 'adapt' }); switch (args.length) { case 1: // If only one parameter assume it's the ID. - return this.handleId.apply(this, args); + return this.handleId(...args); case 2: // If there are two parameters assume it's a plugin. - return this.handlePluginRouter.apply(this, args); + return this.handlePluginRouter(...args); default: // Route to course home page. return this.handleCourse(); @@ -96,9 +97,9 @@ define([ // Reset URL to the current one. this.navigateToCurrentRoute(true); - }, + } - handlePluginRouter: function(pluginName, location, action) { + handlePluginRouter(pluginName, location, action) { var pluginLocation = pluginName; if (location) { @@ -109,15 +110,15 @@ define([ } } - this.updateLocation(pluginLocation, null, null, function() { + this.updateLocation(pluginLocation, null, null, () => { Adapt.trigger('router:plugin:' + pluginName, pluginName, location, action); Adapt.trigger('router:plugin', pluginName, location, action); - Adapt.router.set('_canNavigate', true, { pluginName: 'adapt' }); + this.model.set('_canNavigate', true, { pluginName: 'adapt' }); }); - }, + } - handleCourse: function() { + handleCourse() { if (Adapt.course.has('_start')) { // Do not allow access to the menu when the start controller is enabled. var startController = Adapt.course.get('_start'); @@ -129,29 +130,29 @@ define([ this.showLoading(); - this.removeViews(_.bind(function() { + this.removeViews(() => { Adapt.course.set('_isReady', false); this.setContentObjectToVisited(Adapt.course); - this.updateLocation('course', null, null, _.bind(function() { - Adapt.once('menuView:ready', function() { + this.updateLocation('course', null, null, () => { + this.listenToOnce(Adapt, 'menuView:ready', () => { // Allow navigation. - Adapt.router.set('_canNavigate', true, { pluginName: 'adapt' }); + this.model.set('_canNavigate', true, { pluginName: 'adapt' }); this.handleNavigationFocus(); - }.bind(this)); + }); Adapt.trigger('router:menu', Adapt.course); - }, this)); - }, this)); - }, + }); + }); + } - handleId: function(id) { + handleId(id) { var currentModel = Adapt.findById(id); var type = ''; if (!currentModel) { - Adapt.router.set('_canNavigate', true, { pluginName: 'adapt' }); + this.model.set('_canNavigate', true, { pluginName: 'adapt' }); return; } @@ -162,7 +163,7 @@ define([ case 'menu': if (currentModel.get('_isLocked') && Adapt.config.get('_forceRouteLocking')) { Adapt.log.warn('Unable to navigate to locked id: ' + id); - Adapt.router.set('_canNavigate', true, { pluginName: 'adapt' }); + this.model.set('_canNavigate', true, { pluginName: 'adapt' }); if (Adapt.location._previousId === undefined) { return this.navigate('#/', { trigger: true, replace: true }); } else { @@ -170,53 +171,53 @@ define([ } } else { this.showLoading(); - this.removeViews(_.bind(function() { + this.removeViews(() => { var location; this.setContentObjectToVisited(currentModel); if (type === 'page') { location = 'page-' + id; - this.updateLocation(location, 'page', id, _.bind(function() { - Adapt.once('pageView:ready', function() { + this.updateLocation(location, 'page', id, () => { + this.listenToOnce(Adapt, 'pageView:ready', () => { // Allow navigation. - Adapt.router.set('_canNavigate', true, { pluginName: 'adapt' }); + this.model.set('_canNavigate', true, { pluginName: 'adapt' }); this.handleNavigationFocus(); - }.bind(this)); + }); Adapt.trigger('router:page', currentModel); this.$wrapper.append(new PageView({ model: currentModel }).$el); - }, this)); + }); } else { location = 'menu-' + id; - this.updateLocation(location, 'menu', id, _.bind(function() { - Adapt.once('menuView:ready', function() { + this.updateLocation(location, 'menu', id, () => { + this.listenToOnce(Adapt, 'menuView:ready', () => { // Allow navigation. - Adapt.router.set('_canNavigate', true, { pluginName: 'adapt' }); + this.model.set('_canNavigate', true, { pluginName: 'adapt' }); this.handleNavigationFocus(); - }.bind(this)); + }); Adapt.trigger('router:menu', currentModel); - }, this)); + }); } - }, this)); + }); } break; default: // Allow navigation. - Adapt.router.set('_canNavigate', true, { pluginName: 'adapt' }); + this.model.set('_canNavigate', true, { pluginName: 'adapt' }); Adapt.navigateToElement('.' + id, { replace: true }); } - }, + } - removeViews: function(onComplete) { + removeViews(onComplete) { Adapt.remove(); Adapt.wait.queue(onComplete); - }, + } - showLoading: function() { + showLoading() { $('.js-loading').show(); - }, + } - navigateToArguments: function(args) { + navigateToArguments(args) { args = this.pruneArguments(args); var options = { trigger: false, replace: false }; @@ -237,66 +238,69 @@ define([ this.navigate('#/' + args.join('/'), options); break; default: - Adapt.log.warn('DEPRECATED - use Backbone.history.navigate or ' + - 'window.location.href instead of Adapt.trigger("router:navigateTo")'); - this.handleRoute.apply(this, args); + Adapt.log.deprecated(`Use Backbone.history.navigate or window.location.href instead of Adapt.trigger('router:navigateTo')`); + this.handleRoute(...args); } - }, + } - skipNavigation: function() { + skipNavigation() { Adapt.a11y.focusFirst('.' + Adapt.location._contentType); - }, + } - navigateToPreviousRoute: function(force) { + navigateToPreviousRoute(force) { // Sometimes a plugin might want to stop the default navigation. // Check whether default navigation has changed. - if (Adapt.router.get('_canNavigate') || force) { - if (!Adapt.location._currentId) { - return Backbone.history.history.back(); - } - if (Adapt.location._previousContentType === 'page' && Adapt.location._contentType === 'menu') { - return this.navigateToParent(); - } - if (Adapt.location._previousContentType === 'page') { - return Backbone.history.history.back(); - } - if (Adapt.location._currentLocation === 'course') { - return; - } - this.navigateToParent(); + if (!this.model.get('_canNavigate') && !force) { + return; + } + if (!Adapt.location._currentId) { + return Backbone.history.history.back(); + } + if (Adapt.location._previousContentType === 'page' && Adapt.location._contentType === 'menu') { + return this.navigateToParent(); } - }, + if (Adapt.location._previousContentType === 'page') { + return Backbone.history.history.back(); + } + if (Adapt.location._currentLocation === 'course') { + return; + } + this.navigateToParent(); + } - navigateToHomeRoute: function(force) { - if (Adapt.router.get('_canNavigate') || force) { - this.navigate('#/', { trigger: true }); + navigateToHomeRoute(force) { + if (!this.model.get('_canNavigate') && !force) { + return; } - }, + this.navigate('#/', { trigger: true }); + } - navigateToCurrentRoute: function(force) { - if (Adapt.router.get('_canNavigate') || force) { - if (!Adapt.location._currentId) { - return; - } - var currentId = Adapt.location._currentId; - var route = (currentId === Adapt.course.get('_id')) ? '#/' : '#/id/' + currentId; - this.navigate(route, { trigger: true, replace: true }); + navigateToCurrentRoute(force) { + if (!this.model.get('_canNavigate') && !force) { + return; + } + if (!Adapt.location._currentId) { + return; } - }, + var currentId = Adapt.location._currentId; + var route = (currentId === Adapt.course.get('_id')) ? '#/' : '#/id/' + currentId; + this.navigate(route, { trigger: true, replace: true }); + } - navigateToParent: function(force) { - if (Adapt.router.get('_canNavigate') || force) { - var parentId = Adapt.contentObjects.findWhere({ _id: Adapt.location._currentId }).get('_parentId'); - var route = (parentId === Adapt.course.get('_id')) ? '#/' : '#/id/' + parentId; - this.navigate(route, { trigger: true }); + navigateToParent(force) { + if (!this.model.get('_canNavigate') && !force) { + return; } - }, + var parentId = Adapt.contentObjects.findWhere({ _id: Adapt.location._currentId }).get('_parentId'); + var route = (parentId === Adapt.course.get('_id')) ? '#/' : '#/id/' + parentId; + this.navigate(route, { trigger: true }); + } - setContentObjectToVisited: function(model) { + setContentObjectToVisited(model) { model.set('_isVisited', true); - }, + } - updateLocation: function(currentLocation, type, id, onComplete) { + updateLocation(currentLocation, type, id, onComplete) { // Handles updating the location. Adapt.location._previousId = Adapt.location._currentId; Adapt.location._previousContentType = Adapt.location._contentType; @@ -355,9 +359,9 @@ define([ Adapt.trigger('router:location', Adapt.location); Adapt.wait.queue(onComplete); - }, + } - setDocumentTitle: function() { + setDocumentTitle() { if (!Adapt.location._currentId) return; var currentModel = Adapt.findById(Adapt.location._currentId); @@ -374,19 +378,32 @@ define([ var courseTitle = Adapt.course.get('title'); var documentTitle = $('
' + courseTitle + pageTitle + '
').text(); - Adapt.once('pageView:ready menuView:ready', function() { + this.listenToOnce(Adapt, 'pageView:ready menuView:ready', () => { document.title = documentTitle; }); - }, + } - handleNavigationFocus: function() { - if (!Adapt.router.get('_shouldNavigateFocus')) return; + handleNavigationFocus() { + if (!this.model.get('_shouldNavigateFocus')) return; // Body will be forced to accept focus to start the // screen reader reading the page. Adapt.a11y.focus('body'); } - }); - return new Router({ model: new Backbone.Model() }); + get(...args) { + Adapt.log.deprecated('Adapt.router.get, please use Adapt.router.model.get'); + return this.model.get(...args); + } + + set(...args) { + Adapt.log.deprecated('Adapt.router.set, please use Adapt.router.model.set'); + return this.model.set(...args); + } + + } + + return (Adapt.router = new Router({ + model: new RouterModel(null, { reset: true }) + })); });