(function(factory) { // Support three module loading scenarios if (typeof define === 'function' && define['amd']) { // [1] AMD anonymous module define(['exports', 'require'], factory); } else if (typeof exports === 'object' && typeof module === 'object') { // [2] CommonJS/Node.js factory(module['exports'] || exports); // module.exports is for Node.js } else { // [3] No module loader (plain