Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
/**
2
The YUI module contains the components required for building the YUI seed file.
3
This includes the script loading mechanism, a simple queue, and the core
4
utilities for the library.
5
 
6
@module yui
7
@main yui
8
@submodule yui-base
9
**/
10
 
11
/*jshint eqeqeq: false*/
12
if (typeof YUI != 'undefined') {
13
    YUI._YUI = YUI;
14
}
15
 
16
/**
17
The YUI global namespace object. This is the constructor for all YUI instances.
18
 
19
This is a self-instantiable factory function, meaning you don't need to precede
20
it with the `new` operator. You can invoke it directly like this:
21
 
22
    YUI().use('*', function (Y) {
23
        // Y is a new YUI instance.
24
    });
25
 
26
But it also works like this:
27
 
28
    var Y = YUI();
29
 
30
The `YUI` constructor accepts an optional config object, like this:
31
 
32
    YUI({
33
        debug: true,
34
        combine: false
35
    }).use('node', function (Y) {
36
        // Y.Node is ready to use.
37
    });
38
 
39
See the API docs for the <a href="config.html">Config</a> class for the complete
40
list of supported configuration properties accepted by the YUI constuctor.
41
 
42
If a global `YUI` object is already defined, the existing YUI object will not be
43
overwritten, to ensure that defined namespaces are preserved.
44
 
45
Each YUI instance has full custom event support, but only if the event system is
46
available.
47
 
48
@class YUI
49
@uses EventTarget
50
@constructor
51
@global
52
@param {Object} [config]* Zero or more optional configuration objects. Config
53
    values are stored in the `Y.config` property. See the
54
    <a href="config.html">Config</a> docs for the list of supported properties.
55
**/
56
 
57
    /*global YUI*/
58
    /*global YUI_config*/
59
    var YUI = function() {
60
        var i = 0,
61
            Y = this,
62
            args = arguments,
63
            l = args.length,
64
            instanceOf = function(o, type) {
65
                return (o && o.hasOwnProperty && (o instanceof type));
66
            },
67
            gconf = (typeof YUI_config !== 'undefined') && YUI_config;
68
 
69
        if (!(instanceOf(Y, YUI))) {
70
            Y = new YUI();
71
        } else {
72
            // set up the core environment
73
            Y._init();
74
 
75
            /**
76
            Master configuration that might span multiple contexts in a non-
77
            browser environment. It is applied first to all instances in all
78
            contexts.
79
 
80
            @example
81
 
82
                YUI.GlobalConfig = {
83
                    filter: 'debug'
84
                };
85
 
86
                YUI().use('node', function (Y) {
87
                    // debug files used here
88
                });
89
 
90
                YUI({
91
                    filter: 'min'
92
                }).use('node', function (Y) {
93
                    // min files used here
94
                });
95
 
96
            @property {Object} GlobalConfig
97
            @global
98
            @static
99
            **/
100
            if (YUI.GlobalConfig) {
101
                Y.applyConfig(YUI.GlobalConfig);
102
            }
103
 
104
            /**
105
            Page-level config applied to all YUI instances created on the
106
            current page. This is applied after `YUI.GlobalConfig` and before
107
            any instance-level configuration.
108
 
109
            @example
110
 
111
                // Single global var to include before YUI seed file
112
                YUI_config = {
113
                    filter: 'debug'
114
                };
115
 
116
                YUI().use('node', function (Y) {
117
                    // debug files used here
118
                });
119
 
120
                YUI({
121
                    filter: 'min'
122
                }).use('node', function (Y) {
123
                    // min files used here
124
                });
125
 
126
            @property {Object} YUI_config
127
            @global
128
            **/
129
            if (gconf) {
130
                Y.applyConfig(gconf);
131
            }
132
 
133
            // bind the specified additional modules for this instance
134
            if (!l) {
135
                Y._afterConfig();
136
                Y._setup();
137
            }
138
        }
139
 
140
        if (l) {
141
            // Each instance can accept one or more configuration objects.
142
            // These are applied after YUI.GlobalConfig and YUI_Config,
143
            // overriding values set in those config files if there is a
144
            // matching property.
145
            for (; i < l; i++) {
146
                Y.applyConfig(args[i]);
147
            }
148
 
149
            Y._afterConfig();
150
            Y._setup();
151
        }
152
 
153
        Y.instanceOf = instanceOf;
154
 
155
        return Y;
156
    };
157
 
158
(function() {
159
 
160
    var proto, prop,
161
        VERSION = '3.18.1',
162
        PERIOD = '.',
163
        BASE = 'http://yui.yahooapis.com/',
164
        /*
165
            These CSS class names can't be generated by
166
            getClassName since it is not available at the
167
            time they are being used.
168
        */
169
        DOC_LABEL = 'yui3-js-enabled',
170
        CSS_STAMP_EL = 'yui3-css-stamp',
171
        NOOP = function() {},
172
        SLICE = Array.prototype.slice,
173
        APPLY_TO_AUTH = { 'io.xdrReady': 1,   // the functions applyTo
174
                          'io.xdrResponse': 1,   // can call. this should
175
                          'SWF.eventHandler': 1 }, // be done at build time
176
        hasWin = (typeof window != 'undefined'),
177
        win = (hasWin) ? window : null,
178
        doc = (hasWin) ? win.document : null,
179
        docEl = doc && doc.documentElement,
180
        docClass = docEl && docEl.className,
181
        instances = {},
182
        time = new Date().getTime(),
183
        add = function(el, type, fn, capture) {
184
            if (el && el.addEventListener) {
185
                el.addEventListener(type, fn, capture);
186
            } else if (el && el.attachEvent) {
187
                el.attachEvent('on' + type, fn);
188
            }
189
        },
190
        remove = function(el, type, fn, capture) {
191
            if (el && el.removeEventListener) {
192
                // this can throw an uncaught exception in FF
193
                try {
194
                    el.removeEventListener(type, fn, capture);
195
                } catch (ex) {}
196
            } else if (el && el.detachEvent) {
197
                el.detachEvent('on' + type, fn);
198
            }
199
        },
200
        handleReady = function() {
201
            YUI.Env.DOMReady = true;
202
            if (hasWin) {
203
                remove(doc, 'DOMContentLoaded', handleReady);
204
            }
205
        },
206
        handleLoad = function() {
207
            YUI.Env.windowLoaded = true;
208
            YUI.Env.DOMReady = true;
209
            if (hasWin) {
210
                remove(window, 'load', handleLoad);
211
            }
212
        },
213
        getLoader = function(Y, o) {
214
            var loader = Y.Env._loader,
215
                lCore = [ 'loader-base' ],
216
                G_ENV = YUI.Env,
217
                mods = G_ENV.mods;
218
 
219
            if (loader) {
220
                //loader._config(Y.config);
221
                loader.ignoreRegistered = false;
222
                loader.onEnd = null;
223
                loader.data = null;
224
                loader.required = [];
225
                loader.loadType = null;
226
            } else {
227
                loader = new Y.Loader(Y.config);
228
                Y.Env._loader = loader;
229
            }
230
            if (mods && mods.loader) {
231
                lCore = [].concat(lCore, YUI.Env.loaderExtras);
232
            }
233
            YUI.Env.core = Y.Array.dedupe([].concat(YUI.Env.core, lCore));
234
 
235
            return loader;
236
        },
237
 
238
        clobber = function(r, s) {
239
            for (var i in s) {
240
                if (s.hasOwnProperty(i)) {
241
                    r[i] = s[i];
242
                }
243
            }
244
        },
245
 
246
        ALREADY_DONE = { success: true };
247
 
248
//  Stamp the documentElement (HTML) with a class of "yui-loaded" to
249
//  enable styles that need to key off of JS being enabled.
250
if (docEl && docClass.indexOf(DOC_LABEL) == -1) {
251
    if (docClass) {
252
        docClass += ' ';
253
    }
254
    docClass += DOC_LABEL;
255
    docEl.className = docClass;
256
}
257
 
258
if (VERSION.indexOf('@') > -1) {
259
    VERSION = '3.5.0'; // dev time hack for cdn test
260
}
261
 
262
proto = {
263
    /**
264
    Applies a new configuration object to the config of this YUI instance. This
265
    will merge new group/module definitions, and will also update the loader
266
    cache if necessary. Updating `Y.config` directly will not update the cache.
267
 
268
    @method applyConfig
269
    @param {Object} o the configuration object.
270
    @since 3.2.0
271
    **/
272
    applyConfig: function(o) {
273
 
274
        o = o || NOOP;
275
 
276
        var attr,
277
            name,
278
            // detail,
279
            config = this.config,
280
            mods = config.modules,
281
            groups = config.groups,
282
            aliases = config.aliases,
283
            loader = this.Env._loader;
284
 
285
        for (name in o) {
286
            if (o.hasOwnProperty(name)) {
287
                attr = o[name];
288
                if (mods && name == 'modules') {
289
                    clobber(mods, attr);
290
                } else if (aliases && name == 'aliases') {
291
                    clobber(aliases, attr);
292
                } else if (groups && name == 'groups') {
293
                    clobber(groups, attr);
294
                } else if (name == 'win') {
295
                    config[name] = (attr && attr.contentWindow) || attr;
296
                    config.doc = config[name] ? config[name].document : null;
297
                } else if (name == '_yuid') {
298
                    // preserve the guid
299
                } else {
300
                    config[name] = attr;
301
                }
302
            }
303
        }
304
 
305
        if (loader) {
306
            loader._config(o);
307
        }
308
 
309
    },
310
 
311
    /**
312
    Old way to apply a config to this instance (calls `applyConfig` under the
313
    hood).
314
 
315
    @private
316
    @method _config
317
    @param {Object} o The config to apply
318
    **/
319
    _config: function(o) {
320
        this.applyConfig(o);
321
    },
322
 
323
    /**
324
    Initializes this YUI instance.
325
 
326
    @private
327
    @method _init
328
    **/
329
    _init: function() {
330
        var filter, el,
331
            Y = this,
332
            G_ENV = YUI.Env,
333
            Env = Y.Env,
334
            prop;
335
 
336
        /**
337
        The version number of this YUI instance.
338
 
339
        This value is typically updated by a script when a YUI release is built,
340
        so it may not reflect the correct version number when YUI is run from
341
        the development source tree.
342
 
343
        @property {String} version
344
        **/
345
        Y.version = VERSION;
346
 
347
        if (!Env) {
348
            Y.Env = {
349
                core: ['get', 'features', 'intl-base', 'yui-log', 'yui-log-nodejs', 'yui-later', 'loader-base', 'loader-rollup', 'loader-yui3'],
350
                loaderExtras: ['loader-rollup', 'loader-yui3'],
351
                mods: {}, // flat module map
352
                versions: {}, // version module map
353
                base: BASE,
354
                cdn: BASE + VERSION + '/',
355
                // bootstrapped: false,
356
                _idx: 0,
357
                _used: {},
358
                _attached: {},
359
                _exported: {},
360
                _missed: [],
361
                _yidx: 0,
362
                _uidx: 0,
363
                _guidp: 'y',
364
                _loaded: {},
365
                // serviced: {},
366
                // Regex in English:
367
                // I'll start at the \b(yui).
368
                // 1. Look in the test string for "yui" or
369
                //    "yui-base" or "yui-davglass" or "yui-foobar" that comes after a word break.  That is, it
370
                //    can't match "foyui" or "i_heart_yui". This can be anywhere in the string.
371
                // 2. After #1 must come a forward slash followed by the string matched in #1, so
372
                //    "yui-base/yui-base" or "yui-pants/yui-pants".
373
                // 3. The second occurence of the #1 token can optionally be followed by "-debug" or "-min",
374
                //    so "yui/yui-min", "yui/yui-debug", "yui-base/yui-base-debug". NOT "yui/yui-tshirt".
375
                // 4. This is followed by ".js", so "yui/yui.js".
376
                // 0. Going back to the beginning, now. If all that stuff in 1-4 comes after a "?" in the string,
377
                //    then capture the junk between the LAST "&" and the string in 1-4.  So
378
                //    "blah?foo/yui/yui.js" will capture "foo/" and "blah?some/thing.js&3.3.0/build/yui-davglass/yui-davglass.js"
379
                //    will capture "3.3.0/build/"
380
                //
381
                // Regex Exploded:
382
                // (?:\?             Find a ?
383
                //   (?:[^&]*&)      followed by 0..n characters followed by an &
384
                //   *               in fact, find as many sets of characters followed by a & as you can
385
                //   ([^&]*)         capture the stuff after the last & in \1
386
                // )?                but it's ok if all this ?junk&more_junk stuff isn't even there
387
                // \b(               after a word break find either the string
388
                //    yui(?:-\w+)?   "yui" optionally followed by a -, then more characters
389
                // )                 and store the yui-* string in \2
390
                // \/\2              then comes a / followed by the yui-* string in \2
391
                // (?:-(min|debug))? optionally followed by "-min" or "-debug"
392
                // .js               and ending in ".js"
393
                _BASE_RE: /(?:\?(?:[^&]*&)*([^&]*))?\b(yui(?:-\w+)?)\/\2(?:-(min|debug))?\.js/,
394
                parseBasePath: function(src, pattern) {
395
                    var match = src.match(pattern),
396
                        path, filter;
397
 
398
                    if (match) {
399
                        path = RegExp.leftContext || src.slice(0, src.indexOf(match[0]));
400
 
401
                        // this is to set up the path to the loader.  The file
402
                        // filter for loader should match the yui include.
403
                        filter = match[3];
404
 
405
                        // extract correct path for mixed combo urls
406
                        // http://yuilibrary.com/projects/yui3/ticket/2528423
407
                        if (match[1]) {
408
                            path += '?' + match[1];
409
                        }
410
                        path = {
411
                            filter: filter,
412
                            path: path
413
                        };
414
                    }
415
                    return path;
416
                },
417
                getBase: G_ENV && G_ENV.getBase ||
418
                        function(pattern) {
419
                            var nodes = (doc && doc.getElementsByTagName('script')) || [],
420
                                path = Env.cdn, parsed,
421
                                i, len, src;
422
 
423
                            for (i = 0, len = nodes.length; i < len; ++i) {
424
                                src = nodes[i].src;
425
                                if (src) {
426
                                    parsed = Y.Env.parseBasePath(src, pattern);
427
                                    if (parsed) {
428
                                        filter = parsed.filter;
429
                                        path = parsed.path;
430
                                        break;
431
                                    }
432
                                }
433
                            }
434
 
435
                            // use CDN default
436
                            return path;
437
                        }
438
 
439
            };
440
 
441
            Env = Y.Env;
442
 
443
            Env._loaded[VERSION] = {};
444
 
445
            if (G_ENV && Y !== YUI) {
446
                Env._yidx = ++G_ENV._yidx;
447
                Env._guidp = ('yui_' + VERSION + '_' +
448
                             Env._yidx + '_' + time).replace(/[^a-z0-9_]+/g, '_');
449
            } else if (YUI._YUI) {
450
 
451
                G_ENV = YUI._YUI.Env;
452
                Env._yidx += G_ENV._yidx;
453
                Env._uidx += G_ENV._uidx;
454
 
455
                for (prop in G_ENV) {
456
                    if (!(prop in Env)) {
457
                        Env[prop] = G_ENV[prop];
458
                    }
459
                }
460
 
461
                delete YUI._YUI;
462
            }
463
 
464
            Y.id = Y.stamp(Y);
465
            instances[Y.id] = Y;
466
 
467
        }
468
 
469
        Y.constructor = YUI;
470
 
471
        // configuration defaults
472
        Y.config = Y.config || {
473
            bootstrap: true,
474
            cacheUse: true,
475
            debug: true,
476
            doc: doc,
477
            fetchCSS: true,
478
            throwFail: true,
479
            useBrowserConsole: true,
480
            useNativeES5: true,
481
            win: win
482
        };
483
 
484
        //Register the CSS stamp element
485
        if (doc && !doc.getElementById(CSS_STAMP_EL)) {
486
            el = doc.createElement('div');
487
            el.innerHTML = '<div id="' + CSS_STAMP_EL + '" style="position: absolute !important; visibility: hidden !important"></div>';
488
            YUI.Env.cssStampEl = el.firstChild;
489
            if (doc.body) {
490
                doc.body.appendChild(YUI.Env.cssStampEl);
491
            } else {
492
                docEl.insertBefore(YUI.Env.cssStampEl, docEl.firstChild);
493
            }
494
        } else if (doc && doc.getElementById(CSS_STAMP_EL) && !YUI.Env.cssStampEl) {
495
            YUI.Env.cssStampEl = doc.getElementById(CSS_STAMP_EL);
496
        }
497
 
498
        Y.config.lang = Y.config.lang || 'en-US';
499
 
500
        Y.config.base = YUI.config.base ||
501
                (YUI.config.defaultBase && YUI.config.root && YUI.config.defaultBase + YUI.config.root) ||
502
                Y.Env.getBase(Y.Env._BASE_RE);
503
 
504
        if (!filter || (!('mindebug').indexOf(filter))) {
505
            filter = 'min';
506
        }
507
        filter = (filter) ? '-' + filter : filter;
508
        Y.config.loaderPath = YUI.config.loaderPath || 'loader/loader' + filter + '.js';
509
 
510
    },
511
 
512
    /**
513
    This method is called after all other configuration has been applied to
514
    the YUI instance.
515
 
516
    @method _afterConfig
517
    @private
518
    **/
519
    _afterConfig: function () {
520
        var Y = this;
521
 
522
        // We need to set up Y.config.global after the rest of the configuration
523
        // so that setting it in user configuration prevents the library from
524
        // using eval(). This is critical for Content Security Policy enabled
525
        // sites and other environments like Chrome extensions
526
        if (!Y.config.hasOwnProperty('global')) {
527
            Y.config.global = Function('return this')();
528
        }
529
    },
530
 
531
    /**
532
    Finishes the instance setup. Attaches whatever YUI modules were defined
533
    at the time that this instance was created.
534
 
535
    @method _setup
536
    @private
537
    **/
538
    _setup: function() {
539
        var i, Y = this,
540
            core = [],
541
            mods = YUI.Env.mods,
542
            extendedCore = Y.config.extendedCore || [],
543
            extras = Y.config.core || [].concat(YUI.Env.core).concat(extendedCore); //Clone it..
544
 
545
        for (i = 0; i < extras.length; i++) {
546
            if (mods[extras[i]]) {
547
                core.push(extras[i]);
548
            }
549
        }
550
 
551
        Y._attach(['yui-base']);
552
        Y._attach(core);
553
 
554
        if (Y.Loader) {
555
            getLoader(Y);
556
        }
557
 
558
        // Y.log(Y.id + ' initialized', 'info', 'yui');
559
    },
560
 
561
    /**
562
    Executes the named method on the specified YUI instance if that method is
563
    whitelisted.
564
 
565
    @method applyTo
566
    @param {String} id YUI instance id.
567
    @param {String} method Name of the method to execute. For example:
568
        'Object.keys'.
569
    @param {Array} args Arguments to apply to the method.
570
    @return {Mixed} Return value from the applied method, or `null` if the
571
        specified instance was not found or the method was not whitelisted.
572
    **/
573
    applyTo: function(id, method, args) {
574
        if (!(method in APPLY_TO_AUTH)) {
575
            this.log(method + ': applyTo not allowed', 'warn', 'yui');
576
            return null;
577
        }
578
 
579
        var instance = instances[id], nest, m, i;
580
        if (instance) {
581
            nest = method.split('.');
582
            m = instance;
583
            for (i = 0; i < nest.length; i = i + 1) {
584
                m = m[nest[i]];
585
                if (!m) {
586
                    this.log('applyTo not found: ' + method, 'warn', 'yui');
587
                }
588
            }
589
            return m && m.apply(instance, args);
590
        }
591
 
592
        return null;
593
    },
594
 
595
/**
596
Registers a YUI module and makes it available for use in a `YUI().use()` call or
597
as a dependency for other modules.
598
 
599
The easiest way to create a first-class YUI module is to use
600
<a href="http://yui.github.com/shifter/">Shifter</a>, the YUI component build
601
tool.
602
 
603
Shifter will automatically wrap your module code in a `YUI.add()` call along
604
with any configuration info required for the module.
605
 
606
@example
607
 
608
    YUI.add('davglass', function (Y) {
609
        Y.davglass = function () {
610
            Y.log('Dav was here!');
611
        };
612
    }, '3.4.0', {
613
        requires: ['harley-davidson', 'mt-dew']
614
    });
615
 
616
@method add
617
@param {String} name Module name.
618
@param {Function} fn Function containing module code. This function will be
619
    executed whenever the module is attached to a specific YUI instance.
620
 
621
    @param {YUI} fn.Y The YUI instance to which this module is attached.
622
    @param {String} fn.name Name of the module
623
 
624
@param {String} version Module version number. This is currently used only for
625
    informational purposes, and is not used internally by YUI.
626
 
627
@param {Object} [details] Module config.
628
    @param {Array} [details.requires] Array of other module names that must be
629
        attached before this module can be attached.
630
    @param {Array} [details.optional] Array of optional module names that should
631
        be attached before this module is attached if they've already been
632
        loaded. If the `loadOptional` YUI option is `true`, optional modules
633
        that have not yet been loaded will be loaded just as if they were hard
634
        requirements.
635
    @param {Array} [details.use] Array of module names that are included within
636
        or otherwise provided by this module, and which should be attached
637
        automatically when this module is attached. This makes it possible to
638
        create "virtual rollup" modules that simply attach a collection of other
639
        modules or submodules.
640
 
641
@return {YUI} This YUI instance.
642
**/
643
    add: function(name, fn, version, details) {
644
        details = details || {};
645
        var env = YUI.Env,
646
            mod = {
647
                name: name,
648
                fn: fn,
649
                version: version,
650
                details: details
651
            },
652
            //Instance hash so we don't apply it to the same instance twice
653
            applied = {},
654
            loader, inst, modInfo,
655
            i, versions = env.versions;
656
 
657
        env.mods[name] = mod;
658
        versions[version] = versions[version] || {};
659
        versions[version][name] = mod;
660
 
661
        for (i in instances) {
662
            if (instances.hasOwnProperty(i)) {
663
                inst = instances[i];
664
                if (!applied[inst.id]) {
665
                    applied[inst.id] = true;
666
                    loader = inst.Env._loader;
667
                    if (loader) {
668
                        modInfo = loader.getModuleInfo(name);
669
                        if (!modInfo || modInfo.temp) {
670
                            loader.addModule(details, name);
671
                        }
672
                    }
673
                }
674
            }
675
        }
676
 
677
        return this;
678
    },
679
 
680
    /**
681
    Executes the callback function associated with each required module,
682
    attaching the module to this YUI instance.
683
 
684
    @method _attach
685
    @param {Array} r The array of modules to attach
686
    @param {Boolean} [moot=false] If `true`, don't throw a warning if the module
687
        is not attached.
688
    @private
689
    **/
690
    _attach: function(r, moot) {
691
        var i, name, mod, details, req, use, after,
692
            mods = YUI.Env.mods,
693
            aliases = YUI.Env.aliases,
694
            Y = this, j,
695
            cache = YUI.Env._renderedMods,
696
            loader = Y.Env._loader,
697
            done = Y.Env._attached,
698
            exported = Y.Env._exported,
699
            len = r.length, loader, def, go,
700
            c = [],
701
            modArgs, esCompat, reqlen, modInfo,
702
            condition,
703
            __exports__, __imports__;
704
 
705
        //Check for conditional modules (in a second+ instance) and add their requirements
706
        //TODO I hate this entire method, it needs to be fixed ASAP (3.5.0) ^davglass
707
        for (i = 0; i < len; i++) {
708
            name = r[i];
709
            mod = mods[name];
710
            c.push(name);
711
            if (loader && loader.conditions[name]) {
712
                for (j in loader.conditions[name]) {
713
                    if (loader.conditions[name].hasOwnProperty(j)) {
714
                        def = loader.conditions[name][j];
715
                        go = def && ((def.ua && Y.UA[def.ua]) || (def.test && def.test(Y)));
716
                        if (go) {
717
                            c.push(def.name);
718
                        }
719
                    }
720
                }
721
            }
722
        }
723
        r = c;
724
        len = r.length;
725
 
726
        for (i = 0; i < len; i++) {
727
            if (!done[r[i]]) {
728
                name = r[i];
729
                mod = mods[name];
730
 
731
                if (aliases && aliases[name] && !mod) {
732
                    Y._attach(aliases[name]);
733
                    continue;
734
                }
735
                if (!mod) {
736
                    modInfo = loader && loader.getModuleInfo(name);
737
                    if (modInfo) {
738
                        mod = modInfo;
739
                        moot = true;
740
                    }
741
 
742
                    // Y.log('no js def for: ' + name, 'info', 'yui');
743
 
744
                    //if (!loader || !loader.moduleInfo[name]) {
745
                    //if ((!loader || !loader.moduleInfo[name]) && !moot) {
746
                    if (!moot && name) {
747
                        if ((name.indexOf('skin-') === -1) && (name.indexOf('css') === -1)) {
748
                            Y.Env._missed.push(name);
749
                            Y.Env._missed = Y.Array.dedupe(Y.Env._missed);
750
                            Y.message('NOT loaded: ' + name, 'warn', 'yui');
751
                        }
752
                    }
753
                } else {
754
                    done[name] = true;
755
                    //Don't like this, but in case a mod was asked for once, then we fetch it
756
                    //We need to remove it from the missed list ^davglass
757
                    for (j = 0; j < Y.Env._missed.length; j++) {
758
                        if (Y.Env._missed[j] === name) {
759
                            Y.message('Found: ' + name + ' (was reported as missing earlier)', 'warn', 'yui');
760
                            Y.Env._missed.splice(j, 1);
761
                        }
762
                    }
763
 
764
                    // Optional dependencies normally work by modifying the
765
                    // dependency list of a module. If the dependency's test
766
                    // passes it is added to the list. If not, it's not loaded.
767
                    // This following check ensures that optional dependencies
768
                    // are not attached when they were already loaded into the
769
                    // page (when bundling for example)
770
                    if (loader && !loader._canBeAttached(name)) {
771
                        Y.log('Failed to attach module ' + name, 'warn', 'yui');
772
                        return true;
773
                    }
774
 
775
                    /*
776
                        If it's a temp module, we need to redo it's requirements if it's already loaded
777
                        since it may have been loaded by another instance and it's dependencies might
778
                        have been redefined inside the fetched file.
779
                    */
780
                    if (loader && cache && cache[name] && cache[name].temp) {
781
                        loader.getRequires(cache[name]);
782
                        req = [];
783
                        modInfo = loader.getModuleInfo(name);
784
                        for (j in modInfo.expanded_map) {
785
                            if (modInfo.expanded_map.hasOwnProperty(j)) {
786
                                req.push(j);
787
                            }
788
                        }
789
                        Y._attach(req);
790
                    }
791
 
792
                    details = mod.details;
793
                    req = details.requires;
794
                    esCompat = details.es;
795
                    use = details.use;
796
                    after = details.after;
797
                    //Force Intl load if there is a language (Loader logic) @todo fix this shit
798
                    if (details.lang) {
799
                        req = req || [];
800
                        req.unshift('intl');
801
                    }
802
 
803
                    if (req) {
804
                        reqlen = req.length;
805
                        for (j = 0; j < reqlen; j++) {
806
                            if (!done[req[j]]) {
807
                                if (!Y._attach(req)) {
808
                                    return false;
809
                                }
810
                                break;
811
                            }
812
                        }
813
                    }
814
 
815
                    if (after) {
816
                        for (j = 0; j < after.length; j++) {
817
                            if (!done[after[j]]) {
818
                                if (!Y._attach(after, true)) {
819
                                    return false;
820
                                }
821
                                break;
822
                            }
823
                        }
824
                    }
825
 
826
                    if (mod.fn) {
827
                        modArgs = [Y, name];
828
                        if (esCompat) {
829
                            __imports__ = {};
830
                            __exports__ = {};
831
                            // passing `exports` and `imports` onto the module function
832
                            modArgs.push(__imports__, __exports__);
833
                            if (req) {
834
                                reqlen = req.length;
835
                                for (j = 0; j < reqlen; j++) {
836
                                    __imports__[req[j]] = exported.hasOwnProperty(req[j]) ? exported[req[j]] : Y;
837
                                }
838
                            }
839
                        }
840
                        if (Y.config.throwFail) {
841
                            __exports__ = mod.fn.apply(esCompat ? undefined : mod, modArgs);
842
                        } else {
843
                            try {
844
                                __exports__ = mod.fn.apply(esCompat ? undefined : mod, modArgs);
845
                            } catch (e) {
846
                                Y.error('Attach error: ' + name, e, name);
847
                                return false;
848
                            }
849
                        }
850
                        if (esCompat) {
851
                            // store the `exports` in case others `es` modules requires it
852
                            exported[name] = __exports__;
853
 
854
                            // If an ES module is conditionally loaded and set
855
                            // to be used "instead" another module, replace the
856
                            // trigger module's content with the conditionally
857
                            // loaded one so the values returned by require()
858
                            // still makes sense
859
                            condition = mod.details.condition;
860
                            if (condition && condition.when === 'instead') {
861
                                exported[condition.trigger] = __exports__;
862
                            }
863
                        }
864
                    }
865
 
866
                    if (use) {
867
                        for (j = 0; j < use.length; j++) {
868
                            if (!done[use[j]]) {
869
                                if (!Y._attach(use)) {
870
                                    return false;
871
                                }
872
                                break;
873
                            }
874
                        }
875
                    }
876
 
877
 
878
 
879
                }
880
            }
881
        }
882
 
883
        return true;
884
    },
885
 
886
    /**
887
    Delays the `use` callback until another event has taken place such as
888
    `window.onload`, `domready`, `contentready`, or `available`.
889
 
890
    @private
891
    @method _delayCallback
892
    @param {Function} cb The original `use` callback.
893
    @param {String|Object} until Either an event name ('load', 'domready', etc.)
894
        or an object containing event/args keys for contentready/available.
895
    @return {Function}
896
    **/
897
    _delayCallback: function(cb, until) {
898
 
899
        var Y = this,
900
            mod = ['event-base'];
901
 
902
        until = (Y.Lang.isObject(until) ? until : { event: until });
903
 
904
        if (until.event === 'load') {
905
            mod.push('event-synthetic');
906
        }
907
 
908
        Y.log('Delaying use callback until: ' + until.event, 'info', 'yui');
909
        return function() {
910
            Y.log('Use callback fired, waiting on delay', 'info', 'yui');
911
            var args = arguments;
912
            Y._use(mod, function() {
913
                Y.log('Delayed use wrapper callback after dependencies', 'info', 'yui');
914
                Y.on(until.event, function() {
915
                    args[1].delayUntil = until.event;
916
                    Y.log('Delayed use callback done after ' + until.event, 'info', 'yui');
917
                    cb.apply(Y, args);
918
                }, until.args);
919
            });
920
        };
921
    },
922
 
923
    /**
924
    Attaches one or more modules to this YUI instance. When this is executed,
925
    the requirements of the desired modules are analyzed, and one of several
926
    things can happen:
927
 
928
 
929
      * All required modules have already been loaded, and just need to be
930
        attached to this YUI instance. In this case, the `use()` callback will
931
        be executed synchronously after the modules are attached.
932
 
933
      * One or more modules have not yet been loaded, or the Get utility is not
934
        available, or the `bootstrap` config option is `false`. In this case,
935
        a warning is issued indicating that modules are missing, but all
936
        available modules will still be attached and the `use()` callback will
937
        be executed synchronously.
938
 
939
      * One or more modules are missing and the Loader is not available but the
940
        Get utility is, and `bootstrap` is not `false`. In this case, the Get
941
        utility will be used to load the Loader, and we will then proceed to
942
        the following state:
943
 
944
      * One or more modules are missing and the Loader is available. In this
945
        case, the Loader will be used to resolve the dependency tree for the
946
        missing modules and load them and their dependencies. When the Loader is
947
        finished loading modules, the `use()` callback will be executed
948
        asynchronously.
949
 
950
    @example
951
 
952
        // Loads and attaches dd and its dependencies.
953
        YUI().use('dd', function (Y) {
954
            // ...
955
        });
956
 
957
        // Loads and attaches dd and node as well as all of their dependencies.
958
        YUI().use(['dd', 'node'], function (Y) {
959
            // ...
960
        });
961
 
962
        // Attaches all modules that have already been loaded.
963
        YUI().use('*', function (Y) {
964
            // ...
965
        });
966
 
967
        // Attaches a gallery module.
968
        YUI().use('gallery-yql', function (Y) {
969
            // ...
970
        });
971
 
972
        // Attaches a YUI 2in3 module.
973
        YUI().use('yui2-datatable', function (Y) {
974
            // ...
975
        });
976
 
977
    @method use
978
    @param {String|Array} modules* One or more module names to attach.
979
    @param {Function} [callback] Callback function to be executed once all
980
        specified modules and their dependencies have been attached.
981
    @param {YUI} callback.Y The YUI instance created for this sandbox.
982
    @param {Object} callback.status Object containing `success`, `msg` and
983
        `data` properties.
984
    @chainable
985
    **/
986
    use: function() {
987
        var args = SLICE.call(arguments, 0),
988
            callback = args[args.length - 1],
989
            Y = this,
990
            i = 0,
991
            name,
992
            Env = Y.Env,
993
            provisioned = true;
994
 
995
        // The last argument supplied to use can be a load complete callback
996
        if (Y.Lang.isFunction(callback)) {
997
            args.pop();
998
            if (Y.config.delayUntil) {
999
                callback = Y._delayCallback(callback, Y.config.delayUntil);
1000
            }
1001
        } else {
1002
            callback = null;
1003
        }
1004
        if (Y.Lang.isArray(args[0])) {
1005
            args = args[0];
1006
        }
1007
 
1008
        if (Y.config.cacheUse) {
1009
            while ((name = args[i++])) {
1010
                if (!Env._attached[name]) {
1011
                    provisioned = false;
1012
                    break;
1013
                }
1014
            }
1015
 
1016
            if (provisioned) {
1017
                if (args.length) {
1018
                    Y.log('already provisioned: ' + args, 'info', 'yui');
1019
                }
1020
                Y._notify(callback, ALREADY_DONE, args);
1021
                return Y;
1022
            }
1023
        }
1024
 
1025
        if (Y._loading) {
1026
            Y._useQueue = Y._useQueue || new Y.Queue();
1027
            Y._useQueue.add([args, callback]);
1028
        } else {
1029
            Y._use(args, function(Y, response) {
1030
                Y._notify(callback, response, args);
1031
            });
1032
        }
1033
 
1034
        return Y;
1035
    },
1036
 
1037
    /**
1038
    Sugar for loading both legacy and ES6-based YUI modules.
1039
 
1040
    @method require
1041
    @param {String} [modules*] List of module names to import or a single
1042
        module name.
1043
    @param {Function} callback Callback that gets called once all the modules
1044
        were loaded. Each parameter of the callback is the export value of the
1045
        corresponding module in the list. If the module is a legacy YUI module,
1046
        the YUI instance is used instead of the module exports.
1047
    @example
1048
    ```
1049
    YUI().require(['es6-set'], function (Y, imports) {
1050
        var Set = imports.Set,
1051
            set = new Set();
1052
    });
1053
    ```
1054
    **/
1055
    require: function () {
1056
        var args = SLICE.call(arguments),
1057
            callback;
1058
 
1059
        if (typeof args[args.length - 1] === 'function') {
1060
            callback = args.pop();
1061
 
1062
            // only add the callback if one was provided
1063
            // YUI().require('foo'); is valid
1064
            args.push(function (Y) {
1065
                var i, length = args.length,
1066
                    exported = Y.Env._exported,
1067
                    __imports__ = {};
1068
 
1069
                // Get only the imports requested as arguments
1070
                for (i = 0; i < length; i++) {
1071
                    if (exported.hasOwnProperty(args[i])) {
1072
                        __imports__[args[i]] = exported[args[i]];
1073
                    }
1074
                }
1075
 
1076
                // Using `undefined` because:
1077
                // - Using `Y.config.global` would force the value of `this` to be
1078
                //   the global object even in strict mode
1079
                // - Using `Y` goes against the goal of moving away from a shared
1080
                //   object and start thinking in terms of imported and exported
1081
                //   objects
1082
                callback.call(undefined, Y, __imports__);
1083
            });
1084
        }
1085
        // Do not return the Y object. This makes it hard to follow this
1086
        // traditional pattern:
1087
        //   var Y = YUI().use(...);
1088
        // This is a good idea in the light of ES6 modules, to avoid working
1089
        // in the global scope.
1090
        // This also leaves the door open for returning a promise, once the
1091
        // YUI loader is based on the ES6 loader which uses
1092
        // loader.import(...).then(...)
1093
        this.use.apply(this, args);
1094
    },
1095
 
1096
    /**
1097
    Handles Loader notifications about attachment/load errors.
1098
 
1099
    @method _notify
1100
    @param {Function} callback Callback to pass to `Y.config.loadErrorFn`.
1101
    @param {Object} response Response returned from Loader.
1102
    @param {Array} args Arguments passed from Loader.
1103
    @private
1104
    **/
1105
    _notify: function(callback, response, args) {
1106
        if (!response.success && this.config.loadErrorFn) {
1107
            this.config.loadErrorFn.call(this, this, callback, response, args);
1108
        } else if (callback) {
1109
            if (this.Env._missed && this.Env._missed.length) {
1110
                response.msg = 'Missing modules: ' + this.Env._missed.join();
1111
                response.success = false;
1112
            }
1113
            if (this.config.throwFail) {
1114
                callback(this, response);
1115
            } else {
1116
                try {
1117
                    callback(this, response);
1118
                } catch (e) {
1119
                    this.error('use callback error', e, args);
1120
                }
1121
            }
1122
        }
1123
    },
1124
 
1125
    /**
1126
    Called from the `use` method queue to ensure that only one set of loading
1127
    logic is performed at a time.
1128
 
1129
    @method _use
1130
    @param {String} args* One or more modules to attach.
1131
    @param {Function} [callback] Function to call once all required modules have
1132
        been attached.
1133
    @private
1134
    **/
1135
    _use: function(args, callback) {
1136
 
1137
        if (!this.Array) {
1138
            this._attach(['yui-base']);
1139
        }
1140
 
1141
        var len, loader, handleBoot,
1142
            Y = this,
1143
            G_ENV = YUI.Env,
1144
            mods = G_ENV.mods,
1145
            Env = Y.Env,
1146
            used = Env._used,
1147
            aliases = G_ENV.aliases,
1148
            queue = G_ENV._loaderQueue,
1149
            firstArg = args[0],
1150
            YArray = Y.Array,
1151
            config = Y.config,
1152
            boot = config.bootstrap,
1153
            missing = [],
1154
            i,
1155
            r = [],
1156
            ret = true,
1157
            fetchCSS = config.fetchCSS,
1158
            process = function(names, skip) {
1159
 
1160
                var i = 0, a = [], name, len, m, req, use;
1161
 
1162
                if (!names.length) {
1163
                    return;
1164
                }
1165
 
1166
                if (aliases) {
1167
                    len = names.length;
1168
                    for (i = 0; i < len; i++) {
1169
                        if (aliases[names[i]] && !mods[names[i]]) {
1170
                            a = [].concat(a, aliases[names[i]]);
1171
                        } else {
1172
                            a.push(names[i]);
1173
                        }
1174
                    }
1175
                    names = a;
1176
                }
1177
 
1178
                len = names.length;
1179
 
1180
                for (i = 0; i < len; i++) {
1181
                    name = names[i];
1182
                    if (!skip) {
1183
                        r.push(name);
1184
                    }
1185
 
1186
                    // only attach a module once
1187
                    if (used[name]) {
1188
                        continue;
1189
                    }
1190
 
1191
                    m = mods[name];
1192
                    req = null;
1193
                    use = null;
1194
 
1195
                    if (m) {
1196
                        used[name] = true;
1197
                        req = m.details.requires;
1198
                        use = m.details.use;
1199
                    } else {
1200
                        // CSS files don't register themselves, see if it has
1201
                        // been loaded
1202
                        if (!G_ENV._loaded[VERSION][name]) {
1203
                            missing.push(name);
1204
                        } else {
1205
                            used[name] = true; // probably css
1206
                        }
1207
                    }
1208
 
1209
                    // make sure requirements are attached
1210
                    if (req && req.length) {
1211
                        process(req);
1212
                    }
1213
 
1214
                    // make sure we grab the submodule dependencies too
1215
                    if (use && use.length) {
1216
                        process(use, 1);
1217
                    }
1218
                }
1219
 
1220
            },
1221
 
1222
            handleLoader = function(fromLoader) {
1223
                var response = fromLoader || {
1224
                        success: true,
1225
                        msg: 'not dynamic'
1226
                    },
1227
                    redo, origMissing,
1228
                    ret = true,
1229
                    data = response.data;
1230
 
1231
                Y._loading = false;
1232
 
1233
                if (data) {
1234
                    origMissing = missing;
1235
                    missing = [];
1236
                    r = [];
1237
                    process(data);
1238
                    redo = missing.length;
1239
                    if (redo) {
1240
                        if ([].concat(missing).sort().join() ==
1241
                                origMissing.sort().join()) {
1242
                            redo = false;
1243
                        }
1244
                    }
1245
                }
1246
 
1247
                if (redo && data) {
1248
                    Y._loading = true;
1249
                    Y._use(missing, function() {
1250
                        Y.log('Nested use callback: ' + data, 'info', 'yui');
1251
                        if (Y._attach(data)) {
1252
                            Y._notify(callback, response, data);
1253
                        }
1254
                    });
1255
                } else {
1256
                    if (data) {
1257
                        // Y.log('attaching from loader: ' + data, 'info', 'yui');
1258
                        ret = Y._attach(data);
1259
                    }
1260
                    if (ret) {
1261
                        Y._notify(callback, response, args);
1262
                    }
1263
                }
1264
 
1265
                if (Y._useQueue && Y._useQueue.size() && !Y._loading) {
1266
                    Y._use.apply(Y, Y._useQueue.next());
1267
                }
1268
 
1269
            };
1270
 
1271
// Y.log(Y.id + ': use called: ' + a + ' :: ' + callback, 'info', 'yui');
1272
 
1273
        // YUI().use('*'); // bind everything available
1274
        if (firstArg === '*') {
1275
            args = [];
1276
            for (i in mods) {
1277
                if (mods.hasOwnProperty(i)) {
1278
                    args.push(i);
1279
                }
1280
            }
1281
            ret = Y._attach(args);
1282
            if (ret) {
1283
                handleLoader();
1284
            }
1285
            return Y;
1286
        }
1287
 
1288
        if ((mods.loader || mods['loader-base']) && !Y.Loader) {
1289
            Y.log('Loader was found in meta, but it is not attached. Attaching..', 'info', 'yui');
1290
            Y._attach(['loader' + ((!mods.loader) ? '-base' : '')]);
1291
        }
1292
 
1293
        // Y.log('before loader requirements: ' + args, 'info', 'yui');
1294
 
1295
        // use loader to expand dependencies and sort the
1296
        // requirements if it is available.
1297
        if (boot && Y.Loader && args.length) {
1298
            Y.log('Using loader to expand dependencies', 'info', 'yui');
1299
            loader = getLoader(Y);
1300
            loader.require(args);
1301
            loader.ignoreRegistered = true;
1302
            loader._boot = true;
1303
            loader.calculate(null, (fetchCSS) ? null : 'js');
1304
            args = loader.sorted;
1305
            loader._boot = false;
1306
        }
1307
 
1308
        process(args);
1309
 
1310
        len = missing.length;
1311
 
1312
 
1313
        if (len) {
1314
            missing = YArray.dedupe(missing);
1315
            len = missing.length;
1316
Y.log('Modules missing: ' + missing + ', ' + missing.length, 'info', 'yui');
1317
        }
1318
 
1319
 
1320
        // dynamic load
1321
        if (boot && len && Y.Loader) {
1322
// Y.log('Using loader to fetch missing deps: ' + missing, 'info', 'yui');
1323
            Y.log('Using Loader', 'info', 'yui');
1324
            Y._loading = true;
1325
            loader = getLoader(Y);
1326
            loader.onEnd = handleLoader;
1327
            loader.context = Y;
1328
            loader.data = args;
1329
            loader.ignoreRegistered = false;
1330
            loader.require(missing);
1331
            loader.insert(null, (fetchCSS) ? null : 'js');
1332
 
1333
        } else if (boot && len && Y.Get && !Env.bootstrapped) {
1334
 
1335
            Y._loading = true;
1336
 
1337
            handleBoot = function() {
1338
                Y._loading = false;
1339
                queue.running = false;
1340
                Env.bootstrapped = true;
1341
                G_ENV._bootstrapping = false;
1342
                if (Y._attach(['loader'])) {
1343
                    Y._use(args, callback);
1344
                }
1345
            };
1346
 
1347
            if (G_ENV._bootstrapping) {
1348
Y.log('Waiting for loader', 'info', 'yui');
1349
                queue.add(handleBoot);
1350
            } else {
1351
                G_ENV._bootstrapping = true;
1352
Y.log('Fetching loader: ' + config.base + config.loaderPath, 'info', 'yui');
1353
                Y.Get.script(config.base + config.loaderPath, {
1354
                    onEnd: handleBoot
1355
                });
1356
            }
1357
 
1358
        } else {
1359
            Y.log('Attaching available dependencies: ' + args, 'info', 'yui');
1360
            ret = Y._attach(args);
1361
            if (ret) {
1362
                handleLoader();
1363
            }
1364
        }
1365
 
1366
        return Y;
1367
    },
1368
 
1369
 
1370
    /**
1371
    Utility method for safely creating namespaces if they don't already exist.
1372
    May be called statically on the YUI global object or as a method on a YUI
1373
    instance.
1374
 
1375
    When called statically, a namespace will be created on the YUI global
1376
    object:
1377
 
1378
        // Create `YUI.your.namespace.here` as nested objects, preserving any
1379
        // objects that already exist instead of overwriting them.
1380
        YUI.namespace('your.namespace.here');
1381
 
1382
    When called as a method on a YUI instance, a namespace will be created on
1383
    that instance:
1384
 
1385
        // Creates `Y.property.package`.
1386
        Y.namespace('property.package');
1387
 
1388
    Dots in the input string cause `namespace` to create nested objects for each
1389
    token. If any part of the requested namespace already exists, the current
1390
    object will be left in place and will not be overwritten. This allows
1391
    multiple calls to `namespace` to preserve existing namespaced properties.
1392
 
1393
    If the first token in the namespace string is "YAHOO", that token is
1394
    discarded. This is legacy behavior for backwards compatibility with YUI 2.
1395
 
1396
    Be careful with namespace tokens. Reserved words may work in some browsers
1397
    and not others. For instance, the following will fail in some browsers
1398
    because the supported version of JavaScript reserves the word "long":
1399
 
1400
        Y.namespace('really.long.nested.namespace');
1401
 
1402
    Note: If you pass multiple arguments to create multiple namespaces, only the
1403
    last one created is returned from this function.
1404
 
1405
    @method namespace
1406
    @param {String} namespace* One or more namespaces to create.
1407
    @return {Object} Reference to the last namespace object created.
1408
    **/
1409
    namespace: function() {
1410
        var a = arguments, o, i = 0, j, d, arg;
1411
 
1412
        for (; i < a.length; i++) {
1413
            o = this; //Reset base object per argument or it will get reused from the last
1414
            arg = a[i];
1415
            if (arg.indexOf(PERIOD) > -1) { //Skip this if no "." is present
1416
                d = arg.split(PERIOD);
1417
                for (j = (d[0] == 'YAHOO') ? 1 : 0; j < d.length; j++) {
1418
                    o[d[j]] = o[d[j]] || {};
1419
                    o = o[d[j]];
1420
                }
1421
            } else {
1422
                o[arg] = o[arg] || {};
1423
                o = o[arg]; //Reset base object to the new object so it's returned
1424
            }
1425
        }
1426
        return o;
1427
    },
1428
 
1429
    // this is replaced if the log module is included
1430
    log: NOOP,
1431
    message: NOOP,
1432
    // this is replaced if the dump module is included
1433
    dump: function (o) { return ''+o; },
1434
 
1435
    /**
1436
    Reports an error.
1437
 
1438
    The reporting mechanism is controlled by the `throwFail` configuration
1439
    attribute. If `throwFail` is falsy, the message is logged. If `throwFail` is
1440
    truthy, a JS exception is thrown.
1441
 
1442
    If an `errorFn` is specified in the config it must return `true` to indicate
1443
    that the exception was handled and keep it from being thrown.
1444
 
1445
    @method error
1446
    @param {String} msg Error message.
1447
    @param {Error|String} [e] JavaScript error object or an error string.
1448
    @param {String} [src] Source of the error (such as the name of the module in
1449
        which the error occurred).
1450
    @chainable
1451
    **/
1452
    error: function(msg, e, src) {
1453
        //TODO Add check for window.onerror here
1454
 
1455
        var Y = this, ret;
1456
 
1457
        if (Y.config.errorFn) {
1458
            ret = Y.config.errorFn.apply(Y, arguments);
1459
        }
1460
 
1461
        if (!ret) {
1462
            throw (e || new Error(msg));
1463
        } else {
1464
            Y.message(msg, 'error', ''+src); // don't scrub this one
1465
        }
1466
 
1467
        return Y;
1468
    },
1469
 
1470
    /**
1471
    Generates an id string that is unique among all YUI instances in this
1472
    execution context.
1473
 
1474
    @method guid
1475
    @param {String} [pre] Prefix.
1476
    @return {String} Unique id.
1477
    **/
1478
    guid: function(pre) {
1479
        var id = this.Env._guidp + '_' + (++this.Env._uidx);
1480
        return (pre) ? (pre + id) : id;
1481
    },
1482
 
1483
    /**
1484
    Returns a unique id associated with the given object and (if *readOnly* is
1485
    falsy) stamps the object with that id so it can be identified in the future.
1486
 
1487
    Stamping an object involves adding a `_yuid` property to it that contains
1488
    the object's id. One exception to this is that in Internet Explorer, DOM
1489
    nodes have a `uniqueID` property that contains a browser-generated unique
1490
    id, which will be used instead of a YUI-generated id when available.
1491
 
1492
    @method stamp
1493
    @param {Object} o Object to stamp.
1494
    @param {Boolean} readOnly If truthy and the given object has not already
1495
        been stamped, the object will not be modified and `null` will be
1496
        returned.
1497
    @return {String} Object's unique id, or `null` if *readOnly* was truthy and
1498
        the given object was not already stamped.
1499
    **/
1500
    stamp: function(o, readOnly) {
1501
        var uid;
1502
        if (!o) {
1503
            return o;
1504
        }
1505
 
1506
        // IE generates its own unique ID for dom nodes
1507
        // The uniqueID property of a document node returns a new ID
1508
        if (o.uniqueID && o.nodeType && o.nodeType !== 9) {
1509
            uid = o.uniqueID;
1510
        } else {
1511
            uid = (typeof o === 'string') ? o : o._yuid;
1512
        }
1513
 
1514
        if (!uid) {
1515
            uid = this.guid();
1516
            if (!readOnly) {
1517
                try {
1518
                    o._yuid = uid;
1519
                } catch (e) {
1520
                    uid = null;
1521
                }
1522
            }
1523
        }
1524
        return uid;
1525
    },
1526
 
1527
    /**
1528
    Destroys this YUI instance.
1529
 
1530
    @method destroy
1531
    @since 3.3.0
1532
    **/
1533
    destroy: function() {
1534
        var Y = this;
1535
        if (Y.Event) {
1536
            Y.Event._unload();
1537
        }
1538
        delete instances[Y.id];
1539
        delete Y.Env;
1540
        delete Y.config;
1541
    }
1542
 
1543
    /**
1544
    Safe `instanceof` wrapper that works around a memory leak in IE when the
1545
    object being tested is `window` or `document`.
1546
 
1547
    Unless you are testing objects that may be `window` or `document`, you
1548
    should use the native `instanceof` operator instead of this method.
1549
 
1550
    @method instanceOf
1551
    @param {Object} o Object to check.
1552
    @param {Object} type Class to check against.
1553
    @since 3.3.0
1554
    **/
1555
};
1556
 
1557
    YUI.prototype = proto;
1558
 
1559
    // inheritance utilities are not available yet
1560
    for (prop in proto) {
1561
        if (proto.hasOwnProperty(prop)) {
1562
            YUI[prop] = proto[prop];
1563
        }
1564
    }
1565
 
1566
    /**
1567
    Applies a configuration to all YUI instances in this execution context.
1568
 
1569
    The main use case for this method is in "mashups" where several third-party
1570
    scripts need to write to a global YUI config, but cannot share a single
1571
    centrally-managed config object. This way they can all call
1572
    `YUI.applyConfig({})` instead of overwriting the single global config.
1573
 
1574
    @example
1575
 
1576
        YUI.applyConfig({
1577
            modules: {
1578
                davglass: {
1579
                    fullpath: './davglass.js'
1580
                }
1581
            }
1582
        });
1583
 
1584
        YUI.applyConfig({
1585
            modules: {
1586
                foo: {
1587
                    fullpath: './foo.js'
1588
                }
1589
            }
1590
        });
1591
 
1592
        YUI().use('davglass', function (Y) {
1593
            // Module davglass will be available here.
1594
        });
1595
 
1596
    @method applyConfig
1597
    @param {Object} o Configuration object to apply.
1598
    @static
1599
    @since 3.5.0
1600
    **/
1601
    YUI.applyConfig = function(o) {
1602
        if (!o) {
1603
            return;
1604
        }
1605
        //If there is a GlobalConfig, apply it first to set the defaults
1606
        if (YUI.GlobalConfig) {
1607
            this.prototype.applyConfig.call(this, YUI.GlobalConfig);
1608
        }
1609
        //Apply this config to it
1610
        this.prototype.applyConfig.call(this, o);
1611
        //Reset GlobalConfig to the combined config
1612
        YUI.GlobalConfig = this.config;
1613
    };
1614
 
1615
    // set up the environment
1616
    YUI._init();
1617
 
1618
    if (hasWin) {
1619
        add(doc, 'DOMContentLoaded', handleReady);
1620
 
1621
        // add a window load event at load time so we can capture
1622
        // the case where it fires before dynamic loading is
1623
        // complete.
1624
        add(window, 'load', handleLoad);
1625
    } else {
1626
        handleReady();
1627
        handleLoad();
1628
    }
1629
 
1630
    YUI.Env.add = add;
1631
    YUI.Env.remove = remove;
1632
 
1633
    /*global exports*/
1634
    // Support the CommonJS method for exporting our single global
1635
    if (typeof exports == 'object') {
1636
        exports.YUI = YUI;
1637
        /**
1638
        * Set a method to be called when `Get.script` is called in Node.js
1639
        * `Get` will open the file, then pass it's content and it's path
1640
        * to this method before attaching it. Commonly used for code coverage
1641
        * instrumentation. <strong>Calling this multiple times will only
1642
        * attach the last hook method</strong>. This method is only
1643
        * available in Node.js.
1644
        * @method setLoadHook
1645
        * @static
1646
        * @param {Function} fn The function to set
1647
        * @param {String} fn.data The content of the file
1648
        * @param {String} fn.path The file path of the file
1649
        */
1650
        YUI.setLoadHook = function(fn) {
1651
            YUI._getLoadHook = fn;
1652
        };
1653
        /**
1654
        * Load hook for `Y.Get.script` in Node.js, see `YUI.setLoadHook`
1655
        * @method _getLoadHook
1656
        * @private
1657
        * @param {String} data The content of the file
1658
        * @param {String} path The file path of the file
1659
        */
1660
        YUI._getLoadHook = null;
1661
    }
1662
 
1663
    YUI.Env[VERSION] = {};
1664
}());
1665
 
1666
 
1667
/**
1668
Config object that contains all of the configuration options for
1669
this `YUI` instance.
1670
 
1671
This object is supplied by the implementer when instantiating YUI. Some
1672
properties have default values if they are not supplied by the implementer.
1673
 
1674
This object should not be updated directly because some values are cached. Use
1675
`applyConfig()` to update the config object on a YUI instance that has already
1676
been configured.
1677
 
1678
@class config
1679
@static
1680
**/
1681
 
1682
/**
1683
If `true` (the default), YUI will "bootstrap" the YUI Loader and module metadata
1684
if they're needed to load additional dependencies and aren't already available.
1685
 
1686
Setting this to `false` will prevent YUI from automatically loading the Loader
1687
and module metadata, so you will need to manually ensure that they're available
1688
or handle dependency resolution yourself.
1689
 
1690
@property {Boolean} bootstrap
1691
@default true
1692
**/
1693
 
1694
/**
1695
If `true`, `Y.log()` messages will be written to the browser's debug console
1696
when available and when `useBrowserConsole` is also `true`.
1697
 
1698
@property {Boolean} debug
1699
@default true
1700
**/
1701
 
1702
/**
1703
Log messages to the browser console if `debug` is `true` and the browser has a
1704
supported console.
1705
 
1706
@property {Boolean} useBrowserConsole
1707
@default true
1708
**/
1709
 
1710
/**
1711
A hash of log sources that should be logged. If specified, only messages from
1712
these sources will be logged. Others will be discarded.
1713
 
1714
@property {Object} logInclude
1715
@type object
1716
**/
1717
 
1718
/**
1719
A hash of log sources that should be not be logged. If specified, all sources
1720
will be logged *except* those on this list.
1721
 
1722
@property {Object} logExclude
1723
**/
1724
 
1725
/**
1726
When the YUI seed file is dynamically loaded after the `window.onload` event has
1727
fired, set this to `true` to tell YUI that it shouldn't wait for `window.onload`
1728
to occur.
1729
 
1730
This ensures that components that rely on `window.onload` and the `domready`
1731
custom event will work as expected even when YUI is dynamically injected.
1732
 
1733
@property {Boolean} injected
1734
@default false
1735
**/
1736
 
1737
/**
1738
If `true`, `Y.error()` will generate or re-throw a JavaScript error. Otherwise,
1739
errors are merely logged silently.
1740
 
1741
@property {Boolean} throwFail
1742
@default true
1743
**/
1744
 
1745
/**
1746
Reference to the global object for this execution context.
1747
 
1748
In a browser, this is the current `window` object. In Node.js, this is the
1749
Node.js `global` object.
1750
 
1751
@property {Object} global
1752
**/
1753
 
1754
/**
1755
The browser window or frame that this YUI instance should operate in.
1756
 
1757
When running in Node.js, this property is `undefined`, since there is no
1758
`window` object. Use `global` to get a reference to the global object that will
1759
work in both browsers and Node.js.
1760
 
1761
@property {Window} win
1762
**/
1763
 
1764
/**
1765
The browser `document` object associated with this YUI instance's `win` object.
1766
 
1767
When running in Node.js, this property is `undefined`, since there is no
1768
`document` object.
1769
 
1770
@property {Document} doc
1771
**/
1772
 
1773
/**
1774
A list of modules that defines the YUI core (overrides the default list).
1775
 
1776
@property {Array} core
1777
@type Array
1778
@default ['get', 'features', 'intl-base', 'yui-log', 'yui-later', 'loader-base', 'loader-rollup', 'loader-yui3']
1779
**/
1780
 
1781
/**
1782
A list of languages to use in order of preference.
1783
 
1784
This list is matched against the list of available languages in modules that the
1785
YUI instance uses to determine the best possible localization of language
1786
sensitive modules.
1787
 
1788
Languages are represented using BCP 47 language tags, such as "en-GB" for
1789
English as used in the United Kingdom, or "zh-Hans-CN" for simplified Chinese as
1790
used in China. The list may be provided as a comma-separated string or as an
1791
array.
1792
 
1793
@property {String|String[]} lang
1794
**/
1795
 
1796
/**
1797
Default date format.
1798
 
1799
@property {String} dateFormat
1800
@deprecated Use configuration in `DataType.Date.format()` instead.
1801
**/
1802
 
1803
/**
1804
Default locale.
1805
 
1806
@property {String} locale
1807
@deprecated Use `config.lang` instead.
1808
**/
1809
 
1810
/**
1811
Default generic polling interval in milliseconds.
1812
 
1813
@property {Number} pollInterval
1814
@default 20
1815
**/
1816
 
1817
/**
1818
The number of dynamic `<script>` nodes to insert by default before automatically
1819
removing them when loading scripts.
1820
 
1821
This applies only to script nodes because removing the node will not make the
1822
evaluated script unavailable. Dynamic CSS nodes are not auto purged, because
1823
removing a linked style sheet will also remove the style definitions.
1824
 
1825
@property {Number} purgethreshold
1826
@default 20
1827
**/
1828
 
1829
/**
1830
Delay in milliseconds to wait after a window `resize` event before firing the
1831
event. If another `resize` event occurs before this delay has elapsed, the
1832
delay will start over to ensure that `resize` events are throttled.
1833
 
1834
@property {Number} windowResizeDelay
1835
@default 40
1836
**/
1837
 
1838
/**
1839
Base directory for dynamic loading.
1840
 
1841
@property {String} base
1842
**/
1843
 
1844
/**
1845
Base URL for a dynamic combo handler. This will be used to make combo-handled
1846
module requests if `combine` is set to `true.
1847
 
1848
@property {String} comboBase
1849
@default "http://yui.yahooapis.com/combo?"
1850
**/
1851
 
1852
/**
1853
Root path to prepend to each module path when creating a combo-handled request.
1854
 
1855
This is updated for each YUI release to point to a specific version of the
1856
library; for example: "3.8.0/build/".
1857
 
1858
@property {String} root
1859
**/
1860
 
1861
/**
1862
Filter to apply to module urls. This filter will modify the default path for all
1863
modules.
1864
 
1865
The default path for the YUI library is the minified version of the files (e.g.,
1866
event-min.js). The filter property can be a predefined filter or a custom
1867
filter. The valid predefined filters are:
1868
 
1869
  - **debug**: Loads debug versions of modules (e.g., event-debug.js).
1870
  - **raw**: Loads raw, non-minified versions of modules without debug logging
1871
    (e.g., event.js).
1872
 
1873
You can also define a custom filter, which must be an object literal containing
1874
a search regular expression and a replacement string:
1875
 
1876
    myFilter: {
1877
        searchExp : "-min\\.js",
1878
        replaceStr: "-debug.js"
1879
    }
1880
 
1881
@property {Object|String} filter
1882
**/
1883
 
1884
/**
1885
Skin configuration and customizations.
1886
 
1887
@property {Object} skin
1888
@param {String} [skin.defaultSkin='sam'] Default skin name. This skin will be
1889
    applied automatically to skinnable components if not overridden by a
1890
    component-specific skin name.
1891
@param {String} [skin.base='assets/skins/'] Default base path for a skin,
1892
    relative to Loader's `base` path.
1893
@param {Object} [skin.overrides] Component-specific skin name overrides. Specify
1894
    a component name as the key and, as the value, a string or array of strings
1895
    for a skin or skins that should be loaded for that component instead of the
1896
    `defaultSkin`.
1897
**/
1898
 
1899
/**
1900
Hash of per-component filter specifications. If specified for a given component,
1901
this overrides the global `filter` config.
1902
 
1903
@example
1904
    YUI({
1905
        modules: {
1906
            'foo': './foo.js',
1907
            'bar': './bar.js',
1908
            'baz': './baz.js'
1909
        },
1910
        filters: {
1911
            'foo': {
1912
                searchExp: '.js',
1913
                replaceStr: '-coverage.js'
1914
            }
1915
        }
1916
    }).use('foo', 'bar', 'baz', function (Y) {
1917
        // foo-coverage.js is loaded
1918
        // bar.js is loaded
1919
        // baz.js is loaded
1920
    });
1921
 
1922
@property {Object} filters
1923
**/
1924
 
1925
/**
1926
If `true`, YUI will use a combo handler to load multiple modules in as few
1927
requests as possible.
1928
 
1929
The YUI CDN (which YUI uses by default) supports combo handling, but other
1930
servers may not. If the server from which you're loading YUI does not support
1931
combo handling, set this to `false`.
1932
 
1933
Providing a value for the `base` config property will cause `combine` to default
1934
to `false` instead of `true`.
1935
 
1936
@property {Boolean} combine
1937
@default true
1938
*/
1939
 
1940
/**
1941
Array of module names that should never be dynamically loaded.
1942
 
1943
@property {String[]} ignore
1944
**/
1945
 
1946
/**
1947
Array of module names that should always be loaded when required, even if
1948
already present on the page.
1949
 
1950
@property {String[]} force
1951
**/
1952
 
1953
/**
1954
DOM element or id that should be used as the insertion point for dynamically
1955
added `<script>` and `<link>` nodes.
1956
 
1957
@property {HTMLElement|String} insertBefore
1958
**/
1959
 
1960
/**
1961
Object hash containing attributes to add to dynamically added `<script>` nodes.
1962
 
1963
@property {Object} jsAttributes
1964
**/
1965
 
1966
/**
1967
Object hash containing attributes to add to dynamically added `<link>` nodes.
1968
 
1969
@property {Object} cssAttributes
1970
**/
1971
 
1972
/**
1973
Timeout in milliseconds before a dynamic JS or CSS request will be considered a
1974
failure. If not set, no timeout will be enforced.
1975
 
1976
@property {Number} timeout
1977
**/
1978
 
1979
/**
1980
A hash of module definitions to add to the list of available YUI modules. These
1981
modules can then be dynamically loaded via the `use()` method.
1982
 
1983
This is a hash in which keys are module names and values are objects containing
1984
module metadata.
1985
 
1986
See `Loader.addModule()` for the supported module metadata fields. Also see
1987
`groups`, which provides a way to configure the base and combo spec for a set of
1988
modules.
1989
 
1990
@example
1991
 
1992
    modules: {
1993
        mymod1: {
1994
            requires: ['node'],
1995
            fullpath: '/mymod1/mymod1.js'
1996
        },
1997
 
1998
        mymod2: {
1999
            requires: ['mymod1'],
2000
            fullpath: '/mymod2/mymod2.js'
2001
        },
2002
 
2003
        mymod3: '/js/mymod3.js',
2004
        mycssmod: '/css/mycssmod.css'
2005
    }
2006
 
2007
@property {Object} modules
2008
**/
2009
 
2010
/**
2011
Aliases are dynamic groups of modules that can be used as shortcuts.
2012
 
2013
@example
2014
 
2015
    YUI({
2016
        aliases: {
2017
            davglass: [ 'node', 'yql', 'dd' ],
2018
            mine: [ 'davglass', 'autocomplete']
2019
        }
2020
    }).use('mine', function (Y) {
2021
        // Node, YQL, DD & AutoComplete available here.
2022
    });
2023
 
2024
@property {Object} aliases
2025
**/
2026
 
2027
/**
2028
A hash of module group definitions.
2029
 
2030
For each group you can specify a list of modules and the base path and
2031
combo spec to use when dynamically loading the modules.
2032
 
2033
@example
2034
 
2035
    groups: {
2036
        yui2: {
2037
            // specify whether or not this group has a combo service
2038
            combine: true,
2039
 
2040
            // The comboSeperator to use with this group's combo handler
2041
            comboSep: ';',
2042
 
2043
            // The maxURLLength for this server
2044
            maxURLLength: 500,
2045
 
2046
            // the base path for non-combo paths
2047
            base: 'http://yui.yahooapis.com/2.8.0r4/build/',
2048
 
2049
            // the path to the combo service
2050
            comboBase: 'http://yui.yahooapis.com/combo?',
2051
 
2052
            // a fragment to prepend to the path attribute when
2053
            // when building combo urls
2054
            root: '2.8.0r4/build/',
2055
 
2056
            // the module definitions
2057
            modules:  {
2058
                yui2_yde: {
2059
                    path: "yahoo-dom-event/yahoo-dom-event.js"
2060
                },
2061
                yui2_anim: {
2062
                    path: "animation/animation.js",
2063
                    requires: ['yui2_yde']
2064
                }
2065
            }
2066
        }
2067
    }
2068
 
2069
@property {Object} groups
2070
**/
2071
 
2072
/**
2073
Path to the Loader JS file, relative to the `base` path.
2074
 
2075
This is used to dynamically bootstrap the Loader when it's needed and isn't yet
2076
available.
2077
 
2078
@property {String} loaderPath
2079
@default "loader/loader-min.js"
2080
**/
2081
 
2082
/**
2083
If `true`, YUI will attempt to load CSS dependencies and skins. Set this to
2084
`false` to prevent YUI from loading any CSS, or set it to the string `"force"`
2085
to force CSS dependencies to be loaded even if their associated JS modules are
2086
already loaded.
2087
 
2088
@property {Boolean|String} fetchCSS
2089
@default true
2090
**/
2091
 
2092
/**
2093
Default gallery version used to build gallery module urls.
2094
 
2095
@property {String} gallery
2096
@since 3.1.0
2097
**/
2098
 
2099
/**
2100
Default YUI 2 version used to build YUI 2 module urls.
2101
 
2102
This is used for intrinsic YUI 2 support via the 2in3 project. Also see the
2103
`2in3` config for pulling different revisions of the wrapped YUI 2 modules.
2104
 
2105
@property {String} yui2
2106
@default "2.9.0"
2107
@since 3.1.0
2108
**/
2109
 
2110
/**
2111
Revision number of YUI 2in3 modules that should be used when loading YUI 2in3.
2112
 
2113
@property {String} 2in3
2114
@default "4"
2115
@since 3.1.0
2116
**/
2117
 
2118
/**
2119
Alternate console log function that should be used in environments without a
2120
supported native console. This function is executed with the YUI instance as its
2121
`this` object.
2122
 
2123
@property {Function} logFn
2124
@since 3.1.0
2125
**/
2126
 
2127
/**
2128
The minimum log level to log messages for. Log levels are defined
2129
incrementally. Messages greater than or equal to the level specified will
2130
be shown. All others will be discarded. The order of log levels in
2131
increasing priority is:
2132
 
2133
    debug
2134
    info
2135
    warn
2136
    error
2137
 
2138
@property {String} logLevel
2139
@default 'debug'
2140
@since 3.10.0
2141
**/
2142
 
2143
/**
2144
Callback to execute when `Y.error()` is called. It receives the error message
2145
and a JavaScript error object if one was provided.
2146
 
2147
This function is executed with the YUI instance as its `this` object.
2148
 
2149
Returning `true` from this function will prevent an exception from being thrown.
2150
 
2151
@property {Function} errorFn
2152
@param {String} errorFn.msg Error message
2153
@param {Object} [errorFn.err] Error object (if one was provided).
2154
@since 3.2.0
2155
**/
2156
 
2157
/**
2158
A callback to execute when Loader fails to load one or more resources.
2159
 
2160
This could be because of a script load failure. It could also be because a
2161
module fails to register itself when the `requireRegistration` config is `true`.
2162
 
2163
If this function is defined, the `use()` callback will only be called when the
2164
loader succeeds. Otherwise, `use()` will always executes unless there was a
2165
JavaScript error when attaching a module.
2166
 
2167
@property {Function} loadErrorFn
2168
@since 3.3.0
2169
**/
2170
 
2171
/**
2172
If `true`, Loader will expect all loaded scripts to be first-class YUI modules
2173
that register themselves with the YUI global, and will trigger a failure if a
2174
loaded script does not register a YUI module.
2175
 
2176
@property {Boolean} requireRegistration
2177
@default false
2178
@since 3.3.0
2179
**/
2180
 
2181
/**
2182
Cache serviced use() requests.
2183
 
2184
@property {Boolean} cacheUse
2185
@default true
2186
@since 3.3.0
2187
@deprecated No longer used.
2188
**/
2189
 
2190
/**
2191
Whether or not YUI should use native ES5 functionality when available for
2192
features like `Y.Array.each()`, `Y.Object()`, etc.
2193
 
2194
When `false`, YUI will always use its own fallback implementations instead of
2195
relying on ES5 functionality, even when ES5 functionality is available.
2196
 
2197
@property {Boolean} useNativeES5
2198
@default true
2199
@since 3.5.0
2200
**/
2201
 
2202
/**
2203
 * Leverage native JSON stringify if the browser has a native
2204
 * implementation.  In general, this is a good idea.  See the Known Issues
2205
 * section in the JSON user guide for caveats.  The default value is true
2206
 * for browsers with native JSON support.
2207
 *
2208
 * @property useNativeJSONStringify
2209
 * @type Boolean
2210
 * @default true
2211
 * @since 3.8.0
2212
 */
2213
 
2214
 /**
2215
 * Leverage native JSON parse if the browser has a native implementation.
2216
 * In general, this is a good idea.  See the Known Issues section in the
2217
 * JSON user guide for caveats.  The default value is true for browsers with
2218
 * native JSON support.
2219
 *
2220
 * @property useNativeJSONParse
2221
 * @type Boolean
2222
 * @default true
2223
 * @since 3.8.0
2224
 */
2225
 
2226
/**
2227
Delay the `use` callback until a specific event has passed (`load`, `domready`, `contentready` or `available`)
2228
 
2229
@property {Object|String} delayUntil
2230
@since 3.6.0
2231
@example
2232
 
2233
You can use `load` or `domready` strings by default:
2234
 
2235
    YUI({
2236
        delayUntil: 'domready'
2237
    }, function (Y) {
2238
        // This will not execute until 'domeready' occurs.
2239
    });
2240
 
2241
Or you can delay until a node is available (with `available` or `contentready`):
2242
 
2243
    YUI({
2244
        delayUntil: {
2245
            event: 'available',
2246
            args : '#foo'
2247
        }
2248
    }, function (Y) {
2249
        // This will not execute until a node matching the selector "#foo" is
2250
        // available in the DOM.
2251
    });
2252
 
2253
**/
2254
YUI.add('yui-base', function (Y, NAME) {
2255
 
2256
/*
2257
 * YUI stub
2258
 * @module yui
2259
 * @submodule yui-base
2260
 */
2261
/**
2262
 * The YUI module contains the components required for building the YUI
2263
 * seed file.  This includes the script loading mechanism, a simple queue,
2264
 * and the core utilities for the library.
2265
 * @module yui
2266
 * @submodule yui-base
2267
 */
2268
 
2269
/**
2270
 * Provides core language utilites and extensions used throughout YUI.
2271
 *
2272
 * @class Lang
2273
 * @static
2274
 */
2275
 
2276
var L = Y.Lang || (Y.Lang = {}),
2277
 
2278
STRING_PROTO = String.prototype,
2279
TOSTRING     = Object.prototype.toString,
2280
 
2281
TYPES = {
2282
    'undefined'        : 'undefined',
2283
    'number'           : 'number',
2284
    'boolean'          : 'boolean',
2285
    'string'           : 'string',
2286
    '[object Function]': 'function',
2287
    '[object RegExp]'  : 'regexp',
2288
    '[object Array]'   : 'array',
2289
    '[object Date]'    : 'date',
2290
    '[object Error]'   : 'error'
2291
},
2292
 
2293
SUBREGEX         = /\{\s*([^|}]+?)\s*(?:\|([^}]*))?\s*\}/g,
2294
 
2295
WHITESPACE       = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF",
2296
WHITESPACE_CLASS = "[\x09-\x0D\x20\xA0\u1680\u180E\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]+",
2297
TRIM_LEFT_REGEX  = new RegExp("^" + WHITESPACE_CLASS),
2298
TRIM_RIGHT_REGEX = new RegExp(WHITESPACE_CLASS + "$"),
2299
TRIMREGEX        = new RegExp(TRIM_LEFT_REGEX.source + "|" + TRIM_RIGHT_REGEX.source, "g"),
2300
 
2301
NATIVE_FN_REGEX  = /\{\s*\[(?:native code|function)\]\s*\}/i;
2302
 
2303
// -- Protected Methods --------------------------------------------------------
2304
 
2305
/**
2306
Returns `true` if the given function appears to be implemented in native code,
2307
`false` otherwise. Will always return `false` -- even in ES5-capable browsers --
2308
if the `useNativeES5` YUI config option is set to `false`.
2309
 
2310
This isn't guaranteed to be 100% accurate and won't work for anything other than
2311
functions, but it can be useful for determining whether a function like
2312
`Array.prototype.forEach` is native or a JS shim provided by another library.
2313
 
2314
There's a great article by @kangax discussing certain flaws with this technique:
2315
<http://perfectionkills.com/detecting-built-in-host-methods/>
2316
 
2317
While his points are valid, it's still possible to benefit from this function
2318
as long as it's used carefully and sparingly, and in such a way that false
2319
negatives have minimal consequences. It's used internally to avoid using
2320
potentially broken non-native ES5 shims that have been added to the page by
2321
other libraries.
2322
 
2323
@method _isNative
2324
@param {Function} fn Function to test.
2325
@return {Boolean} `true` if _fn_ appears to be native, `false` otherwise.
2326
@static
2327
@protected
2328
@since 3.5.0
2329
**/
2330
L._isNative = function (fn) {
2331
    return !!(Y.config.useNativeES5 && fn && NATIVE_FN_REGEX.test(fn));
2332
};
2333
 
2334
// -- Public Methods -----------------------------------------------------------
2335
 
2336
/**
2337
 * Determines whether or not the provided item is an array.
2338
 *
2339
 * Returns `false` for array-like collections such as the function `arguments`
2340
 * collection or `HTMLElement` collections. Use `Y.Array.test()` if you want to
2341
 * test for an array-like collection.
2342
 *
2343
 * @method isArray
2344
 * @param o The object to test.
2345
 * @return {boolean} true if o is an array.
2346
 * @static
2347
 */
2348
L.isArray = L._isNative(Array.isArray) ? Array.isArray : function (o) {
2349
    return L.type(o) === 'array';
2350
};
2351
 
2352
/**
2353
 * Determines whether or not the provided item is a boolean.
2354
 * @method isBoolean
2355
 * @static
2356
 * @param o The object to test.
2357
 * @return {boolean} true if o is a boolean.
2358
 */
2359
L.isBoolean = function(o) {
2360
    return typeof o === 'boolean';
2361
};
2362
 
2363
/**
2364
 * Determines whether or not the supplied item is a date instance.
2365
 * @method isDate
2366
 * @static
2367
 * @param o The object to test.
2368
 * @return {boolean} true if o is a date.
2369
 */
2370
L.isDate = function(o) {
2371
    return L.type(o) === 'date' && o.toString() !== 'Invalid Date' && !isNaN(o);
2372
};
2373
 
2374
/**
2375
 * <p>
2376
 * Determines whether or not the provided item is a function.
2377
 * Note: Internet Explorer thinks certain functions are objects:
2378
 * </p>
2379
 *
2380
 * <pre>
2381
 * var obj = document.createElement("object");
2382
 * Y.Lang.isFunction(obj.getAttribute) // reports false in IE
2383
 * &nbsp;
2384
 * var input = document.createElement("input"); // append to body
2385
 * Y.Lang.isFunction(input.focus) // reports false in IE
2386
 * </pre>
2387
 *
2388
 * <p>
2389
 * You will have to implement additional tests if these functions
2390
 * matter to you.
2391
 * </p>
2392
 *
2393
 * @method isFunction
2394
 * @static
2395
 * @param o The object to test.
2396
 * @return {boolean} true if o is a function.
2397
 */
2398
L.isFunction = function(o) {
2399
    return L.type(o) === 'function';
2400
};
2401
 
2402
/**
2403
 * Determines whether or not the provided item is null.
2404
 * @method isNull
2405
 * @static
2406
 * @param o The object to test.
2407
 * @return {boolean} true if o is null.
2408
 */
2409
L.isNull = function(o) {
2410
    return o === null;
2411
};
2412
 
2413
/**
2414
 * Determines whether or not the provided item is a legal number.
2415
 * @method isNumber
2416
 * @static
2417
 * @param o The object to test.
2418
 * @return {boolean} true if o is a number.
2419
 */
2420
L.isNumber = function(o) {
2421
    return typeof o === 'number' && isFinite(o);
2422
};
2423
 
2424
/**
2425
 * Determines whether or not the provided item is of type object
2426
 * or function. Note that arrays are also objects, so
2427
 * <code>Y.Lang.isObject([]) === true</code>.
2428
 * @method isObject
2429
 * @static
2430
 * @param o The object to test.
2431
 * @param failfn {boolean} fail if the input is a function.
2432
 * @return {boolean} true if o is an object.
2433
 * @see isPlainObject
2434
 */
2435
L.isObject = function(o, failfn) {
2436
    var t = typeof o;
2437
    return (o && (t === 'object' ||
2438
        (!failfn && (t === 'function' || L.isFunction(o))))) || false;
2439
};
2440
 
2441
/**
2442
 * Determines whether or not the provided value is a regexp.
2443
 * @method isRegExp
2444
 * @static
2445
 * @param value The value or object to test.
2446
 * @return {boolean} true if value is a regexp.
2447
 */
2448
L.isRegExp = function(value) {
2449
    return L.type(value) === 'regexp';
2450
};
2451
 
2452
/**
2453
 * Determines whether or not the provided item is a string.
2454
 * @method isString
2455
 * @static
2456
 * @param o The object to test.
2457
 * @return {boolean} true if o is a string.
2458
 */
2459
L.isString = function(o) {
2460
    return typeof o === 'string';
2461
};
2462
 
2463
/**
2464
 * Determines whether or not the provided item is undefined.
2465
 * @method isUndefined
2466
 * @static
2467
 * @param o The object to test.
2468
 * @return {boolean} true if o is undefined.
2469
 */
2470
L.isUndefined = function(o) {
2471
    return typeof o === 'undefined';
2472
};
2473
 
2474
/**
2475
 * A convenience method for detecting a legitimate non-null value.
2476
 * Returns false for null/undefined/NaN, true for other values,
2477
 * including 0/false/''
2478
 * @method isValue
2479
 * @static
2480
 * @param o The item to test.
2481
 * @return {boolean} true if it is not null/undefined/NaN || false.
2482
 */
2483
L.isValue = function(o) {
2484
    var t = L.type(o);
2485
 
2486
    switch (t) {
2487
        case 'number':
2488
            return isFinite(o);
2489
 
2490
        case 'null': // fallthru
2491
        case 'undefined':
2492
            return false;
2493
 
2494
        default:
2495
            return !!t;
2496
    }
2497
};
2498
 
2499
/**
2500
 * Returns the current time in milliseconds.
2501
 *
2502
 * @method now
2503
 * @return {Number} Current time in milliseconds.
2504
 * @static
2505
 * @since 3.3.0
2506
 */
2507
L.now = Date.now || function () {
2508
    return new Date().getTime();
2509
};
2510
 
2511
/**
2512
 * Performs `{placeholder}` substitution on a string. The object passed as the
2513
 * second parameter provides values to replace the `{placeholder}`s.
2514
 * `{placeholder}` token names must match property names of the object. For example,
2515
 *
2516
 *`var greeting = Y.Lang.sub("Hello, {who}!", { who: "World" });`
2517
 *
2518
 * `{placeholder}` tokens that are undefined on the object map will be left
2519
 * in tact (leaving unsightly `{placeholder}`'s in the output string).
2520
 *
2521
 * @method sub
2522
 * @param {string} s String to be modified.
2523
 * @param {object} o Object containing replacement values.
2524
 * @return {string} the substitute result.
2525
 * @static
2526
 * @since 3.2.0
2527
 */
2528
L.sub = function(s, o) {
2529
 
2530
    /**
2531
    Finds the value of `key` in given object.
2532
    If the key has a 'dot' notation e.g. 'foo.bar.baz', the function will
2533
    try to resolve this path if it doesn't exist as a property
2534
    @example
2535
        value({ 'a.b': 1, a: { b: 2 } }, 'a.b'); // 1
2536
        value({ a: { b: 2 } }          , 'a.b'); // 2
2537
    @param {Object} obj A key/value pairs object
2538
    @param {String} key
2539
    @return {Any}
2540
    @private
2541
    **/
2542
    function value(obj, key) {
2543
 
2544
        var subkey;
2545
 
2546
        if ( typeof obj[key] !== 'undefined' ) {
2547
            return obj[key];
2548
        }
2549
 
2550
        key    = key.split('.');         // given 'a.b.c'
2551
        subkey = key.slice(1).join('.'); // 'b.c'
2552
        key    = key[0];                 // 'a'
2553
 
2554
        // special case for null as typeof returns object and we don't want that.
2555
        if ( subkey && typeof obj[key] === 'object' && obj[key] !== null ) {
2556
            return value(obj[key], subkey);
2557
        }
2558
    }
2559
 
2560
    return s.replace ? s.replace(SUBREGEX, function (match, key) {
2561
        var val = key.indexOf('.')>-1 ? value(o, key) : o[key];
2562
        return typeof val === 'undefined' ? match : val;
2563
    }) : s;
2564
};
2565
 
2566
/**
2567
 * Returns a string without any leading or trailing whitespace.  If
2568
 * the input is not a string, the input will be returned untouched.
2569
 * @method trim
2570
 * @static
2571
 * @param s {string} the string to trim.
2572
 * @return {string} the trimmed string.
2573
 */
2574
L.trim = L._isNative(STRING_PROTO.trim) && !WHITESPACE.trim() ? function(s) {
2575
    return s && s.trim ? s.trim() : s;
2576
} : function (s) {
2577
    try {
2578
        return s.replace(TRIMREGEX, '');
2579
    } catch (e) {
2580
        return s;
2581
    }
2582
};
2583
 
2584
/**
2585
 * Returns a string without any leading whitespace.
2586
 * @method trimLeft
2587
 * @static
2588
 * @param s {string} the string to trim.
2589
 * @return {string} the trimmed string.
2590
 */
2591
L.trimLeft = L._isNative(STRING_PROTO.trimLeft) && !WHITESPACE.trimLeft() ? function (s) {
2592
    return s.trimLeft();
2593
} : function (s) {
2594
    return s.replace(TRIM_LEFT_REGEX, '');
2595
};
2596
 
2597
/**
2598
 * Returns a string without any trailing whitespace.
2599
 * @method trimRight
2600
 * @static
2601
 * @param s {string} the string to trim.
2602
 * @return {string} the trimmed string.
2603
 */
2604
L.trimRight = L._isNative(STRING_PROTO.trimRight) && !WHITESPACE.trimRight() ? function (s) {
2605
    return s.trimRight();
2606
} : function (s) {
2607
    return s.replace(TRIM_RIGHT_REGEX, '');
2608
};
2609
 
2610
/**
2611
Returns one of the following strings, representing the type of the item passed
2612
in:
2613
 
2614
 * "array"
2615
 * "boolean"
2616
 * "date"
2617
 * "error"
2618
 * "function"
2619
 * "null"
2620
 * "number"
2621
 * "object"
2622
 * "regexp"
2623
 * "string"
2624
 * "undefined"
2625
 
2626
Known issues:
2627
 
2628
 * `typeof HTMLElementCollection` returns function in Safari, but
2629
    `Y.Lang.type()` reports "object", which could be a good thing --
2630
    but it actually caused the logic in <code>Y.Lang.isObject</code> to fail.
2631
 
2632
@method type
2633
@param o the item to test.
2634
@return {string} the detected type.
2635
@static
2636
**/
2637
L.type = function(o) {
2638
    return TYPES[typeof o] || TYPES[TOSTRING.call(o)] || (o ? 'object' : 'null');
2639
};
2640
/**
2641
@module yui
2642
@submodule yui-base
2643
*/
2644
 
2645
var Lang   = Y.Lang,
2646
    Native = Array.prototype,
2647
 
2648
    hasOwn = Object.prototype.hasOwnProperty;
2649
 
2650
/**
2651
Provides utility methods for working with arrays. Additional array helpers can
2652
be found in the `collection` and `array-extras` modules.
2653
 
2654
`Y.Array(thing)` returns a native array created from _thing_. Depending on
2655
_thing_'s type, one of the following will happen:
2656
 
2657
  * Arrays are returned unmodified unless a non-zero _startIndex_ is
2658
    specified.
2659
  * Array-like collections (see `Array.test()`) are converted to arrays.
2660
  * For everything else, a new array is created with _thing_ as the sole
2661
    item.
2662
 
2663
Note: elements that are also collections, such as `<form>` and `<select>`
2664
elements, are not automatically converted to arrays. To force a conversion,
2665
pass `true` as the value of the _force_ parameter.
2666
 
2667
@class Array
2668
@constructor
2669
@param {Any} thing The thing to arrayify.
2670
@param {Number} [startIndex=0] If non-zero and _thing_ is an array or array-like
2671
  collection, a subset of items starting at the specified index will be
2672
  returned.
2673
@param {Boolean} [force=false] If `true`, _thing_ will be treated as an
2674
  array-like collection no matter what.
2675
@return {Array} A native array created from _thing_, according to the rules
2676
  described above.
2677
**/
2678
function YArray(thing, startIndex, force) {
2679
    var len, result;
2680
 
2681
    /*jshint expr: true*/
2682
    startIndex || (startIndex = 0);
2683
 
2684
    if (force || YArray.test(thing)) {
2685
        // IE throws when trying to slice HTMLElement collections.
2686
        try {
2687
            return Native.slice.call(thing, startIndex);
2688
        } catch (ex) {
2689
            result = [];
2690
 
2691
            for (len = thing.length; startIndex < len; ++startIndex) {
2692
                result.push(thing[startIndex]);
2693
            }
2694
 
2695
            return result;
2696
        }
2697
    }
2698
 
2699
    return [thing];
2700
}
2701
 
2702
Y.Array = YArray;
2703
 
2704
/**
2705
Dedupes an array of strings, returning an array that's guaranteed to contain
2706
only one copy of a given string.
2707
 
2708
This method differs from `Array.unique()` in that it's optimized for use only
2709
with arrays consisting entirely of strings or entirely of numbers, whereas
2710
`unique` may be used with other value types (but is slower).
2711
 
2712
Using `dedupe()` with values other than strings or numbers, or with arrays
2713
containing a mix of strings and numbers, may result in unexpected behavior.
2714
 
2715
@method dedupe
2716
@param {String[]|Number[]} array Array of strings or numbers to dedupe.
2717
@return {Array} Copy of _array_ containing no duplicate values.
2718
@static
2719
@since 3.4.0
2720
**/
2721
YArray.dedupe = Lang._isNative(Object.create) ? function (array) {
2722
    var hash    = Object.create(null),
2723
        results = [],
2724
        i, item, len;
2725
 
2726
    for (i = 0, len = array.length; i < len; ++i) {
2727
        item = array[i];
2728
 
2729
        if (!hash[item]) {
2730
            hash[item] = 1;
2731
            results.push(item);
2732
        }
2733
    }
2734
 
2735
    return results;
2736
} : function (array) {
2737
    var hash    = {},
2738
        results = [],
2739
        i, item, len;
2740
 
2741
    for (i = 0, len = array.length; i < len; ++i) {
2742
        item = array[i];
2743
 
2744
        if (!hasOwn.call(hash, item)) {
2745
            hash[item] = 1;
2746
            results.push(item);
2747
        }
2748
    }
2749
 
2750
    return results;
2751
};
2752
 
2753
/**
2754
Executes the supplied function on each item in the array. This method wraps
2755
the native ES5 `Array.forEach()` method if available.
2756
 
2757
@method each
2758
@param {Array} array Array to iterate.
2759
@param {Function} fn Function to execute on each item in the array. The function
2760
  will receive the following arguments:
2761
    @param {Any} fn.item Current array item.
2762
    @param {Number} fn.index Current array index.
2763
    @param {Array} fn.array Array being iterated.
2764
@param {Object} [thisObj] `this` object to use when calling _fn_.
2765
@return {YUI} The YUI instance.
2766
@static
2767
**/
2768
YArray.each = YArray.forEach = Lang._isNative(Native.forEach) ? function (array, fn, thisObj) {
2769
    Native.forEach.call(array || [], fn, thisObj || Y);
2770
    return Y;
2771
} : function (array, fn, thisObj) {
2772
    for (var i = 0, len = (array && array.length) || 0; i < len; ++i) {
2773
        if (i in array) {
2774
            fn.call(thisObj || Y, array[i], i, array);
2775
        }
2776
    }
2777
 
2778
    return Y;
2779
};
2780
 
2781
/**
2782
Alias for `each()`.
2783
 
2784
@method forEach
2785
@static
2786
**/
2787
 
2788
/**
2789
Returns an object using the first array as keys and the second as values. If
2790
the second array is not provided, or if it doesn't contain the same number of
2791
values as the first array, then `true` will be used in place of the missing
2792
values.
2793
 
2794
@example
2795
 
2796
    Y.Array.hash(['a', 'b', 'c'], ['foo', 'bar']);
2797
    // => {a: 'foo', b: 'bar', c: true}
2798
 
2799
@method hash
2800
@param {String[]} keys Array of strings to use as keys.
2801
@param {Array} [values] Array to use as values.
2802
@return {Object} Hash using the first array as keys and the second as values.
2803
@static
2804
**/
2805
YArray.hash = function (keys, values) {
2806
    var hash = {},
2807
        vlen = (values && values.length) || 0,
2808
        i, len;
2809
 
2810
    for (i = 0, len = keys.length; i < len; ++i) {
2811
        if (i in keys) {
2812
            hash[keys[i]] = vlen > i && i in values ? values[i] : true;
2813
        }
2814
    }
2815
 
2816
    return hash;
2817
};
2818
 
2819
/**
2820
Returns the index of the first item in the array that's equal (using a strict
2821
equality check) to the specified _value_, or `-1` if the value isn't found.
2822
 
2823
This method wraps the native ES5 `Array.indexOf()` method if available.
2824
 
2825
@method indexOf
2826
@param {Array} array Array to search.
2827
@param {Any} value Value to search for.
2828
@param {Number} [from=0] The index at which to begin the search.
2829
@return {Number} Index of the item strictly equal to _value_, or `-1` if not
2830
    found.
2831
@static
2832
**/
2833
YArray.indexOf = Lang._isNative(Native.indexOf) ? function (array, value, from) {
2834
    return Native.indexOf.call(array, value, from);
2835
} : function (array, value, from) {
2836
    // http://es5.github.com/#x15.4.4.14
2837
    var len = array.length;
2838
 
2839
    from = +from || 0;
2840
    from = (from > 0 || -1) * Math.floor(Math.abs(from));
2841
 
2842
    if (from < 0) {
2843
        from += len;
2844
 
2845
        if (from < 0) {
2846
            from = 0;
2847
        }
2848
    }
2849
 
2850
    for (; from < len; ++from) {
2851
        if (from in array && array[from] === value) {
2852
            return from;
2853
        }
2854
    }
2855
 
2856
    return -1;
2857
};
2858
 
2859
/**
2860
Numeric sort convenience function.
2861
 
2862
The native `Array.prototype.sort()` function converts values to strings and
2863
sorts them in lexicographic order, which is unsuitable for sorting numeric
2864
values. Provide `Array.numericSort` as a custom sort function when you want
2865
to sort values in numeric order.
2866
 
2867
@example
2868
 
2869
    [42, 23, 8, 16, 4, 15].sort(Y.Array.numericSort);
2870
    // => [4, 8, 15, 16, 23, 42]
2871
 
2872
@method numericSort
2873
@param {Number} a First value to compare.
2874
@param {Number} b Second value to compare.
2875
@return {Number} Difference between _a_ and _b_.
2876
@static
2877
**/
2878
YArray.numericSort = function (a, b) {
2879
    return a - b;
2880
};
2881
 
2882
/**
2883
Executes the supplied function on each item in the array. Returning a truthy
2884
value from the function will stop the processing of remaining items.
2885
 
2886
@method some
2887
@param {Array} array Array to iterate over.
2888
@param {Function} fn Function to execute on each item. The function will receive
2889
  the following arguments:
2890
    @param {Any} fn.value Current array item.
2891
    @param {Number} fn.index Current array index.
2892
    @param {Array} fn.array Array being iterated over.
2893
@param {Object} [thisObj] `this` object to use when calling _fn_.
2894
@return {Boolean} `true` if the function returns a truthy value on any of the
2895
  items in the array; `false` otherwise.
2896
@static
2897
**/
2898
YArray.some = Lang._isNative(Native.some) ? function (array, fn, thisObj) {
2899
    return Native.some.call(array, fn, thisObj);
2900
} : function (array, fn, thisObj) {
2901
    for (var i = 0, len = array.length; i < len; ++i) {
2902
        if (i in array && fn.call(thisObj, array[i], i, array)) {
2903
            return true;
2904
        }
2905
    }
2906
 
2907
    return false;
2908
};
2909
 
2910
/**
2911
Evaluates _obj_ to determine if it's an array, an array-like collection, or
2912
something else. This is useful when working with the function `arguments`
2913
collection and `HTMLElement` collections.
2914
 
2915
Note: This implementation doesn't consider elements that are also
2916
collections, such as `<form>` and `<select>`, to be array-like.
2917
 
2918
@method test
2919
@param {Object} obj Object to test.
2920
@return {Number} A number indicating the results of the test:
2921
 
2922
  * 0: Neither an array nor an array-like collection.
2923
  * 1: Real array.
2924
  * 2: Array-like collection.
2925
 
2926
@static
2927
**/
2928
YArray.test = function (obj) {
2929
    var result = 0;
2930
 
2931
    if (Lang.isArray(obj)) {
2932
        result = 1;
2933
    } else if (Lang.isObject(obj)) {
2934
        try {
2935
            // indexed, but no tagName (element) or scrollTo/document (window. From DOM.isWindow test which we can't use here),
2936
            // or functions without apply/call (Safari
2937
            // HTMLElementCollection bug).
2938
            if ('length' in obj && !obj.tagName && !(obj.scrollTo && obj.document) && !obj.apply) {
2939
                result = 2;
2940
            }
2941
        } catch (ex) {}
2942
    }
2943
 
2944
    return result;
2945
};
2946
/**
2947
 * The YUI module contains the components required for building the YUI
2948
 * seed file.  This includes the script loading mechanism, a simple queue,
2949
 * and the core utilities for the library.
2950
 * @module yui
2951
 * @submodule yui-base
2952
 */
2953
 
2954
/**
2955
 * A simple FIFO queue.  Items are added to the Queue with add(1..n items) and
2956
 * removed using next().
2957
 *
2958
 * @class Queue
2959
 * @constructor
2960
 * @param {MIXED} item* 0..n items to seed the queue.
2961
 */
2962
function Queue() {
2963
    this._init();
2964
    this.add.apply(this, arguments);
2965
}
2966
 
2967
Queue.prototype = {
2968
    /**
2969
     * Initialize the queue
2970
     *
2971
     * @method _init
2972
     * @protected
2973
     */
2974
    _init: function() {
2975
        /**
2976
         * The collection of enqueued items
2977
         *
2978
         * @property _q
2979
         * @type Array
2980
         * @protected
2981
         */
2982
        this._q = [];
2983
    },
2984
 
2985
    /**
2986
     * Get the next item in the queue. FIFO support
2987
     *
2988
     * @method next
2989
     * @return {MIXED} the next item in the queue.
2990
     */
2991
    next: function() {
2992
        return this._q.shift();
2993
    },
2994
 
2995
    /**
2996
     * Get the last in the queue. LIFO support.
2997
     *
2998
     * @method last
2999
     * @return {MIXED} the last item in the queue.
3000
     */
3001
    last: function() {
3002
        return this._q.pop();
3003
    },
3004
 
3005
    /**
3006
     * Add 0..n items to the end of the queue.
3007
     *
3008
     * @method add
3009
     * @param {MIXED} item* 0..n items.
3010
     * @return {object} this queue.
3011
     */
3012
    add: function() {
3013
        this._q.push.apply(this._q, arguments);
3014
 
3015
        return this;
3016
    },
3017
 
3018
    /**
3019
     * Returns the current number of queued items.
3020
     *
3021
     * @method size
3022
     * @return {Number} The size.
3023
     */
3024
    size: function() {
3025
        return this._q.length;
3026
    }
3027
};
3028
 
3029
Y.Queue = Queue;
3030
 
3031
YUI.Env._loaderQueue = YUI.Env._loaderQueue || new Queue();
3032
 
3033
/**
3034
The YUI module contains the components required for building the YUI seed file.
3035
This includes the script loading mechanism, a simple queue, and the core
3036
utilities for the library.
3037
 
3038
@module yui
3039
@submodule yui-base
3040
**/
3041
 
3042
var CACHED_DELIMITER = '__',
3043
 
3044
    hasOwn   = Object.prototype.hasOwnProperty,
3045
    isObject = Y.Lang.isObject;
3046
 
3047
/**
3048
Returns a wrapper for a function which caches the return value of that function,
3049
keyed off of the combined string representation of the argument values provided
3050
when the wrapper is called.
3051
 
3052
Calling this function again with the same arguments will return the cached value
3053
rather than executing the wrapped function.
3054
 
3055
Note that since the cache is keyed off of the string representation of arguments
3056
passed to the wrapper function, arguments that aren't strings and don't provide
3057
a meaningful `toString()` method may result in unexpected caching behavior. For
3058
example, the objects `{}` and `{foo: 'bar'}` would both be converted to the
3059
string `[object Object]` when used as a cache key.
3060
 
3061
@method cached
3062
@param {Function} source The function to memoize.
3063
@param {Object} [cache={}] Object in which to store cached values. You may seed
3064
  this object with pre-existing cached values if desired.
3065
@param {any} [refetch] If supplied, this value is compared with the cached value
3066
  using a `==` comparison. If the values are equal, the wrapped function is
3067
  executed again even though a cached value exists.
3068
@return {Function} Wrapped function.
3069
@for YUI
3070
**/
3071
Y.cached = function (source, cache, refetch) {
3072
    /*jshint expr: true*/
3073
    cache || (cache = {});
3074
 
3075
    return function (arg) {
3076
        var key = arguments.length > 1 ?
3077
                Array.prototype.join.call(arguments, CACHED_DELIMITER) :
3078
                String(arg);
3079
 
3080
        /*jshint eqeqeq: false*/
3081
        if (!(key in cache) || (refetch && cache[key] == refetch)) {
3082
            cache[key] = source.apply(source, arguments);
3083
        }
3084
 
3085
        return cache[key];
3086
    };
3087
};
3088
 
3089
/**
3090
Returns the `location` object from the window/frame in which this YUI instance
3091
operates, or `undefined` when executing in a non-browser environment
3092
(e.g. Node.js).
3093
 
3094
It is _not_ recommended to hold references to the `window.location` object
3095
outside of the scope of a function in which its properties are being accessed or
3096
its methods are being called. This is because of a nasty bug/issue that exists
3097
in both Safari and MobileSafari browsers:
3098
[WebKit Bug 34679](https://bugs.webkit.org/show_bug.cgi?id=34679).
3099
 
3100
@method getLocation
3101
@return {location} The `location` object from the window/frame in which this YUI
3102
    instance operates.
3103
@since 3.5.0
3104
**/
3105
Y.getLocation = function () {
3106
    // It is safer to look this up every time because yui-base is attached to a
3107
    // YUI instance before a user's config is applied; i.e. `Y.config.win` does
3108
    // not point the correct window object when this file is loaded.
3109
    var win = Y.config.win;
3110
 
3111
    // It is not safe to hold a reference to the `location` object outside the
3112
    // scope in which it is being used. The WebKit engine used in Safari and
3113
    // MobileSafari will "disconnect" the `location` object from the `window`
3114
    // when a page is restored from back/forward history cache.
3115
    return win && win.location;
3116
};
3117
 
3118
/**
3119
Returns a new object containing all of the properties of all the supplied
3120
objects. The properties from later objects will overwrite those in earlier
3121
objects.
3122
 
3123
Passing in a single object will create a shallow copy of it. For a deep copy,
3124
use `clone()`.
3125
 
3126
@method merge
3127
@param {Object} objects* One or more objects to merge.
3128
@return {Object} A new merged object.
3129
**/
3130
Y.merge = function () {
3131
    var i      = 0,
3132
        len    = arguments.length,
3133
        result = {},
3134
        key,
3135
        obj;
3136
 
3137
    for (; i < len; ++i) {
3138
        obj = arguments[i];
3139
 
3140
        for (key in obj) {
3141
            if (hasOwn.call(obj, key)) {
3142
                result[key] = obj[key];
3143
            }
3144
        }
3145
    }
3146
 
3147
    return result;
3148
};
3149
 
3150
/**
3151
Mixes _supplier_'s properties into _receiver_.
3152
 
3153
Properties on _receiver_ or _receiver_'s prototype will not be overwritten or
3154
shadowed unless the _overwrite_ parameter is `true`, and will not be merged
3155
unless the _merge_ parameter is `true`.
3156
 
3157
In the default mode (0), only properties the supplier owns are copied (prototype
3158
properties are not copied). The following copying modes are available:
3159
 
3160
  * `0`: _Default_. Object to object.
3161
  * `1`: Prototype to prototype.
3162
  * `2`: Prototype to prototype and object to object.
3163
  * `3`: Prototype to object.
3164
  * `4`: Object to prototype.
3165
 
3166
@method mix
3167
@param {Function|Object} receiver The object or function to receive the mixed
3168
  properties.
3169
@param {Function|Object} supplier The object or function supplying the
3170
  properties to be mixed.
3171
@param {Boolean} [overwrite=false] If `true`, properties that already exist
3172
  on the receiver will be overwritten with properties from the supplier.
3173
@param {String[]} [whitelist] An array of property names to copy. If
3174
  specified, only the whitelisted properties will be copied, and all others
3175
  will be ignored.
3176
@param {Number} [mode=0] Mix mode to use. See above for available modes.
3177
@param {Boolean} [merge=false] If `true`, objects and arrays that already
3178
  exist on the receiver will have the corresponding object/array from the
3179
  supplier merged into them, rather than being skipped or overwritten. When
3180
  both _overwrite_ and _merge_ are `true`, _merge_ takes precedence.
3181
@return {Function|Object|YUI} The receiver, or the YUI instance if the
3182
  specified receiver is falsy.
3183
**/
3184
Y.mix = function(receiver, supplier, overwrite, whitelist, mode, merge) {
3185
    var alwaysOverwrite, exists, from, i, key, len, to;
3186
 
3187
    // If no supplier is given, we return the receiver. If no receiver is given,
3188
    // we return Y. Returning Y doesn't make much sense to me, but it's
3189
    // grandfathered in for backcompat reasons.
3190
    if (!receiver || !supplier) {
3191
        return receiver || Y;
3192
    }
3193
 
3194
    if (mode) {
3195
        // In mode 2 (prototype to prototype and object to object), we recurse
3196
        // once to do the proto to proto mix. The object to object mix will be
3197
        // handled later on.
3198
        if (mode === 2) {
3199
            Y.mix(receiver.prototype, supplier.prototype, overwrite,
3200
                    whitelist, 0, merge);
3201
        }
3202
 
3203
        // Depending on which mode is specified, we may be copying from or to
3204
        // the prototypes of the supplier and receiver.
3205
        from = mode === 1 || mode === 3 ? supplier.prototype : supplier;
3206
        to   = mode === 1 || mode === 4 ? receiver.prototype : receiver;
3207
 
3208
        // If either the supplier or receiver doesn't actually have a
3209
        // prototype property, then we could end up with an undefined `from`
3210
        // or `to`. If that happens, we abort and return the receiver.
3211
        if (!from || !to) {
3212
            return receiver;
3213
        }
3214
    } else {
3215
        from = supplier;
3216
        to   = receiver;
3217
    }
3218
 
3219
    // If `overwrite` is truthy and `merge` is falsy, then we can skip a
3220
    // property existence check on each iteration and save some time.
3221
    alwaysOverwrite = overwrite && !merge;
3222
 
3223
    if (whitelist) {
3224
        for (i = 0, len = whitelist.length; i < len; ++i) {
3225
            key = whitelist[i];
3226
 
3227
            // We call `Object.prototype.hasOwnProperty` instead of calling
3228
            // `hasOwnProperty` on the object itself, since the object's
3229
            // `hasOwnProperty` method may have been overridden or removed.
3230
            // Also, some native objects don't implement a `hasOwnProperty`
3231
            // method.
3232
            if (!hasOwn.call(from, key)) {
3233
                continue;
3234
            }
3235
 
3236
            // The `key in to` check here is (sadly) intentional for backwards
3237
            // compatibility reasons. It prevents undesired shadowing of
3238
            // prototype members on `to`.
3239
            exists = alwaysOverwrite ? false : key in to;
3240
 
3241
            if (merge && exists && isObject(to[key], true)
3242
                    && isObject(from[key], true)) {
3243
                // If we're in merge mode, and the key is present on both
3244
                // objects, and the value on both objects is either an object or
3245
                // an array (but not a function), then we recurse to merge the
3246
                // `from` value into the `to` value instead of overwriting it.
3247
                //
3248
                // Note: It's intentional that the whitelist isn't passed to the
3249
                // recursive call here. This is legacy behavior that lots of
3250
                // code still depends on.
3251
                Y.mix(to[key], from[key], overwrite, null, 0, merge);
3252
            } else if (overwrite || !exists) {
3253
                // We're not in merge mode, so we'll only copy the `from` value
3254
                // to the `to` value if we're in overwrite mode or if the
3255
                // current key doesn't exist on the `to` object.
3256
                to[key] = from[key];
3257
            }
3258
        }
3259
    } else {
3260
        for (key in from) {
3261
            // The code duplication here is for runtime performance reasons.
3262
            // Combining whitelist and non-whitelist operations into a single
3263
            // loop or breaking the shared logic out into a function both result
3264
            // in worse performance, and Y.mix is critical enough that the byte
3265
            // tradeoff is worth it.
3266
            if (!hasOwn.call(from, key)) {
3267
                continue;
3268
            }
3269
 
3270
            // The `key in to` check here is (sadly) intentional for backwards
3271
            // compatibility reasons. It prevents undesired shadowing of
3272
            // prototype members on `to`.
3273
            exists = alwaysOverwrite ? false : key in to;
3274
 
3275
            if (merge && exists && isObject(to[key], true)
3276
                    && isObject(from[key], true)) {
3277
                Y.mix(to[key], from[key], overwrite, null, 0, merge);
3278
            } else if (overwrite || !exists) {
3279
                to[key] = from[key];
3280
            }
3281
        }
3282
 
3283
        // If this is an IE browser with the JScript enumeration bug, force
3284
        // enumeration of the buggy properties by making a recursive call with
3285
        // the buggy properties as the whitelist.
3286
        if (Y.Object._hasEnumBug) {
3287
            Y.mix(to, from, overwrite, Y.Object._forceEnum, mode, merge);
3288
        }
3289
    }
3290
 
3291
    return receiver;
3292
};
3293
/**
3294
 * The YUI module contains the components required for building the YUI
3295
 * seed file.  This includes the script loading mechanism, a simple queue,
3296
 * and the core utilities for the library.
3297
 * @module yui
3298
 * @submodule yui-base
3299
 */
3300
 
3301
/**
3302
 * Adds utilities to the YUI instance for working with objects.
3303
 *
3304
 * @class Object
3305
 */
3306
 
3307
var Lang   = Y.Lang,
3308
    hasOwn = Object.prototype.hasOwnProperty,
3309
 
3310
    UNDEFINED, // <-- Note the comma. We're still declaring vars.
3311
 
3312
/**
3313
 * Returns a new object that uses _obj_ as its prototype. This method wraps the
3314
 * native ES5 `Object.create()` method if available, but doesn't currently
3315
 * pass through `Object.create()`'s second argument (properties) in order to
3316
 * ensure compatibility with older browsers.
3317
 *
3318
 * @method ()
3319
 * @param {Object} obj Prototype object.
3320
 * @return {Object} New object using _obj_ as its prototype.
3321
 * @static
3322
 */
3323
O = Y.Object = Lang._isNative(Object.create) ? function (obj) {
3324
    // We currently wrap the native Object.create instead of simply aliasing it
3325
    // to ensure consistency with our fallback shim, which currently doesn't
3326
    // support Object.create()'s second argument (properties). Once we have a
3327
    // safe fallback for the properties arg, we can stop wrapping
3328
    // Object.create().
3329
    return Object.create(obj);
3330
} : (function () {
3331
    // Reusable constructor function for the Object.create() shim.
3332
    function F() {}
3333
 
3334
    // The actual shim.
3335
    return function (obj) {
3336
        F.prototype = obj;
3337
        return new F();
3338
    };
3339
}()),
3340
 
3341
/**
3342
 * Property names that IE doesn't enumerate in for..in loops, even when they
3343
 * should be enumerable. When `_hasEnumBug` is `true`, it's necessary to
3344
 * manually enumerate these properties.
3345
 *
3346
 * @property _forceEnum
3347
 * @type String[]
3348
 * @protected
3349
 * @static
3350
 */
3351
forceEnum = O._forceEnum = [
3352
    'hasOwnProperty',
3353
    'isPrototypeOf',
3354
    'propertyIsEnumerable',
3355
    'toString',
3356
    'toLocaleString',
3357
    'valueOf'
3358
],
3359
 
3360
/**
3361
 * `true` if this browser has the JScript enumeration bug that prevents
3362
 * enumeration of the properties named in the `_forceEnum` array, `false`
3363
 * otherwise.
3364
 *
3365
 * See:
3366
 *   - <https://developer.mozilla.org/en/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug>
3367
 *   - <http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation>
3368
 *
3369
 * @property _hasEnumBug
3370
 * @type Boolean
3371
 * @protected
3372
 * @static
3373
 */
3374
hasEnumBug = O._hasEnumBug = !{valueOf: 0}.propertyIsEnumerable('valueOf'),
3375
 
3376
/**
3377
 * `true` if this browser incorrectly considers the `prototype` property of
3378
 * functions to be enumerable. Currently known to affect Opera 11.50 and Android 2.3.x.
3379
 *
3380
 * @property _hasProtoEnumBug
3381
 * @type Boolean
3382
 * @protected
3383
 * @static
3384
 */
3385
hasProtoEnumBug = O._hasProtoEnumBug = (function () {}).propertyIsEnumerable('prototype'),
3386
 
3387
/**
3388
 * Returns `true` if _key_ exists on _obj_, `false` if _key_ doesn't exist or
3389
 * exists only on _obj_'s prototype. This is essentially a safer version of
3390
 * `obj.hasOwnProperty()`.
3391
 *
3392
 * @method owns
3393
 * @param {Object} obj Object to test.
3394
 * @param {String} key Property name to look for.
3395
 * @return {Boolean} `true` if _key_ exists on _obj_, `false` otherwise.
3396
 * @static
3397
 */
3398
owns = O.owns = function (obj, key) {
3399
    return !!obj && hasOwn.call(obj, key);
3400
}; // <-- End of var declarations.
3401
 
3402
/**
3403
 * Alias for `owns()`.
3404
 *
3405
 * @method hasKey
3406
 * @param {Object} obj Object to test.
3407
 * @param {String} key Property name to look for.
3408
 * @return {Boolean} `true` if _key_ exists on _obj_, `false` otherwise.
3409
 * @static
3410
 */
3411
O.hasKey = owns;
3412
 
3413
/**
3414
 * Returns an array containing the object's enumerable keys. Does not include
3415
 * prototype keys or non-enumerable keys.
3416
 *
3417
 * Note that keys are returned in enumeration order (that is, in the same order
3418
 * that they would be enumerated by a `for-in` loop), which may not be the same
3419
 * as the order in which they were defined.
3420
 *
3421
 * This method is an alias for the native ES5 `Object.keys()` method if
3422
 * available and non-buggy. The Opera 11.50 and Android 2.3.x versions of
3423
 * `Object.keys()` have an inconsistency as they consider `prototype` to be
3424
 * enumerable, so a non-native shim is used to rectify the difference.
3425
 *
3426
 * @example
3427
 *
3428
 *     Y.Object.keys({a: 'foo', b: 'bar', c: 'baz'});
3429
 *     // => ['a', 'b', 'c']
3430
 *
3431
 * @method keys
3432
 * @param {Object} obj An object.
3433
 * @return {String[]} Array of keys.
3434
 * @static
3435
 */
3436
O.keys = Lang._isNative(Object.keys) && !hasProtoEnumBug ? Object.keys : function (obj) {
3437
    if (!Lang.isObject(obj)) {
3438
        throw new TypeError('Object.keys called on a non-object');
3439
    }
3440
 
3441
    var keys = [],
3442
        i, key, len;
3443
 
3444
    if (hasProtoEnumBug && typeof obj === 'function') {
3445
        for (key in obj) {
3446
            if (owns(obj, key) && key !== 'prototype') {
3447
                keys.push(key);
3448
            }
3449
        }
3450
    } else {
3451
        for (key in obj) {
3452
            if (owns(obj, key)) {
3453
                keys.push(key);
3454
            }
3455
        }
3456
    }
3457
 
3458
    if (hasEnumBug) {
3459
        for (i = 0, len = forceEnum.length; i < len; ++i) {
3460
            key = forceEnum[i];
3461
 
3462
            if (owns(obj, key)) {
3463
                keys.push(key);
3464
            }
3465
        }
3466
    }
3467
 
3468
    return keys;
3469
};
3470
 
3471
/**
3472
 * Returns an array containing the values of the object's enumerable keys.
3473
 *
3474
 * Note that values are returned in enumeration order (that is, in the same
3475
 * order that they would be enumerated by a `for-in` loop), which may not be the
3476
 * same as the order in which they were defined.
3477
 *
3478
 * @example
3479
 *
3480
 *     Y.Object.values({a: 'foo', b: 'bar', c: 'baz'});
3481
 *     // => ['foo', 'bar', 'baz']
3482
 *
3483
 * @method values
3484
 * @param {Object} obj An object.
3485
 * @return {Array} Array of values.
3486
 * @static
3487
 */
3488
O.values = function (obj) {
3489
    var keys   = O.keys(obj),
3490
        i      = 0,
3491
        len    = keys.length,
3492
        values = [];
3493
 
3494
    for (; i < len; ++i) {
3495
        values.push(obj[keys[i]]);
3496
    }
3497
 
3498
    return values;
3499
};
3500
 
3501
/**
3502
 * Returns the number of enumerable keys owned by an object.
3503
 *
3504
 * @method size
3505
 * @param {Object} obj An object.
3506
 * @return {Number} The object's size.
3507
 * @static
3508
 */
3509
O.size = function (obj) {
3510
    try {
3511
        return O.keys(obj).length;
3512
    } catch (ex) {
3513
        return 0; // Legacy behavior for non-objects.
3514
    }
3515
};
3516
 
3517
/**
3518
 * Returns `true` if the object owns an enumerable property with the specified
3519
 * value.
3520
 *
3521
 * @method hasValue
3522
 * @param {Object} obj An object.
3523
 * @param {any} value The value to search for.
3524
 * @return {Boolean} `true` if _obj_ contains _value_, `false` otherwise.
3525
 * @static
3526
 */
3527
O.hasValue = function (obj, value) {
3528
    return Y.Array.indexOf(O.values(obj), value) > -1;
3529
};
3530
 
3531
/**
3532
 * Executes a function on each enumerable property in _obj_. The function
3533
 * receives the value, the key, and the object itself as parameters (in that
3534
 * order).
3535
 *
3536
 * By default, only properties owned by _obj_ are enumerated. To include
3537
 * prototype properties, set the _proto_ parameter to `true`.
3538
 *
3539
 * @method each
3540
 * @param {Object} obj Object to enumerate.
3541
 * @param {Function} fn Function to execute on each enumerable property.
3542
 *   @param {mixed} fn.value Value of the current property.
3543
 *   @param {String} fn.key Key of the current property.
3544
 *   @param {Object} fn.obj Object being enumerated.
3545
 * @param {Object} [thisObj] `this` object to use when calling _fn_.
3546
 * @param {Boolean} [proto=false] Include prototype properties.
3547
 * @return {YUI} the YUI instance.
3548
 * @chainable
3549
 * @static
3550
 */
3551
O.each = function (obj, fn, thisObj, proto) {
3552
    var key;
3553
 
3554
    for (key in obj) {
3555
        if (proto || owns(obj, key)) {
3556
            fn.call(thisObj || Y, obj[key], key, obj);
3557
        }
3558
    }
3559
 
3560
    return Y;
3561
};
3562
 
3563
/**
3564
 * Executes a function on each enumerable property in _obj_, but halts if the
3565
 * function returns a truthy value. The function receives the value, the key,
3566
 * and the object itself as paramters (in that order).
3567
 *
3568
 * By default, only properties owned by _obj_ are enumerated. To include
3569
 * prototype properties, set the _proto_ parameter to `true`.
3570
 *
3571
 * @method some
3572
 * @param {Object} obj Object to enumerate.
3573
 * @param {Function} fn Function to execute on each enumerable property.
3574
 *   @param {mixed} fn.value Value of the current property.
3575
 *   @param {String} fn.key Key of the current property.
3576
 *   @param {Object} fn.obj Object being enumerated.
3577
 * @param {Object} [thisObj] `this` object to use when calling _fn_.
3578
 * @param {Boolean} [proto=false] Include prototype properties.
3579
 * @return {Boolean} `true` if any execution of _fn_ returns a truthy value,
3580
 *   `false` otherwise.
3581
 * @static
3582
 */
3583
O.some = function (obj, fn, thisObj, proto) {
3584
    var key;
3585
 
3586
    for (key in obj) {
3587
        if (proto || owns(obj, key)) {
3588
            if (fn.call(thisObj || Y, obj[key], key, obj)) {
3589
                return true;
3590
            }
3591
        }
3592
    }
3593
 
3594
    return false;
3595
};
3596
 
3597
/**
3598
 * Retrieves the sub value at the provided path,
3599
 * from the value object provided.
3600
 *
3601
 * @method getValue
3602
 * @static
3603
 * @param o The object from which to extract the property value.
3604
 * @param path {Array} A path array, specifying the object traversal path
3605
 * from which to obtain the sub value.
3606
 * @return {Any} The value stored in the path, undefined if not found,
3607
 * undefined if the source is not an object.  Returns the source object
3608
 * if an empty path is provided.
3609
 */
3610
O.getValue = function(o, path) {
3611
    if (!Lang.isObject(o)) {
3612
        return UNDEFINED;
3613
    }
3614
 
3615
    var i,
3616
        p = Y.Array(path),
3617
        l = p.length;
3618
 
3619
    for (i = 0; o !== UNDEFINED && i < l; i++) {
3620
        o = o[p[i]];
3621
    }
3622
 
3623
    return o;
3624
};
3625
 
3626
/**
3627
 * Sets the sub-attribute value at the provided path on the
3628
 * value object.  Returns the modified value object, or
3629
 * undefined if the path is invalid.
3630
 *
3631
 * @method setValue
3632
 * @static
3633
 * @param o             The object on which to set the sub value.
3634
 * @param path {Array}  A path array, specifying the object traversal path
3635
 *                      at which to set the sub value.
3636
 * @param val {Any}     The new value for the sub-attribute.
3637
 * @return {Object}     The modified object, with the new sub value set, or
3638
 *                      undefined, if the path was invalid.
3639
 */
3640
O.setValue = function(o, path, val) {
3641
    var i,
3642
        p = Y.Array(path),
3643
        leafIdx = p.length - 1,
3644
        ref = o;
3645
 
3646
    if (leafIdx >= 0) {
3647
        for (i = 0; ref !== UNDEFINED && i < leafIdx; i++) {
3648
            ref = ref[p[i]];
3649
        }
3650
 
3651
        if (ref !== UNDEFINED) {
3652
            ref[p[i]] = val;
3653
        } else {
3654
            return UNDEFINED;
3655
        }
3656
    }
3657
 
3658
    return o;
3659
};
3660
 
3661
/**
3662
 * Returns `true` if the object has no enumerable properties of its own.
3663
 *
3664
 * @method isEmpty
3665
 * @param {Object} obj An object.
3666
 * @return {Boolean} `true` if the object is empty.
3667
 * @static
3668
 * @since 3.2.0
3669
 */
3670
O.isEmpty = function (obj) {
3671
    return !O.keys(Object(obj)).length;
3672
};
3673
/**
3674
 * The YUI module contains the components required for building the YUI seed
3675
 * file.  This includes the script loading mechanism, a simple queue, and the
3676
 * core utilities for the library.
3677
 * @module yui
3678
 * @submodule yui-base
3679
 */
3680
 
3681
/**
3682
 * YUI user agent detection.
3683
 * Do not fork for a browser if it can be avoided.  Use feature detection when
3684
 * you can.  Use the user agent as a last resort.  For all fields listed
3685
 * as @type float, UA stores a version number for the browser engine,
3686
 * 0 otherwise.  This value may or may not map to the version number of
3687
 * the browser using the engine.  The value is presented as a float so
3688
 * that it can easily be used for boolean evaluation as well as for
3689
 * looking for a particular range of versions.  Because of this,
3690
 * some of the granularity of the version info may be lost.  The fields that
3691
 * are @type string default to null.  The API docs list the values that
3692
 * these fields can have.
3693
 * @class UA
3694
 * @static
3695
 */
3696
 
3697
/**
3698
* Static method on `YUI.Env` for parsing a UA string.  Called at instantiation
3699
* to populate `Y.UA`.
3700
*
3701
* @static
3702
* @method parseUA
3703
* @param {String} [subUA=navigator.userAgent] UA string to parse
3704
* @return {Object} The Y.UA object
3705
*/
3706
YUI.Env.parseUA = function(subUA) {
3707
 
3708
    var numberify = function(s) {
3709
            var c = 0;
3710
            return parseFloat(s.replace(/\./g, function() {
3711
                return (c++ === 1) ? '' : '.';
3712
            }));
3713
        },
3714
 
3715
        win = Y.config.win,
3716
 
3717
        nav = win && win.navigator,
3718
 
3719
        o = {
3720
 
3721
        /**
3722
         * Internet Explorer version number or 0.  Example: 6
3723
         * @property ie
3724
         * @type float
3725
         * @static
3726
         */
3727
        ie: 0,
3728
 
3729
        /**
3730
         * Opera version number or 0.  Example: 9.2
3731
         * @property opera
3732
         * @type float
3733
         * @static
3734
         */
3735
        opera: 0,
3736
 
3737
        /**
3738
         * Gecko engine revision number.  Will evaluate to 1 if Gecko
3739
         * is detected but the revision could not be found. Other browsers
3740
         * will be 0.  Example: 1.8
3741
         * <pre>
3742
         * Firefox 1.0.0.4: 1.7.8   <-- Reports 1.7
3743
         * Firefox 1.5.0.9: 1.8.0.9 <-- 1.8
3744
         * Firefox 2.0.0.3: 1.8.1.3 <-- 1.81
3745
         * Firefox 3.0   <-- 1.9
3746
         * Firefox 3.5   <-- 1.91
3747
         * </pre>
3748
         * @property gecko
3749
         * @type float
3750
         * @static
3751
         */
3752
        gecko: 0,
3753
 
3754
        /**
3755
         * AppleWebKit version.  KHTML browsers that are not WebKit browsers
3756
         * will evaluate to 1, other browsers 0.  Example: 418.9
3757
         * <pre>
3758
         * Safari 1.3.2 (312.6): 312.8.1 <-- Reports 312.8 -- currently the
3759
         *                                   latest available for Mac OSX 10.3.
3760
         * Safari 2.0.2:         416     <-- hasOwnProperty introduced
3761
         * Safari 2.0.4:         418     <-- preventDefault fixed
3762
         * Safari 2.0.4 (419.3): 418.9.1 <-- One version of Safari may run
3763
         *                                   different versions of webkit
3764
         * Safari 2.0.4 (419.3): 419     <-- Tiger installations that have been
3765
         *                                   updated, but not updated
3766
         *                                   to the latest patch.
3767
         * Webkit 212 nightly:   522+    <-- Safari 3.0 precursor (with native
3768
         * SVG and many major issues fixed).
3769
         * Safari 3.0.4 (523.12) 523.12  <-- First Tiger release - automatic
3770
         * update from 2.x via the 10.4.11 OS patch.
3771
         * Webkit nightly 1/2008:525+    <-- Supports DOMContentLoaded event.
3772
         *                                   yahoo.com user agent hack removed.
3773
         * </pre>
3774
         * http://en.wikipedia.org/wiki/Safari_version_history
3775
         * @property webkit
3776
         * @type float
3777
         * @static
3778
         */
3779
        webkit: 0,
3780
 
3781
        /**
3782
         * Safari will be detected as webkit, but this property will also
3783
         * be populated with the Safari version number
3784
         * @property safari
3785
         * @type float
3786
         * @static
3787
         */
3788
        safari: 0,
3789
 
3790
        /**
3791
         * Chrome will be detected as webkit, but this property will also
3792
         * be populated with the Chrome version number
3793
         * @property chrome
3794
         * @type float
3795
         * @static
3796
         */
3797
        chrome: 0,
3798
 
3799
        /**
3800
         * The mobile property will be set to a string containing any relevant
3801
         * user agent information when a modern mobile browser is detected.
3802
         * Currently limited to Safari on the iPhone/iPod Touch, Nokia N-series
3803
         * devices with the WebKit-based browser, and Opera Mini.
3804
         * @property mobile
3805
         * @type string
3806
         * @default null
3807
         * @static
3808
         */
3809
        mobile: null,
3810
 
3811
        /**
3812
         * Adobe AIR version number or 0.  Only populated if webkit is detected.
3813
         * Example: 1.0
3814
         * @property air
3815
         * @type float
3816
         */
3817
        air: 0,
3818
        /**
3819
         * PhantomJS version number or 0.  Only populated if webkit is detected.
3820
         * Example: 1.0
3821
         * @property phantomjs
3822
         * @type float
3823
         */
3824
        phantomjs: 0,
3825
        /**
3826
         * Detects Apple iPad's OS version
3827
         * @property ipad
3828
         * @type float
3829
         * @static
3830
         */
3831
        ipad: 0,
3832
        /**
3833
         * Detects Apple iPhone's OS version
3834
         * @property iphone
3835
         * @type float
3836
         * @static
3837
         */
3838
        iphone: 0,
3839
        /**
3840
         * Detects Apples iPod's OS version
3841
         * @property ipod
3842
         * @type float
3843
         * @static
3844
         */
3845
        ipod: 0,
3846
        /**
3847
         * General truthy check for iPad, iPhone or iPod
3848
         * @property ios
3849
         * @type Boolean
3850
         * @default null
3851
         * @static
3852
         */
3853
        ios: null,
3854
        /**
3855
         * Detects Googles Android OS version
3856
         * @property android
3857
         * @type float
3858
         * @static
3859
         */
3860
        android: 0,
3861
        /**
3862
         * Detects Kindle Silk
3863
         * @property silk
3864
         * @type float
3865
         * @static
3866
         */
3867
        silk: 0,
3868
        /**
3869
         * Detects Ubuntu version
3870
         * @property ubuntu
3871
         * @type float
3872
         * @static
3873
         */
3874
        ubuntu: 0,
3875
        /**
3876
         * Detects Kindle Silk Acceleration
3877
         * @property accel
3878
         * @type Boolean
3879
         * @static
3880
         */
3881
        accel: false,
3882
        /**
3883
         * Detects Palms WebOS version
3884
         * @property webos
3885
         * @type float
3886
         * @static
3887
         */
3888
        webos: 0,
3889
 
3890
        /**
3891
         * Google Caja version number or 0.
3892
         * @property caja
3893
         * @type float
3894
         */
3895
        caja: nav && nav.cajaVersion,
3896
 
3897
        /**
3898
         * Set to true if the page appears to be in SSL
3899
         * @property secure
3900
         * @type boolean
3901
         * @static
3902
         */
3903
        secure: false,
3904
 
3905
        /**
3906
         * The operating system.
3907
         *
3908
         * Possible values are `windows`, `macintosh`, `android`, `symbos`, `linux`, `rhino` and `ios`.
3909
         *
3910
         * @property os
3911
         * @type string
3912
         * @default null
3913
         * @static
3914
         */
3915
        os: null,
3916
 
3917
        /**
3918
         * The Nodejs Version
3919
         * @property nodejs
3920
         * @type float
3921
         * @default 0
3922
         * @static
3923
         */
3924
        nodejs: 0,
3925
        /**
3926
        * Window8/IE10 Application host environment
3927
        * @property winjs
3928
        * @type Boolean
3929
        * @static
3930
        */
3931
        winjs: !!((typeof Windows !== "undefined") && Windows.System),
3932
        /**
3933
        * Are touch/msPointer events available on this device
3934
        * @property touchEnabled
3935
        * @type Boolean
3936
        * @static
3937
        */
3938
        touchEnabled: false
3939
    },
3940
 
3941
    ua = subUA || nav && nav.userAgent,
3942
 
3943
    loc = win && win.location,
3944
 
3945
    href = loc && loc.href,
3946
 
3947
    m;
3948
 
3949
    /**
3950
    * The User Agent string that was parsed
3951
    * @property userAgent
3952
    * @type String
3953
    * @static
3954
    */
3955
    o.userAgent = ua;
3956
 
3957
 
3958
    o.secure = href && (href.toLowerCase().indexOf('https') === 0);
3959
 
3960
    if (ua) {
3961
 
3962
        if ((/windows|win32/i).test(ua)) {
3963
            o.os = 'windows';
3964
        } else if ((/macintosh|mac_powerpc/i).test(ua)) {
3965
            o.os = 'macintosh';
3966
        } else if ((/android/i).test(ua)) {
3967
            o.os = 'android';
3968
        } else if ((/symbos/i).test(ua)) {
3969
            o.os = 'symbos';
3970
        } else if ((/linux/i).test(ua)) {
3971
            o.os = 'linux';
3972
        } else if ((/rhino/i).test(ua)) {
3973
            o.os = 'rhino';
3974
        }
3975
 
3976
        // Modern KHTML browsers should qualify as Safari X-Grade
3977
        if ((/KHTML/).test(ua)) {
3978
            o.webkit = 1;
3979
        }
3980
        if ((/IEMobile|XBLWP7/).test(ua)) {
3981
            o.mobile = 'windows';
3982
        }
3983
        if ((/Fennec/).test(ua)) {
3984
            o.mobile = 'gecko';
3985
        }
3986
        // Modern WebKit browsers are at least X-Grade
3987
        m = ua.match(/AppleWebKit\/([^\s]*)/);
3988
        if (m && m[1]) {
3989
            o.webkit = numberify(m[1]);
3990
            o.safari = o.webkit;
3991
 
3992
            if (/PhantomJS/.test(ua)) {
3993
                m = ua.match(/PhantomJS\/([^\s]*)/);
3994
                if (m && m[1]) {
3995
                    o.phantomjs = numberify(m[1]);
3996
                }
3997
            }
3998
 
3999
            // Mobile browser check
4000
            if (/ Mobile\//.test(ua) || (/iPad|iPod|iPhone/).test(ua)) {
4001
                o.mobile = 'Apple'; // iPhone or iPod Touch
4002
 
4003
                m = ua.match(/OS ([^\s]*)/);
4004
                if (m && m[1]) {
4005
                    m = numberify(m[1].replace('_', '.'));
4006
                }
4007
                o.ios = m;
4008
                o.os = 'ios';
4009
                o.ipad = o.ipod = o.iphone = 0;
4010
 
4011
                m = ua.match(/iPad|iPod|iPhone/);
4012
                if (m && m[0]) {
4013
                    o[m[0].toLowerCase()] = o.ios;
4014
                }
4015
            } else {
4016
                m = ua.match(/NokiaN[^\/]*|webOS\/\d\.\d/);
4017
                if (m) {
4018
                    // Nokia N-series, webOS, ex: NokiaN95
4019
                    o.mobile = m[0];
4020
                }
4021
                if (/webOS/.test(ua)) {
4022
                    o.mobile = 'WebOS';
4023
                    m = ua.match(/webOS\/([^\s]*);/);
4024
                    if (m && m[1]) {
4025
                        o.webos = numberify(m[1]);
4026
                    }
4027
                }
4028
                if (/ Android/.test(ua)) {
4029
                    o.mobile = 'Android';
4030
                    m = ua.match(/Android ([^\s]*);/);
4031
                    if (m && m[1]) {
4032
                        o.android = numberify(m[1]);
4033
                    }
4034
 
4035
                }
4036
                if (/Silk/.test(ua)) {
4037
                    m = ua.match(/Silk\/([^\s]*)/);
4038
                    if (m && m[1]) {
4039
                        o.silk = numberify(m[1]);
4040
                    }
4041
                    if (!o.android) {
4042
                        o.android = 2.34; //Hack for desktop mode in Kindle
4043
                        o.os = 'Android';
4044
                    }
4045
                    if (/Accelerated=true/.test(ua)) {
4046
                        o.accel = true;
4047
                    }
4048
                }
4049
            }
4050
 
4051
            m = ua.match(/OPR\/(\d+\.\d+)/);
4052
 
4053
            if (m && m[1]) {
4054
                // Opera 15+ with Blink (pretends to be both Chrome and Safari)
4055
                o.opera = numberify(m[1]);
4056
            } else {
4057
                m = ua.match(/(Chrome|CrMo|CriOS)\/([^\s]*)/);
4058
 
4059
                if (m && m[1] && m[2]) {
4060
                    o.chrome = numberify(m[2]); // Chrome
4061
                    o.safari = 0; //Reset safari back to 0
4062
                    if (m[1] === 'CrMo') {
4063
                        o.mobile = 'chrome';
4064
                    }
4065
                } else {
4066
                    m = ua.match(/AdobeAIR\/([^\s]*)/);
4067
                    if (m) {
4068
                        o.air = m[0]; // Adobe AIR 1.0 or better
4069
                    }
4070
                }
4071
            }
4072
        }
4073
 
4074
        m = ua.match(/Ubuntu\ (\d+\.\d+)/);
4075
        if (m && m[1]) {
4076
 
4077
            o.os = 'linux';
4078
            o.ubuntu = numberify(m[1]);
4079
 
4080
            m = ua.match(/\ WebKit\/([^\s]*)/);
4081
            if (m && m[1]) {
4082
                o.webkit = numberify(m[1]);
4083
            }
4084
            m = ua.match(/\ Chromium\/([^\s]*)/);
4085
            if (m && m[1]) {
4086
                o.chrome = numberify(m[1]);
4087
            }
4088
            if (/ Mobile$/.test(ua)) {
4089
                o.mobile = 'Ubuntu';
4090
            }
4091
        }
4092
 
4093
        if (!o.webkit) { // not webkit
4094
// @todo check Opera/8.01 (J2ME/MIDP; Opera Mini/2.0.4509/1316; fi; U; ssr)
4095
            if (/Opera/.test(ua)) {
4096
                m = ua.match(/Opera[\s\/]([^\s]*)/);
4097
                if (m && m[1]) {
4098
                    o.opera = numberify(m[1]);
4099
                }
4100
                m = ua.match(/Version\/([^\s]*)/);
4101
                if (m && m[1]) {
4102
                    o.opera = numberify(m[1]); // opera 10+
4103
                }
4104
 
4105
                if (/Opera Mobi/.test(ua)) {
4106
                    o.mobile = 'opera';
4107
                    m = ua.replace('Opera Mobi', '').match(/Opera ([^\s]*)/);
4108
                    if (m && m[1]) {
4109
                        o.opera = numberify(m[1]);
4110
                    }
4111
                }
4112
                m = ua.match(/Opera Mini[^;]*/);
4113
 
4114
                if (m) {
4115
                    o.mobile = m[0]; // ex: Opera Mini/2.0.4509/1316
4116
                }
4117
            } else { // not opera or webkit
4118
                m = ua.match(/MSIE ([^;]*)|Trident.*; rv:([0-9.]+)/);
4119
 
4120
                if (m && (m[1] || m[2])) {
4121
                    o.ie = numberify(m[1] || m[2]);
4122
                } else { // not opera, webkit, or ie
4123
                    m = ua.match(/Gecko\/([^\s]*)/);
4124
 
4125
                    if (m) {
4126
                        o.gecko = 1; // Gecko detected, look for revision
4127
                        m = ua.match(/rv:([^\s\)]*)/);
4128
                        if (m && m[1]) {
4129
                            o.gecko = numberify(m[1]);
4130
                            if (/Mobile|Tablet/.test(ua)) {
4131
                                o.mobile = "ffos";
4132
                            }
4133
                        }
4134
                    }
4135
                }
4136
            }
4137
        }
4138
    }
4139
 
4140
    //Check for known properties to tell if touch events are enabled on this device or if
4141
    //the number of MSPointer touchpoints on this device is greater than 0.
4142
    if (win && nav && !(o.chrome && o.chrome < 6)) {
4143
        o.touchEnabled = (("ontouchstart" in win) || (("msMaxTouchPoints" in nav) && (nav.msMaxTouchPoints > 0)));
4144
    }
4145
 
4146
    //It was a parsed UA, do not assign the global value.
4147
    if (!subUA) {
4148
 
4149
        if (typeof process === 'object') {
4150
 
4151
            if (process.versions && process.versions.node) {
4152
                //NodeJS
4153
                o.os = process.platform;
4154
                o.nodejs = numberify(process.versions.node);
4155
            }
4156
        }
4157
 
4158
        YUI.Env.UA = o;
4159
 
4160
    }
4161
 
4162
    return o;
4163
};
4164
 
4165
 
4166
Y.UA = YUI.Env.UA || YUI.Env.parseUA();
4167
 
4168
/**
4169
Performs a simple comparison between two version numbers, accounting for
4170
standard versioning logic such as the fact that "535.8" is a lower version than
4171
"535.24", even though a simple numerical comparison would indicate that it's
4172
greater. Also accounts for cases such as "1.1" vs. "1.1.0", which are
4173
considered equivalent.
4174
 
4175
Returns -1 if version _a_ is lower than version _b_, 0 if they're equivalent,
4176
1 if _a_ is higher than _b_.
4177
 
4178
Versions may be numbers or strings containing numbers and dots. For example,
4179
both `535` and `"535.8.10"` are acceptable. A version string containing
4180
non-numeric characters, like `"535.8.beta"`, may produce unexpected results.
4181
 
4182
@method compareVersions
4183
@param {Number|String} a First version number to compare.
4184
@param {Number|String} b Second version number to compare.
4185
@return -1 if _a_ is lower than _b_, 0 if they're equivalent, 1 if _a_ is
4186
    higher than _b_.
4187
**/
4188
Y.UA.compareVersions = function (a, b) {
4189
    var aPart, aParts, bPart, bParts, i, len;
4190
 
4191
    if (a === b) {
4192
        return 0;
4193
    }
4194
 
4195
    aParts = (a + '').split('.');
4196
    bParts = (b + '').split('.');
4197
 
4198
    for (i = 0, len = Math.max(aParts.length, bParts.length); i < len; ++i) {
4199
        aPart = parseInt(aParts[i], 10);
4200
        bPart = parseInt(bParts[i], 10);
4201
 
4202
        /*jshint expr: true*/
4203
        isNaN(aPart) && (aPart = 0);
4204
        isNaN(bPart) && (bPart = 0);
4205
 
4206
        if (aPart < bPart) {
4207
            return -1;
4208
        }
4209
 
4210
        if (aPart > bPart) {
4211
            return 1;
4212
        }
4213
    }
4214
 
4215
    return 0;
4216
};
4217
YUI.Env.aliases = {
4218
    "anim": ["anim-base","anim-color","anim-curve","anim-easing","anim-node-plugin","anim-scroll","anim-xy"],
4219
    "anim-shape-transform": ["anim-shape"],
4220
    "app": ["app-base","app-content","app-transitions","lazy-model-list","model","model-list","model-sync-rest","model-sync-local","router","view","view-node-map"],
4221
    "attribute": ["attribute-base","attribute-complex"],
4222
    "attribute-events": ["attribute-observable"],
4223
    "autocomplete": ["autocomplete-base","autocomplete-sources","autocomplete-list","autocomplete-plugin"],
4224
    "axes": ["axis-numeric","axis-category","axis-time","axis-stacked"],
4225
    "axes-base": ["axis-numeric-base","axis-category-base","axis-time-base","axis-stacked-base"],
4226
    "base": ["base-base","base-pluginhost","base-build"],
4227
    "cache": ["cache-base","cache-offline","cache-plugin"],
4228
    "charts": ["charts-base"],
4229
    "collection": ["array-extras","arraylist","arraylist-add","arraylist-filter","array-invoke"],
4230
    "color": ["color-base","color-hsl","color-harmony"],
4231
    "controller": ["router"],
4232
    "dataschema": ["dataschema-base","dataschema-json","dataschema-xml","dataschema-array","dataschema-text"],
4233
    "datasource": ["datasource-local","datasource-io","datasource-get","datasource-function","datasource-cache","datasource-jsonschema","datasource-xmlschema","datasource-arrayschema","datasource-textschema","datasource-polling"],
4234
    "datatable": ["datatable-core","datatable-table","datatable-head","datatable-body","datatable-base","datatable-column-widths","datatable-message","datatable-mutable","datatable-sort","datatable-datasource"],
4235
    "datatype": ["datatype-date","datatype-number","datatype-xml"],
4236
    "datatype-date": ["datatype-date-parse","datatype-date-format","datatype-date-math"],
4237
    "datatype-number": ["datatype-number-parse","datatype-number-format"],
4238
    "datatype-xml": ["datatype-xml-parse","datatype-xml-format"],
4239
    "dd": ["dd-ddm-base","dd-ddm","dd-ddm-drop","dd-drag","dd-proxy","dd-constrain","dd-drop","dd-scroll","dd-delegate"],
4240
    "dom": ["dom-base","dom-screen","dom-style","selector-native","selector"],
4241
    "editor": ["frame","editor-selection","exec-command","editor-base","editor-para","editor-br","editor-bidi","editor-tab","createlink-base"],
4242
    "event": ["event-base","event-delegate","event-synthetic","event-mousewheel","event-mouseenter","event-key","event-focus","event-resize","event-hover","event-outside","event-touch","event-move","event-flick","event-valuechange","event-tap"],
4243
    "event-custom": ["event-custom-base","event-custom-complex"],
4244
    "event-gestures": ["event-flick","event-move"],
4245
    "handlebars": ["handlebars-compiler"],
4246
    "highlight": ["highlight-base","highlight-accentfold"],
4247
    "history": ["history-base","history-hash","history-html5"],
4248
    "io": ["io-base","io-xdr","io-form","io-upload-iframe","io-queue"],
4249
    "json": ["json-parse","json-stringify"],
4250
    "loader": ["loader-base","loader-rollup","loader-yui3"],
4251
    "loader-pathogen-encoder": ["loader-base","loader-rollup","loader-yui3","loader-pathogen-combohandler"],
4252
    "node": ["node-base","node-event-delegate","node-pluginhost","node-screen","node-style"],
4253
    "pluginhost": ["pluginhost-base","pluginhost-config"],
4254
    "querystring": ["querystring-parse","querystring-stringify"],
4255
    "recordset": ["recordset-base","recordset-sort","recordset-filter","recordset-indexer"],
4256
    "resize": ["resize-base","resize-proxy","resize-constrain"],
4257
    "slider": ["slider-base","slider-value-range","clickable-rail","range-slider"],
4258
    "template": ["template-base","template-micro"],
4259
    "text": ["text-accentfold","text-wordbreak"],
4260
    "widget": ["widget-base","widget-htmlparser","widget-skin","widget-uievents"]
4261
};
4262
 
4263
 
4264
}, '3.18.1', {
4265
    "use": [
4266
        "yui-base",
4267
        "get",
4268
        "features",
4269
        "intl-base",
4270
        "yui-log",
4271
        "yui-log-nodejs",
4272
        "yui-later",
4273
        "loader-base",
4274
        "loader-rollup",
4275
        "loader-yui3"
4276
    ]
4277
});
4278
YUI.add('get', function (Y, NAME) {
4279
 
4280
    /**
4281
    * NodeJS specific Get module used to load remote resources.
4282
    * It contains the same signature as the default Get module so there is no code change needed.
4283
    * @module get-nodejs
4284
    * @class GetNodeJS
4285
    */
4286
 
4287
    var Module = require('module'),
4288
 
4289
        path = require('path'),
4290
        fs = require('fs'),
4291
        request = require('request'),
4292
        end = function(cb, msg, result) {
4293
            //Y.log('Get end: ' + cb.onEnd);
4294
            if (Y.Lang.isFunction(cb.onEnd)) {
4295
                cb.onEnd.call(Y, msg, result);
4296
            }
4297
        }, pass = function(cb) {
4298
            //Y.log('Get pass: ' + cb.onSuccess);
4299
            if (Y.Lang.isFunction(cb.onSuccess)) {
4300
                cb.onSuccess.call(Y, cb);
4301
            }
4302
            end(cb, 'success', 'success');
4303
        }, fail = function(cb, er) {
4304
            //Y.log('Get fail: ' + er);
4305
            er.errors = [er];
4306
            if (Y.Lang.isFunction(cb.onFailure)) {
4307
                cb.onFailure.call(Y, er, cb);
4308
            }
4309
            end(cb, er, 'fail');
4310
        };
4311
 
4312
 
4313
    Y.Get = function() {
4314
    };
4315
 
4316
    //Setup the default config base path
4317
    Y.config.base = path.join(__dirname, '../');
4318
 
4319
    YUI.require = require;
4320
    YUI.process = process;
4321
 
4322
    /**
4323
    * Takes the raw JS files and wraps them to be executed in the YUI context so they can be loaded
4324
    * into the YUI object
4325
    * @method _exec
4326
    * @private
4327
    * @param {String} data The JS to execute
4328
    * @param {String} url The path to the file that was parsed
4329
    * @param {Function} cb The callback to execute when this is completed
4330
    * @param {Error} cb.err=null Error object
4331
    * @param {String} cb.url The URL that was just parsed
4332
    */
4333
 
4334
    Y.Get._exec = function(data, url, cb) {
4335
        if (data.charCodeAt(0) === 0xFEFF) {
4336
            data = data.slice(1);
4337
        }
4338
 
4339
        var mod = new Module(url, module);
4340
        mod.filename = url;
4341
        mod.paths = Module._nodeModulePaths(path.dirname(url));
4342
        if (typeof YUI._getLoadHook === 'function') {
4343
            data = YUI._getLoadHook(data, url);
4344
        }
4345
        mod._compile('module.exports = function (YUI) {' +
4346
            'return (function () {'+ data + '\n;return YUI;}).apply(global);' +
4347
        '};', url);
4348
 
4349
        /*global YUI:true */
4350
        YUI = mod.exports(YUI);
4351
 
4352
        mod.loaded = true;
4353
 
4354
        cb(null, url);
4355
    };
4356
 
4357
    /**
4358
    * Fetches the content from a remote URL or a file from disc and passes the content
4359
    * off to `_exec` for parsing
4360
    * @method _include
4361
    * @private
4362
    * @param {String} url The URL/File path to fetch the content from
4363
    * @param {Function} cb The callback to fire once the content has been executed via `_exec`
4364
    */
4365
    Y.Get._include = function (url, cb) {
4366
        var cfg,
4367
            mod,
4368
            self = this;
4369
 
4370
        if (url.match(/^https?:\/\//)) {
4371
            cfg = {
4372
                url: url,
4373
                timeout: self.timeout
4374
            };
4375
            request(cfg, function (err, response, body) {
4376
                if (err) {
4377
                    Y.log(err, 'error', 'get');
4378
                    cb(err, url);
4379
                } else {
4380
                    Y.Get._exec(body, url, cb);
4381
                }
4382
            });
4383
        } else {
4384
            try {
4385
                // Try to resolve paths relative to the module that required yui.
4386
                url = Module._findPath(url, Module._resolveLookupPaths(url, module.parent.parent)[1]);
4387
 
4388
                if (Y.config.useSync) {
4389
                    //Needs to be in useSync
4390
                    mod = fs.readFileSync(url,'utf8');
4391
                } else {
4392
                    fs.readFile(url, 'utf8', function (err, mod) {
4393
                        if (err) {
4394
                            cb(err, url);
4395
                        } else {
4396
                            Y.Get._exec(mod, url, cb);
4397
                        }
4398
                    });
4399
                    return;
4400
                }
4401
            } catch (err) {
4402
                cb(err, url);
4403
                return;
4404
            }
4405
 
4406
            Y.Get._exec(mod, url, cb);
4407
        }
4408
    };
4409
 
4410
 
4411
    /**
4412
    * Override for Get.script for loading local or remote YUI modules.
4413
    * @method js
4414
    * @param {Array|String} s The URL's to load into this context
4415
    * @param {Object} options Transaction options
4416
    */
4417
    Y.Get.js = function(s, options) {
4418
        var urls = Y.Array(s), url, i, l = urls.length, c= 0,
4419
            check = function() {
4420
                if (c === l) {
4421
                    pass(options);
4422
                }
4423
            };
4424
 
4425
 
4426
        /*jshint loopfunc: true */
4427
        for (i=0; i<l; i++) {
4428
            url = urls[i];
4429
            if (Y.Lang.isObject(url)) {
4430
                url = url.url;
4431
            }
4432
 
4433
            url = url.replace(/'/g, '%27');
4434
            Y.log('URL: ' + url, 'info', 'get');
4435
            Y.Get._include(url, function(err, url) {
4436
                if (!Y.config) {
4437
                    Y.config = {
4438
                        debug: true
4439
                    };
4440
                }
4441
                if (options.onProgress) {
4442
                    options.onProgress.call(options.context || Y, url);
4443
                }
4444
                Y.log('After Load: ' + url, 'info', 'get');
4445
                if (err) {
4446
                    fail(options, err);
4447
                    Y.log('----------------------------------------------------------', 'error', 'get');
4448
                    Y.log(err, 'error', 'get');
4449
                    Y.log('----------------------------------------------------------', 'error', 'get');
4450
                } else {
4451
                    c++;
4452
                    check();
4453
                }
4454
            });
4455
        }
4456
 
4457
        //Keeping Signature in the browser.
4458
        return {
4459
            execute: function() {}
4460
        };
4461
    };
4462
 
4463
    /**
4464
    * Alias for `Y.Get.js`
4465
    * @method script
4466
    */
4467
    Y.Get.script = Y.Get.js;
4468
 
4469
    //Place holder for SS Dom access
4470
    Y.Get.css = function(s, cb) {
4471
        Y.log('Y.Get.css is not supported, just reporting that it has loaded but not fetching.', 'warn', 'get');
4472
        pass(cb);
4473
    };
4474
 
4475
 
4476
 
4477
}, '3.18.1');
4478
YUI.add('features', function (Y, NAME) {
4479
 
4480
var feature_tests = {};
4481
 
4482
/**
4483
Contains the core of YUI's feature test architecture.
4484
@module features
4485
*/
4486
 
4487
/**
4488
* Feature detection
4489
* @class Features
4490
* @static
4491
*/
4492
 
4493
Y.mix(Y.namespace('Features'), {
4494
 
4495
    /**
4496
    * Object hash of all registered feature tests
4497
    * @property tests
4498
    * @type Object
4499
    */
4500
    tests: feature_tests,
4501
 
4502
    /**
4503
    * Add a test to the system
4504
    *
4505
    *   ```
4506
    *   Y.Features.add("load", "1", {});
4507
    *   ```
4508
    *
4509
    * @method add
4510
    * @param {String} cat The category, right now only 'load' is supported
4511
    * @param {String} name The number sequence of the test, how it's reported in the URL or config: 1, 2, 3
4512
    * @param {Object} o Object containing test properties
4513
    * @param {String} o.name The name of the test
4514
    * @param {Function} o.test The test function to execute, the only argument to the function is the `Y` instance
4515
    * @param {String} o.trigger The module that triggers this test.
4516
    */
4517
    add: function(cat, name, o) {
4518
        feature_tests[cat] = feature_tests[cat] || {};
4519
        feature_tests[cat][name] = o;
4520
    },
4521
    /**
4522
    * Execute all tests of a given category and return the serialized results
4523
    *
4524
    *   ```
4525
    *   caps=1:1;2:1;3:0
4526
    *   ```
4527
    * @method all
4528
    * @param {String} cat The category to execute
4529
    * @param {Array} args The arguments to pass to the test function
4530
    * @return {String} A semi-colon separated string of tests and their success/failure: 1:1;2:1;3:0
4531
    */
4532
    all: function(cat, args) {
4533
        var cat_o = feature_tests[cat],
4534
            // results = {};
4535
            result = [];
4536
        if (cat_o) {
4537
            Y.Object.each(cat_o, function(v, k) {
4538
                result.push(k + ':' + (Y.Features.test(cat, k, args) ? 1 : 0));
4539
            });
4540
        }
4541
 
4542
        return (result.length) ? result.join(';') : '';
4543
    },
4544
    /**
4545
    * Run a specific test and return a Boolean response.
4546
    *
4547
    *   ```
4548
    *   Y.Features.test("load", "1");
4549
    *   ```
4550
    *
4551
    * @method test
4552
    * @param {String} cat The category of the test to run
4553
    * @param {String} name The name of the test to run
4554
    * @param {Array} args The arguments to pass to the test function
4555
    * @return {Boolean} True or false if the test passed/failed.
4556
    */
4557
    test: function(cat, name, args) {
4558
        args = args || [];
4559
        var result, ua, test,
4560
            cat_o = feature_tests[cat],
4561
            feature = cat_o && cat_o[name];
4562
 
4563
        if (!feature) {
4564
            Y.log('Feature test ' + cat + ', ' + name + ' not found');
4565
        } else {
4566
 
4567
            result = feature.result;
4568
 
4569
            if (Y.Lang.isUndefined(result)) {
4570
 
4571
                ua = feature.ua;
4572
                if (ua) {
4573
                    result = (Y.UA[ua]);
4574
                }
4575
 
4576
                test = feature.test;
4577
                if (test && ((!ua) || result)) {
4578
                    result = test.apply(Y, args);
4579
                }
4580
 
4581
                feature.result = result;
4582
            }
4583
        }
4584
 
4585
        return result;
4586
    }
4587
});
4588
 
4589
// Y.Features.add("load", "1", {});
4590
// Y.Features.test("load", "1");
4591
// caps=1:1;2:0;3:1;
4592
 
4593
/* This file is auto-generated by (yogi loader --yes --mix --start ../) */
4594
/*jshint maxlen:900, eqeqeq: false */
4595
var add = Y.Features.add;
4596
// app-transitions-native
4597
add('load', '0', {
4598
    "name": "app-transitions-native",
4599
    "test": function (Y) {
4600
    var doc  = Y.config.doc,
4601
        node = doc ? doc.documentElement : null;
4602
 
4603
    if (node && node.style) {
4604
        return ('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style);
4605
    }
4606
 
4607
    return false;
4608
},
4609
    "trigger": "app-transitions"
4610
});
4611
// autocomplete-list-keys
4612
add('load', '1', {
4613
    "name": "autocomplete-list-keys",
4614
    "test": function (Y) {
4615
    // Only add keyboard support to autocomplete-list if this doesn't appear to
4616
    // be an iOS or Android-based mobile device.
4617
    //
4618
    // There's currently no feasible way to actually detect whether a device has
4619
    // a hardware keyboard, so this sniff will have to do. It can easily be
4620
    // overridden by manually loading the autocomplete-list-keys module.
4621
    //
4622
    // Worth noting: even though iOS supports bluetooth keyboards, Mobile Safari
4623
    // doesn't fire the keyboard events used by AutoCompleteList, so there's
4624
    // no point loading the -keys module even when a bluetooth keyboard may be
4625
    // available.
4626
    return !(Y.UA.ios || Y.UA.android);
4627
},
4628
    "trigger": "autocomplete-list"
4629
});
4630
// dd-gestures
4631
add('load', '2', {
4632
    "name": "dd-gestures",
4633
    "trigger": "dd-drag",
4634
    "ua": "touchEnabled"
4635
});
4636
// dom-style-ie
4637
add('load', '3', {
4638
    "name": "dom-style-ie",
4639
    "test": function (Y) {
4640
 
4641
    var testFeature = Y.Features.test,
4642
        addFeature = Y.Features.add,
4643
        WINDOW = Y.config.win,
4644
        DOCUMENT = Y.config.doc,
4645
        DOCUMENT_ELEMENT = 'documentElement',
4646
        ret = false;
4647
 
4648
    addFeature('style', 'computedStyle', {
4649
        test: function() {
4650
            return WINDOW && 'getComputedStyle' in WINDOW;
4651
        }
4652
    });
4653
 
4654
    addFeature('style', 'opacity', {
4655
        test: function() {
4656
            return DOCUMENT && 'opacity' in DOCUMENT[DOCUMENT_ELEMENT].style;
4657
        }
4658
    });
4659
 
4660
    ret =  (!testFeature('style', 'opacity') &&
4661
            !testFeature('style', 'computedStyle'));
4662
 
4663
    return ret;
4664
},
4665
    "trigger": "dom-style"
4666
});
4667
// editor-para-ie
4668
add('load', '4', {
4669
    "name": "editor-para-ie",
4670
    "trigger": "editor-para",
4671
    "ua": "ie",
4672
    "when": "instead"
4673
});
4674
// event-base-ie
4675
add('load', '5', {
4676
    "name": "event-base-ie",
4677
    "test": function(Y) {
4678
    var imp = Y.config.doc && Y.config.doc.implementation;
4679
    return (imp && (!imp.hasFeature('Events', '2.0')));
4680
},
4681
    "trigger": "node-base"
4682
});
4683
// graphics-canvas
4684
add('load', '6', {
4685
    "name": "graphics-canvas",
4686
    "test": function(Y) {
4687
    var DOCUMENT = Y.config.doc,
4688
        useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas",
4689
		canvas = DOCUMENT && DOCUMENT.createElement("canvas"),
4690
        svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
4691
    return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d"));
4692
},
4693
    "trigger": "graphics"
4694
});
4695
// graphics-canvas-default
4696
add('load', '7', {
4697
    "name": "graphics-canvas-default",
4698
    "test": function(Y) {
4699
    var DOCUMENT = Y.config.doc,
4700
        useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas",
4701
		canvas = DOCUMENT && DOCUMENT.createElement("canvas"),
4702
        svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
4703
    return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d"));
4704
},
4705
    "trigger": "graphics"
4706
});
4707
// graphics-svg
4708
add('load', '8', {
4709
    "name": "graphics-svg",
4710
    "test": function(Y) {
4711
    var DOCUMENT = Y.config.doc,
4712
        useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas",
4713
		canvas = DOCUMENT && DOCUMENT.createElement("canvas"),
4714
        svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
4715
 
4716
    return svg && (useSVG || !canvas);
4717
},
4718
    "trigger": "graphics"
4719
});
4720
// graphics-svg-default
4721
add('load', '9', {
4722
    "name": "graphics-svg-default",
4723
    "test": function(Y) {
4724
    var DOCUMENT = Y.config.doc,
4725
        useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas",
4726
		canvas = DOCUMENT && DOCUMENT.createElement("canvas"),
4727
        svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
4728
 
4729
    return svg && (useSVG || !canvas);
4730
},
4731
    "trigger": "graphics"
4732
});
4733
// graphics-vml
4734
add('load', '10', {
4735
    "name": "graphics-vml",
4736
    "test": function(Y) {
4737
    var DOCUMENT = Y.config.doc,
4738
		canvas = DOCUMENT && DOCUMENT.createElement("canvas");
4739
    return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d")));
4740
},
4741
    "trigger": "graphics"
4742
});
4743
// graphics-vml-default
4744
add('load', '11', {
4745
    "name": "graphics-vml-default",
4746
    "test": function(Y) {
4747
    var DOCUMENT = Y.config.doc,
4748
		canvas = DOCUMENT && DOCUMENT.createElement("canvas");
4749
    return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d")));
4750
},
4751
    "trigger": "graphics"
4752
});
4753
// history-hash-ie
4754
add('load', '12', {
4755
    "name": "history-hash-ie",
4756
    "test": function (Y) {
4757
    var docMode = Y.config.doc && Y.config.doc.documentMode;
4758
 
4759
    return Y.UA.ie && (!('onhashchange' in Y.config.win) ||
4760
            !docMode || docMode < 8);
4761
},
4762
    "trigger": "history-hash"
4763
});
4764
// io-nodejs
4765
add('load', '13', {
4766
    "name": "io-nodejs",
4767
    "trigger": "io-base",
4768
    "ua": "nodejs"
4769
});
4770
// json-parse-shim
4771
add('load', '14', {
4772
    "name": "json-parse-shim",
4773
    "test": function (Y) {
4774
    var _JSON = Y.config.global.JSON,
4775
        Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON,
4776
        nativeSupport = Y.config.useNativeJSONParse !== false && !!Native;
4777
 
4778
    function workingNative( k, v ) {
4779
        return k === "ok" ? true : v;
4780
    }
4781
 
4782
    // Double check basic functionality.  This is mainly to catch early broken
4783
    // implementations of the JSON API in Firefox 3.1 beta1 and beta2
4784
    if ( nativeSupport ) {
4785
        try {
4786
            nativeSupport = ( Native.parse( '{"ok":false}', workingNative ) ).ok;
4787
        }
4788
        catch ( e ) {
4789
            nativeSupport = false;
4790
        }
4791
    }
4792
 
4793
    return !nativeSupport;
4794
},
4795
    "trigger": "json-parse"
4796
});
4797
// json-stringify-shim
4798
add('load', '15', {
4799
    "name": "json-stringify-shim",
4800
    "test": function (Y) {
4801
    var _JSON = Y.config.global.JSON,
4802
        Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON,
4803
        nativeSupport = Y.config.useNativeJSONStringify !== false && !!Native;
4804
 
4805
    // Double check basic native functionality.  This is primarily to catch broken
4806
    // early JSON API implementations in Firefox 3.1 beta1 and beta2.
4807
    if ( nativeSupport ) {
4808
        try {
4809
            nativeSupport = ( '0' === Native.stringify(0) );
4810
        } catch ( e ) {
4811
            nativeSupport = false;
4812
        }
4813
    }
4814
 
4815
 
4816
    return !nativeSupport;
4817
},
4818
    "trigger": "json-stringify"
4819
});
4820
// scrollview-base-ie
4821
add('load', '16', {
4822
    "name": "scrollview-base-ie",
4823
    "trigger": "scrollview-base",
4824
    "ua": "ie"
4825
});
4826
// selector-css2
4827
add('load', '17', {
4828
    "name": "selector-css2",
4829
    "test": function (Y) {
4830
    var DOCUMENT = Y.config.doc,
4831
        ret = DOCUMENT && !('querySelectorAll' in DOCUMENT);
4832
 
4833
    return ret;
4834
},
4835
    "trigger": "selector"
4836
});
4837
// transition-timer
4838
add('load', '18', {
4839
    "name": "transition-timer",
4840
    "test": function (Y) {
4841
    var DOCUMENT = Y.config.doc,
4842
        node = (DOCUMENT) ? DOCUMENT.documentElement: null,
4843
        ret = true;
4844
 
4845
    if (node && node.style) {
4846
        ret = !('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style);
4847
    }
4848
 
4849
    return ret;
4850
},
4851
    "trigger": "transition"
4852
});
4853
// widget-base-ie
4854
add('load', '19', {
4855
    "name": "widget-base-ie",
4856
    "trigger": "widget-base",
4857
    "ua": "ie"
4858
});
4859
// yql-jsonp
4860
add('load', '20', {
4861
    "name": "yql-jsonp",
4862
    "test": function (Y) {
4863
    /* Only load the JSONP module when not in nodejs or winjs
4864
    TODO Make the winjs module a CORS module
4865
    */
4866
    return (!Y.UA.nodejs && !Y.UA.winjs);
4867
},
4868
    "trigger": "yql"
4869
});
4870
// yql-nodejs
4871
add('load', '21', {
4872
    "name": "yql-nodejs",
4873
    "trigger": "yql",
4874
    "ua": "nodejs"
4875
});
4876
// yql-winjs
4877
add('load', '22', {
4878
    "name": "yql-winjs",
4879
    "trigger": "yql",
4880
    "ua": "winjs"
4881
});
4882
 
4883
}, '3.18.1', {"requires": ["yui-base"]});
4884
YUI.add('intl-base', function (Y, NAME) {
4885
 
4886
/**
4887
 * The Intl utility provides a central location for managing sets of
4888
 * localized resources (strings and formatting patterns).
4889
 *
4890
 * @class Intl
4891
 * @uses EventTarget
4892
 * @static
4893
 */
4894
 
4895
var SPLIT_REGEX = /[, ]/;
4896
 
4897
Y.mix(Y.namespace('Intl'), {
4898
 
4899
 /**
4900
    * Returns the language among those available that
4901
    * best matches the preferred language list, using the Lookup
4902
    * algorithm of BCP 47.
4903
    * If none of the available languages meets the user's preferences,
4904
    * then "" is returned.
4905
    * Extended language ranges are not supported.
4906
    *
4907
    * @method lookupBestLang
4908
    * @param {String[] | String} preferredLanguages The list of preferred
4909
    * languages in descending preference order, represented as BCP 47
4910
    * language tags. A string array or a comma-separated list.
4911
    * @param {String[]} availableLanguages The list of languages
4912
    * that the application supports, represented as BCP 47 language
4913
    * tags.
4914
    *
4915
    * @return {String} The available language that best matches the
4916
    * preferred language list, or "".
4917
    * @since 3.1.0
4918
    */
4919
    lookupBestLang: function(preferredLanguages, availableLanguages) {
4920
 
4921
        var i, language, result, index;
4922
 
4923
        // check whether the list of available languages contains language;
4924
        // if so return it
4925
        function scan(language) {
4926
            var i;
4927
            for (i = 0; i < availableLanguages.length; i += 1) {
4928
                if (language.toLowerCase() ===
4929
                            availableLanguages[i].toLowerCase()) {
4930
                    return availableLanguages[i];
4931
                }
4932
            }
4933
        }
4934
 
4935
        if (Y.Lang.isString(preferredLanguages)) {
4936
            preferredLanguages = preferredLanguages.split(SPLIT_REGEX);
4937
        }
4938
 
4939
        for (i = 0; i < preferredLanguages.length; i += 1) {
4940
            language = preferredLanguages[i];
4941
            if (!language || language === '*') {
4942
                continue;
4943
            }
4944
            // check the fallback sequence for one language
4945
            while (language.length > 0) {
4946
                result = scan(language);
4947
                if (result) {
4948
                    return result;
4949
                } else {
4950
                    index = language.lastIndexOf('-');
4951
                    if (index >= 0) {
4952
                        language = language.substring(0, index);
4953
                        // one-character subtags get cut along with the
4954
                        // following subtag
4955
                        if (index >= 2 && language.charAt(index - 2) === '-') {
4956
                            language = language.substring(0, index - 2);
4957
                        }
4958
                    } else {
4959
                        // nothing available for this language
4960
                        break;
4961
                    }
4962
                }
4963
            }
4964
        }
4965
 
4966
        return '';
4967
    }
4968
});
4969
 
4970
 
4971
}, '3.18.1', {"requires": ["yui-base"]});
4972
YUI.add('yui-log', function (Y, NAME) {
4973
 
4974
/**
4975
 * Provides console log capability and exposes a custom event for
4976
 * console implementations. This module is a `core` YUI module,
4977
 * <a href="../classes/YUI.html#method_log">it's documentation is located under the YUI class</a>.
4978
 *
4979
 * @module yui
4980
 * @submodule yui-log
4981
 */
4982
 
4983
var INSTANCE = Y,
4984
    LOGEVENT = 'yui:log',
4985
    UNDEFINED = 'undefined',
4986
    LEVELS = { debug: 1,
4987
               info: 2,
4988
               warn: 4,
4989
               error: 8 };
4990
 
4991
/**
4992
 * If the 'debug' config is true, a 'yui:log' event will be
4993
 * dispatched, which the Console widget and anything else
4994
 * can consume.  If the 'useBrowserConsole' config is true, it will
4995
 * write to the browser console if available.  YUI-specific log
4996
 * messages will only be present in the -debug versions of the
4997
 * JS files.  The build system is supposed to remove log statements
4998
 * from the raw and minified versions of the files.
4999
 *
5000
 * @method log
5001
 * @for YUI
5002
 * @param  {String}  msg  The message to log.
5003
 * @param  {String}  cat  The log category for the message.  Default
5004
 *                        categories are "info", "warn", "error", "debug".
5005
 *                        Custom categories can be used as well. (opt).
5006
 * @param  {String}  src  The source of the the message (opt).
5007
 * @param  {boolean} silent If true, the log event won't fire.
5008
 * @return {YUI}      YUI instance.
5009
 */
5010
INSTANCE.log = function(msg, cat, src, silent) {
5011
    var bail, excl, incl, m, f, minlevel,
5012
        Y = INSTANCE,
5013
        c = Y.config,
5014
        publisher = (Y.fire) ? Y : YUI.Env.globalEvents;
5015
    // suppress log message if the config is off or the event stack
5016
    // or the event call stack contains a consumer of the yui:log event
5017
    if (c.debug) {
5018
        // apply source filters
5019
        src = src || "";
5020
        if (typeof src !== "undefined") {
5021
            excl = c.logExclude;
5022
            incl = c.logInclude;
5023
            if (incl && !(src in incl)) {
5024
                bail = 1;
5025
            } else if (incl && (src in incl)) {
5026
                bail = !incl[src];
5027
            } else if (excl && (src in excl)) {
5028
                bail = excl[src];
5029
            }
5030
 
5031
            // Set a default category of info if the category was not defined.
5032
            if ((typeof cat === 'undefined')) {
5033
                cat = 'info';
5034
            }
5035
 
5036
            // Determine the current minlevel as defined in configuration
5037
            Y.config.logLevel = Y.config.logLevel || 'debug';
5038
            minlevel = LEVELS[Y.config.logLevel.toLowerCase()];
5039
 
5040
            if (cat in LEVELS && LEVELS[cat] < minlevel) {
5041
                // Skip this message if the we don't meet the defined minlevel
5042
                bail = 1;
5043
            }
5044
        }
5045
        if (!bail) {
5046
            if (c.useBrowserConsole) {
5047
                m = (src) ? src + ': ' + msg : msg;
5048
                if (Y.Lang.isFunction(c.logFn)) {
5049
                    c.logFn.call(Y, msg, cat, src);
5050
                } else if (typeof console !== UNDEFINED && console.log) {
5051
                    f = (cat && console[cat] && (cat in LEVELS)) ? cat : 'log';
5052
                    console[f](m);
5053
                } else if (typeof opera !== UNDEFINED) {
5054
                    opera.postError(m);
5055
                }
5056
            }
5057
 
5058
            if (publisher && !silent) {
5059
 
5060
                if (publisher === Y && (!publisher.getEvent(LOGEVENT))) {
5061
                    publisher.publish(LOGEVENT, {
5062
                        broadcast: 2
5063
                    });
5064
                }
5065
 
5066
                publisher.fire(LOGEVENT, {
5067
                    msg: msg,
5068
                    cat: cat,
5069
                    src: src
5070
                });
5071
            }
5072
        }
5073
    }
5074
 
5075
    return Y;
5076
};
5077
 
5078
/**
5079
 * Write a system message.  This message will be preserved in the
5080
 * minified and raw versions of the YUI files, unlike log statements.
5081
 * @method message
5082
 * @for YUI
5083
 * @param  {String}  msg  The message to log.
5084
 * @param  {String}  cat  The log category for the message.  Default
5085
 *                        categories are "info", "warn", "error", "debug".
5086
 *                        Custom categories can be used as well. (opt).
5087
 * @param  {String}  src  The source of the the message (opt).
5088
 * @param  {boolean} silent If true, the log event won't fire.
5089
 * @return {YUI}      YUI instance.
5090
 */
5091
INSTANCE.message = function() {
5092
    return INSTANCE.log.apply(INSTANCE, arguments);
5093
};
5094
 
5095
 
5096
}, '3.18.1', {"requires": ["yui-base"]});
5097
YUI.add('yui-log-nodejs', function (Y, NAME) {
5098
 
5099
var sys = require(process.binding('natives').util ? 'util' : 'sys'),
5100
    hasColor = false;
5101
 
5102
try {
5103
    var stdio = require("stdio");
5104
    hasColor = stdio.isStderrATTY();
5105
} catch (ex) {
5106
    hasColor = true;
5107
}
5108
 
5109
Y.config.useColor = hasColor;
5110
 
5111
Y.consoleColor = function(str, num) {
5112
    if (!this.config.useColor) {
5113
        return str;
5114
    }
5115
    if (!num) {
5116
        num = '32';
5117
    }
5118
    return "\u001b[" + num +"m" + str + "\u001b[0m";
5119
};
5120
 
5121
 
5122
var logFn = function(str, t, m) {
5123
    var id = '', lvl, mLvl;
5124
    if (this.id) {
5125
        id = '[' + this.id + ']:';
5126
    }
5127
    t = t || 'info';
5128
    m = (m) ? this.consoleColor(' (' +  m.toLowerCase() + '):', 35) : '';
5129
 
5130
    if (str === null) {
5131
        str = 'null';
5132
    }
5133
 
5134
    if ((typeof str === 'object') || str instanceof Array) {
5135
        try {
5136
            //Should we use this?
5137
            if (str.tagName || str._yuid || str._query) {
5138
                str = str.toString();
5139
            } else {
5140
                str = sys.inspect(str);
5141
            }
5142
        } catch (e) {
5143
            //Fail catcher
5144
        }
5145
    }
5146
 
5147
    lvl = '37;40';
5148
    mLvl = ((str) ? '' : 31);
5149
    t = t+''; //Force to a string..
5150
    switch (t.toLowerCase()) {
5151
        case 'error':
5152
            lvl = mLvl = 31;
5153
            break;
5154
        case 'warn':
5155
            lvl = 33;
5156
            break;
5157
        case 'debug':
5158
            lvl = 34;
5159
            break;
5160
    }
5161
    if (typeof str === 'string') {
5162
        if (str && str.indexOf("\n") !== -1) {
5163
            str = "\n" + str;
5164
        }
5165
    }
5166
 
5167
    // output log messages to stderr
5168
    sys.error(this.consoleColor(t.toLowerCase() + ':', lvl) + m + ' ' + this.consoleColor(str, mLvl));
5169
};
5170
 
5171
if (!Y.config.logFn) {
5172
    Y.config.logFn = logFn;
5173
}
5174
 
5175
 
5176
 
5177
}, '3.18.1');
5178
YUI.add('yui-later', function (Y, NAME) {
5179
 
5180
/**
5181
 * Provides a setTimeout/setInterval wrapper. This module is a `core` YUI module,
5182
 * <a href="../classes/YUI.html#method_later">it's documentation is located under the YUI class</a>.
5183
 *
5184
 * @module yui
5185
 * @submodule yui-later
5186
 */
5187
 
5188
var NO_ARGS = [];
5189
 
5190
/**
5191
 * Executes the supplied function in the context of the supplied
5192
 * object 'when' milliseconds later.  Executes the function a
5193
 * single time unless periodic is set to true.
5194
 * @for YUI
5195
 * @method later
5196
 * @param when {Number} the number of milliseconds to wait until the fn
5197
 * is executed.
5198
 * @param o the context object.
5199
 * @param fn {Function|String} the function to execute or the name of
5200
 * the method in the 'o' object to execute.
5201
 * @param data [Array] data that is provided to the function.  This
5202
 * accepts either a single item or an array.  If an array is provided,
5203
 * the function is executed with one parameter for each array item.
5204
 * If you need to pass a single array parameter, it needs to be wrapped
5205
 * in an array [myarray].
5206
 *
5207
 * Note: native methods in IE may not have the call and apply methods.
5208
 * In this case, it will work, but you are limited to four arguments.
5209
 *
5210
 * @param periodic {boolean} if true, executes continuously at supplied
5211
 * interval until canceled.
5212
 * @return {object} a timer object. Call the cancel() method on this
5213
 * object to stop the timer.
5214
 */
5215
Y.later = function(when, o, fn, data, periodic) {
5216
    when = when || 0;
5217
    data = (!Y.Lang.isUndefined(data)) ? Y.Array(data) : NO_ARGS;
5218
    o = o || Y.config.win || Y;
5219
 
5220
    var cancelled = false,
5221
        method = (o && Y.Lang.isString(fn)) ? o[fn] : fn,
5222
        wrapper = function() {
5223
            // IE 8- may execute a setInterval callback one last time
5224
            // after clearInterval was called, so in order to preserve
5225
            // the cancel() === no more runny-run, we have to jump through
5226
            // an extra hoop.
5227
            if (!cancelled) {
5228
                if (!method.apply) {
5229
                    method(data[0], data[1], data[2], data[3]);
5230
                } else {
5231
                    method.apply(o, data || NO_ARGS);
5232
                }
5233
            }
5234
        },
5235
        id = (periodic) ? setInterval(wrapper, when) : setTimeout(wrapper, when);
5236
 
5237
    return {
5238
        id: id,
5239
        interval: periodic,
5240
        cancel: function() {
5241
            cancelled = true;
5242
            if (this.interval) {
5243
                clearInterval(id);
5244
            } else {
5245
                clearTimeout(id);
5246
            }
5247
        }
5248
    };
5249
};
5250
 
5251
Y.Lang.later = Y.later;
5252
 
5253
 
5254
 
5255
}, '3.18.1', {"requires": ["yui-base"]});
5256
YUI.add('loader-base', function (Y, NAME) {
5257
 
5258
/**
5259
 * The YUI loader core
5260
 * @module loader
5261
 * @submodule loader-base
5262
 */
5263
 
5264
(function() {
5265
    var VERSION = Y.version,
5266
        BUILD = '/build/',
5267
        ROOT = VERSION + '/',
5268
        CDN_BASE = Y.Env.base,
5269
        GALLERY_VERSION = 'gallery-2014.07.31-18-26',
5270
        TNT = '2in3',
5271
        TNT_VERSION = '4',
5272
        YUI2_VERSION = '2.9.0',
5273
        COMBO_BASE = CDN_BASE + 'combo?',
5274
        META = {
5275
            version: VERSION,
5276
            root: ROOT,
5277
            base: Y.Env.base,
5278
            comboBase: COMBO_BASE,
5279
            skin: {
5280
                defaultSkin: 'sam',
5281
                base: 'assets/skins/',
5282
                path: 'skin.css',
5283
                after: [
5284
                    'cssreset',
5285
                    'cssfonts',
5286
                    'cssgrids',
5287
                    'cssbase',
5288
                    'cssreset-context',
5289
                    'cssfonts-context'
5290
                ]
5291
            },
5292
            groups: {},
5293
            patterns: {}
5294
        },
5295
        groups = META.groups,
5296
        yui2Update = function(tnt, yui2, config) {
5297
            var root = TNT + '.' +
5298
                    (tnt || TNT_VERSION) + '/' +
5299
                    (yui2 || YUI2_VERSION) + BUILD,
5300
                base = (config && config.base) ? config.base : CDN_BASE,
5301
                combo = (config && config.comboBase) ? config.comboBase : COMBO_BASE;
5302
 
5303
            groups.yui2.base = base + root;
5304
            groups.yui2.root = root;
5305
            groups.yui2.comboBase = combo;
5306
        },
5307
        galleryUpdate = function(tag, config) {
5308
            var root = (tag || GALLERY_VERSION) + BUILD,
5309
                base = (config && config.base) ? config.base : CDN_BASE,
5310
                combo = (config && config.comboBase) ? config.comboBase : COMBO_BASE;
5311
 
5312
            groups.gallery.base = base + root;
5313
            groups.gallery.root = root;
5314
            groups.gallery.comboBase = combo;
5315
        };
5316
 
5317
 
5318
    groups[VERSION] = {};
5319
 
5320
    groups.gallery = {
5321
        ext: false,
5322
        combine: true,
5323
        comboBase: COMBO_BASE,
5324
        update: galleryUpdate,
5325
        patterns: {
5326
            'gallery-': {},
5327
            'lang/gallery-': {},
5328
            'gallerycss-': {
5329
                type: 'css'
5330
            }
5331
        }
5332
    };
5333
 
5334
    groups.yui2 = {
5335
        combine: true,
5336
        ext: false,
5337
        comboBase: COMBO_BASE,
5338
        update: yui2Update,
5339
        patterns: {
5340
            'yui2-': {
5341
                configFn: function(me) {
5342
                    if (/-skin|reset|fonts|grids|base/.test(me.name)) {
5343
                        me.type = 'css';
5344
                        me.path = me.path.replace(/\.js/, '.css');
5345
                        // this makes skins in builds earlier than
5346
                        // 2.6.0 work as long as combine is false
5347
                        me.path = me.path.replace(/\/yui2-skin/,
5348
                                            '/assets/skins/sam/yui2-skin');
5349
                    }
5350
                }
5351
            }
5352
        }
5353
    };
5354
 
5355
    galleryUpdate();
5356
    yui2Update();
5357
 
5358
    if (YUI.Env[VERSION]) {
5359
        Y.mix(META, YUI.Env[VERSION], false, [
5360
            'modules',
5361
            'groups',
5362
            'skin'
5363
        ], 0, true);
5364
    }
5365
 
5366
    YUI.Env[VERSION] = META;
5367
}());
5368
/*jslint forin: true, maxlen: 350 */
5369
 
5370
/**
5371
 * Loader dynamically loads script and css files.  It includes the dependency
5372
 * information for the version of the library in use, and will automatically pull in
5373
 * dependencies for the modules requested. It can also load the
5374
 * files from the Yahoo! CDN, and it can utilize the combo service provided on
5375
 * this network to reduce the number of http connections required to download
5376
 * YUI files.
5377
 *
5378
 * @module loader
5379
 * @main loader
5380
 * @submodule loader-base
5381
 */
5382
 
5383
var NOT_FOUND = {},
5384
    NO_REQUIREMENTS = [],
5385
    MAX_URL_LENGTH = 1024,
5386
    GLOBAL_ENV = YUI.Env,
5387
    GLOBAL_LOADED = GLOBAL_ENV._loaded,
5388
    CSS = 'css',
5389
    JS = 'js',
5390
    INTL = 'intl',
5391
    DEFAULT_SKIN = 'sam',
5392
    VERSION = Y.version,
5393
    ROOT_LANG = '',
5394
    YObject = Y.Object,
5395
    oeach = YObject.each,
5396
    yArray = Y.Array,
5397
    _queue = GLOBAL_ENV._loaderQueue,
5398
    META = GLOBAL_ENV[VERSION],
5399
    SKIN_PREFIX = 'skin-',
5400
    L = Y.Lang,
5401
    ON_PAGE = GLOBAL_ENV.mods,
5402
    modulekey,
5403
    _path = function(dir, file, type, nomin) {
5404
        var path = dir + '/' + file;
5405
        if (!nomin) {
5406
            path += '-min';
5407
        }
5408
        path += '.' + (type || CSS);
5409
 
5410
        return path;
5411
    };
5412
 
5413
 
5414
    if (!YUI.Env._cssLoaded) {
5415
        YUI.Env._cssLoaded = {};
5416
    }
5417
 
5418
 
5419
/**
5420
 * The component metadata is stored in Y.Env.meta.
5421
 * Part of the loader module.
5422
 * @property meta
5423
 * @for YUI
5424
 */
5425
Y.Env.meta = META;
5426
 
5427
/**
5428
 * Loader dynamically loads script and css files.  It includes the dependency
5429
 * info for the version of the library in use, and will automatically pull in
5430
 * dependencies for the modules requested. It can load the
5431
 * files from the Yahoo! CDN, and it can utilize the combo service provided on
5432
 * this network to reduce the number of http connections required to download
5433
 * YUI files. You can also specify an external, custom combo service to host
5434
 * your modules as well.
5435
 
5436
        var Y = YUI();
5437
        var loader = new Y.Loader({
5438
            filter: 'debug',
5439
            base: '../../',
5440
            root: 'build/',
5441
            combine: true,
5442
            require: ['node', 'dd', 'console']
5443
        });
5444
        var out = loader.resolve(true);
5445
 
5446
 * If the Loader needs to be patched before it is used for the first time, it
5447
 * should be done through the `doBeforeLoader` hook. Simply make the patch
5448
 * available via configuration before YUI is loaded:
5449
 
5450
        YUI_config = YUI_config || {};
5451
        YUI_config.doBeforeLoader = function (config) {
5452
            var resolve = this.context.Loader.prototype.resolve;
5453
            this.context.Loader.prototype.resolve = function () {
5454
                // do something here
5455
                return resolve.apply(this, arguments);
5456
            };
5457
        };
5458
 
5459
 * @constructor
5460
 * @class Loader
5461
 * @param {Object} config an optional set of configuration options.
5462
 * @param {String} config.base The base dir which to fetch this module from
5463
 * @param {String} config.comboBase The Combo service base path. Ex: `http://yui.yahooapis.com/combo?`
5464
 * @param {String} config.root The root path to prepend to module names for the combo service. Ex: `2.5.2/build/`
5465
 * @param {String|Object} config.filter A filter to apply to result urls. <a href="#property_filter">See filter property</a>
5466
 * @param {Object} config.filters Per-component filter specification.  If specified for a given component, this overrides the filter config.
5467
 * @param {Boolean} config.combine Use a combo service to reduce the number of http connections required to load your dependencies
5468
 * @param {Boolean} [config.async=true] Fetch files in async
5469
 * @param {Array} config.ignore: A list of modules that should never be dynamically loaded
5470
 * @param {Array} config.force A list of modules that should always be loaded when required, even if already present on the page
5471
 * @param {HTMLElement|String} config.insertBefore Node or id for a node that should be used as the insertion point for new nodes
5472
 * @param {Object} config.jsAttributes Object literal containing attributes to add to script nodes
5473
 * @param {Object} config.cssAttributes Object literal containing attributes to add to link nodes
5474
 * @param {Number} config.timeout The number of milliseconds before a timeout occurs when dynamically loading nodes.  If not set, there is no timeout
5475
 * @param {Object} config.context Execution context for all callbacks
5476
 * @param {Function} config.onSuccess Callback for the 'success' event
5477
 * @param {Function} config.onFailure Callback for the 'failure' event
5478
 * @param {Function} config.onTimeout Callback for the 'timeout' event
5479
 * @param {Function} config.onProgress Callback executed each time a script or css file is loaded
5480
 * @param {Object} config.modules A list of module definitions.  See <a href="#method_addModule">Loader.addModule</a> for the supported module metadata
5481
 * @param {Object} config.groups A list of group definitions.  Each group can contain specific definitions for `base`, `comboBase`, `combine`, and accepts a list of `modules`.
5482
 * @param {String} config.2in3 The version of the YUI 2 in 3 wrapper to use.  The intrinsic support for YUI 2 modules in YUI 3 relies on versions of the YUI 2 components inside YUI 3 module wrappers.  These wrappers change over time to accomodate the issues that arise from running YUI 2 in a YUI 3 sandbox.
5483
 * @param {String} config.yui2 When using the 2in3 project, you can select the version of YUI 2 to use.  Valid values are `2.2.2`, `2.3.1`, `2.4.1`, `2.5.2`, `2.6.0`, `2.7.0`, `2.8.0`, `2.8.1` and `2.9.0` [default] -- plus all versions of YUI 2 going forward.
5484
 * @param {Function} config.doBeforeLoader An optional hook that allows for the patching of the loader instance. The `Y` instance is available as `this.context` and the only argument to the function is the Loader configuration object.
5485
 */
5486
Y.Loader = function(o) {
5487
 
5488
    var self = this;
5489
 
5490
    //Catch no config passed.
5491
    o = o || {};
5492
 
5493
    modulekey = META.md5;
5494
 
5495
    /**
5496
     * Internal callback to handle multiple internal insert() calls
5497
     * so that css is inserted prior to js
5498
     * @property _internalCallback
5499
     * @private
5500
     */
5501
    // self._internalCallback = null;
5502
 
5503
    /**
5504
     * Callback that will be executed when the loader is finished
5505
     * with an insert
5506
     * @method onSuccess
5507
     * @type function
5508
     */
5509
    // self.onSuccess = null;
5510
 
5511
    /**
5512
     * Callback that will be executed if there is a failure
5513
     * @method onFailure
5514
     * @type function
5515
     */
5516
    // self.onFailure = null;
5517
 
5518
    /**
5519
     * Callback executed each time a script or css file is loaded
5520
     * @method onProgress
5521
     * @type function
5522
     */
5523
    // self.onProgress = null;
5524
 
5525
    /**
5526
     * Callback that will be executed if a timeout occurs
5527
     * @method onTimeout
5528
     * @type function
5529
     */
5530
    // self.onTimeout = null;
5531
 
5532
    /**
5533
     * The execution context for all callbacks
5534
     * @property context
5535
     * @default {YUI} the YUI instance
5536
     */
5537
    self.context = Y;
5538
 
5539
    // Hook that allows the patching of loader
5540
    if (o.doBeforeLoader) {
5541
        o.doBeforeLoader.apply(self, arguments);
5542
    }
5543
 
5544
    /**
5545
     * Data that is passed to all callbacks
5546
     * @property data
5547
     */
5548
    // self.data = null;
5549
 
5550
    /**
5551
     * Node reference or id where new nodes should be inserted before
5552
     * @property insertBefore
5553
     * @type string|HTMLElement
5554
     */
5555
    // self.insertBefore = null;
5556
 
5557
    /**
5558
     * The charset attribute for inserted nodes
5559
     * @property charset
5560
     * @type string
5561
     * @deprecated , use cssAttributes or jsAttributes.
5562
     */
5563
    // self.charset = null;
5564
 
5565
    /**
5566
     * An object literal containing attributes to add to link nodes
5567
     * @property cssAttributes
5568
     * @type object
5569
     */
5570
    // self.cssAttributes = null;
5571
 
5572
    /**
5573
     * An object literal containing attributes to add to script nodes
5574
     * @property jsAttributes
5575
     * @type object
5576
     */
5577
    // self.jsAttributes = null;
5578
 
5579
    /**
5580
     * The base directory.
5581
     * @property base
5582
     * @type string
5583
     * @default http://yui.yahooapis.com/[YUI VERSION]/build/
5584
     */
5585
    self.base = Y.Env.meta.base + Y.Env.meta.root;
5586
 
5587
    /**
5588
     * Base path for the combo service
5589
     * @property comboBase
5590
     * @type string
5591
     * @default http://yui.yahooapis.com/combo?
5592
     */
5593
    self.comboBase = Y.Env.meta.comboBase;
5594
 
5595
    /*
5596
     * Base path for language packs.
5597
     */
5598
    // self.langBase = Y.Env.meta.langBase;
5599
    // self.lang = "";
5600
 
5601
    /**
5602
     * If configured, the loader will attempt to use the combo
5603
     * service for YUI resources and configured external resources.
5604
     * @property combine
5605
     * @type boolean
5606
     * @default true if a base dir isn't in the config
5607
     */
5608
    self.combine = o.base &&
5609
        (o.base.indexOf(self.comboBase.substr(0, 20)) > -1);
5610
 
5611
    /**
5612
    * The default seperator to use between files in a combo URL
5613
    * @property comboSep
5614
    * @type {String}
5615
    * @default Ampersand
5616
    */
5617
    self.comboSep = '&';
5618
    /**
5619
     * Max url length for combo urls.  The default is 1024. This is the URL
5620
     * limit for the Yahoo! hosted combo servers.  If consuming
5621
     * a different combo service that has a different URL limit
5622
     * it is possible to override this default by supplying
5623
     * the maxURLLength config option.  The config option will
5624
     * only take effect if lower than the default.
5625
     *
5626
     * @property maxURLLength
5627
     * @type int
5628
     */
5629
    self.maxURLLength = MAX_URL_LENGTH;
5630
 
5631
    /**
5632
     * Ignore modules registered on the YUI global
5633
     * @property ignoreRegistered
5634
     * @default false
5635
     */
5636
    self.ignoreRegistered = o.ignoreRegistered;
5637
 
5638
    /**
5639
     * Root path to prepend to module path for the combo
5640
     * service
5641
     * @property root
5642
     * @type string
5643
     * @default [YUI VERSION]/build/
5644
     */
5645
    self.root = Y.Env.meta.root;
5646
 
5647
    /**
5648
     * Timeout value in milliseconds.  If set, self value will be used by
5649
     * the get utility.  the timeout event will fire if
5650
     * a timeout occurs.
5651
     * @property timeout
5652
     * @type int
5653
     */
5654
    self.timeout = 0;
5655
 
5656
    /**
5657
     * A list of modules that should not be loaded, even if
5658
     * they turn up in the dependency tree
5659
     * @property ignore
5660
     * @type string[]
5661
     */
5662
    // self.ignore = null;
5663
 
5664
    /**
5665
     * A list of modules that should always be loaded, even
5666
     * if they have already been inserted into the page.
5667
     * @property force
5668
     * @type string[]
5669
     */
5670
    // self.force = null;
5671
 
5672
    self.forceMap = {};
5673
 
5674
    /**
5675
     * Should we allow rollups
5676
     * @property allowRollup
5677
     * @type boolean
5678
     * @default false
5679
     */
5680
    self.allowRollup = false;
5681
 
5682
    /**
5683
     * A filter to apply to result urls.  This filter will modify the default
5684
     * path for all modules.  The default path for the YUI library is the
5685
     * minified version of the files (e.g., event-min.js).  The filter property
5686
     * can be a predefined filter or a custom filter.  The valid predefined
5687
     * filters are:
5688
     * <dl>
5689
     *  <dt>DEBUG</dt>
5690
     *  <dd>Selects the debug versions of the library (e.g., event-debug.js).
5691
     *      This option will automatically include the Logger widget</dd>
5692
     *  <dt>RAW</dt>
5693
     *  <dd>Selects the non-minified version of the library (e.g., event.js).
5694
     *  </dd>
5695
     * </dl>
5696
     * You can also define a custom filter, which must be an object literal
5697
     * containing a search expression and a replace string:
5698
     *
5699
     *      myFilter: {
5700
     *          'searchExp': "-min\\.js",
5701
     *          'replaceStr': "-debug.js"
5702
     *      }
5703
     *
5704
     * @property filter
5705
     * @type string| {searchExp: string, replaceStr: string}
5706
     */
5707
    // self.filter = null;
5708
 
5709
    /**
5710
     * per-component filter specification.  If specified for a given
5711
     * component, this overrides the filter config.
5712
     * @property filters
5713
     * @type object
5714
     */
5715
    self.filters = {};
5716
 
5717
    /**
5718
     * The list of requested modules
5719
     * @property required
5720
     * @type {string: boolean}
5721
     */
5722
    self.required = {};
5723
 
5724
    /**
5725
     * If a module name is predefined when requested, it is checked againsts
5726
     * the patterns provided in this property.  If there is a match, the
5727
     * module is added with the default configuration.
5728
     *
5729
     * At the moment only supporting module prefixes, but anticipate
5730
     * supporting at least regular expressions.
5731
     * @property patterns
5732
     * @type Object
5733
     */
5734
    // self.patterns = Y.merge(Y.Env.meta.patterns);
5735
    self.patterns = {};
5736
 
5737
    /**
5738
     * Internal loader instance metadata. Use accessor `getModuleInfo()` instead.
5739
     */
5740
    self.moduleInfo = {};
5741
 
5742
    self.groups = Y.merge(Y.Env.meta.groups);
5743
 
5744
    /**
5745
     * Provides the information used to skin the skinnable components.
5746
     * The following skin definition would result in 'skin1' and 'skin2'
5747
     * being loaded for calendar (if calendar was requested), and
5748
     * 'sam' for all other skinnable components:
5749
     *
5750
     *      skin: {
5751
     *          // The default skin, which is automatically applied if not
5752
     *          // overriden by a component-specific skin definition.
5753
     *          // Change this in to apply a different skin globally
5754
     *          defaultSkin: 'sam',
5755
     *
5756
     *          // This is combined with the loader base property to get
5757
     *          // the default root directory for a skin. ex:
5758
     *          // http://yui.yahooapis.com/2.3.0/build/assets/skins/sam/
5759
     *          base: 'assets/skins/',
5760
     *
5761
     *          // Any component-specific overrides can be specified here,
5762
     *          // making it possible to load different skins for different
5763
     *          // components.  It is possible to load more than one skin
5764
     *          // for a given component as well.
5765
     *          overrides: {
5766
     *              calendar: ['skin1', 'skin2']
5767
     *          }
5768
     *      }
5769
     * @property skin
5770
     * @type {Object}
5771
     */
5772
    self.skin = Y.merge(Y.Env.meta.skin);
5773
 
5774
    /*
5775
     * Map of conditional modules
5776
     * @since 3.2.0
5777
     */
5778
    self.conditions = {};
5779
 
5780
    // map of modules with a hash of modules that meet the requirement
5781
    // self.provides = {};
5782
 
5783
    self.config = o;
5784
    self._internal = true;
5785
 
5786
    self._populateConditionsCache();
5787
 
5788
    /**
5789
     * Set when beginning to compute the dependency tree.
5790
     * Composed of what YUI reports to be loaded combined
5791
     * with what has been loaded by any instance on the page
5792
     * with the version number specified in the metadata.
5793
     * @property loaded
5794
     * @type {string: boolean}
5795
     */
5796
    self.loaded = GLOBAL_LOADED[VERSION];
5797
 
5798
 
5799
    /**
5800
    * Should Loader fetch scripts in `async`, defaults to `true`
5801
    * @property async
5802
    */
5803
 
5804
    self.async = true;
5805
 
5806
    self._inspectPage();
5807
 
5808
    self._internal = false;
5809
 
5810
    self._config(o);
5811
 
5812
    self.forceMap = (self.force) ? Y.Array.hash(self.force) : {};
5813
 
5814
    self.testresults = null;
5815
 
5816
    if (Y.config.tests) {
5817
        self.testresults = Y.config.tests;
5818
    }
5819
 
5820
    /**
5821
     * List of rollup files found in the library metadata
5822
     * @property rollups
5823
     */
5824
    // self.rollups = null;
5825
 
5826
    /**
5827
     * Whether or not to load optional dependencies for
5828
     * the requested modules
5829
     * @property loadOptional
5830
     * @type boolean
5831
     * @default false
5832
     */
5833
    // self.loadOptional = false;
5834
 
5835
    /**
5836
     * All of the derived dependencies in sorted order, which
5837
     * will be populated when either calculate() or insert()
5838
     * is called
5839
     * @property sorted
5840
     * @type string[]
5841
     */
5842
    self.sorted = [];
5843
 
5844
    /*
5845
     * A list of modules to attach to the YUI instance when complete.
5846
     * If not supplied, the sorted list of dependencies are applied.
5847
     * @property attaching
5848
     */
5849
    // self.attaching = null;
5850
 
5851
    /**
5852
     * Flag to indicate the dependency tree needs to be recomputed
5853
     * if insert is called again.
5854
     * @property dirty
5855
     * @type boolean
5856
     * @default true
5857
     */
5858
    self.dirty = true;
5859
 
5860
    /**
5861
     * List of modules inserted by the utility
5862
     * @property inserted
5863
     * @type {string: boolean}
5864
     */
5865
    self.inserted = {};
5866
 
5867
    /**
5868
     * List of skipped modules during insert() because the module
5869
     * was not defined
5870
     * @property skipped
5871
     */
5872
    self.skipped = {};
5873
 
5874
    // Y.on('yui:load', self.loadNext, self);
5875
 
5876
    self.tested = {};
5877
 
5878
    /*
5879
     * Cached sorted calculate results
5880
     * @property results
5881
     * @since 3.2.0
5882
     */
5883
    //self.results = {};
5884
 
5885
    if (self.ignoreRegistered) {
5886
        //Clear inpage already processed modules.
5887
        self._resetModules();
5888
    }
5889
 
5890
};
5891
 
5892
Y.Loader.prototype = {
5893
    /**
5894
    * Gets the module info from the local moduleInfo hash, or from the
5895
    * default metadata and populate the local moduleInfo hash.
5896
    * @method getModuleInfo
5897
    * @param {string} name of the module
5898
    * @public
5899
    */
5900
    getModuleInfo: function(name) {
5901
 
5902
        var m = this.moduleInfo[name],
5903
            rawMetaModules, globalRenderedMods, internal, v;
5904
 
5905
        if (m) {
5906
            return m;
5907
        }
5908
 
5909
        rawMetaModules = META.modules;
5910
        globalRenderedMods = GLOBAL_ENV._renderedMods;
5911
        internal = this._internal;
5912
 
5913
        /*
5914
        The logic here is:
5915
 
5916
        - if the `moduleInfo[name]` is avilable,
5917
          then short circuit
5918
        - otherwise, if the module is in the globalCache (cross Y instance),
5919
          then port it from the global registry into `moduleInfo[name]`
5920
        - otherwise, if the module has raw metadata (from meta modules)
5921
          then add it to the global registry and to `moduleInfo[name]`
5922
 
5923
        */
5924
        if (globalRenderedMods && globalRenderedMods.hasOwnProperty(name) && !this.ignoreRegistered) {
5925
            this.moduleInfo[name] = Y.merge(globalRenderedMods[name]);
5926
        } else {
5927
            if (rawMetaModules.hasOwnProperty(name)) {
5928
                this._internal = true; // making sure that modules from raw data are marked as internal
5929
                v = this.addModule(rawMetaModules[name], name);
5930
                // Inspect the page for the CSS module and mark it as loaded.
5931
                if (v && v.type === CSS) {
5932
                    if (this.isCSSLoaded(v.name, true)) {
5933
                        Y.log('Found CSS module on page: ' + v.name, 'info', 'loader');
5934
                        this.loaded[v.name] = true;
5935
                    }
5936
                }
5937
                this._internal = internal;
5938
            }
5939
        }
5940
        return this.moduleInfo[name];
5941
    },
5942
    /**
5943
    * Expand the names that are aliases to other modules.
5944
    * @method _expandAliases
5945
    * @param {string[]} list a module name or a list of names to be expanded
5946
    * @private
5947
    * @return {array}
5948
    */
5949
    _expandAliases: function(list) {
5950
        var expanded = [],
5951
            aliases = YUI.Env.aliases,
5952
            i, name;
5953
        list = Y.Array(list);
5954
        for (i = 0; i < list.length; i += 1) {
5955
            name = list[i];
5956
            expanded.push.apply(expanded, aliases[name] ? aliases[name] : [name]);
5957
        }
5958
        return expanded;
5959
    },
5960
    /**
5961
    * Populate the conditions cache from raw modules, this is necessary
5962
    * because no other module will require a conditional module, instead
5963
    * the condition has to be executed and then the module is analyzed
5964
    * to be included in the final requirement list. Without this cache
5965
    * conditional modules will be simply ignored.
5966
    * @method _populateConditionsCache
5967
    * @private
5968
    */
5969
    _populateConditionsCache: function() {
5970
        var rawMetaModules = META.modules,
5971
            cache = GLOBAL_ENV._conditions,
5972
            i, j, t, trigger;
5973
 
5974
        // if we have conditions in cache and cache is enabled
5975
        // we should port them to this loader instance
5976
        if (cache && !this.ignoreRegistered) {
5977
            for (i in cache) {
5978
                if (cache.hasOwnProperty(i)) {
5979
                    this.conditions[i] = Y.merge(cache[i]);
5980
                }
5981
            }
5982
        } else {
5983
            for (i in rawMetaModules) {
5984
                if (rawMetaModules.hasOwnProperty(i) && rawMetaModules[i].condition) {
5985
                    t = this._expandAliases(rawMetaModules[i].condition.trigger);
5986
                    for (j = 0; j < t.length; j += 1) {
5987
                        trigger = t[j];
5988
                        this.conditions[trigger] = this.conditions[trigger] || {};
5989
                        this.conditions[trigger][rawMetaModules[i].name || i] = rawMetaModules[i].condition;
5990
                    }
5991
                }
5992
            }
5993
            GLOBAL_ENV._conditions = this.conditions;
5994
        }
5995
    },
5996
    /**
5997
    * Reset modules in the module cache to a pre-processed state so additional
5998
    * computations with a different skin or language will work as expected.
5999
    * @method _resetModules
6000
    * @private
6001
    */
6002
    _resetModules: function() {
6003
        var self = this, i, o,
6004
            mod, name, details;
6005
        for (i in self.moduleInfo) {
6006
            if (self.moduleInfo.hasOwnProperty(i) && self.moduleInfo[i]) {
6007
                mod = self.moduleInfo[i];
6008
                name = mod.name;
6009
                details  = (YUI.Env.mods[name] ? YUI.Env.mods[name].details : null);
6010
 
6011
                if (details) {
6012
                    self.moduleInfo[name]._reset = true;
6013
                    self.moduleInfo[name].requires = details.requires || [];
6014
                    self.moduleInfo[name].optional = details.optional || [];
6015
                    self.moduleInfo[name].supersedes = details.supercedes || [];
6016
                }
6017
 
6018
                if (mod.defaults) {
6019
                    for (o in mod.defaults) {
6020
                        if (mod.defaults.hasOwnProperty(o)) {
6021
                            if (mod[o]) {
6022
                                mod[o] = mod.defaults[o];
6023
                            }
6024
                        }
6025
                    }
6026
                }
6027
                mod.langCache = undefined;
6028
                mod.skinCache = undefined;
6029
                if (mod.skinnable) {
6030
                    self._addSkin(self.skin.defaultSkin, mod.name);
6031
                }
6032
            }
6033
        }
6034
    },
6035
    /**
6036
    Regex that matches a CSS URL. Used to guess the file type when it's not
6037
    specified.
6038
 
6039
    @property REGEX_CSS
6040
    @type RegExp
6041
    @final
6042
    @protected
6043
    @since 3.5.0
6044
    **/
6045
    REGEX_CSS: /\.css(?:[?;].*)?$/i,
6046
 
6047
    /**
6048
    * Default filters for raw and debug
6049
    * @property FILTER_DEFS
6050
    * @type Object
6051
    * @final
6052
    * @protected
6053
    */
6054
    FILTER_DEFS: {
6055
        RAW: {
6056
            'searchExp': '-min\\.js',
6057
            'replaceStr': '.js'
6058
        },
6059
        DEBUG: {
6060
            'searchExp': '-min\\.js',
6061
            'replaceStr': '-debug.js'
6062
        },
6063
        COVERAGE: {
6064
            'searchExp': '-min\\.js',
6065
            'replaceStr': '-coverage.js'
6066
        }
6067
    },
6068
    /*
6069
    * Check the pages meta-data and cache the result.
6070
    * @method _inspectPage
6071
    * @private
6072
    */
6073
    _inspectPage: function() {
6074
        var self = this, v, m, req, mr, i;
6075
 
6076
        for (i in ON_PAGE) {
6077
            if (ON_PAGE.hasOwnProperty(i)) {
6078
                v = ON_PAGE[i];
6079
                if (v.details) {
6080
                    m = self.getModuleInfo(v.name);
6081
                    req = v.details.requires;
6082
                    mr = m && m.requires;
6083
 
6084
                   if (m) {
6085
                       if (!m._inspected && req && mr.length !== req.length) {
6086
                           // console.log('deleting ' + m.name);
6087
                           delete m.expanded;
6088
                       }
6089
                   } else {
6090
                       m = self.addModule(v.details, i);
6091
                   }
6092
                   m._inspected = true;
6093
               }
6094
            }
6095
        }
6096
    },
6097
    /*
6098
    * returns true if b is not loaded, and is required directly or by means of modules it supersedes.
6099
    * @private
6100
    * @method _requires
6101
    * @param {String} mod1 The first module to compare
6102
    * @param {String} mod2 The second module to compare
6103
    */
6104
   _requires: function(mod1, mod2) {
6105
 
6106
        var i, rm, after_map, s,
6107
            m = this.getModuleInfo(mod1),
6108
            other = this.getModuleInfo(mod2);
6109
 
6110
        if (!m || !other) {
6111
            return false;
6112
        }
6113
 
6114
        rm = m.expanded_map;
6115
        after_map = m.after_map;
6116
 
6117
        // check if this module should be sorted after the other
6118
        // do this first to short circut circular deps
6119
        if (after_map && (mod2 in after_map)) {
6120
            return true;
6121
        }
6122
 
6123
        after_map = other.after_map;
6124
 
6125
        // and vis-versa
6126
        if (after_map && (mod1 in after_map)) {
6127
            return false;
6128
        }
6129
 
6130
        // check if this module requires one the other supersedes
6131
        s = other.supersedes;
6132
        if (s) {
6133
            for (i = 0; i < s.length; i++) {
6134
                if (this._requires(mod1, s[i])) {
6135
                    return true;
6136
                }
6137
            }
6138
        }
6139
 
6140
        s = m.supersedes;
6141
        if (s) {
6142
            for (i = 0; i < s.length; i++) {
6143
                if (this._requires(mod2, s[i])) {
6144
                    return false;
6145
                }
6146
            }
6147
        }
6148
 
6149
        // check if this module requires the other directly
6150
        // if (r && yArray.indexOf(r, mod2) > -1) {
6151
        if (rm && (mod2 in rm)) {
6152
            return true;
6153
        }
6154
 
6155
        // external css files should be sorted below yui css
6156
        if (m.ext && m.type === CSS && !other.ext && other.type === CSS) {
6157
            return true;
6158
        }
6159
 
6160
        return false;
6161
    },
6162
    /**
6163
    * Apply a new config to the Loader instance
6164
    * @method _config
6165
    * @private
6166
    * @param {Object} o The new configuration
6167
    */
6168
    _config: function(o) {
6169
        var i, j, val, a, f, group, groupName, self = this,
6170
            mods = [], mod, modInfo;
6171
        // apply config values
6172
        if (o) {
6173
            for (i in o) {
6174
                if (o.hasOwnProperty(i)) {
6175
                    val = o[i];
6176
                    //TODO This should be a case
6177
                    if (i === 'require') {
6178
                        self.require(val);
6179
                    } else if (i === 'skin') {
6180
                        //If the config.skin is a string, format to the expected object
6181
                        if (typeof val === 'string') {
6182
                            self.skin.defaultSkin = o.skin;
6183
                            val = {
6184
                                defaultSkin: val
6185
                            };
6186
                        }
6187
 
6188
                        Y.mix(self.skin, val, true);
6189
                    } else if (i === 'groups') {
6190
                        for (j in val) {
6191
                            if (val.hasOwnProperty(j)) {
6192
                                // Y.log('group: ' + j);
6193
                                groupName = j;
6194
                                group = val[j];
6195
                                self.addGroup(group, groupName);
6196
                                if (group.aliases) {
6197
                                    for (a in group.aliases) {
6198
                                        if (group.aliases.hasOwnProperty(a)) {
6199
                                            self.addAlias(group.aliases[a], a);
6200
                                        }
6201
                                    }
6202
                                }
6203
                            }
6204
                        }
6205
 
6206
                    } else if (i === 'modules') {
6207
                        // add a hash of module definitions
6208
                        for (j in val) {
6209
                            if (val.hasOwnProperty(j)) {
6210
                                self.addModule(val[j], j);
6211
                            }
6212
                        }
6213
                    } else if (i === 'aliases') {
6214
                        for (j in val) {
6215
                            if (val.hasOwnProperty(j)) {
6216
                                self.addAlias(val[j], j);
6217
                            }
6218
                        }
6219
                    } else if (i === 'gallery') {
6220
                        if (this.groups.gallery.update) {
6221
                            this.groups.gallery.update(val, o);
6222
                        }
6223
                    } else if (i === 'yui2' || i === '2in3') {
6224
                        if (this.groups.yui2.update) {
6225
                            this.groups.yui2.update(o['2in3'], o.yui2, o);
6226
                        }
6227
                    } else {
6228
                        self[i] = val;
6229
                    }
6230
                }
6231
            }
6232
        }
6233
 
6234
        // fix filter
6235
        f = self.filter;
6236
 
6237
        if (L.isString(f)) {
6238
            f = f.toUpperCase();
6239
            self.filterName = f;
6240
            self.filter = self.FILTER_DEFS[f];
6241
            if (f === 'DEBUG') {
6242
                self.require('yui-log', 'dump');
6243
            }
6244
        }
6245
 
6246
        if (self.filterName && self.coverage) {
6247
            if (self.filterName === 'COVERAGE' && L.isArray(self.coverage) && self.coverage.length) {
6248
                for (i = 0; i < self.coverage.length; i++) {
6249
                    mod = self.coverage[i];
6250
                    modInfo = self.getModuleInfo(mod);
6251
                    if (modInfo && modInfo.use) {
6252
                        mods = mods.concat(modInfo.use);
6253
                    } else {
6254
                        mods.push(mod);
6255
                    }
6256
                }
6257
                self.filters = self.filters || {};
6258
                Y.Array.each(mods, function(mod) {
6259
                    self.filters[mod] = self.FILTER_DEFS.COVERAGE;
6260
                });
6261
                self.filterName = 'RAW';
6262
                self.filter = self.FILTER_DEFS[self.filterName];
6263
            }
6264
        }
6265
 
6266
    },
6267
 
6268
    /**
6269
     * Returns the skin module name for the specified skin name.  If a
6270
     * module name is supplied, the returned skin module name is
6271
     * specific to the module passed in.
6272
     * @method formatSkin
6273
     * @param {string} skin the name of the skin.
6274
     * @param {string} mod optional: the name of a module to skin.
6275
     * @return {string} the full skin module name.
6276
     */
6277
    formatSkin: function(skin, mod) {
6278
        var s = SKIN_PREFIX + skin;
6279
        if (mod) {
6280
            s = s + '-' + mod;
6281
        }
6282
 
6283
        return s;
6284
    },
6285
 
6286
    /**
6287
     * Adds the skin def to the module info
6288
     * @method _addSkin
6289
     * @param {string} skin the name of the skin.
6290
     * @param {string} mod the name of the module.
6291
     * @param {string} parent parent module if this is a skin of a
6292
     * submodule or plugin.
6293
     * @return {string} the module name for the skin.
6294
     * @private
6295
     */
6296
    _addSkin: function(skin, mod, parent) {
6297
        var pkg, name, nmod,
6298
            sinf = this.skin,
6299
            mdef = mod && this.getModuleInfo(mod),
6300
            ext = mdef && mdef.ext;
6301
 
6302
        // Add a module definition for the module-specific skin css
6303
        if (mod) {
6304
            name = this.formatSkin(skin, mod);
6305
            if (!this.getModuleInfo(name)) {
6306
                pkg = mdef.pkg || mod;
6307
                nmod = {
6308
                    skin: true,
6309
                    name: name,
6310
                    group: mdef.group,
6311
                    type: 'css',
6312
                    after: sinf.after,
6313
                    path: (parent || pkg) + '/' + sinf.base + skin +
6314
                          '/' + mod + '.css',
6315
                    ext: ext
6316
                };
6317
                if (mdef.base) {
6318
                    nmod.base = mdef.base;
6319
                }
6320
                if (mdef.configFn) {
6321
                    nmod.configFn = mdef.configFn;
6322
                }
6323
                this.addModule(nmod, name);
6324
 
6325
                Y.log('Adding skin (' + name + '), ' + parent + ', ' + pkg + ', ' + nmod.path, 'info', 'loader');
6326
            }
6327
        }
6328
 
6329
        return name;
6330
    },
6331
    /**
6332
    * Adds an alias module to the system
6333
    * @method addAlias
6334
    * @param {Array} use An array of modules that makes up this alias
6335
    * @param {String} name The name of the alias
6336
    * @example
6337
    *       var loader = new Y.Loader({});
6338
    *       loader.addAlias([ 'node', 'yql' ], 'davglass');
6339
    *       loader.require(['davglass']);
6340
    *       var out = loader.resolve(true);
6341
    *
6342
    *       //out.js will contain Node and YQL modules
6343
    */
6344
    addAlias: function(use, name) {
6345
        YUI.Env.aliases[name] = use;
6346
        this.addModule({
6347
            name: name,
6348
            use: use
6349
        });
6350
    },
6351
    /**
6352
     * Add a new module group
6353
     * @method addGroup
6354
     * @param {Object} config An object containing the group configuration data
6355
     * @param {String} config.name required, the group name
6356
     * @param {String} config.base The base directory for this module group
6357
     * @param {String} config.root The root path to add to each combo resource path
6358
     * @param {Boolean} config.combine Should the request be combined
6359
     * @param {String} config.comboBase Combo service base path
6360
     * @param {Object} config.modules The group of modules
6361
     * @param {String} name the group name.
6362
     * @example
6363
     *      var loader = new Y.Loader({});
6364
     *      loader.addGroup({
6365
     *          name: 'davglass',
6366
     *          combine: true,
6367
     *          comboBase: '/combo?',
6368
     *          root: '',
6369
     *          modules: {
6370
     *              //Module List here
6371
     *          }
6372
     *      }, 'davglass');
6373
     */
6374
    addGroup: function(o, name) {
6375
        var mods = o.modules,
6376
            self = this,
6377
            defaultBase = o.defaultBase || Y.config.defaultBase,
6378
            i, v;
6379
 
6380
        name = name || o.name;
6381
        o.name = name;
6382
        self.groups[name] = o;
6383
 
6384
        if (!o.base && defaultBase && o.root) {
6385
            o.base = defaultBase + o.root;
6386
        }
6387
 
6388
        if (o.patterns) {
6389
            for (i in o.patterns) {
6390
                if (o.patterns.hasOwnProperty(i)) {
6391
                    o.patterns[i].group = name;
6392
                    self.patterns[i] = o.patterns[i];
6393
                }
6394
            }
6395
        }
6396
 
6397
        if (mods) {
6398
            for (i in mods) {
6399
                if (mods.hasOwnProperty(i)) {
6400
                    v = mods[i];
6401
                    if (typeof v === 'string') {
6402
                        v = { name: i, fullpath: v };
6403
                    }
6404
                    v.group = name;
6405
                    self.addModule(v, i);
6406
                }
6407
            }
6408
        }
6409
    },
6410
 
6411
    /**
6412
     * Add a new module to the component metadata.
6413
     * @method addModule
6414
     * @param {Object} config An object containing the module data.
6415
     * @param {String} config.name Required, the component name
6416
     * @param {String} config.type Required, the component type (js or css)
6417
     * @param {String} config.path Required, the path to the script from `base`
6418
     * @param {Array} config.requires Array of modules required by this component
6419
     * @param {Array} [config.optional] Array of optional modules for this component
6420
     * @param {Array} [config.supersedes] Array of the modules this component replaces
6421
     * @param {Array} [config.after] Array of modules the components which, if present, should be sorted above this one
6422
     * @param {Object} [config.after_map] Faster alternative to 'after' -- supply a hash instead of an array
6423
     * @param {Number} [config.rollup] The number of superseded modules required for automatic rollup
6424
     * @param {String} [config.fullpath] If `fullpath` is specified, this is used instead of the configured `base + path`
6425
     * @param {Boolean} [config.skinnable] Flag to determine if skin assets should automatically be pulled in
6426
     * @param {Object} [config.submodules] Hash of submodules
6427
     * @param {String} [config.group] The group the module belongs to -- this is set automatically when it is added as part of a group configuration.
6428
     * @param {Array} [config.lang] Array of BCP 47 language tags of languages for which this module has localized resource bundles, e.g., `["en-GB", "zh-Hans-CN"]`
6429
     * @param {Object} [config.condition] Specifies that the module should be loaded automatically if a condition is met. This is an object with up to four fields:
6430
     * @param {String} [config.condition.trigger] The name of a module that can trigger the auto-load
6431
     * @param {Function} [config.condition.test] A function that returns true when the module is to be loaded.
6432
     * @param {String} [config.condition.ua] The UA name of <a href="UA.html">Y.UA</a> object that returns true when the module is to be loaded. e.g., `"ie"`, `"nodejs"`.
6433
     * @param {String} [config.condition.when] Specifies the load order of the conditional module
6434
     *  with regard to the position of the trigger module.
6435
     *  This should be one of three values: `before`, `after`, or `instead`.  The default is `after`.
6436
     * @param {Object} [config.testresults] A hash of test results from `Y.Features.all()`
6437
     * @param {Function} [config.configFn] A function to exectute when configuring this module
6438
     * @param {Object} config.configFn.mod The module config, modifying this object will modify it's config. Returning false will delete the module's config.
6439
     * @param {String[]} [config.optionalRequires] List of dependencies that
6440
        may optionally be loaded by this loader. This is targeted mostly at
6441
        polyfills, since they should not be in the list of requires because
6442
        polyfills are assumed to be available in the global scope.
6443
     * @param {Function} [config.test] Test to be called when this module is
6444
        added as an optional dependency of another module. If the test function
6445
        returns `false`, the module will be ignored and will not be attached to
6446
        this YUI instance.
6447
     * @param {String} [name] The module name, required if not in the module data.
6448
     * @return {Object} the module definition or null if the object passed in did not provide all required attributes.
6449
     */
6450
    addModule: function(o, name) {
6451
        name = name || o.name;
6452
 
6453
        if (typeof o === 'string') {
6454
            o = { name: name, fullpath: o };
6455
        }
6456
 
6457
 
6458
        var subs, i, l, t, sup, s, smod, plugins, plug,
6459
            j, langs, packName, supName, flatSup, flatLang, lang, ret,
6460
            overrides, skinname, when, g, p,
6461
            modInfo = this.moduleInfo[name],
6462
            conditions = this.conditions, trigger;
6463
 
6464
        //Only merge this data if the temp flag is set
6465
        //from an earlier pass from a pattern or else
6466
        //an override module (YUI_config) can not be used to
6467
        //replace a default module.
6468
        if (modInfo && modInfo.temp) {
6469
            //This catches temp modules loaded via a pattern
6470
            // The module will be added twice, once from the pattern and
6471
            // Once from the actual add call, this ensures that properties
6472
            // that were added to the module the first time around (group: gallery)
6473
            // are also added the second time around too.
6474
            o = Y.merge(modInfo, o);
6475
        }
6476
 
6477
        o.name = name;
6478
 
6479
        if (!o || !o.name) {
6480
            return null;
6481
        }
6482
 
6483
        if (!o.type) {
6484
            //Always assume it's javascript unless the CSS pattern is matched.
6485
            o.type = JS;
6486
            p = o.path || o.fullpath;
6487
            if (p && this.REGEX_CSS.test(p)) {
6488
                Y.log('Auto determined module type as CSS', 'warn', 'loader');
6489
                o.type = CSS;
6490
            }
6491
        }
6492
 
6493
        if (!o.path && !o.fullpath) {
6494
            o.path = _path(name, name, o.type);
6495
        }
6496
        o.supersedes = o.supersedes || o.use;
6497
 
6498
        o.ext = ('ext' in o) ? o.ext : (this._internal) ? false : true;
6499
 
6500
        // Handle submodule logic
6501
        subs = o.submodules;
6502
 
6503
        this.moduleInfo[name] = o;
6504
 
6505
        o.requires = o.requires || [];
6506
 
6507
        /*
6508
        Only allowing the cascade of requires information, since
6509
        optional and supersedes are far more fine grained than
6510
        a blanket requires is.
6511
        */
6512
        if (this.requires) {
6513
            for (i = 0; i < this.requires.length; i++) {
6514
                o.requires.push(this.requires[i]);
6515
            }
6516
        }
6517
        if (o.group && this.groups && this.groups[o.group]) {
6518
            g = this.groups[o.group];
6519
            if (g.requires) {
6520
                for (i = 0; i < g.requires.length; i++) {
6521
                    o.requires.push(g.requires[i]);
6522
                }
6523
            }
6524
        }
6525
 
6526
 
6527
        if (!o.defaults) {
6528
            o.defaults = {
6529
                requires: o.requires ? [].concat(o.requires) : null,
6530
                supersedes: o.supersedes ? [].concat(o.supersedes) : null,
6531
                optional: o.optional ? [].concat(o.optional) : null
6532
            };
6533
        }
6534
 
6535
        if (o.skinnable && o.ext && o.temp) {
6536
            skinname = this._addSkin(this.skin.defaultSkin, name);
6537
            o.requires.unshift(skinname);
6538
        }
6539
 
6540
        if (o.requires.length) {
6541
            o.requires = this.filterRequires(o.requires) || [];
6542
        }
6543
 
6544
        if (!o.langPack && o.lang) {
6545
            langs = yArray(o.lang);
6546
            for (j = 0; j < langs.length; j++) {
6547
                lang = langs[j];
6548
                packName = this.getLangPackName(lang, name);
6549
                smod = this.getModuleInfo(packName);
6550
                if (!smod) {
6551
                    smod = this._addLangPack(lang, o, packName);
6552
                }
6553
            }
6554
        }
6555
 
6556
 
6557
        if (subs) {
6558
            sup = o.supersedes || [];
6559
            l = 0;
6560
 
6561
            for (i in subs) {
6562
                if (subs.hasOwnProperty(i)) {
6563
                    s = subs[i];
6564
 
6565
                    s.path = s.path || _path(name, i, o.type);
6566
                    s.pkg = name;
6567
                    s.group = o.group;
6568
 
6569
                    if (s.supersedes) {
6570
                        sup = sup.concat(s.supersedes);
6571
                    }
6572
 
6573
                    smod = this.addModule(s, i);
6574
                    sup.push(i);
6575
 
6576
                    if (smod.skinnable) {
6577
                        o.skinnable = true;
6578
                        overrides = this.skin.overrides;
6579
                        if (overrides && overrides[i]) {
6580
                            for (j = 0; j < overrides[i].length; j++) {
6581
                                skinname = this._addSkin(overrides[i][j],
6582
                                         i, name);
6583
                                sup.push(skinname);
6584
                            }
6585
                        }
6586
                        skinname = this._addSkin(this.skin.defaultSkin,
6587
                                        i, name);
6588
                        sup.push(skinname);
6589
                    }
6590
 
6591
                    // looks like we are expected to work out the metadata
6592
                    // for the parent module language packs from what is
6593
                    // specified in the child modules.
6594
                    if (s.lang && s.lang.length) {
6595
 
6596
                        langs = yArray(s.lang);
6597
                        for (j = 0; j < langs.length; j++) {
6598
                            lang = langs[j];
6599
                            packName = this.getLangPackName(lang, name);
6600
                            supName = this.getLangPackName(lang, i);
6601
                            smod = this.getModuleInfo(packName);
6602
 
6603
                            if (!smod) {
6604
                                smod = this._addLangPack(lang, o, packName);
6605
                            }
6606
 
6607
                            flatSup = flatSup || yArray.hash(smod.supersedes);
6608
 
6609
                            if (!(supName in flatSup)) {
6610
                                smod.supersedes.push(supName);
6611
                            }
6612
 
6613
                            o.lang = o.lang || [];
6614
 
6615
                            flatLang = flatLang || yArray.hash(o.lang);
6616
 
6617
                            if (!(lang in flatLang)) {
6618
                                o.lang.push(lang);
6619
                            }
6620
 
6621
// Y.log('pack ' + packName + ' should supersede ' + supName);
6622
// Add rollup file, need to add to supersedes list too
6623
 
6624
                            // default packages
6625
                            packName = this.getLangPackName(ROOT_LANG, name);
6626
                            supName = this.getLangPackName(ROOT_LANG, i);
6627
 
6628
                            smod = this.getModuleInfo(packName);
6629
 
6630
                            if (!smod) {
6631
                                smod = this._addLangPack(lang, o, packName);
6632
                            }
6633
 
6634
                            if (!(supName in flatSup)) {
6635
                                smod.supersedes.push(supName);
6636
                            }
6637
 
6638
// Y.log('pack ' + packName + ' should supersede ' + supName);
6639
// Add rollup file, need to add to supersedes list too
6640
 
6641
                        }
6642
                    }
6643
 
6644
                    l++;
6645
                }
6646
            }
6647
            //o.supersedes = YObject.keys(yArray.hash(sup));
6648
            o.supersedes = yArray.dedupe(sup);
6649
            if (this.allowRollup) {
6650
                o.rollup = (l < 4) ? l : Math.min(l - 1, 4);
6651
            }
6652
        }
6653
 
6654
        plugins = o.plugins;
6655
        if (plugins) {
6656
            for (i in plugins) {
6657
                if (plugins.hasOwnProperty(i)) {
6658
                    plug = plugins[i];
6659
                    plug.pkg = name;
6660
                    plug.path = plug.path || _path(name, i, o.type);
6661
                    plug.requires = plug.requires || [];
6662
                    plug.group = o.group;
6663
                    this.addModule(plug, i);
6664
                    if (o.skinnable) {
6665
                        this._addSkin(this.skin.defaultSkin, i, name);
6666
                    }
6667
 
6668
                }
6669
            }
6670
        }
6671
 
6672
        if (o.condition) {
6673
            t = this._expandAliases(o.condition.trigger);
6674
            for (i = 0; i < t.length; i++) {
6675
                trigger = t[i];
6676
                when = o.condition.when;
6677
                conditions[trigger] = conditions[trigger] || {};
6678
                conditions[trigger][name] = o.condition;
6679
                // the 'when' attribute can be 'before', 'after', or 'instead'
6680
                // the default is after.
6681
                if (when && when !== 'after') {
6682
                    if (when === 'instead') { // replace the trigger
6683
                        o.supersedes = o.supersedes || [];
6684
                        o.supersedes.push(trigger);
6685
                    }
6686
                    // before the trigger
6687
                        // the trigger requires the conditional mod,
6688
                        // so it should appear before the conditional
6689
                        // mod if we do not intersede.
6690
                } else { // after the trigger
6691
                    o.after = o.after || [];
6692
                    o.after.push(trigger);
6693
                }
6694
            }
6695
        }
6696
 
6697
        if (o.supersedes) {
6698
            o.supersedes = this.filterRequires(o.supersedes);
6699
        }
6700
 
6701
        if (o.after) {
6702
            o.after = this.filterRequires(o.after);
6703
            o.after_map = yArray.hash(o.after);
6704
        }
6705
 
6706
        // this.dirty = true;
6707
 
6708
        if (o.configFn) {
6709
            ret = o.configFn(o);
6710
            if (ret === false) {
6711
                Y.log('Config function returned false for ' + name + ', skipping.', 'info', 'loader');
6712
                delete this.moduleInfo[name];
6713
                delete GLOBAL_ENV._renderedMods[name];
6714
                o = null;
6715
            }
6716
        }
6717
        //Add to global cache
6718
        if (o) {
6719
            if (!GLOBAL_ENV._renderedMods) {
6720
                GLOBAL_ENV._renderedMods = {};
6721
            }
6722
            GLOBAL_ENV._renderedMods[name] = Y.mix(GLOBAL_ENV._renderedMods[name] || {}, o);
6723
            GLOBAL_ENV._conditions = conditions;
6724
        }
6725
 
6726
        return o;
6727
    },
6728
 
6729
    /**
6730
     * Add a requirement for one or more module
6731
     * @method require
6732
     * @param {string[] | string*} what the modules to load.
6733
     */
6734
    require: function(what) {
6735
        var a = (typeof what === 'string') ? yArray(arguments) : what;
6736
        this.dirty = true;
6737
        this.required = Y.merge(this.required, yArray.hash(this.filterRequires(a)));
6738
 
6739
        this._explodeRollups();
6740
    },
6741
    /**
6742
    * Grab all the items that were asked for, check to see if the Loader
6743
    * meta-data contains a "use" array. If it doesm remove the asked item and replace it with
6744
    * the content of the "use".
6745
    * This will make asking for: "dd"
6746
    * Actually ask for: "dd-ddm-base,dd-ddm,dd-ddm-drop,dd-drag,dd-proxy,dd-constrain,dd-drop,dd-scroll,dd-drop-plugin"
6747
    * @private
6748
    * @method _explodeRollups
6749
    */
6750
    _explodeRollups: function() {
6751
        var self = this, m, m2, i, a, v, len, len2,
6752
        r = self.required;
6753
 
6754
        if (!self.allowRollup) {
6755
            for (i in r) {
6756
                if (r.hasOwnProperty(i)) {
6757
                    m = self.getModule(i);
6758
                    if (m && m.use) {
6759
                        len = m.use.length;
6760
                        for (a = 0; a < len; a++) {
6761
                            m2 = self.getModule(m.use[a]);
6762
                            if (m2 && m2.use) {
6763
                                len2 = m2.use.length;
6764
                                for (v = 0; v < len2; v++) {
6765
                                    r[m2.use[v]] = true;
6766
                                }
6767
                            } else {
6768
                                r[m.use[a]] = true;
6769
                            }
6770
                        }
6771
                    }
6772
                }
6773
            }
6774
            self.required = r;
6775
        }
6776
 
6777
    },
6778
    /**
6779
    * Explodes the required array to remove aliases and replace them with real modules
6780
    * @method filterRequires
6781
    * @param {Array} r The original requires array
6782
    * @return {Array} The new array of exploded requirements
6783
    */
6784
    filterRequires: function(r) {
6785
        if (r) {
6786
            if (!Y.Lang.isArray(r)) {
6787
                r = [r];
6788
            }
6789
            r = Y.Array(r);
6790
            var c = [], i, mod, o, m;
6791
 
6792
            for (i = 0; i < r.length; i++) {
6793
                mod = this.getModule(r[i]);
6794
                if (mod && mod.use) {
6795
                    for (o = 0; o < mod.use.length; o++) {
6796
                        //Must walk the other modules in case a module is a rollup of rollups (datatype)
6797
                        m = this.getModule(mod.use[o]);
6798
                        if (m && m.use && (m.name !== mod.name)) {
6799
                            c = Y.Array.dedupe([].concat(c, this.filterRequires(m.use)));
6800
                        } else {
6801
                            c.push(mod.use[o]);
6802
                        }
6803
                    }
6804
                } else {
6805
                    c.push(r[i]);
6806
                }
6807
            }
6808
            r = c;
6809
        }
6810
        return r;
6811
    },
6812
 
6813
    /**
6814
    Returns `true` if the module can be attached to the YUI instance. Runs
6815
    the module's test if there is one and caches its result.
6816
 
6817
    @method _canBeAttached
6818
    @param {String} module Name of the module to check.
6819
    @return {Boolean} Result of the module's test if it has one, or `true`.
6820
    **/
6821
    _canBeAttached: function (m) {
6822
        m = this.getModule(m);
6823
        if (m && m.test) {
6824
            if (!m.hasOwnProperty('_testResult')) {
6825
                m._testResult = m.test(Y);
6826
            }
6827
            return m._testResult;
6828
        }
6829
        // return `true` for modules not registered as Loader will know what
6830
        // to do with them later on
6831
        return true;
6832
    },
6833
 
6834
    /**
6835
     * Returns an object containing properties for all modules required
6836
     * in order to load the requested module
6837
     * @method getRequires
6838
     * @param {object}  mod The module definition from moduleInfo.
6839
     * @return {array} the expanded requirement list.
6840
     */
6841
    getRequires: function(mod) {
6842
 
6843
        if (!mod) {
6844
            //console.log('returning no reqs for ' + mod.name);
6845
            return NO_REQUIREMENTS;
6846
        }
6847
 
6848
        if (mod._parsed) {
6849
            //console.log('returning requires for ' + mod.name, mod.requires);
6850
            return mod.expanded || NO_REQUIREMENTS;
6851
        }
6852
 
6853
        //TODO add modue cache here out of scope..
6854
 
6855
        var i, m, j, length, add, packName, lang, testresults = this.testresults,
6856
            name = mod.name, cond,
6857
            adddef = ON_PAGE[name] && ON_PAGE[name].details,
6858
            optReqs = mod.optionalRequires,
6859
            d, go, def,
6860
            r, old_mod,
6861
            o, skinmod, skindef, skinpar, skinname,
6862
            intl = mod.lang || mod.intl,
6863
            ftests = Y.Features && Y.Features.tests.load,
6864
            hash, reparse;
6865
 
6866
        // console.log(name);
6867
 
6868
        // pattern match leaves module stub that needs to be filled out
6869
        if (mod.temp && adddef) {
6870
            old_mod = mod;
6871
            mod = this.addModule(adddef, name);
6872
            mod.group = old_mod.group;
6873
            mod.pkg = old_mod.pkg;
6874
            delete mod.expanded;
6875
        }
6876
 
6877
        // console.log('cache: ' + mod.langCache + ' == ' + this.lang);
6878
 
6879
        //If a skin or a lang is different, reparse..
6880
        reparse = !((!this.lang || mod.langCache === this.lang) && (mod.skinCache === this.skin.defaultSkin));
6881
 
6882
        if (mod.expanded && !reparse) {
6883
            //Y.log('Already expanded ' + name + ', ' + mod.expanded);
6884
            return mod.expanded;
6885
        }
6886
 
6887
        // Optional dependencies are dependencies that may or may not be
6888
        // available.
6889
        // This feature was designed specifically to be used when transpiling
6890
        // ES6 modules, in order to use polyfills and regular scripts that define
6891
        // global variables without having to import them since they should be
6892
        // available in the global scope.
6893
        if (optReqs) {
6894
            for (i = 0, length = optReqs.length; i < length; i++) {
6895
                if (this._canBeAttached(optReqs[i])) {
6896
                    mod.requires.push(optReqs[i]);
6897
                }
6898
            }
6899
        }
6900
 
6901
        d = [];
6902
        hash = {};
6903
        r = this.filterRequires(mod.requires);
6904
        if (mod.lang) {
6905
            //If a module has a lang attribute, auto add the intl requirement.
6906
            d.unshift('intl');
6907
            r.unshift('intl');
6908
            intl = true;
6909
        }
6910
        o = this.filterRequires(mod.optional);
6911
 
6912
        // Y.log("getRequires: " + name + " (dirty:" + this.dirty +
6913
        // ", expanded:" + mod.expanded + ")");
6914
 
6915
        mod._parsed = true;
6916
        mod.langCache = this.lang;
6917
        mod.skinCache = this.skin.defaultSkin;
6918
 
6919
        for (i = 0; i < r.length; i++) {
6920
            //Y.log(name + ' requiring ' + r[i], 'info', 'loader');
6921
            if (!hash[r[i]]) {
6922
                d.push(r[i]);
6923
                hash[r[i]] = true;
6924
                m = this.getModule(r[i]);
6925
                if (m) {
6926
                    add = this.getRequires(m);
6927
                    intl = intl || (m.expanded_map &&
6928
                        (INTL in m.expanded_map));
6929
                    for (j = 0; j < add.length; j++) {
6930
                        d.push(add[j]);
6931
                    }
6932
                }
6933
            }
6934
        }
6935
 
6936
        // get the requirements from superseded modules, if any
6937
        r = this.filterRequires(mod.supersedes);
6938
        if (r) {
6939
            for (i = 0; i < r.length; i++) {
6940
                if (!hash[r[i]]) {
6941
                    // if this module has submodules, the requirements list is
6942
                    // expanded to include the submodules.  This is so we can
6943
                    // prevent dups when a submodule is already loaded and the
6944
                    // parent is requested.
6945
                    if (mod.submodules) {
6946
                        d.push(r[i]);
6947
                    }
6948
 
6949
                    hash[r[i]] = true;
6950
                    m = this.getModule(r[i]);
6951
 
6952
                    if (m) {
6953
                        add = this.getRequires(m);
6954
                        intl = intl || (m.expanded_map &&
6955
                            (INTL in m.expanded_map));
6956
                        for (j = 0; j < add.length; j++) {
6957
                            d.push(add[j]);
6958
                        }
6959
                    }
6960
                }
6961
            }
6962
        }
6963
 
6964
        if (o && this.loadOptional) {
6965
            for (i = 0; i < o.length; i++) {
6966
                if (!hash[o[i]]) {
6967
                    d.push(o[i]);
6968
                    hash[o[i]] = true;
6969
                    m = this.getModuleInfo(o[i]);
6970
                    if (m) {
6971
                        add = this.getRequires(m);
6972
                        intl = intl || (m.expanded_map &&
6973
                            (INTL in m.expanded_map));
6974
                        for (j = 0; j < add.length; j++) {
6975
                            d.push(add[j]);
6976
                        }
6977
                    }
6978
                }
6979
            }
6980
        }
6981
 
6982
        cond = this.conditions[name];
6983
 
6984
        if (cond) {
6985
            //Set the module to not parsed since we have conditionals and this could change the dependency tree.
6986
            mod._parsed = false;
6987
            if (testresults && ftests) {
6988
                oeach(testresults, function(result, id) {
6989
                    var condmod = ftests[id].name;
6990
                    if (!hash[condmod] && ftests[id].trigger === name) {
6991
                        if (result && ftests[id]) {
6992
                            hash[condmod] = true;
6993
                            d.push(condmod);
6994
                        }
6995
                    }
6996
                });
6997
            } else {
6998
                for (i in cond) {
6999
                    if (cond.hasOwnProperty(i)) {
7000
                        if (!hash[i]) {
7001
                            def = cond[i];
7002
                            //first see if they've specfied a ua check
7003
                            //then see if they've got a test fn & if it returns true
7004
                            //otherwise just having a condition block is enough
7005
                            go = def && ((!def.ua && !def.test) || (def.ua && Y.UA[def.ua]) ||
7006
                                        (def.test && def.test(Y, r)));
7007
 
7008
                            if (go) {
7009
                                hash[i] = true;
7010
                                d.push(i);
7011
                                m = this.getModule(i);
7012
                                if (m) {
7013
                                    add = this.getRequires(m);
7014
                                    for (j = 0; j < add.length; j++) {
7015
                                        d.push(add[j]);
7016
                                    }
7017
 
7018
                                }
7019
                            }
7020
                        }
7021
                    }
7022
                }
7023
            }
7024
        }
7025
 
7026
        // Create skin modules
7027
        if (mod.skinnable) {
7028
            skindef = this.skin.overrides;
7029
            for (i in YUI.Env.aliases) {
7030
                if (YUI.Env.aliases.hasOwnProperty(i)) {
7031
                    if (Y.Array.indexOf(YUI.Env.aliases[i], name) > -1) {
7032
                        skinpar = i;
7033
                    }
7034
                }
7035
            }
7036
            if (skindef && (skindef[name] || (skinpar && skindef[skinpar]))) {
7037
                skinname = name;
7038
                if (skindef[skinpar]) {
7039
                    skinname = skinpar;
7040
                }
7041
                for (i = 0; i < skindef[skinname].length; i++) {
7042
                    skinmod = this._addSkin(skindef[skinname][i], name);
7043
                    if (!this.isCSSLoaded(skinmod, this._boot)) {
7044
                        d.push(skinmod);
7045
                    }
7046
                }
7047
            } else {
7048
                skinmod = this._addSkin(this.skin.defaultSkin, name);
7049
                if (!this.isCSSLoaded(skinmod, this._boot)) {
7050
                    d.push(skinmod);
7051
                }
7052
            }
7053
        }
7054
 
7055
        mod._parsed = false;
7056
 
7057
        if (intl) {
7058
 
7059
            if (mod.lang && !mod.langPack && Y.Intl) {
7060
                lang = Y.Intl.lookupBestLang(this.lang || ROOT_LANG, mod.lang);
7061
                //Y.log('Best lang: ' + lang + ', this.lang: ' + this.lang + ', mod.lang: ' + mod.lang);
7062
                packName = this.getLangPackName(lang, name);
7063
                if (packName) {
7064
                    d.unshift(packName);
7065
                }
7066
            }
7067
            d.unshift(INTL);
7068
        }
7069
 
7070
        mod.expanded_map = yArray.hash(d);
7071
 
7072
        mod.expanded = YObject.keys(mod.expanded_map);
7073
 
7074
        return mod.expanded;
7075
    },
7076
    /**
7077
    * Check to see if named css module is already loaded on the page
7078
    * @method isCSSLoaded
7079
    * @param {String} name The name of the css file
7080
    * @param {Boolean} skip To skip the short-circuit for ignoreRegister
7081
    * @return Boolean
7082
    */
7083
    isCSSLoaded: function(name, skip) {
7084
        //TODO - Make this call a batching call with name being an array
7085
        if (!name || !YUI.Env.cssStampEl || (!skip && this.ignoreRegistered)) {
7086
            Y.log('isCSSLoaded was skipped for ' + name, 'warn', 'loader');
7087
            return false;
7088
        }
7089
        var el = YUI.Env.cssStampEl,
7090
            ret = false,
7091
            mod = YUI.Env._cssLoaded[name],
7092
            style = el.currentStyle; //IE
7093
 
7094
 
7095
        if (mod !== undefined) {
7096
            //Y.log('isCSSLoaded was cached for ' + name, 'warn', 'loader');
7097
            return mod;
7098
        }
7099
 
7100
        //Add the classname to the element
7101
        el.className = name;
7102
 
7103
        if (!style) {
7104
            style = Y.config.doc.defaultView.getComputedStyle(el, null);
7105
        }
7106
 
7107
        if (style && style.display === 'none') {
7108
            ret = true;
7109
        }
7110
 
7111
        Y.log('Has Skin? ' + name + ' : ' + ret, 'info', 'loader');
7112
 
7113
        el.className = ''; //Reset the classname to ''
7114
 
7115
        YUI.Env._cssLoaded[name] = ret;
7116
 
7117
        return ret;
7118
    },
7119
 
7120
    /**
7121
     * Returns a hash of module names the supplied module satisfies.
7122
     * @method getProvides
7123
     * @param {string} name The name of the module.
7124
     * @return {object} what this module provides.
7125
     */
7126
    getProvides: function(name) {
7127
        var m = this.getModule(name), o, s;
7128
            // supmap = this.provides;
7129
 
7130
        if (!m) {
7131
            return NOT_FOUND;
7132
        }
7133
 
7134
        if (m && !m.provides) {
7135
            o = {};
7136
            s = m.supersedes;
7137
 
7138
            if (s) {
7139
                yArray.each(s, function(v) {
7140
                    Y.mix(o, this.getProvides(v));
7141
                }, this);
7142
            }
7143
 
7144
            o[name] = true;
7145
            m.provides = o;
7146
 
7147
        }
7148
 
7149
        return m.provides;
7150
    },
7151
 
7152
    /**
7153
     * Calculates the dependency tree, the result is stored in the sorted
7154
     * property.
7155
     * @method calculate
7156
     * @param {object} o optional options object.
7157
     * @param {string} type optional argument to prune modules.
7158
     */
7159
    calculate: function(o, type) {
7160
        if (o || type || this.dirty) {
7161
 
7162
            if (o) {
7163
                this._config(o);
7164
            }
7165
 
7166
            if (!this._init) {
7167
                this._setup();
7168
            }
7169
 
7170
            this._explode();
7171
 
7172
            if (this.allowRollup) {
7173
                this._rollup();
7174
            } else {
7175
                this._explodeRollups();
7176
            }
7177
            this._reduce();
7178
            this._sort();
7179
        }
7180
    },
7181
    /**
7182
    * Creates a "psuedo" package for languages provided in the lang array
7183
    * @method _addLangPack
7184
    * @private
7185
    * @param {String} lang The language to create
7186
    * @param {Object} m The module definition to create the language pack around
7187
    * @param {String} packName The name of the package (e.g: lang/datatype-date-en-US)
7188
    * @return {Object} The module definition
7189
    */
7190
    _addLangPack: function(lang, m, packName) {
7191
        var name = m.name,
7192
            packPath, conf,
7193
            existing = this.getModuleInfo(packName);
7194
 
7195
        if (!existing) {
7196
 
7197
            packPath = _path((m.pkg || name), packName, JS, true);
7198
 
7199
            conf = {
7200
                path: packPath,
7201
                intl: true,
7202
                langPack: true,
7203
                ext: m.ext,
7204
                group: m.group,
7205
                supersedes: []
7206
            };
7207
            if (m.root) {
7208
                conf.root = m.root;
7209
            }
7210
            if (m.base) {
7211
                conf.base = m.base;
7212
            }
7213
 
7214
            if (m.configFn) {
7215
                conf.configFn = m.configFn;
7216
            }
7217
 
7218
            this.addModule(conf, packName);
7219
 
7220
            if (lang) {
7221
                Y.Env.lang = Y.Env.lang || {};
7222
                Y.Env.lang[lang] = Y.Env.lang[lang] || {};
7223
                Y.Env.lang[lang][name] = true;
7224
            }
7225
        }
7226
 
7227
        return this.getModuleInfo(packName);
7228
    },
7229
 
7230
    /**
7231
     * Investigates the current YUI configuration on the page.  By default,
7232
     * modules already detected will not be loaded again unless a force
7233
     * option is encountered.  Called by calculate()
7234
     * @method _setup
7235
     * @private
7236
     */
7237
    _setup: function() {
7238
        var info = this.moduleInfo, name, i, j, m, l,
7239
            packName;
7240
 
7241
        for (name in info) {
7242
            if (info.hasOwnProperty(name)) {
7243
                m = info[name];
7244
                if (m) {
7245
 
7246
                    // remove dups
7247
                    //m.requires = YObject.keys(yArray.hash(m.requires));
7248
                    m.requires = yArray.dedupe(m.requires);
7249
 
7250
                    // Create lang pack modules
7251
                    //if (m.lang && m.lang.length) {
7252
                    if (m.lang) {
7253
                        // Setup root package if the module has lang defined,
7254
                        // it needs to provide a root language pack
7255
                        packName = this.getLangPackName(ROOT_LANG, name);
7256
                        this._addLangPack(null, m, packName);
7257
                    }
7258
 
7259
                }
7260
            }
7261
        }
7262
 
7263
 
7264
        //l = Y.merge(this.inserted);
7265
        l = {};
7266
 
7267
        // available modules
7268
        if (!this.ignoreRegistered) {
7269
            Y.mix(l, GLOBAL_ENV.mods);
7270
        }
7271
 
7272
        // add the ignore list to the list of loaded packages
7273
        if (this.ignore) {
7274
            Y.mix(l, yArray.hash(this.ignore));
7275
        }
7276
 
7277
        // expand the list to include superseded modules
7278
        for (j in l) {
7279
            if (l.hasOwnProperty(j)) {
7280
                Y.mix(l, this.getProvides(j));
7281
            }
7282
        }
7283
 
7284
        // remove modules on the force list from the loaded list
7285
        if (this.force) {
7286
            for (i = 0; i < this.force.length; i++) {
7287
                if (this.force[i] in l) {
7288
                    delete l[this.force[i]];
7289
                }
7290
            }
7291
        }
7292
 
7293
        Y.mix(this.loaded, l);
7294
 
7295
        this._init = true;
7296
    },
7297
 
7298
    /**
7299
     * Builds a module name for a language pack
7300
     * @method getLangPackName
7301
     * @param {string} lang the language code.
7302
     * @param {string} mname the module to build it for.
7303
     * @return {string} the language pack module name.
7304
     */
7305
    getLangPackName: function(lang, mname) {
7306
        return ('lang/' + mname + ((lang) ? '_' + lang : ''));
7307
    },
7308
    /**
7309
     * Inspects the required modules list looking for additional
7310
     * dependencies.  Expands the required list to include all
7311
     * required modules.  Called by calculate()
7312
     * @method _explode
7313
     * @private
7314
     */
7315
    _explode: function() {
7316
        //TODO Move done out of scope
7317
        var r = this.required, m, reqs, done = {},
7318
            self = this, name, expound;
7319
 
7320
        // the setup phase is over, all modules have been created
7321
        self.dirty = false;
7322
 
7323
        self._explodeRollups();
7324
        r = self.required;
7325
 
7326
        for (name in r) {
7327
            if (r.hasOwnProperty(name)) {
7328
                if (!done[name]) {
7329
                    done[name] = true;
7330
                    m = self.getModule(name);
7331
                    if (m) {
7332
                        expound = m.expound;
7333
 
7334
                        if (expound) {
7335
                            r[expound] = self.getModule(expound);
7336
                            reqs = self.getRequires(r[expound]);
7337
                            Y.mix(r, yArray.hash(reqs));
7338
                        }
7339
 
7340
                        reqs = self.getRequires(m);
7341
                        Y.mix(r, yArray.hash(reqs));
7342
                    }
7343
                }
7344
            }
7345
        }
7346
 
7347
        // Y.log('After explode: ' + YObject.keys(r));
7348
    },
7349
    /**
7350
    * The default method used to test a module against a pattern
7351
    * @method _patternTest
7352
    * @private
7353
    * @param {String} mname The module being tested
7354
    * @param {String} pname The pattern to match
7355
    */
7356
    _patternTest: function(mname, pname) {
7357
        return (mname.indexOf(pname) > -1);
7358
    },
7359
    /**
7360
    * Get's the loader meta data for the requested module
7361
    * @method getModule
7362
    * @param {String} mname The module name to get
7363
    * @return {Object} The module metadata
7364
    */
7365
    getModule: function(mname) {
7366
        //TODO: Remove name check - it's a quick hack to fix pattern WIP
7367
        if (!mname) {
7368
            return null;
7369
        }
7370
 
7371
        var p, found, pname,
7372
            m = this.getModuleInfo(mname),
7373
            patterns = this.patterns;
7374
 
7375
        // check the patterns library to see if we should automatically add
7376
        // the module with defaults
7377
        if (!m || (m && m.ext)) {
7378
           // Y.log('testing patterns ' + YObject.keys(patterns));
7379
            for (pname in patterns) {
7380
                if (patterns.hasOwnProperty(pname)) {
7381
                    // Y.log('testing pattern ' + i);
7382
                    p = patterns[pname];
7383
 
7384
                    //There is no test method, create a default one that tests
7385
                    // the pattern against the mod name
7386
                    if (!p.test) {
7387
                        p.test = this._patternTest;
7388
                    }
7389
 
7390
                    if (p.test(mname, pname)) {
7391
                        // use the metadata supplied for the pattern
7392
                        // as the module definition.
7393
                        found = p;
7394
                        break;
7395
                    }
7396
                }
7397
            }
7398
        }
7399
 
7400
        if (!m) {
7401
            if (found) {
7402
                if (p.action) {
7403
                    // Y.log('executing pattern action: ' + pname);
7404
                    p.action.call(this, mname, pname);
7405
                } else {
7406
Y.log('Undefined module: ' + mname + ', matched a pattern: ' +
7407
    pname, 'info', 'loader');
7408
                    // ext true or false?
7409
                    m = this.addModule(Y.merge(found, {
7410
                        test: void 0,
7411
                        temp: true
7412
                    }), mname);
7413
                    if (m && found.configFn) {
7414
                        m.configFn = found.configFn;
7415
                    }
7416
                }
7417
            }
7418
        } else {
7419
            if (found && m && found.configFn && !m.configFn) {
7420
                m.configFn = found.configFn;
7421
                m.configFn(m);
7422
            }
7423
        }
7424
 
7425
        return m;
7426
    },
7427
 
7428
    // impl in rollup submodule
7429
    _rollup: function() { },
7430
 
7431
    /**
7432
     * Remove superceded modules and loaded modules.  Called by
7433
     * calculate() after we have the mega list of all dependencies
7434
     * @method _reduce
7435
     * @return {object} the reduced dependency hash.
7436
     * @private
7437
     */
7438
    _reduce: function(r) {
7439
 
7440
        r = r || this.required;
7441
 
7442
        var i, j, s, m, type = this.loadType,
7443
        ignore = this.ignore ? yArray.hash(this.ignore) : false;
7444
 
7445
        for (i in r) {
7446
            if (r.hasOwnProperty(i)) {
7447
                m = this.getModule(i);
7448
                // remove if already loaded
7449
                if (((this.loaded[i] || ON_PAGE[i]) &&
7450
                        !this.forceMap[i] && !this.ignoreRegistered) ||
7451
                        (type && m && m.type !== type)) {
7452
                    delete r[i];
7453
                }
7454
                if (ignore && ignore[i]) {
7455
                    delete r[i];
7456
                }
7457
                // remove anything this module supersedes
7458
                s = m && m.supersedes;
7459
                if (s) {
7460
                    for (j = 0; j < s.length; j++) {
7461
                        if (s[j] in r) {
7462
                            delete r[s[j]];
7463
                        }
7464
                    }
7465
                }
7466
            }
7467
        }
7468
 
7469
        return r;
7470
    },
7471
    /**
7472
    * Handles the queue when a module has been loaded for all cases
7473
    * @method _finish
7474
    * @private
7475
    * @param {String} msg The message from Loader
7476
    * @param {Boolean} success A boolean denoting success or failure
7477
    */
7478
    _finish: function(msg, success) {
7479
        Y.log('loader finishing: ' + msg + ', ' + Y.id + ', ' +
7480
            this.data, 'info', 'loader');
7481
 
7482
        _queue.running = false;
7483
 
7484
        var onEnd = this.onEnd;
7485
        if (onEnd) {
7486
            onEnd.call(this.context, {
7487
                msg: msg,
7488
                data: this.data,
7489
                success: success
7490
            });
7491
        }
7492
        this._continue();
7493
    },
7494
    /**
7495
    * The default Loader onSuccess handler, calls this.onSuccess with a payload
7496
    * @method _onSuccess
7497
    * @private
7498
    */
7499
    _onSuccess: function() {
7500
        var self = this, skipped = Y.merge(self.skipped), fn,
7501
            failed = [], rreg = self.requireRegistration,
7502
            success, msg, i, mod;
7503
 
7504
        for (i in skipped) {
7505
            if (skipped.hasOwnProperty(i)) {
7506
                delete self.inserted[i];
7507
            }
7508
        }
7509
 
7510
        self.skipped = {};
7511
 
7512
        for (i in self.inserted) {
7513
            if (self.inserted.hasOwnProperty(i)) {
7514
                mod = self.getModule(i);
7515
                if (mod && rreg && mod.type === JS && !(i in YUI.Env.mods)) {
7516
                    failed.push(i);
7517
                } else {
7518
                    Y.mix(self.loaded, self.getProvides(i));
7519
                }
7520
            }
7521
        }
7522
 
7523
        fn = self.onSuccess;
7524
        msg = (failed.length) ? 'notregistered' : 'success';
7525
        success = !(failed.length);
7526
        if (fn) {
7527
            fn.call(self.context, {
7528
                msg: msg,
7529
                data: self.data,
7530
                success: success,
7531
                failed: failed,
7532
                skipped: skipped
7533
            });
7534
        }
7535
        self._finish(msg, success);
7536
    },
7537
    /**
7538
    * The default Loader onProgress handler, calls this.onProgress with a payload
7539
    * @method _onProgress
7540
    * @private
7541
    */
7542
    _onProgress: function(e) {
7543
        var self = this, i;
7544
        //set the internal cache to what just came in.
7545
        if (e.data && e.data.length) {
7546
            for (i = 0; i < e.data.length; i++) {
7547
                e.data[i] = self.getModule(e.data[i].name);
7548
            }
7549
        }
7550
        if (self.onProgress) {
7551
            self.onProgress.call(self.context, {
7552
                name: e.url,
7553
                data: e.data
7554
            });
7555
        }
7556
    },
7557
    /**
7558
    * The default Loader onFailure handler, calls this.onFailure with a payload
7559
    * @method _onFailure
7560
    * @private
7561
    */
7562
    _onFailure: function(o) {
7563
        var f = this.onFailure, msg = [], i = 0, len = o.errors.length;
7564
 
7565
        for (i; i < len; i++) {
7566
            msg.push(o.errors[i].error);
7567
        }
7568
 
7569
        msg = msg.join(',');
7570
 
7571
        Y.log('load error: ' + msg + ', ' + Y.id, 'error', 'loader');
7572
 
7573
        if (f) {
7574
            f.call(this.context, {
7575
                msg: msg,
7576
                data: this.data,
7577
                success: false
7578
            });
7579
        }
7580
 
7581
        this._finish(msg, false);
7582
 
7583
    },
7584
 
7585
    /**
7586
    * The default Loader onTimeout handler, calls this.onTimeout with a payload
7587
    * @method _onTimeout
7588
    * @param {Get.Transaction} transaction The Transaction object from `Y.Get`
7589
    * @private
7590
    */
7591
    _onTimeout: function(transaction) {
7592
        Y.log('loader timeout: ' + Y.id, 'error', 'loader');
7593
        var f = this.onTimeout;
7594
        if (f) {
7595
            f.call(this.context, {
7596
                msg: 'timeout',
7597
                data: this.data,
7598
                success: false,
7599
                transaction: transaction
7600
            });
7601
        }
7602
    },
7603
 
7604
    /**
7605
     * Sorts the dependency tree.  The last step of calculate()
7606
     * @method _sort
7607
     * @private
7608
     */
7609
    _sort: function() {
7610
        var name,
7611
 
7612
            // Object containing module names.
7613
            required = this.required,
7614
 
7615
            // Keep track of whether we've visited a module.
7616
            visited = {};
7617
 
7618
        // Will contain modules names, in the correct order,
7619
        // according to dependencies.
7620
        this.sorted = [];
7621
 
7622
        for (name in required) {
7623
            if (!visited[name] && required.hasOwnProperty(name)) {
7624
                this._visit(name, visited);
7625
            }
7626
        }
7627
    },
7628
 
7629
    /**
7630
     * Recursively visits the dependencies of the module name
7631
     * passed in, and appends each module name to the `sorted` property.
7632
     * @param {String} name The name of a module.
7633
     * @param {Object} visited Keeps track of whether a module was visited.
7634
     * @method _visit
7635
     * @private
7636
     */
7637
    _visit: function (name, visited) {
7638
        var required, condition, moduleInfo, dependency, dependencies,
7639
            trigger, isAfter, i, l;
7640
 
7641
        visited[name] = true;
7642
        required = this.required;
7643
        moduleInfo = this.moduleInfo[name];
7644
        condition = this.conditions[name] || {};
7645
 
7646
        if (moduleInfo) {
7647
            // Recurse on each dependency of this module,
7648
            // figuring out its dependencies, and so on.
7649
            dependencies = moduleInfo.expanded || moduleInfo.requires;
7650
 
7651
            for (i = 0, l = dependencies.length; i < l; ++i) {
7652
                dependency = dependencies[i];
7653
                trigger = condition[dependency];
7654
 
7655
                // We cannot process this dependency yet if it must
7656
                // appear after our current module.
7657
                isAfter = trigger && (!trigger.when || trigger.when === "after");
7658
 
7659
                // Is this module name in the required list of modules,
7660
                // and have we not already visited it?
7661
                if (required[dependency] && !visited[dependency] && !isAfter) {
7662
                    this._visit(dependency, visited);
7663
                }
7664
            }
7665
        }
7666
 
7667
        this.sorted.push(name);
7668
    },
7669
 
7670
    /**
7671
    * Handles the actual insertion of script/link tags
7672
    * @method _insert
7673
    * @private
7674
    * @param {Object} source The YUI instance the request came from
7675
    * @param {Object} o The metadata to include
7676
    * @param {String} type JS or CSS
7677
    * @param {Boolean} [skipcalc=false] Do a Loader.calculate on the meta
7678
    */
7679
    _insert: function(source, o, type, skipcalc) {
7680
 
7681
        Y.log('private _insert() ' + (type || '') + ', ' + Y.id, "info", "loader");
7682
 
7683
        // restore the state at the time of the request
7684
        if (source) {
7685
            this._config(source);
7686
        }
7687
 
7688
        // build the dependency list
7689
        // don't include type so we can process CSS and script in
7690
        // one pass when the type is not specified.
7691
 
7692
        var modules = this.resolve(!skipcalc),
7693
            self = this, comp = 0, actions = 0,
7694
            mods = {}, deps, complete;
7695
 
7696
        self._refetch = [];
7697
 
7698
        if (type) {
7699
            //Filter out the opposite type and reset the array so the checks later work
7700
            modules[((type === JS) ? CSS : JS)] = [];
7701
        }
7702
        if (!self.fetchCSS) {
7703
            modules.css = [];
7704
        }
7705
        if (modules.js.length) {
7706
            comp++;
7707
        }
7708
        if (modules.css.length) {
7709
            comp++;
7710
        }
7711
 
7712
        //console.log('Resolved Modules: ', modules);
7713
 
7714
        complete = function(d) {
7715
            actions++;
7716
            var errs = {}, i = 0, o = 0, u = '', fn,
7717
                modName, resMods;
7718
 
7719
            if (d && d.errors) {
7720
                for (i = 0; i < d.errors.length; i++) {
7721
                    if (d.errors[i].request) {
7722
                        u = d.errors[i].request.url;
7723
                    } else {
7724
                        u = d.errors[i];
7725
                    }
7726
                    errs[u] = u;
7727
                }
7728
            }
7729
 
7730
            if (d && d.data && d.data.length && (d.type === 'success')) {
7731
                for (i = 0; i < d.data.length; i++) {
7732
                    self.inserted[d.data[i].name] = true;
7733
                    //If the external module has a skin or a lang, reprocess it
7734
                    if (d.data[i].lang || d.data[i].skinnable) {
7735
                        delete self.inserted[d.data[i].name];
7736
                        self._refetch.push(d.data[i].name);
7737
                    }
7738
                }
7739
            }
7740
 
7741
            if (actions === comp) {
7742
                self._loading = null;
7743
                Y.log('Loader actions complete!', 'info', 'loader');
7744
                if (self._refetch.length) {
7745
                    //Get the deps for the new meta-data and reprocess
7746
                    Y.log('Found potential modules to refetch', 'info', 'loader');
7747
                    for (i = 0; i < self._refetch.length; i++) {
7748
                        deps = self.getRequires(self.getModule(self._refetch[i]));
7749
                        for (o = 0; o < deps.length; o++) {
7750
                            if (!self.inserted[deps[o]]) {
7751
                                //We wouldn't be to this point without the module being here
7752
                                mods[deps[o]] = deps[o];
7753
                            }
7754
                        }
7755
                    }
7756
                    mods = Y.Object.keys(mods);
7757
                    if (mods.length) {
7758
                        Y.log('Refetching modules with new meta-data', 'info', 'loader');
7759
                        self.require(mods);
7760
                        resMods = self.resolve(true);
7761
                        if (resMods.cssMods.length) {
7762
                            for (i=0; i <  resMods.cssMods.length; i++) {
7763
                                modName = resMods.cssMods[i].name;
7764
                                delete YUI.Env._cssLoaded[modName];
7765
                                if (self.isCSSLoaded(modName)) {
7766
                                    self.inserted[modName] = true;
7767
                                    delete self.required[modName];
7768
                                }
7769
                            }
7770
                            self.sorted = [];
7771
                            self._sort();
7772
                        }
7773
                        d = null; //bail
7774
                        self._insert(); //insert the new deps
7775
                    }
7776
                }
7777
                if (d && d.fn) {
7778
                    Y.log('Firing final Loader callback!', 'info', 'loader');
7779
                    fn = d.fn;
7780
                    delete d.fn;
7781
                    fn.call(self, d);
7782
                }
7783
            }
7784
        };
7785
 
7786
        this._loading = true;
7787
 
7788
        if (!modules.js.length && !modules.css.length) {
7789
            Y.log('No modules resolved..', 'warn', 'loader');
7790
            actions = -1;
7791
            complete({
7792
                fn: self._onSuccess
7793
            });
7794
            return;
7795
        }
7796
 
7797
 
7798
        if (modules.css.length) { //Load CSS first
7799
            Y.log('Loading CSS modules', 'info', 'loader');
7800
            Y.Get.css(modules.css, {
7801
                data: modules.cssMods,
7802
                attributes: self.cssAttributes,
7803
                insertBefore: self.insertBefore,
7804
                charset: self.charset,
7805
                timeout: self.timeout,
7806
                context: self,
7807
                onProgress: function(e) {
7808
                    self._onProgress.call(self, e);
7809
                },
7810
                onTimeout: function(d) {
7811
                    self._onTimeout.call(self, d);
7812
                },
7813
                onSuccess: function(d) {
7814
                    d.type = 'success';
7815
                    d.fn = self._onSuccess;
7816
                    complete.call(self, d);
7817
                },
7818
                onFailure: function(d) {
7819
                    d.type = 'failure';
7820
                    d.fn = self._onFailure;
7821
                    complete.call(self, d);
7822
                }
7823
            });
7824
        }
7825
 
7826
        if (modules.js.length) {
7827
            Y.log('Loading JS modules', 'info', 'loader');
7828
            Y.Get.js(modules.js, {
7829
                data: modules.jsMods,
7830
                insertBefore: self.insertBefore,
7831
                attributes: self.jsAttributes,
7832
                charset: self.charset,
7833
                timeout: self.timeout,
7834
                autopurge: false,
7835
                context: self,
7836
                async: self.async,
7837
                onProgress: function(e) {
7838
                    self._onProgress.call(self, e);
7839
                },
7840
                onTimeout: function(d) {
7841
                    self._onTimeout.call(self, d);
7842
                },
7843
                onSuccess: function(d) {
7844
                    d.type = 'success';
7845
                    d.fn = self._onSuccess;
7846
                    complete.call(self, d);
7847
                },
7848
                onFailure: function(d) {
7849
                    d.type = 'failure';
7850
                    d.fn = self._onFailure;
7851
                    complete.call(self, d);
7852
                }
7853
            });
7854
        }
7855
    },
7856
    /**
7857
    * Once a loader operation is completely finished, process any additional queued items.
7858
    * @method _continue
7859
    * @private
7860
    */
7861
    _continue: function() {
7862
        if (!(_queue.running) && _queue.size() > 0) {
7863
            _queue.running = true;
7864
            _queue.next()();
7865
        }
7866
    },
7867
 
7868
    /**
7869
     * inserts the requested modules and their dependencies.
7870
     * <code>type</code> can be "js" or "css".  Both script and
7871
     * css are inserted if type is not provided.
7872
     * @method insert
7873
     * @param {object} o optional options object.
7874
     * @param {string} type the type of dependency to insert.
7875
     */
7876
    insert: function(o, type, skipsort) {
7877
        Y.log('public insert() ' + (type || '') + ', ' + Y.Object.keys(this.required), "info", "loader");
7878
        var self = this, copy = Y.merge(this);
7879
        delete copy.require;
7880
        delete copy.dirty;
7881
        _queue.add(function() {
7882
            self._insert(copy, o, type, skipsort);
7883
        });
7884
        this._continue();
7885
    },
7886
 
7887
    /**
7888
     * Executed every time a module is loaded, and if we are in a load
7889
     * cycle, we attempt to load the next script.  Public so that it
7890
     * is possible to call this if using a method other than
7891
     * Y.register to determine when scripts are fully loaded
7892
     * @method loadNext
7893
     * @deprecated
7894
     * @param {string} mname optional the name of the module that has
7895
     * been loaded (which is usually why it is time to load the next
7896
     * one).
7897
     */
7898
    loadNext: function() {
7899
        Y.log('loadNext was called..', 'error', 'loader');
7900
        return;
7901
    },
7902
 
7903
    /**
7904
     * Apply filter defined for this instance to a url/path
7905
     * @method _filter
7906
     * @param {string} u the string to filter.
7907
     * @param {string} name the name of the module, if we are processing
7908
     * a single module as opposed to a combined url.
7909
     * @return {string} the filtered string.
7910
     * @private
7911
     */
7912
    _filter: function(u, name, group) {
7913
        var f = this.filter,
7914
            hasFilter = name && (name in this.filters),
7915
            modFilter = hasFilter && this.filters[name],
7916
            groupName = group || (this.getModuleInfo(name) || {}).group || null;
7917
 
7918
        if (groupName && this.groups[groupName] && this.groups[groupName].filter) {
7919
            modFilter = this.groups[groupName].filter;
7920
            hasFilter = true;
7921
        }
7922
 
7923
        if (u) {
7924
            if (hasFilter) {
7925
                f = (L.isString(modFilter)) ? this.FILTER_DEFS[modFilter.toUpperCase()] || null : modFilter;
7926
            }
7927
            if (f) {
7928
                u = u.replace(new RegExp(f.searchExp, 'g'), f.replaceStr);
7929
            }
7930
        }
7931
        return u;
7932
    },
7933
 
7934
    /**
7935
     * Generates the full url for a module
7936
     * @method _url
7937
     * @param {string} path the path fragment.
7938
     * @param {String} name The name of the module
7939
     * @param {String} [base] The base url to use. Defaults to self.base
7940
     * @return {string} the full url.
7941
     * @private
7942
     */
7943
    _url: function(path, name, base) {
7944
        return this._filter((base || this.base || '') + path, name);
7945
    },
7946
    /**
7947
    * Returns an Object hash of file arrays built from `loader.sorted` or from an arbitrary list of sorted modules.
7948
    * @method resolve
7949
    * @param {Boolean} [calc=false] Perform a loader.calculate() before anything else
7950
    * @param {Array} [sorted=loader.sorted] An override for the loader.sorted array
7951
    * @return {Object} Object hash (js and css) of two arrays of file lists
7952
    * @example This method can be used as an off-line dep calculator
7953
    *
7954
    *        var Y = YUI();
7955
    *        var loader = new Y.Loader({
7956
    *            filter: 'debug',
7957
    *            base: '../../',
7958
    *            root: 'build/',
7959
    *            combine: true,
7960
    *            require: ['node', 'dd', 'console']
7961
    *        });
7962
    *        var out = loader.resolve(true);
7963
    *
7964
    */
7965
    resolve: function(calc, sorted) {
7966
        var self     = this,
7967
            resolved = { js: [], jsMods: [], css: [], cssMods: [] },
7968
            addSingle,
7969
            usePathogen = Y.config.comboLoader && Y.config.customComboBase;
7970
 
7971
        if (self.skin.overrides || self.skin.defaultSkin !== DEFAULT_SKIN || self.ignoreRegistered) {
7972
            self._resetModules();
7973
        }
7974
 
7975
        if (calc) {
7976
            self.calculate();
7977
        }
7978
        sorted = sorted || self.sorted;
7979
 
7980
        addSingle = function(mod) {
7981
            if (mod) {
7982
                var group = (mod.group && self.groups[mod.group]) || NOT_FOUND,
7983
                    url;
7984
 
7985
                //Always assume it's async
7986
                if (group.async === false) {
7987
                    mod.async = group.async;
7988
                }
7989
 
7990
                url = (mod.fullpath) ? self._filter(mod.fullpath, mod.name) :
7991
                      self._url(mod.path, mod.name, group.base || mod.base);
7992
 
7993
                if (mod.attributes || mod.async === false) {
7994
                    url = {
7995
                        url: url,
7996
                        async: mod.async
7997
                    };
7998
                    if (mod.attributes) {
7999
                        url.attributes = mod.attributes;
8000
                    }
8001
                }
8002
                resolved[mod.type].push(url);
8003
                resolved[mod.type + 'Mods'].push(mod);
8004
            } else {
8005
                Y.log('Undefined Module', 'warn', 'loader');
8006
            }
8007
 
8008
        };
8009
 
8010
        /*jslint vars: true */
8011
        var inserted     = (self.ignoreRegistered) ? {} : self.inserted,
8012
            comboSources,
8013
            maxURLLength,
8014
            comboMeta,
8015
            comboBase,
8016
            comboSep,
8017
            group,
8018
            mod,
8019
            len,
8020
            i,
8021
            hasComboModule = false;
8022
 
8023
        /*jslint vars: false */
8024
 
8025
        for (i = 0, len = sorted.length; i < len; i++) {
8026
            mod = self.getModule(sorted[i]);
8027
            if (!mod || inserted[mod.name]) {
8028
                continue;
8029
            }
8030
 
8031
            group = self.groups[mod.group];
8032
 
8033
            comboBase = self.comboBase;
8034
 
8035
            if (group) {
8036
                if (!group.combine || mod.fullpath) {
8037
                    //This is not a combo module, skip it and load it singly later.
8038
                    addSingle(mod);
8039
                    continue;
8040
                }
8041
                mod.combine = true;
8042
 
8043
                if (typeof group.root === 'string') {
8044
                    mod.root = group.root;
8045
                }
8046
 
8047
                comboBase    = group.comboBase || comboBase;
8048
                comboSep     = group.comboSep;
8049
                maxURLLength = group.maxURLLength;
8050
            } else {
8051
                if (!self.combine) {
8052
                    //This is not a combo module, skip it and load it singly later.
8053
                    addSingle(mod);
8054
                    continue;
8055
                }
8056
            }
8057
 
8058
            if (!mod.combine && mod.ext) {
8059
                addSingle(mod);
8060
                continue;
8061
            }
8062
            hasComboModule = true;
8063
            comboSources = comboSources || {};
8064
            comboSources[comboBase] = comboSources[comboBase] ||
8065
                { js: [], jsMods: [], css: [], cssMods: [] };
8066
 
8067
            comboMeta               = comboSources[comboBase];
8068
            comboMeta.group         = mod.group;
8069
            comboMeta.comboSep      = comboSep || self.comboSep;
8070
            comboMeta.maxURLLength  = maxURLLength || self.maxURLLength;
8071
 
8072
            comboMeta[mod.type + 'Mods'].push(mod);
8073
            if (mod.type === JS || mod.type === CSS) {
8074
                resolved[mod.type + 'Mods'].push(mod);
8075
            }
8076
        }
8077
        //only encode if we have something to encode
8078
        if (hasComboModule) {
8079
            if (usePathogen) {
8080
                resolved = this._pathogenEncodeComboSources(resolved);
8081
            } else {
8082
                resolved = this._encodeComboSources(resolved, comboSources);
8083
            }
8084
        }
8085
        return resolved;
8086
    },
8087
 
8088
    /**
8089
     * Encodes combo sources and appends them to an object hash of arrays from `loader.resolve`.
8090
     *
8091
     * @method _encodeComboSources
8092
     * @param {Object} resolved The object hash of arrays in which to attach the encoded combo sources.
8093
     * @param {Object} comboSources An object containing relevant data about modules.
8094
     * @return Object
8095
     * @private
8096
     */
8097
    _encodeComboSources: function(resolved, comboSources) {
8098
        var fragSubset,
8099
            modules,
8100
            tmpBase,
8101
            baseLen,
8102
            frags,
8103
            frag,
8104
            type,
8105
            mod,
8106
            maxURLLength,
8107
            comboBase,
8108
            comboMeta,
8109
            comboSep,
8110
            i,
8111
            len,
8112
            self = this;
8113
 
8114
        for (comboBase in comboSources) {
8115
            if (comboSources.hasOwnProperty(comboBase)) {
8116
                comboMeta    = comboSources[comboBase];
8117
                comboSep     = comboMeta.comboSep;
8118
                maxURLLength = comboMeta.maxURLLength;
8119
                Y.log('Using maxURLLength of ' + maxURLLength, 'info', 'loader');
8120
                for (type in comboMeta) {
8121
                    if (type === JS || type === CSS) {
8122
                        modules = comboMeta[type + 'Mods'];
8123
                        frags = [];
8124
                        for (i = 0, len = modules.length; i < len; i += 1) {
8125
                            mod = modules[i];
8126
                            frag = ((typeof mod.root === 'string') ? mod.root : self.root) + (mod.path || mod.fullpath);
8127
                            frags.push(
8128
                                self._filter(frag, mod.name)
8129
                            );
8130
                        }
8131
                        tmpBase = comboBase + frags.join(comboSep);
8132
                        baseLen = tmpBase.length;
8133
                        if (maxURLLength <= comboBase.length) {
8134
                            Y.log('maxURLLength (' + maxURLLength + ') is lower than the comboBase length (' + comboBase.length + '), resetting to default (' + MAX_URL_LENGTH + ')', 'error', 'loader');
8135
                            maxURLLength = MAX_URL_LENGTH;
8136
                        }
8137
 
8138
                        if (frags.length) {
8139
                            if (baseLen > maxURLLength) {
8140
                                Y.log('Exceeded maxURLLength (' + maxURLLength + ') for ' + type + ', splitting', 'info', 'loader');
8141
                                fragSubset = [];
8142
                                for (i = 0, len = frags.length; i < len; i++) {
8143
                                    fragSubset.push(frags[i]);
8144
                                    tmpBase = comboBase + fragSubset.join(comboSep);
8145
 
8146
                                    if (tmpBase.length > maxURLLength) {
8147
                                        frag = fragSubset.pop();
8148
                                        tmpBase = comboBase + fragSubset.join(comboSep);
8149
                                        resolved[type].push(self._filter(tmpBase, null, comboMeta.group));
8150
                                        fragSubset = [];
8151
                                        if (frag) {
8152
                                            fragSubset.push(frag);
8153
                                        }
8154
                                    }
8155
                                }
8156
                                if (fragSubset.length) {
8157
                                    tmpBase = comboBase + fragSubset.join(comboSep);
8158
                                    resolved[type].push(self._filter(tmpBase, null, comboMeta.group));
8159
                                }
8160
                            } else {
8161
                                resolved[type].push(self._filter(tmpBase, null, comboMeta.group));
8162
                            }
8163
                        }
8164
                    }
8165
                }
8166
            }
8167
        }
8168
        return resolved;
8169
    },
8170
 
8171
    /**
8172
    Shortcut to calculate, resolve and load all modules.
8173
 
8174
        var loader = new Y.Loader({
8175
            ignoreRegistered: true,
8176
            modules: {
8177
                mod: {
8178
                    path: 'mod.js'
8179
                }
8180
            },
8181
            requires: [ 'mod' ]
8182
        });
8183
        loader.load(function() {
8184
            console.log('All modules have loaded..');
8185
        });
8186
 
8187
 
8188
    @method load
8189
    @param {Function} cb Executed after all load operations are complete
8190
    */
8191
    load: function(cb) {
8192
        if (!cb) {
8193
            Y.log('No callback supplied to load()', 'error', 'loader');
8194
            return;
8195
        }
8196
        var self = this,
8197
            out = self.resolve(true);
8198
 
8199
        self.data = out;
8200
 
8201
        self.onEnd = function() {
8202
            cb.apply(self.context || self, arguments);
8203
        };
8204
 
8205
        self.insert();
8206
    }
8207
};
8208
 
8209
 
8210
}, '3.18.1', {"requires": ["get", "features"]});
8211
YUI.add('loader-rollup', function (Y, NAME) {
8212
 
8213
/**
8214
 * Optional automatic rollup logic for reducing http connections
8215
 * when not using a combo service.
8216
 * @module loader
8217
 * @submodule rollup
8218
 */
8219
 
8220
/**
8221
 * Look for rollup packages to determine if all of the modules a
8222
 * rollup supersedes are required.  If so, include the rollup to
8223
 * help reduce the total number of connections required.  Called
8224
 * by calculate().  This is an optional feature, and requires the
8225
 * appropriate submodule to function.
8226
 * @method _rollup
8227
 * @for Loader
8228
 * @private
8229
 */
8230
Y.Loader.prototype._rollup = function() {
8231
    var i, j, m, s, r = this.required, roll,
8232
        info = this.moduleInfo, rolled, c, smod;
8233
 
8234
    // find and cache rollup modules
8235
    if (this.dirty || !this.rollups) {
8236
        this.rollups = {};
8237
        for (i in info) {
8238
            if (info.hasOwnProperty(i)) {
8239
                m = this.getModule(i);
8240
                // if (m && m.rollup && m.supersedes) {
8241
                if (m && m.rollup) {
8242
                    this.rollups[i] = m;
8243
                }
8244
            }
8245
        }
8246
    }
8247
 
8248
    // make as many passes as needed to pick up rollup rollups
8249
    for (;;) {
8250
        rolled = false;
8251
 
8252
        // go through the rollup candidates
8253
        for (i in this.rollups) {
8254
            if (this.rollups.hasOwnProperty(i)) {
8255
                // there can be only one, unless forced
8256
                if (!r[i] && ((!this.loaded[i]) || this.forceMap[i])) {
8257
                    m = this.getModule(i);
8258
                    s = m.supersedes || [];
8259
                    roll = false;
8260
 
8261
                    // @TODO remove continue
8262
                    if (!m.rollup) {
8263
                        continue;
8264
                    }
8265
 
8266
                    c = 0;
8267
 
8268
                    // check the threshold
8269
                    for (j = 0; j < s.length; j++) {
8270
                        smod = info[s[j]];
8271
 
8272
                        // if the superseded module is loaded, we can't
8273
                        // load the rollup unless it has been forced.
8274
                        if (this.loaded[s[j]] && !this.forceMap[s[j]]) {
8275
                            roll = false;
8276
                            break;
8277
                        // increment the counter if this module is required.
8278
                        // if we are beyond the rollup threshold, we will
8279
                        // use the rollup module
8280
                        } else if (r[s[j]] && m.type === smod.type) {
8281
                            c++;
8282
                            // Y.log("adding to thresh: " + c + ", " + s[j]);
8283
                            roll = (c >= m.rollup);
8284
                            if (roll) {
8285
                                // Y.log("over thresh " + c + ", " + s[j]);
8286
                                break;
8287
                            }
8288
                        }
8289
                    }
8290
 
8291
                    if (roll) {
8292
                        // Y.log("adding rollup: " +  i);
8293
                        // add the rollup
8294
                        r[i] = true;
8295
                        rolled = true;
8296
 
8297
                        // expand the rollup's dependencies
8298
                        this.getRequires(m);
8299
                    }
8300
                }
8301
            }
8302
        }
8303
 
8304
        // if we made it here w/o rolling up something, we are done
8305
        if (!rolled) {
8306
            break;
8307
        }
8308
    }
8309
};
8310
 
8311
 
8312
}, '3.18.1', {"requires": ["loader-base"]});
8313
YUI.add('loader-yui3', function (Y, NAME) {
8314
 
8315
/* This file is auto-generated by (yogi loader --yes --mix --start ../) */
8316
 
8317
/*jshint maxlen:900, eqeqeq: false */
8318
 
8319
/**
8320
 * YUI 3 module metadata
8321
 * @module loader
8322
 * @submodule loader-yui3
8323
 */
8324
YUI.Env[Y.version].modules = YUI.Env[Y.version].modules || {};
8325
Y.mix(YUI.Env[Y.version].modules, {
8326
    "align-plugin": {
8327
        "requires": [
8328
            "node-screen",
8329
            "node-pluginhost"
8330
        ]
8331
    },
8332
    "anim": {
8333
        "use": [
8334
            "anim-base",
8335
            "anim-color",
8336
            "anim-curve",
8337
            "anim-easing",
8338
            "anim-node-plugin",
8339
            "anim-scroll",
8340
            "anim-xy"
8341
        ]
8342
    },
8343
    "anim-base": {
8344
        "requires": [
8345
            "base-base",
8346
            "node-style",
8347
            "color-base"
8348
        ]
8349
    },
8350
    "anim-color": {
8351
        "requires": [
8352
            "anim-base"
8353
        ]
8354
    },
8355
    "anim-curve": {
8356
        "requires": [
8357
            "anim-xy"
8358
        ]
8359
    },
8360
    "anim-easing": {
8361
        "requires": [
8362
            "anim-base"
8363
        ]
8364
    },
8365
    "anim-node-plugin": {
8366
        "requires": [
8367
            "node-pluginhost",
8368
            "anim-base"
8369
        ]
8370
    },
8371
    "anim-scroll": {
8372
        "requires": [
8373
            "anim-base"
8374
        ]
8375
    },
8376
    "anim-shape": {
8377
        "requires": [
8378
            "anim-base",
8379
            "anim-easing",
8380
            "anim-color",
8381
            "matrix"
8382
        ]
8383
    },
8384
    "anim-shape-transform": {
8385
        "use": [
8386
            "anim-shape"
8387
        ]
8388
    },
8389
    "anim-xy": {
8390
        "requires": [
8391
            "anim-base",
8392
            "node-screen"
8393
        ]
8394
    },
8395
    "app": {
8396
        "use": [
8397
            "app-base",
8398
            "app-content",
8399
            "app-transitions",
8400
            "lazy-model-list",
8401
            "model",
8402
            "model-list",
8403
            "model-sync-rest",
8404
            "model-sync-local",
8405
            "router",
8406
            "view",
8407
            "view-node-map"
8408
        ]
8409
    },
8410
    "app-base": {
8411
        "requires": [
8412
            "classnamemanager",
8413
            "pjax-base",
8414
            "router",
8415
            "view"
8416
        ]
8417
    },
8418
    "app-content": {
8419
        "requires": [
8420
            "app-base",
8421
            "pjax-content"
8422
        ]
8423
    },
8424
    "app-transitions": {
8425
        "requires": [
8426
            "app-base"
8427
        ]
8428
    },
8429
    "app-transitions-css": {
8430
        "type": "css"
8431
    },
8432
    "app-transitions-native": {
8433
        "condition": {
8434
            "name": "app-transitions-native",
8435
            "test": function (Y) {
8436
    var doc  = Y.config.doc,
8437
        node = doc ? doc.documentElement : null;
8438
 
8439
    if (node && node.style) {
8440
        return ('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style);
8441
    }
8442
 
8443
    return false;
8444
},
8445
            "trigger": "app-transitions"
8446
        },
8447
        "requires": [
8448
            "app-transitions",
8449
            "app-transitions-css",
8450
            "parallel",
8451
            "transition"
8452
        ]
8453
    },
8454
    "array-extras": {
8455
        "requires": [
8456
            "yui-base"
8457
        ]
8458
    },
8459
    "array-invoke": {
8460
        "requires": [
8461
            "yui-base"
8462
        ]
8463
    },
8464
    "arraylist": {
8465
        "requires": [
8466
            "yui-base"
8467
        ]
8468
    },
8469
    "arraylist-add": {
8470
        "requires": [
8471
            "arraylist"
8472
        ]
8473
    },
8474
    "arraylist-filter": {
8475
        "requires": [
8476
            "arraylist"
8477
        ]
8478
    },
8479
    "arraysort": {
8480
        "requires": [
8481
            "yui-base"
8482
        ]
8483
    },
8484
    "async-queue": {
8485
        "requires": [
8486
            "event-custom"
8487
        ]
8488
    },
8489
    "attribute": {
8490
        "use": [
8491
            "attribute-base",
8492
            "attribute-complex"
8493
        ]
8494
    },
8495
    "attribute-base": {
8496
        "requires": [
8497
            "attribute-core",
8498
            "attribute-observable",
8499
            "attribute-extras"
8500
        ]
8501
    },
8502
    "attribute-complex": {
8503
        "requires": [
8504
            "attribute-base"
8505
        ]
8506
    },
8507
    "attribute-core": {
8508
        "requires": [
8509
            "oop"
8510
        ]
8511
    },
8512
    "attribute-events": {
8513
        "use": [
8514
            "attribute-observable"
8515
        ]
8516
    },
8517
    "attribute-extras": {
8518
        "requires": [
8519
            "oop"
8520
        ]
8521
    },
8522
    "attribute-observable": {
8523
        "requires": [
8524
            "event-custom"
8525
        ]
8526
    },
8527
    "autocomplete": {
8528
        "use": [
8529
            "autocomplete-base",
8530
            "autocomplete-sources",
8531
            "autocomplete-list",
8532
            "autocomplete-plugin"
8533
        ]
8534
    },
8535
    "autocomplete-base": {
8536
        "optional": [
8537
            "autocomplete-sources"
8538
        ],
8539
        "requires": [
8540
            "array-extras",
8541
            "base-build",
8542
            "escape",
8543
            "event-valuechange",
8544
            "node-base"
8545
        ]
8546
    },
8547
    "autocomplete-filters": {
8548
        "requires": [
8549
            "array-extras",
8550
            "text-wordbreak"
8551
        ]
8552
    },
8553
    "autocomplete-filters-accentfold": {
8554
        "requires": [
8555
            "array-extras",
8556
            "text-accentfold",
8557
            "text-wordbreak"
8558
        ]
8559
    },
8560
    "autocomplete-highlighters": {
8561
        "requires": [
8562
            "array-extras",
8563
            "highlight-base"
8564
        ]
8565
    },
8566
    "autocomplete-highlighters-accentfold": {
8567
        "requires": [
8568
            "array-extras",
8569
            "highlight-accentfold"
8570
        ]
8571
    },
8572
    "autocomplete-list": {
8573
        "after": [
8574
            "autocomplete-sources"
8575
        ],
8576
        "lang": [
8577
            "en",
8578
            "es",
8579
            "hu",
8580
            "it"
8581
        ],
8582
        "requires": [
8583
            "autocomplete-base",
8584
            "event-resize",
8585
            "node-screen",
8586
            "selector-css3",
8587
            "shim-plugin",
8588
            "widget",
8589
            "widget-position",
8590
            "widget-position-align"
8591
        ],
8592
        "skinnable": true
8593
    },
8594
    "autocomplete-list-keys": {
8595
        "condition": {
8596
            "name": "autocomplete-list-keys",
8597
            "test": function (Y) {
8598
    // Only add keyboard support to autocomplete-list if this doesn't appear to
8599
    // be an iOS or Android-based mobile device.
8600
    //
8601
    // There's currently no feasible way to actually detect whether a device has
8602
    // a hardware keyboard, so this sniff will have to do. It can easily be
8603
    // overridden by manually loading the autocomplete-list-keys module.
8604
    //
8605
    // Worth noting: even though iOS supports bluetooth keyboards, Mobile Safari
8606
    // doesn't fire the keyboard events used by AutoCompleteList, so there's
8607
    // no point loading the -keys module even when a bluetooth keyboard may be
8608
    // available.
8609
    return !(Y.UA.ios || Y.UA.android);
8610
},
8611
            "trigger": "autocomplete-list"
8612
        },
8613
        "requires": [
8614
            "autocomplete-list",
8615
            "base-build"
8616
        ]
8617
    },
8618
    "autocomplete-plugin": {
8619
        "requires": [
8620
            "autocomplete-list",
8621
            "node-pluginhost"
8622
        ]
8623
    },
8624
    "autocomplete-sources": {
8625
        "optional": [
8626
            "io-base",
8627
            "json-parse",
8628
            "jsonp",
8629
            "yql"
8630
        ],
8631
        "requires": [
8632
            "autocomplete-base"
8633
        ]
8634
    },
8635
    "axes": {
8636
        "use": [
8637
            "axis-numeric",
8638
            "axis-category",
8639
            "axis-time",
8640
            "axis-stacked"
8641
        ]
8642
    },
8643
    "axes-base": {
8644
        "use": [
8645
            "axis-numeric-base",
8646
            "axis-category-base",
8647
            "axis-time-base",
8648
            "axis-stacked-base"
8649
        ]
8650
    },
8651
    "axis": {
8652
        "requires": [
8653
            "dom",
8654
            "widget",
8655
            "widget-position",
8656
            "widget-stack",
8657
            "graphics",
8658
            "axis-base"
8659
        ]
8660
    },
8661
    "axis-base": {
8662
        "requires": [
8663
            "classnamemanager",
8664
            "datatype-number",
8665
            "datatype-date",
8666
            "base",
8667
            "event-custom"
8668
        ]
8669
    },
8670
    "axis-category": {
8671
        "requires": [
8672
            "axis",
8673
            "axis-category-base"
8674
        ]
8675
    },
8676
    "axis-category-base": {
8677
        "requires": [
8678
            "axis-base"
8679
        ]
8680
    },
8681
    "axis-numeric": {
8682
        "requires": [
8683
            "axis",
8684
            "axis-numeric-base"
8685
        ]
8686
    },
8687
    "axis-numeric-base": {
8688
        "requires": [
8689
            "axis-base"
8690
        ]
8691
    },
8692
    "axis-stacked": {
8693
        "requires": [
8694
            "axis-numeric",
8695
            "axis-stacked-base"
8696
        ]
8697
    },
8698
    "axis-stacked-base": {
8699
        "requires": [
8700
            "axis-numeric-base"
8701
        ]
8702
    },
8703
    "axis-time": {
8704
        "requires": [
8705
            "axis",
8706
            "axis-time-base"
8707
        ]
8708
    },
8709
    "axis-time-base": {
8710
        "requires": [
8711
            "axis-base"
8712
        ]
8713
    },
8714
    "base": {
8715
        "use": [
8716
            "base-base",
8717
            "base-pluginhost",
8718
            "base-build"
8719
        ]
8720
    },
8721
    "base-base": {
8722
        "requires": [
8723
            "attribute-base",
8724
            "base-core",
8725
            "base-observable"
8726
        ]
8727
    },
8728
    "base-build": {
8729
        "requires": [
8730
            "base-base"
8731
        ]
8732
    },
8733
    "base-core": {
8734
        "requires": [
8735
            "attribute-core"
8736
        ]
8737
    },
8738
    "base-observable": {
8739
        "requires": [
8740
            "attribute-observable",
8741
            "base-core"
8742
        ]
8743
    },
8744
    "base-pluginhost": {
8745
        "requires": [
8746
            "base-base",
8747
            "pluginhost"
8748
        ]
8749
    },
8750
    "button": {
8751
        "requires": [
8752
            "button-core",
8753
            "cssbutton",
8754
            "widget"
8755
        ]
8756
    },
8757
    "button-core": {
8758
        "requires": [
8759
            "attribute-core",
8760
            "classnamemanager",
8761
            "node-base",
8762
            "escape"
8763
        ]
8764
    },
8765
    "button-group": {
8766
        "requires": [
8767
            "button-plugin",
8768
            "cssbutton",
8769
            "widget"
8770
        ]
8771
    },
8772
    "button-plugin": {
8773
        "requires": [
8774
            "button-core",
8775
            "cssbutton",
8776
            "node-pluginhost"
8777
        ]
8778
    },
8779
    "cache": {
8780
        "use": [
8781
            "cache-base",
8782
            "cache-offline",
8783
            "cache-plugin"
8784
        ]
8785
    },
8786
    "cache-base": {
8787
        "requires": [
8788
            "base"
8789
        ]
8790
    },
8791
    "cache-offline": {
8792
        "requires": [
8793
            "cache-base",
8794
            "json"
8795
        ]
8796
    },
8797
    "cache-plugin": {
8798
        "requires": [
8799
            "plugin",
8800
            "cache-base"
8801
        ]
8802
    },
8803
    "calendar": {
8804
        "requires": [
8805
            "calendar-base",
8806
            "calendarnavigator"
8807
        ],
8808
        "skinnable": true
8809
    },
8810
    "calendar-base": {
8811
        "lang": [
8812
            "de",
8813
            "en",
8814
            "es",
8815
            "es-AR",
8816
            "fr",
8817
            "hu",
8818
            "it",
8819
            "ja",
8820
            "nb-NO",
8821
            "nl",
8822
            "pt-BR",
8823
            "ru",
8824
            "zh-Hans",
8825
            "zh-Hans-CN",
8826
            "zh-Hant",
8827
            "zh-Hant-HK",
8828
            "zh-HANT-TW"
8829
        ],
8830
        "requires": [
8831
            "widget",
8832
            "datatype-date",
8833
            "datatype-date-math",
8834
            "cssgrids"
8835
        ],
8836
        "skinnable": true
8837
    },
8838
    "calendarnavigator": {
8839
        "requires": [
8840
            "plugin",
8841
            "classnamemanager",
8842
            "datatype-date",
8843
            "node"
8844
        ],
8845
        "skinnable": true
8846
    },
8847
    "charts": {
8848
        "use": [
8849
            "charts-base"
8850
        ]
8851
    },
8852
    "charts-base": {
8853
        "requires": [
8854
            "dom",
8855
            "event-mouseenter",
8856
            "event-touch",
8857
            "graphics-group",
8858
            "axes",
8859
            "series-pie",
8860
            "series-line",
8861
            "series-marker",
8862
            "series-area",
8863
            "series-spline",
8864
            "series-column",
8865
            "series-bar",
8866
            "series-areaspline",
8867
            "series-combo",
8868
            "series-combospline",
8869
            "series-line-stacked",
8870
            "series-marker-stacked",
8871
            "series-area-stacked",
8872
            "series-spline-stacked",
8873
            "series-column-stacked",
8874
            "series-bar-stacked",
8875
            "series-areaspline-stacked",
8876
            "series-combo-stacked",
8877
            "series-combospline-stacked"
8878
        ]
8879
    },
8880
    "charts-legend": {
8881
        "requires": [
8882
            "charts-base"
8883
        ]
8884
    },
8885
    "classnamemanager": {
8886
        "requires": [
8887
            "yui-base"
8888
        ]
8889
    },
8890
    "clickable-rail": {
8891
        "requires": [
8892
            "slider-base"
8893
        ]
8894
    },
8895
    "collection": {
8896
        "use": [
8897
            "array-extras",
8898
            "arraylist",
8899
            "arraylist-add",
8900
            "arraylist-filter",
8901
            "array-invoke"
8902
        ]
8903
    },
8904
    "color": {
8905
        "use": [
8906
            "color-base",
8907
            "color-hsl",
8908
            "color-harmony"
8909
        ]
8910
    },
8911
    "color-base": {
8912
        "requires": [
8913
            "yui-base"
8914
        ]
8915
    },
8916
    "color-harmony": {
8917
        "requires": [
8918
            "color-hsl"
8919
        ]
8920
    },
8921
    "color-hsl": {
8922
        "requires": [
8923
            "color-base"
8924
        ]
8925
    },
8926
    "color-hsv": {
8927
        "requires": [
8928
            "color-base"
8929
        ]
8930
    },
8931
    "console": {
8932
        "lang": [
8933
            "en",
8934
            "es",
8935
            "hu",
8936
            "it",
8937
            "ja"
8938
        ],
8939
        "requires": [
8940
            "yui-log",
8941
            "widget"
8942
        ],
8943
        "skinnable": true
8944
    },
8945
    "console-filters": {
8946
        "requires": [
8947
            "plugin",
8948
            "console"
8949
        ],
8950
        "skinnable": true
8951
    },
8952
    "content-editable": {
8953
        "requires": [
8954
            "node-base",
8955
            "editor-selection",
8956
            "stylesheet",
8957
            "plugin"
8958
        ]
8959
    },
8960
    "controller": {
8961
        "use": [
8962
            "router"
8963
        ]
8964
    },
8965
    "cookie": {
8966
        "requires": [
8967
            "yui-base"
8968
        ]
8969
    },
8970
    "createlink-base": {
8971
        "requires": [
8972
            "editor-base"
8973
        ]
8974
    },
8975
    "cssbase": {
8976
        "after": [
8977
            "cssreset",
8978
            "cssfonts",
8979
            "cssgrids",
8980
            "cssreset-context",
8981
            "cssfonts-context",
8982
            "cssgrids-context"
8983
        ],
8984
        "type": "css"
8985
    },
8986
    "cssbase-context": {
8987
        "after": [
8988
            "cssreset",
8989
            "cssfonts",
8990
            "cssgrids",
8991
            "cssreset-context",
8992
            "cssfonts-context",
8993
            "cssgrids-context"
8994
        ],
8995
        "type": "css"
8996
    },
8997
    "cssbutton": {
8998
        "type": "css"
8999
    },
9000
    "cssfonts": {
9001
        "type": "css"
9002
    },
9003
    "cssfonts-context": {
9004
        "type": "css"
9005
    },
9006
    "cssgrids": {
9007
        "optional": [
9008
            "cssnormalize"
9009
        ],
9010
        "type": "css"
9011
    },
9012
    "cssgrids-base": {
9013
        "optional": [
9014
            "cssnormalize"
9015
        ],
9016
        "type": "css"
9017
    },
9018
    "cssgrids-responsive": {
9019
        "optional": [
9020
            "cssnormalize"
9021
        ],
9022
        "requires": [
9023
            "cssgrids",
9024
            "cssgrids-responsive-base"
9025
        ],
9026
        "type": "css"
9027
    },
9028
    "cssgrids-units": {
9029
        "optional": [
9030
            "cssnormalize"
9031
        ],
9032
        "requires": [
9033
            "cssgrids-base"
9034
        ],
9035
        "type": "css"
9036
    },
9037
    "cssnormalize": {
9038
        "type": "css"
9039
    },
9040
    "cssnormalize-context": {
9041
        "type": "css"
9042
    },
9043
    "cssreset": {
9044
        "type": "css"
9045
    },
9046
    "cssreset-context": {
9047
        "type": "css"
9048
    },
9049
    "dataschema": {
9050
        "use": [
9051
            "dataschema-base",
9052
            "dataschema-json",
9053
            "dataschema-xml",
9054
            "dataschema-array",
9055
            "dataschema-text"
9056
        ]
9057
    },
9058
    "dataschema-array": {
9059
        "requires": [
9060
            "dataschema-base"
9061
        ]
9062
    },
9063
    "dataschema-base": {
9064
        "requires": [
9065
            "base"
9066
        ]
9067
    },
9068
    "dataschema-json": {
9069
        "requires": [
9070
            "dataschema-base",
9071
            "json"
9072
        ]
9073
    },
9074
    "dataschema-text": {
9075
        "requires": [
9076
            "dataschema-base"
9077
        ]
9078
    },
9079
    "dataschema-xml": {
9080
        "requires": [
9081
            "dataschema-base"
9082
        ]
9083
    },
9084
    "datasource": {
9085
        "use": [
9086
            "datasource-local",
9087
            "datasource-io",
9088
            "datasource-get",
9089
            "datasource-function",
9090
            "datasource-cache",
9091
            "datasource-jsonschema",
9092
            "datasource-xmlschema",
9093
            "datasource-arrayschema",
9094
            "datasource-textschema",
9095
            "datasource-polling"
9096
        ]
9097
    },
9098
    "datasource-arrayschema": {
9099
        "requires": [
9100
            "datasource-local",
9101
            "plugin",
9102
            "dataschema-array"
9103
        ]
9104
    },
9105
    "datasource-cache": {
9106
        "requires": [
9107
            "datasource-local",
9108
            "plugin",
9109
            "cache-base"
9110
        ]
9111
    },
9112
    "datasource-function": {
9113
        "requires": [
9114
            "datasource-local"
9115
        ]
9116
    },
9117
    "datasource-get": {
9118
        "requires": [
9119
            "datasource-local",
9120
            "get"
9121
        ]
9122
    },
9123
    "datasource-io": {
9124
        "requires": [
9125
            "datasource-local",
9126
            "io-base"
9127
        ]
9128
    },
9129
    "datasource-jsonschema": {
9130
        "requires": [
9131
            "datasource-local",
9132
            "plugin",
9133
            "dataschema-json"
9134
        ]
9135
    },
9136
    "datasource-local": {
9137
        "requires": [
9138
            "base"
9139
        ]
9140
    },
9141
    "datasource-polling": {
9142
        "requires": [
9143
            "datasource-local"
9144
        ]
9145
    },
9146
    "datasource-textschema": {
9147
        "requires": [
9148
            "datasource-local",
9149
            "plugin",
9150
            "dataschema-text"
9151
        ]
9152
    },
9153
    "datasource-xmlschema": {
9154
        "requires": [
9155
            "datasource-local",
9156
            "plugin",
9157
            "datatype-xml",
9158
            "dataschema-xml"
9159
        ]
9160
    },
9161
    "datatable": {
9162
        "use": [
9163
            "datatable-core",
9164
            "datatable-table",
9165
            "datatable-head",
9166
            "datatable-body",
9167
            "datatable-base",
9168
            "datatable-column-widths",
9169
            "datatable-message",
9170
            "datatable-mutable",
9171
            "datatable-sort",
9172
            "datatable-datasource"
9173
        ]
9174
    },
9175
    "datatable-base": {
9176
        "requires": [
9177
            "datatable-core",
9178
            "datatable-table",
9179
            "datatable-head",
9180
            "datatable-body",
9181
            "base-build",
9182
            "widget"
9183
        ],
9184
        "skinnable": true
9185
    },
9186
    "datatable-body": {
9187
        "requires": [
9188
            "datatable-core",
9189
            "view",
9190
            "classnamemanager"
9191
        ]
9192
    },
9193
    "datatable-column-widths": {
9194
        "requires": [
9195
            "datatable-base"
9196
        ]
9197
    },
9198
    "datatable-core": {
9199
        "requires": [
9200
            "escape",
9201
            "model-list",
9202
            "node-event-delegate"
9203
        ]
9204
    },
9205
    "datatable-datasource": {
9206
        "requires": [
9207
            "datatable-base",
9208
            "plugin",
9209
            "datasource-local"
9210
        ]
9211
    },
9212
    "datatable-foot": {
9213
        "requires": [
9214
            "datatable-core",
9215
            "view"
9216
        ]
9217
    },
9218
    "datatable-formatters": {
9219
        "requires": [
9220
            "datatable-body",
9221
            "datatype-number-format",
9222
            "datatype-date-format",
9223
            "escape"
9224
        ]
9225
    },
9226
    "datatable-head": {
9227
        "requires": [
9228
            "datatable-core",
9229
            "view",
9230
            "classnamemanager"
9231
        ]
9232
    },
9233
    "datatable-highlight": {
9234
        "requires": [
9235
            "datatable-base",
9236
            "event-hover"
9237
        ],
9238
        "skinnable": true
9239
    },
9240
    "datatable-keynav": {
9241
        "requires": [
9242
            "datatable-base"
9243
        ]
9244
    },
9245
    "datatable-message": {
9246
        "lang": [
9247
            "en",
9248
            "fr",
9249
            "es",
9250
            "hu",
9251
            "it"
9252
        ],
9253
        "requires": [
9254
            "datatable-base"
9255
        ],
9256
        "skinnable": true
9257
    },
9258
    "datatable-mutable": {
9259
        "requires": [
9260
            "datatable-base"
9261
        ]
9262
    },
9263
    "datatable-paginator": {
9264
        "lang": [
9265
            "en",
9266
            "fr"
9267
        ],
9268
        "requires": [
9269
            "model",
9270
            "view",
9271
            "paginator-core",
9272
            "datatable-foot",
9273
            "datatable-paginator-templates"
9274
        ],
9275
        "skinnable": true
9276
    },
9277
    "datatable-paginator-templates": {
9278
        "requires": [
9279
            "template"
9280
        ]
9281
    },
9282
    "datatable-scroll": {
9283
        "requires": [
9284
            "datatable-base",
9285
            "datatable-column-widths",
9286
            "dom-screen"
9287
        ],
9288
        "skinnable": true
9289
    },
9290
    "datatable-sort": {
9291
        "lang": [
9292
            "en",
9293
            "fr",
9294
            "es",
9295
            "hu"
9296
        ],
9297
        "requires": [
9298
            "datatable-base"
9299
        ],
9300
        "skinnable": true
9301
    },
9302
    "datatable-table": {
9303
        "requires": [
9304
            "datatable-core",
9305
            "datatable-head",
9306
            "datatable-body",
9307
            "view",
9308
            "classnamemanager"
9309
        ]
9310
    },
9311
    "datatype": {
9312
        "use": [
9313
            "datatype-date",
9314
            "datatype-number",
9315
            "datatype-xml"
9316
        ]
9317
    },
9318
    "datatype-date": {
9319
        "use": [
9320
            "datatype-date-parse",
9321
            "datatype-date-format",
9322
            "datatype-date-math"
9323
        ]
9324
    },
9325
    "datatype-date-format": {
9326
        "lang": [
9327
            "ar",
9328
            "ar-JO",
9329
            "ca",
9330
            "ca-ES",
9331
            "da",
9332
            "da-DK",
9333
            "de",
9334
            "de-AT",
9335
            "de-DE",
9336
            "el",
9337
            "el-GR",
9338
            "en",
9339
            "en-AU",
9340
            "en-CA",
9341
            "en-GB",
9342
            "en-IE",
9343
            "en-IN",
9344
            "en-JO",
9345
            "en-MY",
9346
            "en-NZ",
9347
            "en-PH",
9348
            "en-SG",
9349
            "en-US",
9350
            "es",
9351
            "es-AR",
9352
            "es-BO",
9353
            "es-CL",
9354
            "es-CO",
9355
            "es-EC",
9356
            "es-ES",
9357
            "es-MX",
9358
            "es-PE",
9359
            "es-PY",
9360
            "es-US",
9361
            "es-UY",
9362
            "es-VE",
9363
            "fi",
9364
            "fi-FI",
9365
            "fr",
9366
            "fr-BE",
9367
            "fr-CA",
9368
            "fr-FR",
9369
            "hi",
9370
            "hi-IN",
9371
            "hu",
9372
            "id",
9373
            "id-ID",
9374
            "it",
9375
            "it-IT",
9376
            "ja",
9377
            "ja-JP",
9378
            "ko",
9379
            "ko-KR",
9380
            "ms",
9381
            "ms-MY",
9382
            "nb",
9383
            "nb-NO",
9384
            "nl",
9385
            "nl-BE",
9386
            "nl-NL",
9387
            "pl",
9388
            "pl-PL",
9389
            "pt",
9390
            "pt-BR",
9391
            "ro",
9392
            "ro-RO",
9393
            "ru",
9394
            "ru-RU",
9395
            "sv",
9396
            "sv-SE",
9397
            "th",
9398
            "th-TH",
9399
            "tr",
9400
            "tr-TR",
9401
            "vi",
9402
            "vi-VN",
9403
            "zh-Hans",
9404
            "zh-Hans-CN",
9405
            "zh-Hant",
9406
            "zh-Hant-HK",
9407
            "zh-Hant-TW"
9408
        ]
9409
    },
9410
    "datatype-date-math": {
9411
        "requires": [
9412
            "yui-base"
9413
        ]
9414
    },
9415
    "datatype-date-parse": {},
9416
    "datatype-number": {
9417
        "use": [
9418
            "datatype-number-parse",
9419
            "datatype-number-format"
9420
        ]
9421
    },
9422
    "datatype-number-format": {},
9423
    "datatype-number-parse": {
9424
        "requires": [
9425
            "escape"
9426
        ]
9427
    },
9428
    "datatype-xml": {
9429
        "use": [
9430
            "datatype-xml-parse",
9431
            "datatype-xml-format"
9432
        ]
9433
    },
9434
    "datatype-xml-format": {},
9435
    "datatype-xml-parse": {},
9436
    "dd": {
9437
        "use": [
9438
            "dd-ddm-base",
9439
            "dd-ddm",
9440
            "dd-ddm-drop",
9441
            "dd-drag",
9442
            "dd-proxy",
9443
            "dd-constrain",
9444
            "dd-drop",
9445
            "dd-scroll",
9446
            "dd-delegate"
9447
        ]
9448
    },
9449
    "dd-constrain": {
9450
        "requires": [
9451
            "dd-drag"
9452
        ]
9453
    },
9454
    "dd-ddm": {
9455
        "requires": [
9456
            "dd-ddm-base",
9457
            "event-resize"
9458
        ]
9459
    },
9460
    "dd-ddm-base": {
9461
        "requires": [
9462
            "node",
9463
            "base",
9464
            "yui-throttle",
9465
            "classnamemanager"
9466
        ]
9467
    },
9468
    "dd-ddm-drop": {
9469
        "requires": [
9470
            "dd-ddm"
9471
        ]
9472
    },
9473
    "dd-delegate": {
9474
        "requires": [
9475
            "dd-drag",
9476
            "dd-drop-plugin",
9477
            "event-mouseenter"
9478
        ]
9479
    },
9480
    "dd-drag": {
9481
        "requires": [
9482
            "dd-ddm-base",
9483
            "selector-css2"
9484
        ]
9485
    },
9486
    "dd-drop": {
9487
        "requires": [
9488
            "dd-drag",
9489
            "dd-ddm-drop"
9490
        ]
9491
    },
9492
    "dd-drop-plugin": {
9493
        "requires": [
9494
            "dd-drop"
9495
        ]
9496
    },
9497
    "dd-gestures": {
9498
        "condition": {
9499
            "name": "dd-gestures",
9500
            "trigger": "dd-drag",
9501
            "ua": "touchEnabled"
9502
        },
9503
        "requires": [
9504
            "dd-drag",
9505
            "event-synthetic",
9506
            "event-gestures"
9507
        ]
9508
    },
9509
    "dd-plugin": {
9510
        "optional": [
9511
            "dd-constrain",
9512
            "dd-proxy"
9513
        ],
9514
        "requires": [
9515
            "dd-drag"
9516
        ]
9517
    },
9518
    "dd-proxy": {
9519
        "requires": [
9520
            "dd-drag"
9521
        ]
9522
    },
9523
    "dd-scroll": {
9524
        "requires": [
9525
            "dd-drag"
9526
        ]
9527
    },
9528
    "dial": {
9529
        "lang": [
9530
            "en",
9531
            "es",
9532
            "hu"
9533
        ],
9534
        "requires": [
9535
            "widget",
9536
            "dd-drag",
9537
            "event-mouseenter",
9538
            "event-move",
9539
            "event-key",
9540
            "transition",
9541
            "intl"
9542
        ],
9543
        "skinnable": true
9544
    },
9545
    "dom": {
9546
        "use": [
9547
            "dom-base",
9548
            "dom-screen",
9549
            "dom-style",
9550
            "selector-native",
9551
            "selector"
9552
        ]
9553
    },
9554
    "dom-base": {
9555
        "requires": [
9556
            "dom-core"
9557
        ]
9558
    },
9559
    "dom-core": {
9560
        "requires": [
9561
            "oop",
9562
            "features"
9563
        ]
9564
    },
9565
    "dom-screen": {
9566
        "requires": [
9567
            "dom-base",
9568
            "dom-style"
9569
        ]
9570
    },
9571
    "dom-style": {
9572
        "requires": [
9573
            "dom-base"
9574
        ]
9575
    },
9576
    "dom-style-ie": {
9577
        "condition": {
9578
            "name": "dom-style-ie",
9579
            "test": function (Y) {
9580
 
9581
    var testFeature = Y.Features.test,
9582
        addFeature = Y.Features.add,
9583
        WINDOW = Y.config.win,
9584
        DOCUMENT = Y.config.doc,
9585
        DOCUMENT_ELEMENT = 'documentElement',
9586
        ret = false;
9587
 
9588
    addFeature('style', 'computedStyle', {
9589
        test: function() {
9590
            return WINDOW && 'getComputedStyle' in WINDOW;
9591
        }
9592
    });
9593
 
9594
    addFeature('style', 'opacity', {
9595
        test: function() {
9596
            return DOCUMENT && 'opacity' in DOCUMENT[DOCUMENT_ELEMENT].style;
9597
        }
9598
    });
9599
 
9600
    ret =  (!testFeature('style', 'opacity') &&
9601
            !testFeature('style', 'computedStyle'));
9602
 
9603
    return ret;
9604
},
9605
            "trigger": "dom-style"
9606
        },
9607
        "requires": [
9608
            "dom-style",
9609
            "color-base"
9610
        ]
9611
    },
9612
    "dump": {
9613
        "requires": [
9614
            "yui-base"
9615
        ]
9616
    },
9617
    "editor": {
9618
        "use": [
9619
            "frame",
9620
            "editor-selection",
9621
            "exec-command",
9622
            "editor-base",
9623
            "editor-para",
9624
            "editor-br",
9625
            "editor-bidi",
9626
            "editor-tab",
9627
            "createlink-base"
9628
        ]
9629
    },
9630
    "editor-base": {
9631
        "requires": [
9632
            "base",
9633
            "frame",
9634
            "node",
9635
            "exec-command",
9636
            "editor-selection"
9637
        ]
9638
    },
9639
    "editor-bidi": {
9640
        "requires": [
9641
            "editor-base"
9642
        ]
9643
    },
9644
    "editor-br": {
9645
        "requires": [
9646
            "editor-base"
9647
        ]
9648
    },
9649
    "editor-inline": {
9650
        "requires": [
9651
            "editor-base",
9652
            "content-editable"
9653
        ]
9654
    },
9655
    "editor-lists": {
9656
        "requires": [
9657
            "editor-base"
9658
        ]
9659
    },
9660
    "editor-para": {
9661
        "requires": [
9662
            "editor-para-base"
9663
        ]
9664
    },
9665
    "editor-para-base": {
9666
        "requires": [
9667
            "editor-base"
9668
        ]
9669
    },
9670
    "editor-para-ie": {
9671
        "condition": {
9672
            "name": "editor-para-ie",
9673
            "trigger": "editor-para",
9674
            "ua": "ie",
9675
            "when": "instead"
9676
        },
9677
        "requires": [
9678
            "editor-para-base"
9679
        ]
9680
    },
9681
    "editor-selection": {
9682
        "requires": [
9683
            "node"
9684
        ]
9685
    },
9686
    "editor-tab": {
9687
        "requires": [
9688
            "editor-base"
9689
        ]
9690
    },
9691
    "escape": {
9692
        "requires": [
9693
            "yui-base"
9694
        ]
9695
    },
9696
    "event": {
9697
        "after": [
9698
            "node-base"
9699
        ],
9700
        "use": [
9701
            "event-base",
9702
            "event-delegate",
9703
            "event-synthetic",
9704
            "event-mousewheel",
9705
            "event-mouseenter",
9706
            "event-key",
9707
            "event-focus",
9708
            "event-resize",
9709
            "event-hover",
9710
            "event-outside",
9711
            "event-touch",
9712
            "event-move",
9713
            "event-flick",
9714
            "event-valuechange",
9715
            "event-tap"
9716
        ]
9717
    },
9718
    "event-base": {
9719
        "after": [
9720
            "node-base"
9721
        ],
9722
        "requires": [
9723
            "event-custom-base"
9724
        ]
9725
    },
9726
    "event-base-ie": {
9727
        "after": [
9728
            "event-base"
9729
        ],
9730
        "condition": {
9731
            "name": "event-base-ie",
9732
            "test": function(Y) {
9733
    var imp = Y.config.doc && Y.config.doc.implementation;
9734
    return (imp && (!imp.hasFeature('Events', '2.0')));
9735
},
9736
            "trigger": "node-base"
9737
        },
9738
        "requires": [
9739
            "node-base"
9740
        ]
9741
    },
9742
    "event-contextmenu": {
9743
        "requires": [
9744
            "event-synthetic",
9745
            "dom-screen"
9746
        ]
9747
    },
9748
    "event-custom": {
9749
        "use": [
9750
            "event-custom-base",
9751
            "event-custom-complex"
9752
        ]
9753
    },
9754
    "event-custom-base": {
9755
        "requires": [
9756
            "oop"
9757
        ]
9758
    },
9759
    "event-custom-complex": {
9760
        "requires": [
9761
            "event-custom-base"
9762
        ]
9763
    },
9764
    "event-delegate": {
9765
        "requires": [
9766
            "node-base"
9767
        ]
9768
    },
9769
    "event-flick": {
9770
        "requires": [
9771
            "node-base",
9772
            "event-touch",
9773
            "event-synthetic"
9774
        ]
9775
    },
9776
    "event-focus": {
9777
        "requires": [
9778
            "event-synthetic"
9779
        ]
9780
    },
9781
    "event-gestures": {
9782
        "use": [
9783
            "event-flick",
9784
            "event-move"
9785
        ]
9786
    },
9787
    "event-hover": {
9788
        "requires": [
9789
            "event-mouseenter"
9790
        ]
9791
    },
9792
    "event-key": {
9793
        "requires": [
9794
            "event-synthetic"
9795
        ]
9796
    },
9797
    "event-mouseenter": {
9798
        "requires": [
9799
            "event-synthetic"
9800
        ]
9801
    },
9802
    "event-mousewheel": {
9803
        "requires": [
9804
            "node-base"
9805
        ]
9806
    },
9807
    "event-move": {
9808
        "requires": [
9809
            "node-base",
9810
            "event-touch",
9811
            "event-synthetic"
9812
        ]
9813
    },
9814
    "event-outside": {
9815
        "requires": [
9816
            "event-synthetic"
9817
        ]
9818
    },
9819
    "event-resize": {
9820
        "requires": [
9821
            "node-base",
9822
            "event-synthetic"
9823
        ]
9824
    },
9825
    "event-simulate": {
9826
        "requires": [
9827
            "event-base"
9828
        ]
9829
    },
9830
    "event-synthetic": {
9831
        "requires": [
9832
            "node-base",
9833
            "event-custom-complex"
9834
        ]
9835
    },
9836
    "event-tap": {
9837
        "requires": [
9838
            "node-base",
9839
            "event-base",
9840
            "event-touch",
9841
            "event-synthetic"
9842
        ]
9843
    },
9844
    "event-touch": {
9845
        "requires": [
9846
            "node-base"
9847
        ]
9848
    },
9849
    "event-valuechange": {
9850
        "requires": [
9851
            "event-focus",
9852
            "event-synthetic"
9853
        ]
9854
    },
9855
    "exec-command": {
9856
        "requires": [
9857
            "frame"
9858
        ]
9859
    },
9860
    "features": {
9861
        "requires": [
9862
            "yui-base"
9863
        ]
9864
    },
9865
    "file": {
9866
        "requires": [
9867
            "file-flash",
9868
            "file-html5"
9869
        ]
9870
    },
9871
    "file-flash": {
9872
        "requires": [
9873
            "base"
9874
        ]
9875
    },
9876
    "file-html5": {
9877
        "requires": [
9878
            "base"
9879
        ]
9880
    },
9881
    "frame": {
9882
        "requires": [
9883
            "base",
9884
            "node",
9885
            "plugin",
9886
            "selector-css3",
9887
            "yui-throttle"
9888
        ]
9889
    },
9890
    "gesture-simulate": {
9891
        "requires": [
9892
            "async-queue",
9893
            "event-simulate",
9894
            "node-screen"
9895
        ]
9896
    },
9897
    "get": {
9898
        "requires": [
9899
            "yui-base"
9900
        ]
9901
    },
9902
    "graphics": {
9903
        "requires": [
9904
            "node",
9905
            "event-custom",
9906
            "pluginhost",
9907
            "matrix",
9908
            "classnamemanager"
9909
        ]
9910
    },
9911
    "graphics-canvas": {
9912
        "condition": {
9913
            "name": "graphics-canvas",
9914
            "test": function(Y) {
9915
    var DOCUMENT = Y.config.doc,
9916
        useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas",
9917
		canvas = DOCUMENT && DOCUMENT.createElement("canvas"),
9918
        svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
9919
    return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d"));
9920
},
9921
            "trigger": "graphics"
9922
        },
9923
        "requires": [
9924
            "graphics",
9925
            "color-base"
9926
        ]
9927
    },
9928
    "graphics-canvas-default": {
9929
        "condition": {
9930
            "name": "graphics-canvas-default",
9931
            "test": function(Y) {
9932
    var DOCUMENT = Y.config.doc,
9933
        useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas",
9934
		canvas = DOCUMENT && DOCUMENT.createElement("canvas"),
9935
        svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
9936
    return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d"));
9937
},
9938
            "trigger": "graphics"
9939
        }
9940
    },
9941
    "graphics-group": {
9942
        "requires": [
9943
            "graphics"
9944
        ]
9945
    },
9946
    "graphics-svg": {
9947
        "condition": {
9948
            "name": "graphics-svg",
9949
            "test": function(Y) {
9950
    var DOCUMENT = Y.config.doc,
9951
        useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas",
9952
		canvas = DOCUMENT && DOCUMENT.createElement("canvas"),
9953
        svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
9954
 
9955
    return svg && (useSVG || !canvas);
9956
},
9957
            "trigger": "graphics"
9958
        },
9959
        "requires": [
9960
            "graphics"
9961
        ]
9962
    },
9963
    "graphics-svg-default": {
9964
        "condition": {
9965
            "name": "graphics-svg-default",
9966
            "test": function(Y) {
9967
    var DOCUMENT = Y.config.doc,
9968
        useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas",
9969
		canvas = DOCUMENT && DOCUMENT.createElement("canvas"),
9970
        svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
9971
 
9972
    return svg && (useSVG || !canvas);
9973
},
9974
            "trigger": "graphics"
9975
        }
9976
    },
9977
    "graphics-vml": {
9978
        "condition": {
9979
            "name": "graphics-vml",
9980
            "test": function(Y) {
9981
    var DOCUMENT = Y.config.doc,
9982
		canvas = DOCUMENT && DOCUMENT.createElement("canvas");
9983
    return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d")));
9984
},
9985
            "trigger": "graphics"
9986
        },
9987
        "requires": [
9988
            "graphics",
9989
            "color-base"
9990
        ]
9991
    },
9992
    "graphics-vml-default": {
9993
        "condition": {
9994
            "name": "graphics-vml-default",
9995
            "test": function(Y) {
9996
    var DOCUMENT = Y.config.doc,
9997
		canvas = DOCUMENT && DOCUMENT.createElement("canvas");
9998
    return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d")));
9999
},
10000
            "trigger": "graphics"
10001
        }
10002
    },
10003
    "handlebars": {
10004
        "use": [
10005
            "handlebars-compiler"
10006
        ]
10007
    },
10008
    "handlebars-base": {
10009
        "requires": []
10010
    },
10011
    "handlebars-compiler": {
10012
        "requires": [
10013
            "handlebars-base"
10014
        ]
10015
    },
10016
    "highlight": {
10017
        "use": [
10018
            "highlight-base",
10019
            "highlight-accentfold"
10020
        ]
10021
    },
10022
    "highlight-accentfold": {
10023
        "requires": [
10024
            "highlight-base",
10025
            "text-accentfold"
10026
        ]
10027
    },
10028
    "highlight-base": {
10029
        "requires": [
10030
            "array-extras",
10031
            "classnamemanager",
10032
            "escape",
10033
            "text-wordbreak"
10034
        ]
10035
    },
10036
    "history": {
10037
        "use": [
10038
            "history-base",
10039
            "history-hash",
10040
            "history-html5"
10041
        ]
10042
    },
10043
    "history-base": {
10044
        "requires": [
10045
            "event-custom-complex"
10046
        ]
10047
    },
10048
    "history-hash": {
10049
        "after": [
10050
            "history-html5"
10051
        ],
10052
        "requires": [
10053
            "event-synthetic",
10054
            "history-base",
10055
            "yui-later"
10056
        ]
10057
    },
10058
    "history-hash-ie": {
10059
        "condition": {
10060
            "name": "history-hash-ie",
10061
            "test": function (Y) {
10062
    var docMode = Y.config.doc && Y.config.doc.documentMode;
10063
 
10064
    return Y.UA.ie && (!('onhashchange' in Y.config.win) ||
10065
            !docMode || docMode < 8);
10066
},
10067
            "trigger": "history-hash"
10068
        },
10069
        "requires": [
10070
            "history-hash",
10071
            "node-base"
10072
        ]
10073
    },
10074
    "history-html5": {
10075
        "optional": [
10076
            "json"
10077
        ],
10078
        "requires": [
10079
            "event-base",
10080
            "history-base",
10081
            "node-base"
10082
        ]
10083
    },
10084
    "imageloader": {
10085
        "requires": [
10086
            "base-base",
10087
            "node-style",
10088
            "node-screen"
10089
        ]
10090
    },
10091
    "intl": {
10092
        "requires": [
10093
            "intl-base",
10094
            "event-custom"
10095
        ]
10096
    },
10097
    "intl-base": {
10098
        "requires": [
10099
            "yui-base"
10100
        ]
10101
    },
10102
    "io": {
10103
        "use": [
10104
            "io-base",
10105
            "io-xdr",
10106
            "io-form",
10107
            "io-upload-iframe",
10108
            "io-queue"
10109
        ]
10110
    },
10111
    "io-base": {
10112
        "requires": [
10113
            "event-custom-base",
10114
            "querystring-stringify-simple"
10115
        ]
10116
    },
10117
    "io-form": {
10118
        "requires": [
10119
            "io-base",
10120
            "node-base"
10121
        ]
10122
    },
10123
    "io-nodejs": {
10124
        "condition": {
10125
            "name": "io-nodejs",
10126
            "trigger": "io-base",
10127
            "ua": "nodejs"
10128
        },
10129
        "requires": [
10130
            "io-base"
10131
        ]
10132
    },
10133
    "io-queue": {
10134
        "requires": [
10135
            "io-base",
10136
            "queue-promote"
10137
        ]
10138
    },
10139
    "io-upload-iframe": {
10140
        "requires": [
10141
            "io-base",
10142
            "node-base"
10143
        ]
10144
    },
10145
    "io-xdr": {
10146
        "requires": [
10147
            "io-base",
10148
            "datatype-xml-parse"
10149
        ]
10150
    },
10151
    "json": {
10152
        "use": [
10153
            "json-parse",
10154
            "json-stringify"
10155
        ]
10156
    },
10157
    "json-parse": {
10158
        "requires": [
10159
            "yui-base"
10160
        ]
10161
    },
10162
    "json-parse-shim": {
10163
        "condition": {
10164
            "name": "json-parse-shim",
10165
            "test": function (Y) {
10166
    var _JSON = Y.config.global.JSON,
10167
        Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON,
10168
        nativeSupport = Y.config.useNativeJSONParse !== false && !!Native;
10169
 
10170
    function workingNative( k, v ) {
10171
        return k === "ok" ? true : v;
10172
    }
10173
 
10174
    // Double check basic functionality.  This is mainly to catch early broken
10175
    // implementations of the JSON API in Firefox 3.1 beta1 and beta2
10176
    if ( nativeSupport ) {
10177
        try {
10178
            nativeSupport = ( Native.parse( '{"ok":false}', workingNative ) ).ok;
10179
        }
10180
        catch ( e ) {
10181
            nativeSupport = false;
10182
        }
10183
    }
10184
 
10185
    return !nativeSupport;
10186
},
10187
            "trigger": "json-parse"
10188
        },
10189
        "requires": [
10190
            "json-parse"
10191
        ]
10192
    },
10193
    "json-stringify": {
10194
        "requires": [
10195
            "yui-base"
10196
        ]
10197
    },
10198
    "json-stringify-shim": {
10199
        "condition": {
10200
            "name": "json-stringify-shim",
10201
            "test": function (Y) {
10202
    var _JSON = Y.config.global.JSON,
10203
        Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON,
10204
        nativeSupport = Y.config.useNativeJSONStringify !== false && !!Native;
10205
 
10206
    // Double check basic native functionality.  This is primarily to catch broken
10207
    // early JSON API implementations in Firefox 3.1 beta1 and beta2.
10208
    if ( nativeSupport ) {
10209
        try {
10210
            nativeSupport = ( '0' === Native.stringify(0) );
10211
        } catch ( e ) {
10212
            nativeSupport = false;
10213
        }
10214
    }
10215
 
10216
 
10217
    return !nativeSupport;
10218
},
10219
            "trigger": "json-stringify"
10220
        },
10221
        "requires": [
10222
            "json-stringify"
10223
        ]
10224
    },
10225
    "jsonp": {
10226
        "requires": [
10227
            "get",
10228
            "oop"
10229
        ]
10230
    },
10231
    "jsonp-url": {
10232
        "requires": [
10233
            "jsonp"
10234
        ]
10235
    },
10236
    "lazy-model-list": {
10237
        "requires": [
10238
            "model-list"
10239
        ]
10240
    },
10241
    "loader": {
10242
        "use": [
10243
            "loader-base",
10244
            "loader-rollup",
10245
            "loader-yui3"
10246
        ]
10247
    },
10248
    "loader-base": {
10249
        "requires": [
10250
            "get",
10251
            "features"
10252
        ]
10253
    },
10254
    "loader-pathogen-combohandler": {},
10255
    "loader-pathogen-encoder": {
10256
        "use": [
10257
            "loader-base",
10258
            "loader-rollup",
10259
            "loader-yui3",
10260
            "loader-pathogen-combohandler"
10261
        ]
10262
    },
10263
    "loader-rollup": {
10264
        "requires": [
10265
            "loader-base"
10266
        ]
10267
    },
10268
    "loader-yui3": {
10269
        "requires": [
10270
            "loader-base"
10271
        ]
10272
    },
10273
    "matrix": {
10274
        "requires": [
10275
            "yui-base"
10276
        ]
10277
    },
10278
    "model": {
10279
        "requires": [
10280
            "base-build",
10281
            "escape",
10282
            "json-parse"
10283
        ]
10284
    },
10285
    "model-list": {
10286
        "requires": [
10287
            "array-extras",
10288
            "array-invoke",
10289
            "arraylist",
10290
            "base-build",
10291
            "escape",
10292
            "json-parse",
10293
            "model"
10294
        ]
10295
    },
10296
    "model-sync-local": {
10297
        "requires": [
10298
            "model",
10299
            "json-stringify"
10300
        ]
10301
    },
10302
    "model-sync-rest": {
10303
        "requires": [
10304
            "model",
10305
            "io-base",
10306
            "json-stringify"
10307
        ]
10308
    },
10309
    "node": {
10310
        "use": [
10311
            "node-base",
10312
            "node-event-delegate",
10313
            "node-pluginhost",
10314
            "node-screen",
10315
            "node-style"
10316
        ]
10317
    },
10318
    "node-base": {
10319
        "requires": [
10320
            "event-base",
10321
            "node-core",
10322
            "dom-base",
10323
            "dom-style"
10324
        ]
10325
    },
10326
    "node-core": {
10327
        "requires": [
10328
            "dom-core",
10329
            "selector"
10330
        ]
10331
    },
10332
    "node-event-delegate": {
10333
        "requires": [
10334
            "node-base",
10335
            "event-delegate"
10336
        ]
10337
    },
10338
    "node-event-html5": {
10339
        "requires": [
10340
            "node-base"
10341
        ]
10342
    },
10343
    "node-event-simulate": {
10344
        "requires": [
10345
            "node-base",
10346
            "event-simulate",
10347
            "gesture-simulate"
10348
        ]
10349
    },
10350
    "node-flick": {
10351
        "requires": [
10352
            "classnamemanager",
10353
            "transition",
10354
            "event-flick",
10355
            "plugin"
10356
        ],
10357
        "skinnable": true
10358
    },
10359
    "node-focusmanager": {
10360
        "requires": [
10361
            "attribute",
10362
            "node",
10363
            "plugin",
10364
            "node-event-simulate",
10365
            "event-key",
10366
            "event-focus"
10367
        ]
10368
    },
10369
    "node-load": {
10370
        "requires": [
10371
            "node-base",
10372
            "io-base"
10373
        ]
10374
    },
10375
    "node-menunav": {
10376
        "requires": [
10377
            "node",
10378
            "classnamemanager",
10379
            "plugin",
10380
            "node-focusmanager"
10381
        ],
10382
        "skinnable": true
10383
    },
10384
    "node-pluginhost": {
10385
        "requires": [
10386
            "node-base",
10387
            "pluginhost"
10388
        ]
10389
    },
10390
    "node-screen": {
10391
        "requires": [
10392
            "dom-screen",
10393
            "node-base"
10394
        ]
10395
    },
10396
    "node-scroll-info": {
10397
        "requires": [
10398
            "array-extras",
10399
            "base-build",
10400
            "event-resize",
10401
            "node-pluginhost",
10402
            "plugin",
10403
            "selector"
10404
        ]
10405
    },
10406
    "node-style": {
10407
        "requires": [
10408
            "dom-style",
10409
            "node-base"
10410
        ]
10411
    },
10412
    "oop": {
10413
        "requires": [
10414
            "yui-base"
10415
        ]
10416
    },
10417
    "overlay": {
10418
        "requires": [
10419
            "widget",
10420
            "widget-stdmod",
10421
            "widget-position",
10422
            "widget-position-align",
10423
            "widget-stack",
10424
            "widget-position-constrain"
10425
        ],
10426
        "skinnable": true
10427
    },
10428
    "paginator": {
10429
        "requires": [
10430
            "paginator-core"
10431
        ]
10432
    },
10433
    "paginator-core": {
10434
        "requires": [
10435
            "base"
10436
        ]
10437
    },
10438
    "paginator-url": {
10439
        "requires": [
10440
            "paginator"
10441
        ]
10442
    },
10443
    "panel": {
10444
        "requires": [
10445
            "widget",
10446
            "widget-autohide",
10447
            "widget-buttons",
10448
            "widget-modality",
10449
            "widget-position",
10450
            "widget-position-align",
10451
            "widget-position-constrain",
10452
            "widget-stack",
10453
            "widget-stdmod"
10454
        ],
10455
        "skinnable": true
10456
    },
10457
    "parallel": {
10458
        "requires": [
10459
            "yui-base"
10460
        ]
10461
    },
10462
    "pjax": {
10463
        "requires": [
10464
            "pjax-base",
10465
            "pjax-content"
10466
        ]
10467
    },
10468
    "pjax-base": {
10469
        "requires": [
10470
            "classnamemanager",
10471
            "node-event-delegate",
10472
            "router"
10473
        ]
10474
    },
10475
    "pjax-content": {
10476
        "requires": [
10477
            "io-base",
10478
            "node-base",
10479
            "router"
10480
        ]
10481
    },
10482
    "pjax-plugin": {
10483
        "requires": [
10484
            "node-pluginhost",
10485
            "pjax",
10486
            "plugin"
10487
        ]
10488
    },
10489
    "plugin": {
10490
        "requires": [
10491
            "base-base"
10492
        ]
10493
    },
10494
    "pluginhost": {
10495
        "use": [
10496
            "pluginhost-base",
10497
            "pluginhost-config"
10498
        ]
10499
    },
10500
    "pluginhost-base": {
10501
        "requires": [
10502
            "yui-base"
10503
        ]
10504
    },
10505
    "pluginhost-config": {
10506
        "requires": [
10507
            "pluginhost-base"
10508
        ]
10509
    },
10510
    "promise": {
10511
        "requires": [
10512
            "timers"
10513
        ]
10514
    },
10515
    "querystring": {
10516
        "use": [
10517
            "querystring-parse",
10518
            "querystring-stringify"
10519
        ]
10520
    },
10521
    "querystring-parse": {
10522
        "requires": [
10523
            "yui-base",
10524
            "array-extras"
10525
        ]
10526
    },
10527
    "querystring-parse-simple": {
10528
        "requires": [
10529
            "yui-base"
10530
        ]
10531
    },
10532
    "querystring-stringify": {
10533
        "requires": [
10534
            "yui-base"
10535
        ]
10536
    },
10537
    "querystring-stringify-simple": {
10538
        "requires": [
10539
            "yui-base"
10540
        ]
10541
    },
10542
    "queue-promote": {
10543
        "requires": [
10544
            "yui-base"
10545
        ]
10546
    },
10547
    "range-slider": {
10548
        "requires": [
10549
            "slider-base",
10550
            "slider-value-range",
10551
            "clickable-rail"
10552
        ]
10553
    },
10554
    "recordset": {
10555
        "use": [
10556
            "recordset-base",
10557
            "recordset-sort",
10558
            "recordset-filter",
10559
            "recordset-indexer"
10560
        ]
10561
    },
10562
    "recordset-base": {
10563
        "requires": [
10564
            "base",
10565
            "arraylist"
10566
        ]
10567
    },
10568
    "recordset-filter": {
10569
        "requires": [
10570
            "recordset-base",
10571
            "array-extras",
10572
            "plugin"
10573
        ]
10574
    },
10575
    "recordset-indexer": {
10576
        "requires": [
10577
            "recordset-base",
10578
            "plugin"
10579
        ]
10580
    },
10581
    "recordset-sort": {
10582
        "requires": [
10583
            "arraysort",
10584
            "recordset-base",
10585
            "plugin"
10586
        ]
10587
    },
10588
    "resize": {
10589
        "use": [
10590
            "resize-base",
10591
            "resize-proxy",
10592
            "resize-constrain"
10593
        ]
10594
    },
10595
    "resize-base": {
10596
        "requires": [
10597
            "base",
10598
            "widget",
10599
            "event",
10600
            "oop",
10601
            "dd-drag",
10602
            "dd-delegate",
10603
            "dd-drop"
10604
        ],
10605
        "skinnable": true
10606
    },
10607
    "resize-constrain": {
10608
        "requires": [
10609
            "plugin",
10610
            "resize-base"
10611
        ]
10612
    },
10613
    "resize-plugin": {
10614
        "optional": [
10615
            "resize-constrain"
10616
        ],
10617
        "requires": [
10618
            "resize-base",
10619
            "plugin"
10620
        ]
10621
    },
10622
    "resize-proxy": {
10623
        "requires": [
10624
            "plugin",
10625
            "resize-base"
10626
        ]
10627
    },
10628
    "router": {
10629
        "optional": [
10630
            "querystring-parse"
10631
        ],
10632
        "requires": [
10633
            "array-extras",
10634
            "base-build",
10635
            "history"
10636
        ]
10637
    },
10638
    "scrollview": {
10639
        "requires": [
10640
            "scrollview-base",
10641
            "scrollview-scrollbars"
10642
        ]
10643
    },
10644
    "scrollview-base": {
10645
        "requires": [
10646
            "widget",
10647
            "event-gestures",
10648
            "event-mousewheel",
10649
            "transition"
10650
        ],
10651
        "skinnable": true
10652
    },
10653
    "scrollview-base-ie": {
10654
        "condition": {
10655
            "name": "scrollview-base-ie",
10656
            "trigger": "scrollview-base",
10657
            "ua": "ie"
10658
        },
10659
        "requires": [
10660
            "scrollview-base"
10661
        ]
10662
    },
10663
    "scrollview-list": {
10664
        "requires": [
10665
            "plugin",
10666
            "classnamemanager"
10667
        ],
10668
        "skinnable": true
10669
    },
10670
    "scrollview-paginator": {
10671
        "requires": [
10672
            "plugin",
10673
            "classnamemanager"
10674
        ]
10675
    },
10676
    "scrollview-scrollbars": {
10677
        "requires": [
10678
            "classnamemanager",
10679
            "transition",
10680
            "plugin"
10681
        ],
10682
        "skinnable": true
10683
    },
10684
    "selector": {
10685
        "requires": [
10686
            "selector-native"
10687
        ]
10688
    },
10689
    "selector-css2": {
10690
        "condition": {
10691
            "name": "selector-css2",
10692
            "test": function (Y) {
10693
    var DOCUMENT = Y.config.doc,
10694
        ret = DOCUMENT && !('querySelectorAll' in DOCUMENT);
10695
 
10696
    return ret;
10697
},
10698
            "trigger": "selector"
10699
        },
10700
        "requires": [
10701
            "selector-native"
10702
        ]
10703
    },
10704
    "selector-css3": {
10705
        "requires": [
10706
            "selector-native",
10707
            "selector-css2"
10708
        ]
10709
    },
10710
    "selector-native": {
10711
        "requires": [
10712
            "dom-base"
10713
        ]
10714
    },
10715
    "series-area": {
10716
        "requires": [
10717
            "series-cartesian",
10718
            "series-fill-util"
10719
        ]
10720
    },
10721
    "series-area-stacked": {
10722
        "requires": [
10723
            "series-stacked",
10724
            "series-area"
10725
        ]
10726
    },
10727
    "series-areaspline": {
10728
        "requires": [
10729
            "series-area",
10730
            "series-curve-util"
10731
        ]
10732
    },
10733
    "series-areaspline-stacked": {
10734
        "requires": [
10735
            "series-stacked",
10736
            "series-areaspline"
10737
        ]
10738
    },
10739
    "series-bar": {
10740
        "requires": [
10741
            "series-marker",
10742
            "series-histogram-base"
10743
        ]
10744
    },
10745
    "series-bar-stacked": {
10746
        "requires": [
10747
            "series-stacked",
10748
            "series-bar"
10749
        ]
10750
    },
10751
    "series-base": {
10752
        "requires": [
10753
            "graphics",
10754
            "axis-base"
10755
        ]
10756
    },
10757
    "series-candlestick": {
10758
        "requires": [
10759
            "series-range"
10760
        ]
10761
    },
10762
    "series-cartesian": {
10763
        "requires": [
10764
            "series-base"
10765
        ]
10766
    },
10767
    "series-column": {
10768
        "requires": [
10769
            "series-marker",
10770
            "series-histogram-base"
10771
        ]
10772
    },
10773
    "series-column-stacked": {
10774
        "requires": [
10775
            "series-stacked",
10776
            "series-column"
10777
        ]
10778
    },
10779
    "series-combo": {
10780
        "requires": [
10781
            "series-cartesian",
10782
            "series-line-util",
10783
            "series-plot-util",
10784
            "series-fill-util"
10785
        ]
10786
    },
10787
    "series-combo-stacked": {
10788
        "requires": [
10789
            "series-stacked",
10790
            "series-combo"
10791
        ]
10792
    },
10793
    "series-combospline": {
10794
        "requires": [
10795
            "series-combo",
10796
            "series-curve-util"
10797
        ]
10798
    },
10799
    "series-combospline-stacked": {
10800
        "requires": [
10801
            "series-combo-stacked",
10802
            "series-curve-util"
10803
        ]
10804
    },
10805
    "series-curve-util": {},
10806
    "series-fill-util": {},
10807
    "series-histogram-base": {
10808
        "requires": [
10809
            "series-cartesian",
10810
            "series-plot-util"
10811
        ]
10812
    },
10813
    "series-line": {
10814
        "requires": [
10815
            "series-cartesian",
10816
            "series-line-util"
10817
        ]
10818
    },
10819
    "series-line-stacked": {
10820
        "requires": [
10821
            "series-stacked",
10822
            "series-line"
10823
        ]
10824
    },
10825
    "series-line-util": {},
10826
    "series-marker": {
10827
        "requires": [
10828
            "series-cartesian",
10829
            "series-plot-util"
10830
        ]
10831
    },
10832
    "series-marker-stacked": {
10833
        "requires": [
10834
            "series-stacked",
10835
            "series-marker"
10836
        ]
10837
    },
10838
    "series-ohlc": {
10839
        "requires": [
10840
            "series-range"
10841
        ]
10842
    },
10843
    "series-pie": {
10844
        "requires": [
10845
            "series-base",
10846
            "series-plot-util"
10847
        ]
10848
    },
10849
    "series-plot-util": {},
10850
    "series-range": {
10851
        "requires": [
10852
            "series-cartesian"
10853
        ]
10854
    },
10855
    "series-spline": {
10856
        "requires": [
10857
            "series-line",
10858
            "series-curve-util"
10859
        ]
10860
    },
10861
    "series-spline-stacked": {
10862
        "requires": [
10863
            "series-stacked",
10864
            "series-spline"
10865
        ]
10866
    },
10867
    "series-stacked": {
10868
        "requires": [
10869
            "axis-stacked"
10870
        ]
10871
    },
10872
    "shim-plugin": {
10873
        "requires": [
10874
            "node-style",
10875
            "node-pluginhost"
10876
        ]
10877
    },
10878
    "slider": {
10879
        "use": [
10880
            "slider-base",
10881
            "slider-value-range",
10882
            "clickable-rail",
10883
            "range-slider"
10884
        ]
10885
    },
10886
    "slider-base": {
10887
        "requires": [
10888
            "widget",
10889
            "dd-constrain",
10890
            "event-key"
10891
        ],
10892
        "skinnable": true
10893
    },
10894
    "slider-value-range": {
10895
        "requires": [
10896
            "slider-base"
10897
        ]
10898
    },
10899
    "sortable": {
10900
        "requires": [
10901
            "dd-delegate",
10902
            "dd-drop-plugin",
10903
            "dd-proxy"
10904
        ]
10905
    },
10906
    "sortable-scroll": {
10907
        "requires": [
10908
            "dd-scroll",
10909
            "sortable"
10910
        ]
10911
    },
10912
    "stylesheet": {
10913
        "requires": [
10914
            "yui-base"
10915
        ]
10916
    },
10917
    "substitute": {
10918
        "optional": [
10919
            "dump"
10920
        ],
10921
        "requires": [
10922
            "yui-base"
10923
        ]
10924
    },
10925
    "swf": {
10926
        "requires": [
10927
            "event-custom",
10928
            "node",
10929
            "swfdetect",
10930
            "escape"
10931
        ]
10932
    },
10933
    "swfdetect": {
10934
        "requires": [
10935
            "yui-base"
10936
        ]
10937
    },
10938
    "tabview": {
10939
        "requires": [
10940
            "widget",
10941
            "widget-parent",
10942
            "widget-child",
10943
            "tabview-base",
10944
            "node-pluginhost",
10945
            "node-focusmanager"
10946
        ],
10947
        "skinnable": true
10948
    },
10949
    "tabview-base": {
10950
        "requires": [
10951
            "node-event-delegate",
10952
            "classnamemanager"
10953
        ]
10954
    },
10955
    "tabview-plugin": {
10956
        "requires": [
10957
            "tabview-base"
10958
        ]
10959
    },
10960
    "template": {
10961
        "use": [
10962
            "template-base",
10963
            "template-micro"
10964
        ]
10965
    },
10966
    "template-base": {
10967
        "requires": [
10968
            "yui-base"
10969
        ]
10970
    },
10971
    "template-micro": {
10972
        "requires": [
10973
            "escape"
10974
        ]
10975
    },
10976
    "test": {
10977
        "requires": [
10978
            "event-simulate",
10979
            "event-custom",
10980
            "json-stringify"
10981
        ]
10982
    },
10983
    "test-console": {
10984
        "requires": [
10985
            "console-filters",
10986
            "test",
10987
            "array-extras"
10988
        ],
10989
        "skinnable": true
10990
    },
10991
    "text": {
10992
        "use": [
10993
            "text-accentfold",
10994
            "text-wordbreak"
10995
        ]
10996
    },
10997
    "text-accentfold": {
10998
        "requires": [
10999
            "array-extras",
11000
            "text-data-accentfold"
11001
        ]
11002
    },
11003
    "text-data-accentfold": {
11004
        "requires": [
11005
            "yui-base"
11006
        ]
11007
    },
11008
    "text-data-wordbreak": {
11009
        "requires": [
11010
            "yui-base"
11011
        ]
11012
    },
11013
    "text-wordbreak": {
11014
        "requires": [
11015
            "array-extras",
11016
            "text-data-wordbreak"
11017
        ]
11018
    },
11019
    "timers": {
11020
        "requires": [
11021
            "yui-base"
11022
        ]
11023
    },
11024
    "transition": {
11025
        "requires": [
11026
            "node-style"
11027
        ]
11028
    },
11029
    "transition-timer": {
11030
        "condition": {
11031
            "name": "transition-timer",
11032
            "test": function (Y) {
11033
    var DOCUMENT = Y.config.doc,
11034
        node = (DOCUMENT) ? DOCUMENT.documentElement: null,
11035
        ret = true;
11036
 
11037
    if (node && node.style) {
11038
        ret = !('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style);
11039
    }
11040
 
11041
    return ret;
11042
},
11043
            "trigger": "transition"
11044
        },
11045
        "requires": [
11046
            "transition"
11047
        ]
11048
    },
11049
    "tree": {
11050
        "requires": [
11051
            "base-build",
11052
            "tree-node"
11053
        ]
11054
    },
11055
    "tree-labelable": {
11056
        "requires": [
11057
            "tree"
11058
        ]
11059
    },
11060
    "tree-lazy": {
11061
        "requires": [
11062
            "base-pluginhost",
11063
            "plugin",
11064
            "tree"
11065
        ]
11066
    },
11067
    "tree-node": {},
11068
    "tree-openable": {
11069
        "requires": [
11070
            "tree"
11071
        ]
11072
    },
11073
    "tree-selectable": {
11074
        "requires": [
11075
            "tree"
11076
        ]
11077
    },
11078
    "tree-sortable": {
11079
        "requires": [
11080
            "tree"
11081
        ]
11082
    },
11083
    "uploader": {
11084
        "requires": [
11085
            "uploader-html5",
11086
            "uploader-flash"
11087
        ]
11088
    },
11089
    "uploader-flash": {
11090
        "requires": [
11091
            "swfdetect",
11092
            "escape",
11093
            "widget",
11094
            "base",
11095
            "cssbutton",
11096
            "node",
11097
            "event-custom",
11098
            "uploader-queue"
11099
        ]
11100
    },
11101
    "uploader-html5": {
11102
        "requires": [
11103
            "widget",
11104
            "node-event-simulate",
11105
            "file-html5",
11106
            "uploader-queue"
11107
        ]
11108
    },
11109
    "uploader-queue": {
11110
        "requires": [
11111
            "base"
11112
        ]
11113
    },
11114
    "view": {
11115
        "requires": [
11116
            "base-build",
11117
            "node-event-delegate"
11118
        ]
11119
    },
11120
    "view-node-map": {
11121
        "requires": [
11122
            "view"
11123
        ]
11124
    },
11125
    "widget": {
11126
        "use": [
11127
            "widget-base",
11128
            "widget-htmlparser",
11129
            "widget-skin",
11130
            "widget-uievents"
11131
        ]
11132
    },
11133
    "widget-anim": {
11134
        "requires": [
11135
            "anim-base",
11136
            "plugin",
11137
            "widget"
11138
        ]
11139
    },
11140
    "widget-autohide": {
11141
        "requires": [
11142
            "base-build",
11143
            "event-key",
11144
            "event-outside",
11145
            "widget"
11146
        ]
11147
    },
11148
    "widget-base": {
11149
        "requires": [
11150
            "attribute",
11151
            "base-base",
11152
            "base-pluginhost",
11153
            "classnamemanager",
11154
            "event-focus",
11155
            "node-base",
11156
            "node-style"
11157
        ],
11158
        "skinnable": true
11159
    },
11160
    "widget-base-ie": {
11161
        "condition": {
11162
            "name": "widget-base-ie",
11163
            "trigger": "widget-base",
11164
            "ua": "ie"
11165
        },
11166
        "requires": [
11167
            "widget-base"
11168
        ]
11169
    },
11170
    "widget-buttons": {
11171
        "requires": [
11172
            "button-plugin",
11173
            "cssbutton",
11174
            "widget-stdmod"
11175
        ]
11176
    },
11177
    "widget-child": {
11178
        "requires": [
11179
            "base-build",
11180
            "widget"
11181
        ]
11182
    },
11183
    "widget-htmlparser": {
11184
        "requires": [
11185
            "widget-base"
11186
        ]
11187
    },
11188
    "widget-modality": {
11189
        "requires": [
11190
            "base-build",
11191
            "event-outside",
11192
            "widget"
11193
        ],
11194
        "skinnable": true
11195
    },
11196
    "widget-parent": {
11197
        "requires": [
11198
            "arraylist",
11199
            "base-build",
11200
            "widget"
11201
        ]
11202
    },
11203
    "widget-position": {
11204
        "requires": [
11205
            "base-build",
11206
            "node-screen",
11207
            "widget"
11208
        ]
11209
    },
11210
    "widget-position-align": {
11211
        "requires": [
11212
            "widget-position"
11213
        ]
11214
    },
11215
    "widget-position-constrain": {
11216
        "requires": [
11217
            "widget-position"
11218
        ]
11219
    },
11220
    "widget-skin": {
11221
        "requires": [
11222
            "widget-base"
11223
        ]
11224
    },
11225
    "widget-stack": {
11226
        "requires": [
11227
            "base-build",
11228
            "widget"
11229
        ],
11230
        "skinnable": true
11231
    },
11232
    "widget-stdmod": {
11233
        "requires": [
11234
            "base-build",
11235
            "widget"
11236
        ]
11237
    },
11238
    "widget-uievents": {
11239
        "requires": [
11240
            "node-event-delegate",
11241
            "widget-base"
11242
        ]
11243
    },
11244
    "yql": {
11245
        "requires": [
11246
            "oop"
11247
        ]
11248
    },
11249
    "yql-jsonp": {
11250
        "condition": {
11251
            "name": "yql-jsonp",
11252
            "test": function (Y) {
11253
    /* Only load the JSONP module when not in nodejs or winjs
11254
    TODO Make the winjs module a CORS module
11255
    */
11256
    return (!Y.UA.nodejs && !Y.UA.winjs);
11257
},
11258
            "trigger": "yql"
11259
        },
11260
        "requires": [
11261
            "yql",
11262
            "jsonp",
11263
            "jsonp-url"
11264
        ]
11265
    },
11266
    "yql-nodejs": {
11267
        "condition": {
11268
            "name": "yql-nodejs",
11269
            "trigger": "yql",
11270
            "ua": "nodejs"
11271
        },
11272
        "requires": [
11273
            "yql"
11274
        ]
11275
    },
11276
    "yql-winjs": {
11277
        "condition": {
11278
            "name": "yql-winjs",
11279
            "trigger": "yql",
11280
            "ua": "winjs"
11281
        },
11282
        "requires": [
11283
            "yql"
11284
        ]
11285
    },
11286
    "yui": {},
11287
    "yui-base": {},
11288
    "yui-later": {
11289
        "requires": [
11290
            "yui-base"
11291
        ]
11292
    },
11293
    "yui-log": {
11294
        "requires": [
11295
            "yui-base"
11296
        ]
11297
    },
11298
    "yui-throttle": {
11299
        "requires": [
11300
            "yui-base"
11301
        ]
11302
    }
11303
});
11304
YUI.Env[Y.version].md5 = '2fd2be6b12ee9f999b4367499ae61aae';
11305
 
11306
 
11307
}, '3.18.1', {"requires": ["loader-base"]});
11308
YUI.add('yui', function (Y, NAME) {}, '3.18.1', {
11309
    "use": [
11310
        "get",
11311
        "features",
11312
        "intl-base",
11313
        "yui-log",
11314
        "yui-log-nodejs",
11315
        "yui-later",
11316
        "loader-base",
11317
        "loader-rollup",
11318
        "loader-yui3"
11319
    ]
11320
});