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