diff --git a/dist/amd/can-util.js b/dist/amd/can-util.js
new file mode 100644
index 00000000..ed31840d
--- /dev/null
+++ b/dist/amd/can-util.js
@@ -0,0 +1,19 @@
+/*can-util@3.11.2#can-util*/
+define([
+ 'require',
+ 'exports',
+ 'module',
+ './js/deep-assign/deep-assign',
+ './js/omit/omit',
+ 'can-namespace',
+ './dom/dom',
+ './js/js'
+], function (require, exports, module) {
+ var deepAssign = require('./js/deep-assign/deep-assign');
+ var omit = require('./js/omit/omit');
+ var namespace = require('can-namespace');
+ module.exports = deepAssign(namespace, require('./dom/dom'), omit(require('./js/js'), [
+ 'cid',
+ 'types'
+ ]));
+});
\ No newline at end of file
diff --git a/dist/amd/dom/ajax/ajax.js b/dist/amd/dom/ajax/ajax.js
new file mode 100644
index 00000000..195fc5a1
--- /dev/null
+++ b/dist/amd/dom/ajax/ajax.js
@@ -0,0 +1,12 @@
+/*can-util@3.11.2#dom/ajax/ajax*/
+define([
+ 'require',
+ 'exports',
+ 'module',
+ 'can-log/dev',
+ 'can-ajax'
+], function (require, exports, module) {
+ 'use strict';
+ var canDev = require('can-log/dev');
+ module.exports = require('can-ajax');
+});
\ No newline at end of file
diff --git a/dist/amd/dom/attr/attr.js b/dist/amd/dom/attr/attr.js
new file mode 100644
index 00000000..cbbcc203
--- /dev/null
+++ b/dist/amd/dom/attr/attr.js
@@ -0,0 +1,587 @@
+/*can-util@3.11.2#dom/attr/attr*/
+define([
+ 'require',
+ 'exports',
+ 'module',
+ '../../js/set-immediate/set-immediate',
+ 'can-globals/document',
+ 'can-globals/global',
+ '../is-of-global-document/is-of-global-document',
+ '../data/data',
+ '../contains/contains',
+ '../events/events',
+ '../dispatch/dispatch',
+ 'can-globals/mutation-observer',
+ '../../js/each/each',
+ 'can-types',
+ '../../js/diff/diff',
+ '../events/attributes/attributes',
+ '../events/inserted/inserted'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ var setImmediate = require('../../js/set-immediate/set-immediate');
+ var getDocument = require('can-globals/document');
+ var global = require('can-globals/global')();
+ var isOfGlobalDocument = require('../is-of-global-document/is-of-global-document');
+ var setData = require('../data/data');
+ var domContains = require('../contains/contains');
+ var domEvents = require('../events/events');
+ var domDispatch = require('../dispatch/dispatch');
+ var getMutationObserver = require('can-globals/mutation-observer');
+ var each = require('../../js/each/each');
+ var types = require('can-types');
+ var diff = require('../../js/diff/diff');
+ require('../events/attributes/attributes');
+ require('../events/inserted/inserted');
+ var namespaces = { 'xlink': 'http://www.w3.org/1999/xlink' };
+ var formElements = {
+ 'INPUT': true,
+ 'TEXTAREA': true,
+ 'SELECT': true
+ }, toString = function (value) {
+ if (value == null) {
+ return '';
+ } else {
+ return '' + value;
+ }
+ }, isSVG = function (el) {
+ return el.namespaceURI === 'http://www.w3.org/2000/svg';
+ }, truthy = function () {
+ return true;
+ }, getSpecialTest = function (special) {
+ return special && special.test || truthy;
+ }, propProp = function (prop, obj) {
+ obj = obj || {};
+ obj.get = function () {
+ return this[prop];
+ };
+ obj.set = function (value) {
+ if (this[prop] !== value) {
+ this[prop] = value;
+ }
+ return value;
+ };
+ return obj;
+ }, booleanProp = function (prop) {
+ return {
+ isBoolean: true,
+ set: function (value) {
+ if (prop in this) {
+ this[prop] = value !== false;
+ } else {
+ this.setAttribute(prop, '');
+ }
+ },
+ remove: function () {
+ this[prop] = false;
+ }
+ };
+ }, setupMO = function (el, callback) {
+ var attrMO = setData.get.call(el, 'attrMO');
+ if (!attrMO) {
+ var onMutation = function () {
+ callback.call(el);
+ };
+ var MO = getMutationObserver();
+ if (MO) {
+ var observer = new MO(onMutation);
+ observer.observe(el, {
+ childList: true,
+ subtree: true
+ });
+ setData.set.call(el, 'attrMO', observer);
+ } else {
+ setData.set.call(el, 'attrMO', true);
+ setData.set.call(el, 'canBindingCallback', { onMutation: onMutation });
+ }
+ }
+ }, _findOptionToSelect = function (parent, value) {
+ var child = parent.firstChild;
+ while (child) {
+ if (child.nodeName === 'OPTION' && value === child.value) {
+ return child;
+ }
+ if (child.nodeName === 'OPTGROUP') {
+ var groupChild = _findOptionToSelect(child, value);
+ if (groupChild) {
+ return groupChild;
+ }
+ }
+ child = child.nextSibling;
+ }
+ }, setChildOptions = function (el, value) {
+ var option;
+ if (value != null) {
+ option = _findOptionToSelect(el, value);
+ }
+ if (option) {
+ option.selected = true;
+ } else {
+ el.selectedIndex = -1;
+ }
+ }, forEachOption = function (parent, fn) {
+ var child = parent.firstChild;
+ while (child) {
+ if (child.nodeName === 'OPTION') {
+ fn(child);
+ }
+ if (child.nodeName === 'OPTGROUP') {
+ forEachOption(child, fn);
+ }
+ child = child.nextSibling;
+ }
+ }, collectSelectedOptions = function (parent) {
+ var selectedValues = [];
+ forEachOption(parent, function (option) {
+ if (option.selected) {
+ selectedValues.push(option.value);
+ }
+ });
+ return selectedValues;
+ }, markSelectedOptions = function (parent, values) {
+ forEachOption(parent, function (option) {
+ option.selected = values.indexOf(option.value) !== -1;
+ });
+ }, setChildOptionsOnChange = function (select, aEL) {
+ var handler = setData.get.call(select, 'attrSetChildOptions');
+ if (handler) {
+ return Function.prototype;
+ }
+ handler = function () {
+ setChildOptions(select, select.value);
+ };
+ setData.set.call(select, 'attrSetChildOptions', handler);
+ aEL.call(select, 'change', handler);
+ return function (rEL) {
+ setData.clean.call(select, 'attrSetChildOptions');
+ rEL.call(select, 'change', handler);
+ };
+ }, attr = {
+ special: {
+ checked: {
+ get: function () {
+ return this.checked;
+ },
+ set: function (val) {
+ var notFalse = !!val || val === '' || arguments.length === 0;
+ this.checked = notFalse;
+ if (notFalse && this.type === 'radio') {
+ this.defaultChecked = true;
+ }
+ return val;
+ },
+ remove: function () {
+ this.checked = false;
+ },
+ test: function () {
+ return this.nodeName === 'INPUT';
+ }
+ },
+ 'class': {
+ get: function () {
+ if (isSVG(this)) {
+ return this.getAttribute('class');
+ }
+ return this.className;
+ },
+ set: function (val) {
+ val = val || '';
+ if (isSVG(this)) {
+ this.setAttribute('class', '' + val);
+ } else {
+ this.className = val;
+ }
+ return val;
+ }
+ },
+ disabled: booleanProp('disabled'),
+ focused: {
+ get: function () {
+ return this === document.activeElement;
+ },
+ set: function (val) {
+ var cur = attr.get(this, 'focused');
+ var docEl = this.ownerDocument.documentElement;
+ var element = this;
+ function focusTask() {
+ if (val) {
+ element.focus();
+ } else {
+ element.blur();
+ }
+ }
+ if (cur !== val) {
+ if (!domContains.call(docEl, element)) {
+ var initialSetHandler = function () {
+ domEvents.removeEventListener.call(element, 'inserted', initialSetHandler);
+ focusTask();
+ };
+ domEvents.addEventListener.call(element, 'inserted', initialSetHandler);
+ } else {
+ types.queueTask([
+ focusTask,
+ this,
+ []
+ ]);
+ }
+ }
+ return !!val;
+ },
+ addEventListener: function (eventName, handler, aEL) {
+ aEL.call(this, 'focus', handler);
+ aEL.call(this, 'blur', handler);
+ return function (rEL) {
+ rEL.call(this, 'focus', handler);
+ rEL.call(this, 'blur', handler);
+ };
+ },
+ test: function () {
+ return this.nodeName === 'INPUT';
+ }
+ },
+ 'for': propProp('htmlFor'),
+ innertext: propProp('innerText'),
+ innerhtml: propProp('innerHTML'),
+ innerHTML: propProp('innerHTML', {
+ addEventListener: function (eventName, handler, aEL) {
+ var handlers = [];
+ var el = this;
+ each([
+ 'change',
+ 'blur'
+ ], function (eventName) {
+ var localHandler = function () {
+ handler.apply(this, arguments);
+ };
+ domEvents.addEventListener.call(el, eventName, localHandler);
+ handlers.push([
+ eventName,
+ localHandler
+ ]);
+ });
+ return function (rEL) {
+ each(handlers, function (info) {
+ rEL.call(el, info[0], info[1]);
+ });
+ };
+ }
+ }),
+ required: booleanProp('required'),
+ readonly: booleanProp('readOnly'),
+ selected: {
+ get: function () {
+ return this.selected;
+ },
+ set: function (val) {
+ val = !!val;
+ setData.set.call(this, 'lastSetValue', val);
+ return this.selected = val;
+ },
+ addEventListener: function (eventName, handler, aEL) {
+ var option = this;
+ var select = this.parentNode;
+ var lastVal = option.selected;
+ var localHandler = function (changeEvent) {
+ var curVal = option.selected;
+ lastVal = setData.get.call(option, 'lastSetValue') || lastVal;
+ if (curVal !== lastVal) {
+ lastVal = curVal;
+ domDispatch.call(option, eventName);
+ }
+ };
+ var removeChangeHandler = setChildOptionsOnChange(select, aEL);
+ domEvents.addEventListener.call(select, 'change', localHandler);
+ aEL.call(option, eventName, handler);
+ return function (rEL) {
+ removeChangeHandler(rEL);
+ domEvents.removeEventListener.call(select, 'change', localHandler);
+ rEL.call(option, eventName, handler);
+ };
+ },
+ test: function () {
+ return this.nodeName === 'OPTION' && this.parentNode && this.parentNode.nodeName === 'SELECT';
+ }
+ },
+ src: {
+ set: function (val) {
+ if (val == null || val === '') {
+ this.removeAttribute('src');
+ return null;
+ } else {
+ this.setAttribute('src', val);
+ return val;
+ }
+ }
+ },
+ style: {
+ set: function () {
+ var el = global.document && getDocument().createElement('div');
+ if (el && el.style && 'cssText' in el.style) {
+ return function (val) {
+ return this.style.cssText = val || '';
+ };
+ } else {
+ return function (val) {
+ return this.setAttribute('style', val);
+ };
+ }
+ }()
+ },
+ textcontent: propProp('textContent'),
+ value: {
+ get: function () {
+ var value = this.value;
+ if (this.nodeName === 'SELECT') {
+ if ('selectedIndex' in this && this.selectedIndex === -1) {
+ value = undefined;
+ }
+ }
+ return value;
+ },
+ set: function (value) {
+ var nodeName = this.nodeName.toLowerCase();
+ if (nodeName === 'input') {
+ value = toString(value);
+ }
+ if (this.value !== value || nodeName === 'option') {
+ this.value = value;
+ }
+ if (attr.defaultValue[nodeName]) {
+ this.defaultValue = value;
+ }
+ if (nodeName === 'select') {
+ setData.set.call(this, 'attrValueLastVal', value);
+ setChildOptions(this, value === null ? value : this.value);
+ var docEl = this.ownerDocument.documentElement;
+ if (!domContains.call(docEl, this)) {
+ var select = this;
+ var initialSetHandler = function () {
+ domEvents.removeEventListener.call(select, 'inserted', initialSetHandler);
+ setChildOptions(select, value === null ? value : select.value);
+ };
+ domEvents.addEventListener.call(this, 'inserted', initialSetHandler);
+ }
+ setupMO(this, function () {
+ var value = setData.get.call(this, 'attrValueLastVal');
+ attr.set(this, 'value', value);
+ domDispatch.call(this, 'change');
+ });
+ }
+ return value;
+ },
+ test: function () {
+ return formElements[this.nodeName];
+ }
+ },
+ values: {
+ get: function () {
+ return collectSelectedOptions(this);
+ },
+ set: function (values) {
+ values = values || [];
+ markSelectedOptions(this, values);
+ setData.set.call(this, 'stickyValues', attr.get(this, 'values'));
+ setupMO(this, function () {
+ var previousValues = setData.get.call(this, 'stickyValues');
+ attr.set(this, 'values', previousValues);
+ var currentValues = setData.get.call(this, 'stickyValues');
+ var changes = diff(previousValues.slice().sort(), currentValues.slice().sort());
+ if (changes.length) {
+ domDispatch.call(this, 'values');
+ }
+ });
+ return values;
+ },
+ addEventListener: function (eventName, handler, aEL) {
+ var localHandler = function () {
+ domDispatch.call(this, 'values');
+ };
+ domEvents.addEventListener.call(this, 'change', localHandler);
+ aEL.call(this, eventName, handler);
+ return function (rEL) {
+ domEvents.removeEventListener.call(this, 'change', localHandler);
+ rEL.call(this, eventName, handler);
+ };
+ }
+ }
+ },
+ defaultValue: {
+ input: true,
+ textarea: true
+ },
+ setAttrOrProp: function (el, attrName, val) {
+ attrName = attrName.toLowerCase();
+ var special = attr.special[attrName];
+ if (special && special.isBoolean && !val) {
+ this.remove(el, attrName);
+ } else {
+ this.set(el, attrName, val);
+ }
+ },
+ set: function (el, attrName, val) {
+ var usingMutationObserver = isOfGlobalDocument(el) && getMutationObserver();
+ attrName = attrName.toLowerCase();
+ var oldValue;
+ if (!usingMutationObserver) {
+ oldValue = attr.get(el, attrName);
+ }
+ var newValue;
+ var special = attr.special[attrName];
+ var setter = special && special.set;
+ var test = getSpecialTest(special);
+ if (typeof setter === 'function' && test.call(el)) {
+ if (arguments.length === 2) {
+ newValue = setter.call(el);
+ } else {
+ newValue = setter.call(el, val);
+ }
+ } else {
+ attr.setAttribute(el, attrName, val);
+ }
+ if (!usingMutationObserver && newValue !== oldValue) {
+ attr.trigger(el, attrName, oldValue);
+ }
+ },
+ setSelectValue: function (el, value) {
+ attr.set(el, 'value', value);
+ },
+ setAttribute: function () {
+ var doc = getDocument();
+ if (doc && document.createAttribute) {
+ try {
+ doc.createAttribute('{}');
+ } catch (e) {
+ var invalidNodes = {}, attributeDummy = document.createElement('div');
+ return function (el, attrName, val) {
+ var first = attrName.charAt(0), cachedNode, node, attr;
+ if ((first === '{' || first === '(' || first === '*') && el.setAttributeNode) {
+ cachedNode = invalidNodes[attrName];
+ if (!cachedNode) {
+ attributeDummy.innerHTML = '
';
+ cachedNode = invalidNodes[attrName] = attributeDummy.childNodes[0].attributes[0];
+ }
+ node = cachedNode.cloneNode();
+ node.value = val;
+ el.setAttributeNode(node);
+ } else {
+ attr = attrName.split(':');
+ if (attr.length !== 1 && namespaces[attr[0]]) {
+ el.setAttributeNS(namespaces[attr[0]], attrName, val);
+ } else {
+ el.setAttribute(attrName, val);
+ }
+ }
+ };
+ }
+ }
+ return function (el, attrName, val) {
+ el.setAttribute(attrName, val);
+ };
+ }(),
+ trigger: function (el, attrName, oldValue) {
+ if (setData.get.call(el, 'canHasAttributesBindings')) {
+ attrName = attrName.toLowerCase();
+ return setImmediate(function () {
+ domDispatch.call(el, {
+ type: 'attributes',
+ attributeName: attrName,
+ target: el,
+ oldValue: oldValue,
+ bubbles: false
+ }, []);
+ });
+ }
+ },
+ get: function (el, attrName) {
+ attrName = attrName.toLowerCase();
+ var special = attr.special[attrName];
+ var getter = special && special.get;
+ var test = getSpecialTest(special);
+ if (typeof getter === 'function' && test.call(el)) {
+ return getter.call(el);
+ } else {
+ return el.getAttribute(attrName);
+ }
+ },
+ remove: function (el, attrName) {
+ attrName = attrName.toLowerCase();
+ var oldValue;
+ if (!getMutationObserver()) {
+ oldValue = attr.get(el, attrName);
+ }
+ var special = attr.special[attrName];
+ var setter = special && special.set;
+ var remover = special && special.remove;
+ var test = getSpecialTest(special);
+ if (typeof remover === 'function' && test.call(el)) {
+ remover.call(el);
+ } else if (typeof setter === 'function' && test.call(el)) {
+ setter.call(el, undefined);
+ } else {
+ el.removeAttribute(attrName);
+ }
+ if (!getMutationObserver() && oldValue != null) {
+ attr.trigger(el, attrName, oldValue);
+ }
+ },
+ has: function () {
+ var el = getDocument() && document.createElement('div');
+ if (el && el.hasAttribute) {
+ return function (el, name) {
+ return el.hasAttribute(name);
+ };
+ } else {
+ return function (el, name) {
+ return el.getAttribute(name) !== null;
+ };
+ }
+ }()
+ };
+ var oldAddEventListener = domEvents.addEventListener;
+ domEvents.addEventListener = function (eventName, handler) {
+ var special = attr.special[eventName];
+ if (special && special.addEventListener) {
+ var teardown = special.addEventListener.call(this, eventName, handler, oldAddEventListener);
+ var teardowns = setData.get.call(this, 'attrTeardowns');
+ if (!teardowns) {
+ setData.set.call(this, 'attrTeardowns', teardowns = {});
+ }
+ if (!teardowns[eventName]) {
+ teardowns[eventName] = [];
+ }
+ teardowns[eventName].push({
+ teardown: teardown,
+ handler: handler
+ });
+ return;
+ }
+ return oldAddEventListener.apply(this, arguments);
+ };
+ var oldRemoveEventListener = domEvents.removeEventListener;
+ domEvents.removeEventListener = function (eventName, handler) {
+ var special = attr.special[eventName];
+ if (special && special.addEventListener) {
+ var teardowns = setData.get.call(this, 'attrTeardowns');
+ if (teardowns && teardowns[eventName]) {
+ var eventTeardowns = teardowns[eventName];
+ for (var i = 0, len = eventTeardowns.length; i < len; i++) {
+ if (eventTeardowns[i].handler === handler) {
+ eventTeardowns[i].teardown.call(this, oldRemoveEventListener);
+ eventTeardowns.splice(i, 1);
+ break;
+ }
+ }
+ if (eventTeardowns.length === 0) {
+ delete teardowns[eventName];
+ }
+ }
+ return;
+ }
+ return oldRemoveEventListener.apply(this, arguments);
+ };
+ module.exports = exports = attr;
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
\ No newline at end of file
diff --git a/dist/amd/dom/child-nodes/child-nodes.js b/dist/amd/dom/child-nodes/child-nodes.js
new file mode 100644
index 00000000..fa9635c4
--- /dev/null
+++ b/dist/amd/dom/child-nodes/child-nodes.js
@@ -0,0 +1,19 @@
+/*can-util@3.11.2#dom/child-nodes/child-nodes*/
+define(function (require, exports, module) {
+ 'use strict';
+ function childNodes(node) {
+ var childNodes = node.childNodes;
+ if ('length' in childNodes) {
+ return childNodes;
+ } else {
+ var cur = node.firstChild;
+ var nodes = [];
+ while (cur) {
+ nodes.push(cur);
+ cur = cur.nextSibling;
+ }
+ return nodes;
+ }
+ }
+ module.exports = childNodes;
+});
\ No newline at end of file
diff --git a/dist/amd/dom/class-name/class-name.js b/dist/amd/dom/class-name/class-name.js
new file mode 100644
index 00000000..5aa0125e
--- /dev/null
+++ b/dist/amd/dom/class-name/class-name.js
@@ -0,0 +1,29 @@
+/*can-util@3.11.2#dom/class-name/class-name*/
+define(function (require, exports, module) {
+ 'use strict';
+ var has = function (className) {
+ if (this.classList) {
+ return this.classList.contains(className);
+ } else {
+ return !!this.className.match(new RegExp('(\\s|^)' + className + '(\\s|$)'));
+ }
+ };
+ module.exports = {
+ has: has,
+ add: function (className) {
+ if (this.classList) {
+ this.classList.add(className);
+ } else if (!has.call(this, className)) {
+ this.className += ' ' + className;
+ }
+ },
+ remove: function (className) {
+ if (this.classList) {
+ this.classList.remove(className);
+ } else if (has.call(this, className)) {
+ var reg = new RegExp('(\\s|^)' + className + '(\\s|$)');
+ this.className = this.className.replace(reg, ' ');
+ }
+ }
+ };
+});
\ No newline at end of file
diff --git a/dist/amd/dom/contains/contains.js b/dist/amd/dom/contains/contains.js
new file mode 100644
index 00000000..ec459059
--- /dev/null
+++ b/dist/amd/dom/contains/contains.js
@@ -0,0 +1,7 @@
+/*can-util@3.11.2#dom/contains/contains*/
+define(function (require, exports, module) {
+ 'use strict';
+ module.exports = function (child) {
+ return this.contains(child);
+ };
+});
\ No newline at end of file
diff --git a/dist/amd/dom/data/data.js b/dist/amd/dom/data/data.js
new file mode 100644
index 00000000..bf388c1a
--- /dev/null
+++ b/dist/amd/dom/data/data.js
@@ -0,0 +1,43 @@
+/*can-util@3.11.2#dom/data/data*/
+define([
+ 'require',
+ 'exports',
+ 'module',
+ 'can-dom-data-state',
+ '../mutation-observer/document/document'
+], function (require, exports, module) {
+ 'use strict';
+ var domDataState = require('can-dom-data-state');
+ var mutationDocument = require('../mutation-observer/document/document');
+ var elementSetCount = 0;
+ var deleteNode = function () {
+ elementSetCount -= 1;
+ return domDataState.delete.call(this);
+ };
+ var cleanupDomData = function (node) {
+ if (domDataState.get.call(node) !== undefined) {
+ deleteNode.call(node);
+ }
+ if (elementSetCount === 0) {
+ mutationDocument.offAfterRemovedNodes(cleanupDomData);
+ }
+ };
+ module.exports = {
+ getCid: domDataState.getCid,
+ cid: domDataState.cid,
+ expando: domDataState.expando,
+ clean: domDataState.clean,
+ get: domDataState.get,
+ set: function (name, value) {
+ if (elementSetCount === 0) {
+ mutationDocument.onAfterRemovedNodes(cleanupDomData);
+ }
+ elementSetCount += domDataState.get.call(this) ? 0 : 1;
+ domDataState.set.call(this, name, value);
+ },
+ delete: deleteNode,
+ _getElementSetCount: function () {
+ return elementSetCount;
+ }
+ };
+});
\ No newline at end of file
diff --git a/dist/amd/dom/dispatch/dispatch.js b/dist/amd/dom/dispatch/dispatch.js
new file mode 100644
index 00000000..5fcde118
--- /dev/null
+++ b/dist/amd/dom/dispatch/dispatch.js
@@ -0,0 +1,13 @@
+/*can-util@3.11.2#dom/dispatch/dispatch*/
+define([
+ 'require',
+ 'exports',
+ 'module',
+ '../events/events'
+], function (require, exports, module) {
+ 'use strict';
+ var domEvents = require('../events/events');
+ module.exports = function () {
+ return domEvents.dispatch.apply(this, arguments);
+ };
+});
\ No newline at end of file
diff --git a/dist/amd/dom/document/document.js b/dist/amd/dom/document/document.js
new file mode 100644
index 00000000..d820a08e
--- /dev/null
+++ b/dist/amd/dom/document/document.js
@@ -0,0 +1,14 @@
+/*can-util@3.11.2#dom/document/document*/
+define([
+ 'require',
+ 'exports',
+ 'module',
+ 'can-globals/document'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ module.exports = require('can-globals/document');
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
\ No newline at end of file
diff --git a/dist/amd/dom/dom.js b/dist/amd/dom/dom.js
new file mode 100644
index 00000000..ccf8d50f
--- /dev/null
+++ b/dist/amd/dom/dom.js
@@ -0,0 +1,44 @@
+/*can-util@3.11.2#dom/dom*/
+define([
+ 'require',
+ 'exports',
+ 'module',
+ './ajax/ajax',
+ './attr/attr',
+ './child-nodes/child-nodes',
+ './class-name/class-name',
+ './contains/contains',
+ './data/data',
+ './dispatch/dispatch',
+ './document/document',
+ './events/events',
+ './frag/frag',
+ './fragment/fragment',
+ './is-of-global-document/is-of-global-document',
+ './matches/matches',
+ './mutate/mutate',
+ './mutation-observer/mutation-observer'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ module.exports = {
+ ajax: require('./ajax/ajax'),
+ attr: require('./attr/attr'),
+ childNodes: require('./child-nodes/child-nodes'),
+ className: require('./class-name/class-name'),
+ contains: require('./contains/contains'),
+ data: require('./data/data'),
+ dispatch: require('./dispatch/dispatch'),
+ document: require('./document/document'),
+ events: require('./events/events'),
+ frag: require('./frag/frag'),
+ fragment: require('./fragment/fragment'),
+ isOfGlobalDocument: require('./is-of-global-document/is-of-global-document'),
+ matches: require('./matches/matches'),
+ mutate: require('./mutate/mutate'),
+ mutationObserver: require('./mutation-observer/mutation-observer')
+ };
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
\ No newline at end of file
diff --git a/dist/amd/dom/events/attributes/attributes.js b/dist/amd/dom/events/attributes/attributes.js
new file mode 100644
index 00000000..8effca8b
--- /dev/null
+++ b/dist/amd/dom/events/attributes/attributes.js
@@ -0,0 +1,66 @@
+/*can-util@3.11.2#dom/events/attributes/attributes*/
+define([
+ 'require',
+ 'exports',
+ 'module',
+ '../events',
+ '../../is-of-global-document/is-of-global-document',
+ '../../data/data',
+ 'can-globals/mutation-observer',
+ 'can-assign',
+ '../../dispatch/dispatch'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ var events = require('../events');
+ var isOfGlobalDocument = require('../../is-of-global-document/is-of-global-document');
+ var domData = require('../../data/data');
+ var getMutationObserver = require('can-globals/mutation-observer');
+ var assign = require('can-assign');
+ var domDispatch = require('../../dispatch/dispatch');
+ var originalAdd = events.addEventListener, originalRemove = events.removeEventListener;
+ events.addEventListener = function (eventName) {
+ if (eventName === 'attributes') {
+ var MutationObserver = getMutationObserver();
+ if (isOfGlobalDocument(this) && MutationObserver) {
+ var existingObserver = domData.get.call(this, 'canAttributesObserver');
+ if (!existingObserver) {
+ var self = this;
+ var observer = new MutationObserver(function (mutations) {
+ mutations.forEach(function (mutation) {
+ var copy = assign({}, mutation);
+ domDispatch.call(self, copy, [], false);
+ });
+ });
+ observer.observe(this, {
+ attributes: true,
+ attributeOldValue: true
+ });
+ domData.set.call(this, 'canAttributesObserver', observer);
+ }
+ } else {
+ domData.set.call(this, 'canHasAttributesBindings', true);
+ }
+ }
+ return originalAdd.apply(this, arguments);
+ };
+ events.removeEventListener = function (eventName) {
+ if (eventName === 'attributes') {
+ var MutationObserver = getMutationObserver();
+ var observer;
+ if (isOfGlobalDocument(this) && MutationObserver) {
+ observer = domData.get.call(this, 'canAttributesObserver');
+ if (observer && observer.disconnect) {
+ observer.disconnect();
+ domData.clean.call(this, 'canAttributesObserver');
+ }
+ } else {
+ domData.clean.call(this, 'canHasAttributesBindings');
+ }
+ }
+ return originalRemove.apply(this, arguments);
+ };
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
\ No newline at end of file
diff --git a/dist/amd/dom/events/events.js b/dist/amd/dom/events/events.js
new file mode 100644
index 00000000..3daf064b
--- /dev/null
+++ b/dist/amd/dom/events/events.js
@@ -0,0 +1,85 @@
+/*can-util@3.11.2#dom/events/events*/
+define([
+ 'require',
+ 'exports',
+ 'module',
+ 'can-globals/document',
+ 'can-globals/is-browser-window',
+ '../../js/is-plain-object/is-plain-object',
+ 'can-log/dev'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ var getDocument = require('can-globals/document');
+ var isBrowserWindow = require('can-globals/is-browser-window');
+ var isPlainObject = require('../../js/is-plain-object/is-plain-object');
+ var fixSyntheticEventsOnDisabled = false;
+ var dev = require('can-log/dev');
+ function isDispatchingOnDisabled(element, ev) {
+ var isInsertedOrRemoved = isPlainObject(ev) ? ev.type === 'inserted' || ev.type === 'removed' : ev === 'inserted' || ev === 'removed';
+ var isDisabled = !!element.disabled;
+ return isInsertedOrRemoved && isDisabled;
+ }
+ module.exports = {
+ addEventListener: function () {
+ this.addEventListener.apply(this, arguments);
+ },
+ removeEventListener: function () {
+ this.removeEventListener.apply(this, arguments);
+ },
+ canAddEventListener: function () {
+ return this.nodeName && (this.nodeType === 1 || this.nodeType === 9) || this === window;
+ },
+ dispatch: function (event, args, bubbles) {
+ var ret;
+ var dispatchingOnDisabled = fixSyntheticEventsOnDisabled && isDispatchingOnDisabled(this, event);
+ var doc = this.ownerDocument || getDocument();
+ var ev = doc.createEvent('HTMLEvents');
+ var isString = typeof event === 'string';
+ ev.initEvent(isString ? event : event.type, bubbles === undefined ? true : bubbles, false);
+ if (!isString) {
+ for (var prop in event) {
+ if (ev[prop] === undefined) {
+ ev[prop] = event[prop];
+ }
+ }
+ }
+ if (this.disabled === true && ev.type !== 'fix_synthetic_events_on_disabled_test') {
+ }
+ ev.args = args;
+ if (dispatchingOnDisabled) {
+ this.disabled = false;
+ }
+ ret = this.dispatchEvent(ev);
+ if (dispatchingOnDisabled) {
+ this.disabled = true;
+ }
+ return ret;
+ }
+ };
+ (function () {
+ if (!isBrowserWindow()) {
+ return;
+ }
+ var testEventName = 'fix_synthetic_events_on_disabled_test';
+ var input = document.createElement('input');
+ input.disabled = true;
+ var timer = setTimeout(function () {
+ fixSyntheticEventsOnDisabled = true;
+ }, 50);
+ var onTest = function onTest() {
+ clearTimeout(timer);
+ module.exports.removeEventListener.call(input, testEventName, onTest);
+ };
+ module.exports.addEventListener.call(input, testEventName, onTest);
+ try {
+ module.exports.dispatch.call(input, testEventName, [], false);
+ } catch (e) {
+ onTest();
+ fixSyntheticEventsOnDisabled = true;
+ }
+ }());
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
\ No newline at end of file
diff --git a/dist/amd/dom/events/inserted/inserted.js b/dist/amd/dom/events/inserted/inserted.js
new file mode 100644
index 00000000..73d63197
--- /dev/null
+++ b/dist/amd/dom/events/inserted/inserted.js
@@ -0,0 +1,11 @@
+/*can-util@3.11.2#dom/events/inserted/inserted*/
+define([
+ 'require',
+ 'exports',
+ 'module',
+ '../make-mutation-event/make-mutation-event'
+], function (require, exports, module) {
+ 'use strict';
+ var makeMutationEvent = require('../make-mutation-event/make-mutation-event');
+ makeMutationEvent('inserted', 'addedNodes');
+});
\ No newline at end of file
diff --git a/dist/amd/dom/events/make-mutation-event/make-mutation-event.js b/dist/amd/dom/events/make-mutation-event/make-mutation-event.js
new file mode 100644
index 00000000..4c73be3d
--- /dev/null
+++ b/dist/amd/dom/events/make-mutation-event/make-mutation-event.js
@@ -0,0 +1,76 @@
+/*can-util@3.11.2#dom/events/make-mutation-event/make-mutation-event*/
+define([
+ 'require',
+ 'exports',
+ 'module',
+ '../events',
+ '../../data/data',
+ 'can-globals/mutation-observer',
+ '../../dispatch/dispatch',
+ '../../mutation-observer/document/document',
+ 'can-globals/document',
+ 'can-cid/map',
+ '../../../js/string/string',
+ '../../is-of-global-document/is-of-global-document'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ var events = require('../events');
+ var domData = require('../../data/data');
+ var getMutationObserver = require('can-globals/mutation-observer');
+ var domDispatch = require('../../dispatch/dispatch');
+ var mutationDocument = require('../../mutation-observer/document/document');
+ var getDocument = require('can-globals/document');
+ var CIDMap = require('can-cid/map');
+ var string = require('../../../js/string/string');
+ require('../../is-of-global-document/is-of-global-document');
+ module.exports = function (specialEventName, mutationNodesProperty) {
+ var originalAdd = events.addEventListener, originalRemove = events.removeEventListener;
+ events.addEventListener = function (eventName) {
+ if (eventName === specialEventName && getMutationObserver()) {
+ var documentElement = getDocument().documentElement;
+ var specialEventData = domData.get.call(documentElement, specialEventName + 'Data');
+ if (!specialEventData) {
+ specialEventData = {
+ handler: function (mutatedNode) {
+ if (specialEventData.nodeIdsRespondingToInsert.has(mutatedNode)) {
+ domDispatch.call(mutatedNode, specialEventName, [], false);
+ specialEventData.nodeIdsRespondingToInsert.delete(mutatedNode);
+ }
+ },
+ nodeIdsRespondingToInsert: new CIDMap()
+ };
+ mutationDocument['on' + string.capitalize(mutationNodesProperty)](specialEventData.handler);
+ domData.set.call(documentElement, specialEventName + 'Data', specialEventData);
+ }
+ if (this.nodeType !== 11) {
+ var count = specialEventData.nodeIdsRespondingToInsert.get(this) || 0;
+ specialEventData.nodeIdsRespondingToInsert.set(this, count + 1);
+ }
+ }
+ return originalAdd.apply(this, arguments);
+ };
+ events.removeEventListener = function (eventName) {
+ if (eventName === specialEventName && getMutationObserver()) {
+ var documentElement = getDocument().documentElement;
+ var specialEventData = domData.get.call(documentElement, specialEventName + 'Data');
+ if (specialEventData) {
+ var newCount = specialEventData.nodeIdsRespondingToInsert.get(this) - 1;
+ if (newCount) {
+ specialEventData.nodeIdsRespondingToInsert.set(this, newCount);
+ } else {
+ specialEventData.nodeIdsRespondingToInsert.delete(this);
+ }
+ if (!specialEventData.nodeIdsRespondingToInsert.size) {
+ mutationDocument['off' + string.capitalize(mutationNodesProperty)](specialEventData.handler);
+ domData.clean.call(documentElement, specialEventName + 'Data');
+ }
+ }
+ }
+ return originalRemove.apply(this, arguments);
+ };
+ };
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
\ No newline at end of file
diff --git a/dist/amd/dom/frag/frag.js b/dist/amd/dom/frag/frag.js
new file mode 100644
index 00000000..d7d1a93c
--- /dev/null
+++ b/dist/amd/dom/frag/frag.js
@@ -0,0 +1,53 @@
+/*can-util@3.11.2#dom/frag/frag*/
+define([
+ 'require',
+ 'exports',
+ 'module',
+ 'can-globals/document',
+ '../fragment/fragment',
+ '../../js/each/each',
+ '../child-nodes/child-nodes'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ var getDocument = require('can-globals/document');
+ var fragment = require('../fragment/fragment');
+ var each = require('../../js/each/each');
+ var childNodes = require('../child-nodes/child-nodes');
+ var makeFrag = function (item, doc) {
+ var document = doc || getDocument();
+ var frag;
+ if (!item || typeof item === 'string') {
+ frag = fragment(item == null ? '' : '' + item, document);
+ if (!frag.childNodes.length) {
+ frag.appendChild(document.createTextNode(''));
+ }
+ return frag;
+ } else if (item.nodeType === 11) {
+ return item;
+ } else if (typeof item.nodeType === 'number') {
+ frag = document.createDocumentFragment();
+ frag.appendChild(item);
+ return frag;
+ } else if (typeof item.length === 'number') {
+ frag = document.createDocumentFragment();
+ each(item, function (item) {
+ frag.appendChild(makeFrag(item));
+ });
+ if (!childNodes(frag).length) {
+ frag.appendChild(document.createTextNode(''));
+ }
+ return frag;
+ } else {
+ frag = fragment('' + item, document);
+ if (!childNodes(frag).length) {
+ frag.appendChild(document.createTextNode(''));
+ }
+ return frag;
+ }
+ };
+ module.exports = makeFrag;
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
\ No newline at end of file
diff --git a/dist/amd/dom/fragment/fragment.js b/dist/amd/dom/fragment/fragment.js
new file mode 100644
index 00000000..c4208023
--- /dev/null
+++ b/dist/amd/dom/fragment/fragment.js
@@ -0,0 +1,64 @@
+/*can-util@3.11.2#dom/fragment/fragment*/
+define([
+ 'require',
+ 'exports',
+ 'module',
+ 'can-globals/document',
+ '../child-nodes/child-nodes'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ var getDocument = require('can-globals/document'), childNodes = require('../child-nodes/child-nodes');
+ var fragmentRE = /^\s*<(\w+)[^>]*>/, toString = {}.toString, fragment = function (html, name, doc) {
+ if (name === undefined) {
+ name = fragmentRE.test(html) && RegExp.$1;
+ }
+ if (html && toString.call(html.replace) === '[object Function]') {
+ html = html.replace(/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, '<$1>$2>');
+ }
+ var container = doc.createElement('div'), temp = doc.createElement('div');
+ if (name === 'tbody' || name === 'tfoot' || name === 'thead' || name === 'colgroup') {
+ temp.innerHTML = '';
+ container = temp.firstChild.nodeType === 3 ? temp.lastChild : temp.firstChild;
+ } else if (name === 'col') {
+ temp.innerHTML = '';
+ container = temp.firstChild.nodeType === 3 ? temp.lastChild : temp.firstChild.firstChild;
+ } else if (name === 'tr') {
+ temp.innerHTML = '';
+ container = temp.firstChild.nodeType === 3 ? temp.lastChild : temp.firstChild.firstChild;
+ } else if (name === 'td' || name === 'th') {
+ temp.innerHTML = '';
+ container = temp.firstChild.nodeType === 3 ? temp.lastChild : temp.firstChild.firstChild.firstChild;
+ } else if (name === 'option') {
+ temp.innerHTML = '';
+ container = temp.firstChild.nodeType === 3 ? temp.lastChild : temp.firstChild;
+ } else {
+ container.innerHTML = '' + html;
+ }
+ var tmp = {}, children = childNodes(container);
+ tmp.length = children.length;
+ for (var i = 0; i < children.length; i++) {
+ tmp[i] = children[i];
+ }
+ return [].slice.call(tmp);
+ };
+ var buildFragment = function (html, doc) {
+ if (html && html.nodeType === 11) {
+ return html;
+ }
+ if (!doc) {
+ doc = getDocument();
+ } else if (doc.length) {
+ doc = doc[0];
+ }
+ var parts = fragment(html, undefined, doc), frag = (doc || document).createDocumentFragment();
+ for (var i = 0, length = parts.length; i < length; i++) {
+ frag.appendChild(parts[i]);
+ }
+ return frag;
+ };
+ module.exports = buildFragment;
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
\ No newline at end of file
diff --git a/dist/amd/dom/is-of-global-document/is-of-global-document.js b/dist/amd/dom/is-of-global-document/is-of-global-document.js
new file mode 100644
index 00000000..3e43087c
--- /dev/null
+++ b/dist/amd/dom/is-of-global-document/is-of-global-document.js
@@ -0,0 +1,17 @@
+/*can-util@3.11.2#dom/is-of-global-document/is-of-global-document*/
+define([
+ 'require',
+ 'exports',
+ 'module',
+ 'can-globals/document'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ var getDocument = require('can-globals/document');
+ module.exports = function (el) {
+ return (el.ownerDocument || el) === getDocument();
+ };
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
\ No newline at end of file
diff --git a/dist/amd/dom/matches/matches.js b/dist/amd/dom/matches/matches.js
new file mode 100644
index 00000000..b034daae
--- /dev/null
+++ b/dist/amd/dom/matches/matches.js
@@ -0,0 +1,11 @@
+/*can-util@3.11.2#dom/matches/matches*/
+define(function (require, exports, module) {
+ 'use strict';
+ var matchesMethod = function (element) {
+ return element.matches || element.webkitMatchesSelector || element.webkitMatchesSelector || element.mozMatchesSelector || element.msMatchesSelector || element.oMatchesSelector;
+ };
+ module.exports = function () {
+ var method = matchesMethod(this);
+ return method ? method.apply(this, arguments) : false;
+ };
+});
\ No newline at end of file
diff --git a/dist/amd/dom/mutate/mutate.js b/dist/amd/dom/mutate/mutate.js
new file mode 100644
index 00000000..47bcd3ea
--- /dev/null
+++ b/dist/amd/dom/mutate/mutate.js
@@ -0,0 +1,156 @@
+/*can-util@3.11.2#dom/mutate/mutate*/
+define([
+ 'require',
+ 'exports',
+ 'module',
+ '../../js/make-array/make-array',
+ '../../js/set-immediate/set-immediate',
+ 'can-cid',
+ 'can-globals/mutation-observer',
+ '../child-nodes/child-nodes',
+ '../contains/contains',
+ '../dispatch/dispatch',
+ 'can-globals/document',
+ '../data/data'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ var makeArray = require('../../js/make-array/make-array');
+ var setImmediate = require('../../js/set-immediate/set-immediate');
+ var CID = require('can-cid');
+ var getMutationObserver = require('can-globals/mutation-observer');
+ var childNodes = require('../child-nodes/child-nodes');
+ var domContains = require('../contains/contains');
+ var domDispatch = require('../dispatch/dispatch');
+ var getDocument = require('can-globals/document');
+ var domData = require('../data/data');
+ var mutatedElements;
+ var checks = {
+ inserted: function (root, elem) {
+ return domContains.call(root, elem);
+ },
+ removed: function (root, elem) {
+ return !domContains.call(root, elem);
+ }
+ };
+ var fireOn = function (elems, root, check, event, dispatched) {
+ if (!elems.length) {
+ return;
+ }
+ var children, cid;
+ for (var i = 0, elem; (elem = elems[i]) !== undefined; i++) {
+ cid = CID(elem);
+ if (elem.getElementsByTagName && check(root, elem) && !dispatched[cid]) {
+ dispatched[cid] = true;
+ children = makeArray(elem.getElementsByTagName('*'));
+ domDispatch.call(elem, event, [], false);
+ if (event === 'removed') {
+ domData.delete.call(elem);
+ }
+ for (var j = 0, child; (child = children[j]) !== undefined; j++) {
+ cid = CID(child);
+ if (!dispatched[cid]) {
+ domDispatch.call(child, event, [], false);
+ if (event === 'removed') {
+ domData.delete.call(child);
+ }
+ dispatched[cid] = true;
+ }
+ }
+ }
+ }
+ };
+ var fireMutations = function () {
+ var mutations = mutatedElements;
+ mutatedElements = null;
+ var firstElement = mutations[0][1][0];
+ var doc = getDocument() || firstElement.ownerDocument || firstElement;
+ var root = doc.contains ? doc : doc.documentElement;
+ var dispatched = {
+ inserted: {},
+ removed: {}
+ };
+ mutations.forEach(function (mutation) {
+ fireOn(mutation[1], root, checks[mutation[0]], mutation[0], dispatched[mutation[0]]);
+ });
+ };
+ var mutated = function (elements, type) {
+ if (!getMutationObserver() && elements.length) {
+ var firstElement = elements[0];
+ var doc = getDocument() || firstElement.ownerDocument || firstElement;
+ var root = doc.contains ? doc : doc.documentElement;
+ if (checks.inserted(root, firstElement)) {
+ if (!mutatedElements) {
+ mutatedElements = [];
+ setImmediate(fireMutations);
+ }
+ mutatedElements.push([
+ type,
+ elements
+ ]);
+ }
+ }
+ };
+ module.exports = {
+ appendChild: function (child) {
+ if (getMutationObserver()) {
+ this.appendChild(child);
+ } else {
+ var children;
+ if (child.nodeType === 11) {
+ children = makeArray(childNodes(child));
+ } else {
+ children = [child];
+ }
+ this.appendChild(child);
+ mutated(children, 'inserted');
+ }
+ },
+ insertBefore: function (child, ref, document) {
+ if (getMutationObserver()) {
+ this.insertBefore(child, ref);
+ } else {
+ var children;
+ if (child.nodeType === 11) {
+ children = makeArray(childNodes(child));
+ } else {
+ children = [child];
+ }
+ this.insertBefore(child, ref);
+ mutated(children, 'inserted');
+ }
+ },
+ removeChild: function (child) {
+ if (getMutationObserver()) {
+ this.removeChild(child);
+ } else {
+ mutated([child], 'removed');
+ this.removeChild(child);
+ }
+ },
+ replaceChild: function (newChild, oldChild) {
+ if (getMutationObserver()) {
+ this.replaceChild(newChild, oldChild);
+ } else {
+ var children;
+ if (newChild.nodeType === 11) {
+ children = makeArray(childNodes(newChild));
+ } else {
+ children = [newChild];
+ }
+ mutated([oldChild], 'removed');
+ this.replaceChild(newChild, oldChild);
+ mutated(children, 'inserted');
+ }
+ },
+ inserted: function (elements) {
+ mutated(elements, 'inserted');
+ },
+ removed: function (elements) {
+ mutated(elements, 'removed');
+ }
+ };
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
\ No newline at end of file
diff --git a/dist/amd/dom/mutation-observer/document/document.js b/dist/amd/dom/mutation-observer/document/document.js
new file mode 100644
index 00000000..8ffffe2d
--- /dev/null
+++ b/dist/amd/dom/mutation-observer/document/document.js
@@ -0,0 +1,154 @@
+/*can-util@3.11.2#dom/mutation-observer/document/document*/
+define([
+ 'require',
+ 'exports',
+ 'module',
+ 'can-globals/document',
+ 'can-dom-data-state',
+ 'can-globals/mutation-observer',
+ '../../../js/each/each',
+ 'can-cid/set',
+ '../../../js/make-array/make-array',
+ '../../../js/string/string'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ var getDocument = require('can-globals/document');
+ var domDataState = require('can-dom-data-state');
+ var getMutationObserver = require('can-globals/mutation-observer');
+ var each = require('../../../js/each/each');
+ var CIDStore = require('can-cid/set');
+ var makeArray = require('../../../js/make-array/make-array');
+ var string = require('../../../js/string/string');
+ var dispatchIfListening = function (mutatedNode, nodes, dispatched) {
+ if (dispatched.has(mutatedNode)) {
+ return true;
+ }
+ dispatched.add(mutatedNode);
+ if (nodes.name === 'removedNodes') {
+ var documentElement = getDocument().documentElement;
+ if (documentElement.contains(mutatedNode)) {
+ return;
+ }
+ }
+ nodes.handlers.forEach(function (handler) {
+ handler(mutatedNode);
+ });
+ nodes.afterHandlers.forEach(function (handler) {
+ handler(mutatedNode);
+ });
+ };
+ var mutationObserverDocument = {
+ add: function (handler) {
+ var MO = getMutationObserver();
+ if (MO) {
+ var documentElement = getDocument().documentElement;
+ var globalObserverData = domDataState.get.call(documentElement, 'globalObserverData');
+ if (!globalObserverData) {
+ var observer = new MO(function (mutations) {
+ globalObserverData.handlers.forEach(function (handler) {
+ handler(mutations);
+ });
+ });
+ observer.observe(documentElement, {
+ childList: true,
+ subtree: true
+ });
+ globalObserverData = {
+ observer: observer,
+ handlers: []
+ };
+ domDataState.set.call(documentElement, 'globalObserverData', globalObserverData);
+ }
+ globalObserverData.handlers.push(handler);
+ }
+ },
+ remove: function (handler) {
+ var documentElement = getDocument().documentElement;
+ var globalObserverData = domDataState.get.call(documentElement, 'globalObserverData');
+ if (globalObserverData) {
+ var index = globalObserverData.handlers.indexOf(handler);
+ if (index >= 0) {
+ globalObserverData.handlers.splice(index, 1);
+ }
+ if (globalObserverData.handlers.length === 0) {
+ globalObserverData.observer.disconnect();
+ domDataState.clean.call(documentElement, 'globalObserverData');
+ }
+ }
+ }
+ };
+ var makeMutationMethods = function (name) {
+ var mutationName = name.toLowerCase() + 'Nodes';
+ var getMutationData = function () {
+ var documentElement = getDocument().documentElement;
+ var mutationData = domDataState.get.call(documentElement, mutationName + 'MutationData');
+ if (!mutationData) {
+ mutationData = {
+ name: mutationName,
+ handlers: [],
+ afterHandlers: [],
+ hander: null
+ };
+ if (getMutationObserver()) {
+ domDataState.set.call(documentElement, mutationName + 'MutationData', mutationData);
+ }
+ }
+ return mutationData;
+ };
+ var setup = function () {
+ var mutationData = getMutationData();
+ if (mutationData.handlers.length === 0 || mutationData.afterHandlers.length === 0) {
+ mutationData.handler = function (mutations) {
+ var dispatched = new CIDStore();
+ mutations.forEach(function (mutation) {
+ each(mutation[mutationName], function (mutatedNode) {
+ var children = mutatedNode.getElementsByTagName && makeArray(mutatedNode.getElementsByTagName('*'));
+ var alreadyChecked = dispatchIfListening(mutatedNode, mutationData, dispatched);
+ if (children && !alreadyChecked) {
+ for (var j = 0, child; (child = children[j]) !== undefined; j++) {
+ dispatchIfListening(child, mutationData, dispatched);
+ }
+ }
+ });
+ });
+ };
+ this.add(mutationData.handler);
+ }
+ return mutationData;
+ };
+ var teardown = function () {
+ var documentElement = getDocument().documentElement;
+ var mutationData = getMutationData();
+ if (mutationData.handlers.length === 0 && mutationData.afterHandlers.length === 0) {
+ this.remove(mutationData.handler);
+ domDataState.clean.call(documentElement, mutationName + 'MutationData');
+ }
+ };
+ var createOnOffHandlers = function (name, handlerList) {
+ mutationObserverDocument['on' + name] = function (handler) {
+ var mutationData = setup.call(this);
+ mutationData[handlerList].push(handler);
+ };
+ mutationObserverDocument['off' + name] = function (handler) {
+ var mutationData = getMutationData();
+ var index = mutationData[handlerList].indexOf(handler);
+ if (index >= 0) {
+ mutationData[handlerList].splice(index, 1);
+ }
+ teardown.call(this);
+ };
+ };
+ var createHandlers = function (name) {
+ createOnOffHandlers(name, 'handlers');
+ createOnOffHandlers('After' + name, 'afterHandlers');
+ };
+ createHandlers(string.capitalize(mutationName));
+ };
+ makeMutationMethods('added');
+ makeMutationMethods('removed');
+ module.exports = mutationObserverDocument;
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
\ No newline at end of file
diff --git a/dist/amd/dom/mutation-observer/mutation-observer.js b/dist/amd/dom/mutation-observer/mutation-observer.js
new file mode 100644
index 00000000..0a9fc746
--- /dev/null
+++ b/dist/amd/dom/mutation-observer/mutation-observer.js
@@ -0,0 +1,22 @@
+/*can-util@3.11.2#dom/mutation-observer/mutation-observer*/
+define([
+ 'require',
+ 'exports',
+ 'module',
+ 'can-globals'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ var globals = require('can-globals');
+ module.exports = function (setMO) {
+ if (setMO !== undefined) {
+ globals.setKeyValue('MutationObserver', function () {
+ return setMO;
+ });
+ }
+ return globals.getKeyValue('MutationObserver');
+ };
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
\ No newline at end of file
diff --git a/dist/amd/js/deep-assign/deep-assign.js b/dist/amd/js/deep-assign/deep-assign.js
new file mode 100644
index 00000000..e3dd50ab
--- /dev/null
+++ b/dist/amd/js/deep-assign/deep-assign.js
@@ -0,0 +1,46 @@
+/*can-util@3.11.2#js/deep-assign/deep-assign*/
+define([
+ 'require',
+ 'exports',
+ 'module',
+ '../is-function/is-function',
+ '../is-plain-object/is-plain-object'
+], function (require, exports, module) {
+ 'use strict';
+ var isFunction = require('../is-function/is-function');
+ var isPlainObject = require('../is-plain-object/is-plain-object');
+ function deepAssign() {
+ var options, name, src, copy, copyIsArray, clone, target = arguments[0] || {}, i = 1, length = arguments.length;
+ if (typeof target !== 'object' && !isFunction(target)) {
+ target = {};
+ }
+ if (length === i) {
+ target = this;
+ --i;
+ }
+ for (; i < length; i++) {
+ if ((options = arguments[i]) != null) {
+ for (name in options) {
+ src = target[name];
+ copy = options[name];
+ if (target === copy) {
+ continue;
+ }
+ if (copy && (isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) {
+ if (copyIsArray) {
+ copyIsArray = false;
+ clone = src && Array.isArray(src) ? src : [];
+ } else {
+ clone = src && isPlainObject(src) ? src : {};
+ }
+ target[name] = deepAssign(clone, copy);
+ } else if (copy !== undefined) {
+ target[name] = copy;
+ }
+ }
+ }
+ }
+ return target;
+ }
+ module.exports = deepAssign;
+});
\ No newline at end of file
diff --git a/dist/amd/js/dev/dev.js b/dist/amd/js/dev/dev.js
new file mode 100644
index 00000000..1719c3a2
--- /dev/null
+++ b/dist/amd/js/dev/dev.js
@@ -0,0 +1,10 @@
+/*can-util@3.11.2#js/dev/dev*/
+define([
+ 'require',
+ 'exports',
+ 'module',
+ 'can-log/dev'
+], function (require, exports, module) {
+ 'use strict';
+ module.exports = require('can-log/dev');
+});
\ No newline at end of file
diff --git a/dist/amd/js/diff/diff.js b/dist/amd/js/diff/diff.js
new file mode 100644
index 00000000..cf6b84e5
--- /dev/null
+++ b/dist/amd/js/diff/diff.js
@@ -0,0 +1,73 @@
+/*can-util@3.11.2#js/diff/diff*/
+define(function (require, exports, module) {
+ 'use strict';
+ var slice = [].slice;
+ var defaultIdentity = function (a, b) {
+ return a === b;
+ };
+ function reverseDiff(oldDiffStopIndex, newDiffStopIndex, oldList, newList, identity) {
+ var oldIndex = oldList.length - 1, newIndex = newList.length - 1;
+ while (oldIndex > oldDiffStopIndex && newIndex > newDiffStopIndex) {
+ var oldItem = oldList[oldIndex], newItem = newList[newIndex];
+ if (identity(oldItem, newItem)) {
+ oldIndex--;
+ newIndex--;
+ continue;
+ } else {
+ return [{
+ index: newDiffStopIndex,
+ deleteCount: oldIndex - oldDiffStopIndex + 1,
+ insert: slice.call(newList, newDiffStopIndex, newIndex + 1)
+ }];
+ }
+ }
+ return [{
+ index: newDiffStopIndex,
+ deleteCount: oldIndex - oldDiffStopIndex + 1,
+ insert: slice.call(newList, newDiffStopIndex, newIndex + 1)
+ }];
+ }
+ module.exports = exports = function (oldList, newList, identity) {
+ identity = identity || defaultIdentity;
+ var oldIndex = 0, newIndex = 0, oldLength = oldList.length, newLength = newList.length, patches = [];
+ while (oldIndex < oldLength && newIndex < newLength) {
+ var oldItem = oldList[oldIndex], newItem = newList[newIndex];
+ if (identity(oldItem, newItem)) {
+ oldIndex++;
+ newIndex++;
+ continue;
+ }
+ if (newIndex + 1 < newLength && identity(oldItem, newList[newIndex + 1])) {
+ patches.push({
+ index: newIndex,
+ deleteCount: 0,
+ insert: [newList[newIndex]]
+ });
+ oldIndex++;
+ newIndex += 2;
+ continue;
+ } else if (oldIndex + 1 < oldLength && identity(oldList[oldIndex + 1], newItem)) {
+ patches.push({
+ index: newIndex,
+ deleteCount: 1,
+ insert: []
+ });
+ oldIndex += 2;
+ newIndex++;
+ continue;
+ } else {
+ patches.push.apply(patches, reverseDiff(oldIndex, newIndex, oldList, newList, identity));
+ return patches;
+ }
+ }
+ if (newIndex === newLength && oldIndex === oldLength) {
+ return patches;
+ }
+ patches.push({
+ index: newIndex,
+ deleteCount: oldLength - oldIndex,
+ insert: slice.call(newList, newIndex)
+ });
+ return patches;
+ };
+});
\ No newline at end of file
diff --git a/dist/amd/js/each/each.js b/dist/amd/js/each/each.js
new file mode 100644
index 00000000..4d2248a6
--- /dev/null
+++ b/dist/amd/js/each/each.js
@@ -0,0 +1,43 @@
+/*can-util@3.11.2#js/each/each*/
+define([
+ 'require',
+ 'exports',
+ 'module',
+ '../is-array-like/is-array-like',
+ '../is-iterable/is-iterable',
+ 'can-symbol'
+], function (require, exports, module) {
+ 'use strict';
+ var isArrayLike = require('../is-array-like/is-array-like');
+ var has = Object.prototype.hasOwnProperty;
+ var isIterable = require('../is-iterable/is-iterable');
+ var canSymbol = require('can-symbol');
+ function each(elements, callback, context) {
+ var i = 0, key, len, item;
+ if (elements) {
+ if (isArrayLike(elements)) {
+ for (len = elements.length; i < len; i++) {
+ item = elements[i];
+ if (callback.call(context || item, item, i, elements) === false) {
+ break;
+ }
+ }
+ } else if (isIterable(elements)) {
+ var iter = elements[canSymbol.iterator || canSymbol.for('iterator')]();
+ var res, value;
+ while (!(res = iter.next()).done) {
+ value = res.value;
+ callback.call(context || elements, Array.isArray(value) ? value[1] : value, value[0]);
+ }
+ } else if (typeof elements === 'object') {
+ for (key in elements) {
+ if (has.call(elements, key) && callback.call(context || elements[key], elements[key], key, elements) === false) {
+ break;
+ }
+ }
+ }
+ }
+ return elements;
+ }
+ module.exports = each;
+});
\ No newline at end of file
diff --git a/dist/amd/js/get/get.js b/dist/amd/js/get/get.js
new file mode 100644
index 00000000..b6883c3a
--- /dev/null
+++ b/dist/amd/js/get/get.js
@@ -0,0 +1,23 @@
+/*can-util@3.11.2#js/get/get*/
+define([
+ 'require',
+ 'exports',
+ 'module',
+ '../is-container/is-container'
+], function (require, exports, module) {
+ 'use strict';
+ var isContainer = require('../is-container/is-container');
+ function get(obj, name) {
+ var parts = typeof name !== 'undefined' ? (name + '').replace(/\[/g, '.').replace(/]/g, '').split('.') : [], length = parts.length, current, i, container;
+ if (!length) {
+ return obj;
+ }
+ current = obj;
+ for (i = 0; i < length && isContainer(current); i++) {
+ container = current;
+ current = container[parts[i]];
+ }
+ return current;
+ }
+ module.exports = get;
+});
\ No newline at end of file
diff --git a/dist/amd/js/global/global.js b/dist/amd/js/global/global.js
new file mode 100644
index 00000000..66185256
--- /dev/null
+++ b/dist/amd/js/global/global.js
@@ -0,0 +1,14 @@
+/*can-util@3.11.2#js/global/global*/
+define([
+ 'require',
+ 'exports',
+ 'module',
+ 'can-globals/global'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ module.exports = require('can-globals/global');
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
\ No newline at end of file
diff --git a/dist/amd/js/import/import.js b/dist/amd/js/import/import.js
new file mode 100644
index 00000000..c897edc8
--- /dev/null
+++ b/dist/amd/js/import/import.js
@@ -0,0 +1,39 @@
+/*can-util@3.11.2#js/import/import*/
+define([
+ 'require',
+ 'exports',
+ 'module',
+ '../is-function/is-function',
+ 'can-globals/global'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ var isFunction = require('../is-function/is-function');
+ var global = require('can-globals/global')();
+ module.exports = function (moduleName, parentName) {
+ return new Promise(function (resolve, reject) {
+ try {
+ if (typeof global.System === 'object' && isFunction(global.System['import'])) {
+ global.System['import'](moduleName, { name: parentName }).then(resolve, reject);
+ } else if (global.define && global.define.amd) {
+ global.require([moduleName], function (value) {
+ resolve(value);
+ });
+ } else if (global.require) {
+ resolve(global.require(moduleName));
+ } else {
+ if (typeof stealRequire !== 'undefined') {
+ steal.import(moduleName, { name: parentName }).then(resolve, reject);
+ } else {
+ resolve();
+ }
+ }
+ } catch (err) {
+ reject(err);
+ }
+ });
+ };
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
\ No newline at end of file
diff --git a/dist/amd/js/is-array-like/is-array-like.js b/dist/amd/js/is-array-like/is-array-like.js
new file mode 100644
index 00000000..acece7b9
--- /dev/null
+++ b/dist/amd/js/is-array-like/is-array-like.js
@@ -0,0 +1,15 @@
+/*can-util@3.11.2#js/is-array-like/is-array-like*/
+define(function (require, exports, module) {
+ 'use strict';
+ function isArrayLike(obj) {
+ var type = typeof obj;
+ if (type === 'string') {
+ return true;
+ } else if (type === 'number') {
+ return false;
+ }
+ var length = obj && type !== 'boolean' && typeof obj !== 'number' && 'length' in obj && obj.length;
+ return typeof obj !== 'function' && (length === 0 || typeof length === 'number' && length > 0 && length - 1 in obj);
+ }
+ module.exports = isArrayLike;
+});
\ No newline at end of file
diff --git a/dist/amd/js/is-array/is-array.js b/dist/amd/js/is-array/is-array.js
new file mode 100644
index 00000000..360aab7d
--- /dev/null
+++ b/dist/amd/js/is-array/is-array.js
@@ -0,0 +1,14 @@
+/*can-util@3.11.2#js/is-array/is-array*/
+define([
+ 'require',
+ 'exports',
+ 'module',
+ 'can-log/dev'
+], function (require, exports, module) {
+ 'use strict';
+ var dev = require('can-log/dev');
+ var hasWarned = false;
+ module.exports = function (arr) {
+ return Array.isArray(arr);
+ };
+});
\ No newline at end of file
diff --git a/dist/amd/js/is-browser-window/is-browser-window.js b/dist/amd/js/is-browser-window/is-browser-window.js
new file mode 100644
index 00000000..d0572fc2
--- /dev/null
+++ b/dist/amd/js/is-browser-window/is-browser-window.js
@@ -0,0 +1,14 @@
+/*can-util@3.11.2#js/is-browser-window/is-browser-window*/
+define([
+ 'require',
+ 'exports',
+ 'module',
+ 'can-globals/is-browser-window'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ module.exports = require('can-globals/is-browser-window');
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
\ No newline at end of file
diff --git a/dist/amd/js/is-container/is-container.js b/dist/amd/js/is-container/is-container.js
new file mode 100644
index 00000000..215fcf56
--- /dev/null
+++ b/dist/amd/js/is-container/is-container.js
@@ -0,0 +1,7 @@
+/*can-util@3.11.2#js/is-container/is-container*/
+define(function (require, exports, module) {
+ 'use strict';
+ module.exports = function (current) {
+ return /^f|^o/.test(typeof current);
+ };
+});
\ No newline at end of file
diff --git a/dist/amd/js/is-empty-object/is-empty-object.js b/dist/amd/js/is-empty-object/is-empty-object.js
new file mode 100644
index 00000000..d561fa42
--- /dev/null
+++ b/dist/amd/js/is-empty-object/is-empty-object.js
@@ -0,0 +1,10 @@
+/*can-util@3.11.2#js/is-empty-object/is-empty-object*/
+define(function (require, exports, module) {
+ 'use strict';
+ module.exports = function (obj) {
+ for (var prop in obj) {
+ return false;
+ }
+ return true;
+ };
+});
\ No newline at end of file
diff --git a/dist/amd/js/is-function/is-function.js b/dist/amd/js/is-function/is-function.js
new file mode 100644
index 00000000..b4bdf982
--- /dev/null
+++ b/dist/amd/js/is-function/is-function.js
@@ -0,0 +1,15 @@
+/*can-util@3.11.2#js/is-function/is-function*/
+define(function (require, exports, module) {
+ 'use strict';
+ var isFunction = function () {
+ if (typeof document !== 'undefined' && typeof document.getElementsByTagName('body') === 'function') {
+ return function (value) {
+ return Object.prototype.toString.call(value) === '[object Function]';
+ };
+ }
+ return function (value) {
+ return typeof value === 'function';
+ };
+ }();
+ module.exports = isFunction;
+});
\ No newline at end of file
diff --git a/dist/amd/js/is-iterable/is-iterable.js b/dist/amd/js/is-iterable/is-iterable.js
new file mode 100644
index 00000000..43ed000b
--- /dev/null
+++ b/dist/amd/js/is-iterable/is-iterable.js
@@ -0,0 +1,13 @@
+/*can-util@3.11.2#js/is-iterable/is-iterable*/
+define([
+ 'require',
+ 'exports',
+ 'module',
+ 'can-symbol'
+], function (require, exports, module) {
+ 'use strict';
+ var canSymbol = require('can-symbol');
+ module.exports = function (obj) {
+ return obj && !!obj[canSymbol.iterator || canSymbol.for('iterator')];
+ };
+});
\ No newline at end of file
diff --git a/dist/amd/js/is-node/is-node.js b/dist/amd/js/is-node/is-node.js
new file mode 100644
index 00000000..a20b22f8
--- /dev/null
+++ b/dist/amd/js/is-node/is-node.js
@@ -0,0 +1,11 @@
+/*can-util@3.11.2#js/is-node/is-node*/
+define(function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ module.exports = function () {
+ return typeof process === 'object' && {}.toString.call(process) === '[object process]';
+ };
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
\ No newline at end of file
diff --git a/dist/amd/js/is-plain-object/is-plain-object.js b/dist/amd/js/is-plain-object/is-plain-object.js
new file mode 100644
index 00000000..218787ab
--- /dev/null
+++ b/dist/amd/js/is-plain-object/is-plain-object.js
@@ -0,0 +1,25 @@
+/*can-util@3.11.2#js/is-plain-object/is-plain-object*/
+define(function (require, exports, module) {
+ 'use strict';
+ var core_hasOwn = Object.prototype.hasOwnProperty;
+ function isWindow(obj) {
+ return obj !== null && obj == obj.window;
+ }
+ function isPlainObject(obj) {
+ if (!obj || typeof obj !== 'object' || obj.nodeType || isWindow(obj) || obj.constructor && obj.constructor.shortName) {
+ return false;
+ }
+ try {
+ if (obj.constructor && !core_hasOwn.call(obj, 'constructor') && !core_hasOwn.call(obj.constructor.prototype, 'isPrototypeOf')) {
+ return false;
+ }
+ } catch (e) {
+ return false;
+ }
+ var key;
+ for (key in obj) {
+ }
+ return key === undefined || core_hasOwn.call(obj, key);
+ }
+ module.exports = isPlainObject;
+});
\ No newline at end of file
diff --git a/dist/amd/js/is-promise/is-promise.js b/dist/amd/js/is-promise/is-promise.js
new file mode 100644
index 00000000..058e4582
--- /dev/null
+++ b/dist/amd/js/is-promise/is-promise.js
@@ -0,0 +1,13 @@
+/*can-util@3.11.2#js/is-promise/is-promise*/
+define([
+ 'require',
+ 'exports',
+ 'module',
+ 'can-reflect'
+], function (require, exports, module) {
+ 'use strict';
+ var canReflect = require('can-reflect');
+ module.exports = function (obj) {
+ return canReflect.isPromise(obj);
+ };
+});
\ No newline at end of file
diff --git a/dist/amd/js/is-string/is-string.js b/dist/amd/js/is-string/is-string.js
new file mode 100644
index 00000000..2d89d78f
--- /dev/null
+++ b/dist/amd/js/is-string/is-string.js
@@ -0,0 +1,14 @@
+/*can-util@3.11.2#js/is-string/is-string*/
+define([
+ 'require',
+ 'exports',
+ 'module',
+ 'can-log/dev'
+], function (require, exports, module) {
+ 'use strict';
+ var dev = require('can-log/dev');
+ var hasWarned = false;
+ module.exports = function isString(obj) {
+ return typeof obj === 'string';
+ };
+});
\ No newline at end of file
diff --git a/dist/amd/js/is-web-worker/is-web-worker.js b/dist/amd/js/is-web-worker/is-web-worker.js
new file mode 100644
index 00000000..ac0191dc
--- /dev/null
+++ b/dist/amd/js/is-web-worker/is-web-worker.js
@@ -0,0 +1,11 @@
+/*can-util@3.11.2#js/is-web-worker/is-web-worker*/
+define(function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ module.exports = function () {
+ return typeof WorkerGlobalScope !== 'undefined' && this instanceof WorkerGlobalScope;
+ };
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
\ No newline at end of file
diff --git a/dist/amd/js/join-uris/join-uris.js b/dist/amd/js/join-uris/join-uris.js
new file mode 100644
index 00000000..0d91995b
--- /dev/null
+++ b/dist/amd/js/join-uris/join-uris.js
@@ -0,0 +1,26 @@
+/*can-util@3.11.2#js/join-uris/join-uris*/
+define([
+ 'require',
+ 'exports',
+ 'module',
+ 'can-parse-uri'
+], function (require, exports, module) {
+ 'use strict';
+ var parseURI = require('can-parse-uri');
+ module.exports = function (base, href) {
+ function removeDotSegments(input) {
+ var output = [];
+ input.replace(/^(\.\.?(\/|$))+/, '').replace(/\/(\.(\/|$))+/g, '/').replace(/\/\.\.$/, '/../').replace(/\/?[^\/]*/g, function (p) {
+ if (p === '/..') {
+ output.pop();
+ } else {
+ output.push(p);
+ }
+ });
+ return output.join('').replace(/^\//, input.charAt(0) === '/' ? '/' : '');
+ }
+ href = parseURI(href || '');
+ base = parseURI(base || '');
+ return !href || !base ? null : (href.protocol || base.protocol) + (href.protocol || href.authority ? href.authority : base.authority) + removeDotSegments(href.protocol || href.authority || href.pathname.charAt(0) === '/' ? href.pathname : href.pathname ? (base.authority && !base.pathname ? '/' : '') + base.pathname.slice(0, base.pathname.lastIndexOf('/') + 1) + href.pathname : base.pathname) + (href.protocol || href.authority || href.pathname ? href.search : href.search || base.search) + href.hash;
+ };
+});
\ No newline at end of file
diff --git a/dist/amd/js/js.js b/dist/amd/js/js.js
new file mode 100644
index 00000000..59f791d3
--- /dev/null
+++ b/dist/amd/js/js.js
@@ -0,0 +1,64 @@
+/*can-util@3.11.2#js/js*/
+define([
+ 'require',
+ 'exports',
+ 'module',
+ 'can-assign',
+ 'can-cid',
+ './deep-assign/deep-assign',
+ './dev/dev',
+ './diff/diff',
+ './each/each',
+ './global/global',
+ './import/import',
+ './is-array/is-array',
+ './is-array-like/is-array-like',
+ './is-browser-window/is-browser-window',
+ './is-empty-object/is-empty-object',
+ './is-function/is-function',
+ './is-node/is-node',
+ './is-plain-object/is-plain-object',
+ './is-promise/is-promise',
+ './is-string/is-string',
+ './is-web-worker/is-web-worker',
+ './join-uris/join-uris',
+ './last/last',
+ './make-array/make-array',
+ './omit/omit',
+ './set-immediate/set-immediate',
+ './string/string',
+ 'can-types'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ module.exports = {
+ assign: require('can-assign'),
+ cid: require('can-cid'),
+ deepAssign: require('./deep-assign/deep-assign'),
+ dev: require('./dev/dev'),
+ diff: require('./diff/diff'),
+ each: require('./each/each'),
+ global: require('./global/global'),
+ 'import': require('./import/import'),
+ isArray: require('./is-array/is-array'),
+ isArrayLike: require('./is-array-like/is-array-like'),
+ isBrowserWindow: require('./is-browser-window/is-browser-window'),
+ isEmptyObject: require('./is-empty-object/is-empty-object'),
+ isFunction: require('./is-function/is-function'),
+ isNode: require('./is-node/is-node'),
+ isPlainObject: require('./is-plain-object/is-plain-object'),
+ isPromise: require('./is-promise/is-promise'),
+ isString: require('./is-string/is-string'),
+ isWebWorker: require('./is-web-worker/is-web-worker'),
+ joinURIs: require('./join-uris/join-uris'),
+ last: require('./last/last'),
+ makeArray: require('./make-array/make-array'),
+ omit: require('./omit/omit'),
+ setImmediate: require('./set-immediate/set-immediate'),
+ string: require('./string/string'),
+ types: require('can-types')
+ };
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
\ No newline at end of file
diff --git a/dist/amd/js/last/last.js b/dist/amd/js/last/last.js
new file mode 100644
index 00000000..d9b96bd4
--- /dev/null
+++ b/dist/amd/js/last/last.js
@@ -0,0 +1,7 @@
+/*can-util@3.11.2#js/last/last*/
+define(function (require, exports, module) {
+ 'use strict';
+ module.exports = function (arr) {
+ return arr && arr[arr.length - 1];
+ };
+});
\ No newline at end of file
diff --git a/dist/amd/js/make-array/make-array.js b/dist/amd/js/make-array/make-array.js
new file mode 100644
index 00000000..9bee8b1f
--- /dev/null
+++ b/dist/amd/js/make-array/make-array.js
@@ -0,0 +1,24 @@
+/*can-util@3.11.2#js/make-array/make-array*/
+define([
+ 'require',
+ 'exports',
+ 'module',
+ '../each/each',
+ '../is-array-like/is-array-like'
+], function (require, exports, module) {
+ 'use strict';
+ var each = require('../each/each');
+ var isArrayLike = require('../is-array-like/is-array-like');
+ function makeArray(element) {
+ var ret = [];
+ if (isArrayLike(element)) {
+ each(element, function (a, i) {
+ ret[i] = a;
+ });
+ } else if (element === 0 || element) {
+ ret.push(element);
+ }
+ return ret;
+ }
+ module.exports = makeArray;
+});
\ No newline at end of file
diff --git a/dist/amd/js/omit/omit.js b/dist/amd/js/omit/omit.js
new file mode 100644
index 00000000..a815c39a
--- /dev/null
+++ b/dist/amd/js/omit/omit.js
@@ -0,0 +1,13 @@
+/*can-util@3.11.2#js/omit/omit*/
+define(function (require, exports, module) {
+ 'use strict';
+ module.exports = function (source, propsToOmit) {
+ var result = {};
+ for (var prop in source) {
+ if (propsToOmit.indexOf(prop) < 0) {
+ result[prop] = source[prop];
+ }
+ }
+ return result;
+ };
+});
\ No newline at end of file
diff --git a/dist/amd/js/set-immediate/set-immediate.js b/dist/amd/js/set-immediate/set-immediate.js
new file mode 100644
index 00000000..6673f8d8
--- /dev/null
+++ b/dist/amd/js/set-immediate/set-immediate.js
@@ -0,0 +1,17 @@
+/*can-util@3.11.2#js/set-immediate/set-immediate*/
+define([
+ 'require',
+ 'exports',
+ 'module',
+ 'can-globals/global'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ var global = require('can-globals/global')();
+ module.exports = global.setImmediate || function (cb) {
+ return setTimeout(cb, 0);
+ };
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
\ No newline at end of file
diff --git a/dist/amd/js/string/string.js b/dist/amd/js/string/string.js
new file mode 100644
index 00000000..8ed71505
--- /dev/null
+++ b/dist/amd/js/string/string.js
@@ -0,0 +1,94 @@
+/*can-util@3.11.2#js/string/string*/
+define([
+ 'require',
+ 'exports',
+ 'module',
+ '../get/get',
+ '../is-container/is-container',
+ 'can-log/dev',
+ '../is-array/is-array'
+], function (require, exports, module) {
+ 'use strict';
+ var get = require('../get/get');
+ var isContainer = require('../is-container/is-container');
+ var canDev = require('can-log/dev');
+ var isArray = require('../is-array/is-array');
+ var strUndHash = /_|-/, strColons = /\=\=/, strWords = /([A-Z]+)([A-Z][a-z])/g, strLowUp = /([a-z\d])([A-Z])/g, strDash = /([a-z\d])([A-Z])/g, strReplacer = /\{([^\}]+)\}/g, strQuote = /"/g, strSingleQuote = /'/g, strHyphenMatch = /-+(.)?/g, strCamelMatch = /[a-z][A-Z]/g, convertBadValues = function (content) {
+ var isInvalid = content === null || content === undefined || isNaN(content) && '' + content === 'NaN';
+ return '' + (isInvalid ? '' : content);
+ }, deleteAtPath = function (data, path) {
+ var parts = path ? path.replace(/\[/g, '.').replace(/]/g, '').split('.') : [];
+ var current = data;
+ for (var i = 0; i < parts.length - 1; i++) {
+ if (current) {
+ current = current[parts[i]];
+ }
+ }
+ if (current) {
+ delete current[parts[parts.length - 1]];
+ }
+ };
+ var string = {
+ esc: function (content) {
+ return convertBadValues(content).replace(/&/g, '&').replace(//g, '>').replace(strQuote, '"').replace(strSingleQuote, ''');
+ },
+ getObject: function (name, roots) {
+ roots = isArray(roots) ? roots : [roots || window];
+ var result, l = roots.length;
+ for (var i = 0; i < l; i++) {
+ result = get(roots[i], name);
+ if (result) {
+ return result;
+ }
+ }
+ },
+ capitalize: function (s, cache) {
+ return s.charAt(0).toUpperCase() + s.slice(1);
+ },
+ camelize: function (str) {
+ return convertBadValues(str).replace(strHyphenMatch, function (match, chr) {
+ return chr ? chr.toUpperCase() : '';
+ });
+ },
+ hyphenate: function (str) {
+ return convertBadValues(str).replace(strCamelMatch, function (str, offset) {
+ return str.charAt(0) + '-' + str.charAt(1).toLowerCase();
+ });
+ },
+ underscore: function (s) {
+ return s.replace(strColons, '/').replace(strWords, '$1_$2').replace(strLowUp, '$1_$2').replace(strDash, '_').toLowerCase();
+ },
+ sub: function (str, data, remove) {
+ var obs = [];
+ str = str || '';
+ obs.push(str.replace(strReplacer, function (whole, inside) {
+ var ob = get(data, inside);
+ if (remove === true) {
+ deleteAtPath(data, inside);
+ }
+ if (ob === undefined || ob === null) {
+ obs = null;
+ return '';
+ }
+ if (isContainer(ob) && obs) {
+ obs.push(ob);
+ return '';
+ }
+ return '' + ob;
+ }));
+ return obs === null ? obs : obs.length <= 1 ? obs[0] : obs;
+ },
+ replaceWith: function (str, data, replacer, shouldRemoveMatchedPaths) {
+ return str.replace(strReplacer, function (whole, path) {
+ var value = get(data, path);
+ if (shouldRemoveMatchedPaths) {
+ deleteAtPath(data, path);
+ }
+ return replacer(path, value);
+ });
+ },
+ replacer: strReplacer,
+ undHash: strUndHash
+ };
+ module.exports = string;
+});
\ No newline at end of file
diff --git a/dist/global/can-util.js b/dist/global/can-util.js
new file mode 100644
index 00000000..a06de77b
--- /dev/null
+++ b/dist/global/can-util.js
@@ -0,0 +1,4538 @@
+/*[global-shim-start]*/
+(function(exports, global, doEval) {
+ // jshint ignore:line
+ var origDefine = global.define;
+
+ var get = function(name) {
+ var parts = name.split("."),
+ cur = global,
+ i;
+ for (i = 0; i < parts.length; i++) {
+ if (!cur) {
+ break;
+ }
+ cur = cur[parts[i]];
+ }
+ return cur;
+ };
+ var set = function(name, val) {
+ var parts = name.split("."),
+ cur = global,
+ i,
+ part,
+ next;
+ for (i = 0; i < parts.length - 1; i++) {
+ part = parts[i];
+ next = cur[part];
+ if (!next) {
+ next = cur[part] = {};
+ }
+ cur = next;
+ }
+ part = parts[parts.length - 1];
+ cur[part] = val;
+ };
+ var useDefault = function(mod) {
+ if (!mod || !mod.__esModule) return false;
+ var esProps = { __esModule: true, default: true };
+ for (var p in mod) {
+ if (!esProps[p]) return false;
+ }
+ return true;
+ };
+
+ var hasCjsDependencies = function(deps) {
+ return (
+ deps[0] === "require" && deps[1] === "exports" && deps[2] === "module"
+ );
+ };
+
+ var modules =
+ (global.define && global.define.modules) ||
+ (global._define && global._define.modules) ||
+ {};
+ var ourDefine = (global.define = function(moduleName, deps, callback) {
+ var module;
+ if (typeof deps === "function") {
+ callback = deps;
+ deps = [];
+ }
+ var args = [],
+ i;
+ for (i = 0; i < deps.length; i++) {
+ args.push(
+ exports[deps[i]]
+ ? get(exports[deps[i]])
+ : modules[deps[i]] || get(deps[i])
+ );
+ }
+ // CJS has no dependencies but 3 callback arguments
+ if (hasCjsDependencies(deps) || (!deps.length && callback.length)) {
+ module = { exports: {} };
+ args[0] = function(name) {
+ return exports[name] ? get(exports[name]) : modules[name];
+ };
+ args[1] = module.exports;
+ args[2] = module;
+ } else if (!args[0] && deps[0] === "exports") {
+ // Babel uses the exports and module object.
+ module = { exports: {} };
+ args[0] = module.exports;
+ if (deps[1] === "module") {
+ args[1] = module;
+ }
+ } else if (!args[0] && deps[0] === "module") {
+ args[0] = { id: moduleName };
+ }
+
+ global.define = origDefine;
+ var result = callback ? callback.apply(null, args) : undefined;
+ global.define = ourDefine;
+
+ // Favor CJS module.exports over the return value
+ result = module && module.exports ? module.exports : result;
+ modules[moduleName] = result;
+
+ // Set global exports
+ var globalExport = exports[moduleName];
+ if (globalExport && !get(globalExport)) {
+ if (useDefault(result)) {
+ result = result["default"];
+ }
+ set(globalExport, result);
+ }
+ });
+ global.define.orig = origDefine;
+ global.define.modules = modules;
+ global.define.amd = true;
+ ourDefine("@loader", [], function() {
+ // shim for @@global-helpers
+ var noop = function() {};
+ return {
+ get: function() {
+ return { prepareGlobal: noop, retrieveGlobal: noop };
+ },
+ global: global,
+ __exec: function(__load) {
+ doEval(__load.source, global);
+ }
+ };
+ });
+})(
+ { "can-namespace": "can" },
+ typeof self == "object" && self.Object == Object ? self : window,
+ function(__$source__, __$global__) {
+ // jshint ignore:line
+ eval("(function() { " + __$source__ + " \n }).call(__$global__);");
+ }
+);
+
+/*can-util@3.11.2#js/is-function/is-function*/
+define('can-util/js/is-function/is-function', function (require, exports, module) {
+ 'use strict';
+ var isFunction = function () {
+ if (typeof document !== 'undefined' && typeof document.getElementsByTagName('body') === 'function') {
+ return function (value) {
+ return Object.prototype.toString.call(value) === '[object Function]';
+ };
+ }
+ return function (value) {
+ return typeof value === 'function';
+ };
+ }();
+ module.exports = isFunction;
+});
+/*can-util@3.11.2#js/is-plain-object/is-plain-object*/
+define('can-util/js/is-plain-object/is-plain-object', function (require, exports, module) {
+ 'use strict';
+ var core_hasOwn = Object.prototype.hasOwnProperty;
+ function isWindow(obj) {
+ return obj !== null && obj == obj.window;
+ }
+ function isPlainObject(obj) {
+ if (!obj || typeof obj !== 'object' || obj.nodeType || isWindow(obj) || obj.constructor && obj.constructor.shortName) {
+ return false;
+ }
+ try {
+ if (obj.constructor && !core_hasOwn.call(obj, 'constructor') && !core_hasOwn.call(obj.constructor.prototype, 'isPrototypeOf')) {
+ return false;
+ }
+ } catch (e) {
+ return false;
+ }
+ var key;
+ for (key in obj) {
+ }
+ return key === undefined || core_hasOwn.call(obj, key);
+ }
+ module.exports = isPlainObject;
+});
+/*can-util@3.11.2#js/deep-assign/deep-assign*/
+define('can-util/js/deep-assign/deep-assign', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-util/js/is-function/is-function',
+ 'can-util/js/is-plain-object/is-plain-object'
+], function (require, exports, module) {
+ 'use strict';
+ var isFunction = require('can-util/js/is-function/is-function');
+ var isPlainObject = require('can-util/js/is-plain-object/is-plain-object');
+ function deepAssign() {
+ var options, name, src, copy, copyIsArray, clone, target = arguments[0] || {}, i = 1, length = arguments.length;
+ if (typeof target !== 'object' && !isFunction(target)) {
+ target = {};
+ }
+ if (length === i) {
+ target = this;
+ --i;
+ }
+ for (; i < length; i++) {
+ if ((options = arguments[i]) != null) {
+ for (name in options) {
+ src = target[name];
+ copy = options[name];
+ if (target === copy) {
+ continue;
+ }
+ if (copy && (isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) {
+ if (copyIsArray) {
+ copyIsArray = false;
+ clone = src && Array.isArray(src) ? src : [];
+ } else {
+ clone = src && isPlainObject(src) ? src : {};
+ }
+ target[name] = deepAssign(clone, copy);
+ } else if (copy !== undefined) {
+ target[name] = copy;
+ }
+ }
+ }
+ }
+ return target;
+ }
+ module.exports = deepAssign;
+});
+/*can-util@3.11.2#js/omit/omit*/
+define('can-util/js/omit/omit', function (require, exports, module) {
+ 'use strict';
+ module.exports = function (source, propsToOmit) {
+ var result = {};
+ for (var prop in source) {
+ if (propsToOmit.indexOf(prop) < 0) {
+ result[prop] = source[prop];
+ }
+ }
+ return result;
+ };
+});
+/*can-namespace@1.0.0#can-namespace*/
+define('can-namespace', function (require, exports, module) {
+ module.exports = {};
+});
+/*can-log@1.0.0#can-log*/
+define('can-log', function (require, exports, module) {
+ 'use strict';
+ exports.warnTimeout = 5000;
+ exports.logLevel = 0;
+ exports.warn = function () {
+ var ll = this.logLevel;
+ if (ll < 2) {
+ if (typeof console !== 'undefined' && console.warn) {
+ this._logger('warn', Array.prototype.slice.call(arguments));
+ } else if (typeof console !== 'undefined' && console.log) {
+ this._logger('log', Array.prototype.slice.call(arguments));
+ }
+ }
+ };
+ exports.log = function () {
+ var ll = this.logLevel;
+ if (ll < 1) {
+ if (typeof console !== 'undefined' && console.log) {
+ this._logger('log', Array.prototype.slice.call(arguments));
+ }
+ }
+ };
+ exports.error = function () {
+ var ll = this.logLevel;
+ if (ll < 1) {
+ if (typeof console !== 'undefined' && console.error) {
+ this._logger('error', Array.prototype.slice.call(arguments));
+ }
+ }
+ };
+ exports._logger = function (type, arr) {
+ try {
+ console[type].apply(console, arr);
+ } catch (e) {
+ console[type](arr);
+ }
+ };
+});
+/*can-log@1.0.0#dev/dev*/
+define('can-log/dev/dev', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-log'
+], function (require, exports, module) {
+ 'use strict';
+ var canLog = require('can-log');
+ module.exports = {
+ warnTimeout: 5000,
+ logLevel: 0,
+ stringify: function (value) {
+ var flagUndefined = function flagUndefined(key, value) {
+ return value === undefined ? '/* void(undefined) */' : value;
+ };
+ return JSON.stringify(value, flagUndefined, ' ').replace(/"\/\* void\(undefined\) \*\/"/g, 'undefined');
+ },
+ warn: function () {
+ },
+ log: function () {
+ },
+ error: function () {
+ },
+ _logger: canLog._logger
+ };
+});
+/*can-symbol@1.6.1#can-symbol*/
+define('can-symbol', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-namespace'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ var namespace = require('can-namespace');
+ var CanSymbol;
+ if (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function') {
+ CanSymbol = Symbol;
+ } else {
+ var symbolNum = 0;
+ CanSymbol = function CanSymbolPolyfill(description) {
+ var symbolValue = '@@symbol' + symbolNum++ + description;
+ var symbol = {};
+ Object.defineProperties(symbol, {
+ toString: {
+ value: function () {
+ return symbolValue;
+ }
+ }
+ });
+ return symbol;
+ };
+ var descriptionToSymbol = {};
+ var symbolToDescription = {};
+ CanSymbol.for = function (description) {
+ var symbol = descriptionToSymbol[description];
+ if (!symbol) {
+ symbol = descriptionToSymbol[description] = CanSymbol(description);
+ symbolToDescription[symbol] = description;
+ }
+ return symbol;
+ };
+ CanSymbol.keyFor = function (symbol) {
+ return symbolToDescription[symbol];
+ };
+ [
+ 'hasInstance',
+ 'isConcatSpreadable',
+ 'iterator',
+ 'match',
+ 'prototype',
+ 'replace',
+ 'search',
+ 'species',
+ 'split',
+ 'toPrimitive',
+ 'toStringTag',
+ 'unscopables'
+ ].forEach(function (name) {
+ CanSymbol[name] = CanSymbol('Symbol.' + name);
+ });
+ }
+ [
+ 'isMapLike',
+ 'isListLike',
+ 'isValueLike',
+ 'isFunctionLike',
+ 'getOwnKeys',
+ 'getOwnKeyDescriptor',
+ 'proto',
+ 'getOwnEnumerableKeys',
+ 'hasOwnKey',
+ 'hasKey',
+ 'size',
+ 'getName',
+ 'getIdentity',
+ 'assignDeep',
+ 'updateDeep',
+ 'getValue',
+ 'setValue',
+ 'getKeyValue',
+ 'setKeyValue',
+ 'updateValues',
+ 'addValue',
+ 'removeValues',
+ 'apply',
+ 'new',
+ 'onValue',
+ 'offValue',
+ 'onKeyValue',
+ 'offKeyValue',
+ 'getKeyDependencies',
+ 'getValueDependencies',
+ 'keyHasDependencies',
+ 'valueHasDependencies',
+ 'onKeys',
+ 'onKeysAdded',
+ 'onKeysRemoved',
+ 'onPatches'
+ ].forEach(function (name) {
+ CanSymbol.for('can.' + name);
+ });
+ module.exports = namespace.Symbol = CanSymbol;
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
+/*can-reflect@1.13.3#reflections/helpers*/
+define('can-reflect/reflections/helpers', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-symbol'
+], function (require, exports, module) {
+ var canSymbol = require('can-symbol');
+ module.exports = {
+ makeGetFirstSymbolValue: function (symbolNames) {
+ var symbols = symbolNames.map(function (name) {
+ return canSymbol.for(name);
+ });
+ var length = symbols.length;
+ return function getFirstSymbol(obj) {
+ var index = -1;
+ while (++index < length) {
+ if (obj[symbols[index]] !== undefined) {
+ return obj[symbols[index]];
+ }
+ }
+ };
+ },
+ hasLength: function (list) {
+ var type = typeof list;
+ var length = list && type !== 'boolean' && typeof list !== 'number' && 'length' in list && list.length;
+ return typeof list !== 'function' && (length === 0 || typeof length === 'number' && length > 0 && length - 1 in list);
+ }
+ };
+});
+/*can-reflect@1.13.3#reflections/type/type*/
+define('can-reflect/reflections/type/type', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-symbol',
+ 'can-reflect/reflections/helpers'
+], function (require, exports, module) {
+ var canSymbol = require('can-symbol');
+ var helpers = require('can-reflect/reflections/helpers');
+ var plainFunctionPrototypePropertyNames = Object.getOwnPropertyNames(function () {
+ }.prototype);
+ var plainFunctionPrototypeProto = Object.getPrototypeOf(function () {
+ }.prototype);
+ function isConstructorLike(func) {
+ var value = func[canSymbol.for('can.new')];
+ if (value !== undefined) {
+ return value;
+ }
+ if (typeof func !== 'function') {
+ return false;
+ }
+ var prototype = func.prototype;
+ if (!prototype) {
+ return false;
+ }
+ if (plainFunctionPrototypeProto !== Object.getPrototypeOf(prototype)) {
+ return true;
+ }
+ var propertyNames = Object.getOwnPropertyNames(prototype);
+ if (propertyNames.length === plainFunctionPrototypePropertyNames.length) {
+ for (var i = 0, len = propertyNames.length; i < len; i++) {
+ if (propertyNames[i] !== plainFunctionPrototypePropertyNames[i]) {
+ return true;
+ }
+ }
+ return false;
+ } else {
+ return true;
+ }
+ }
+ var getNewOrApply = helpers.makeGetFirstSymbolValue([
+ 'can.new',
+ 'can.apply'
+ ]);
+ function isFunctionLike(obj) {
+ var result, symbolValue = obj[canSymbol.for('can.isFunctionLike')];
+ if (symbolValue !== undefined) {
+ return symbolValue;
+ }
+ result = getNewOrApply(obj);
+ if (result !== undefined) {
+ return !!result;
+ }
+ return typeof obj === 'function';
+ }
+ function isPrimitive(obj) {
+ var type = typeof obj;
+ if (obj == null || type !== 'function' && type !== 'object') {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ function isBuiltIn(obj) {
+ if (isPrimitive(obj) || Array.isArray(obj) || isPlainObject(obj) || Object.prototype.toString.call(obj) !== '[object Object]' && Object.prototype.toString.call(obj).indexOf('[object ') !== -1) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ function isValueLike(obj) {
+ var symbolValue;
+ if (isPrimitive(obj)) {
+ return true;
+ }
+ symbolValue = obj[canSymbol.for('can.isValueLike')];
+ if (typeof symbolValue !== 'undefined') {
+ return symbolValue;
+ }
+ var value = obj[canSymbol.for('can.getValue')];
+ if (value !== undefined) {
+ return !!value;
+ }
+ }
+ function isMapLike(obj) {
+ if (isPrimitive(obj)) {
+ return false;
+ }
+ var isMapLike = obj[canSymbol.for('can.isMapLike')];
+ if (typeof isMapLike !== 'undefined') {
+ return !!isMapLike;
+ }
+ var value = obj[canSymbol.for('can.getKeyValue')];
+ if (value !== undefined) {
+ return !!value;
+ }
+ return true;
+ }
+ var onValueSymbol = canSymbol.for('can.onValue'), onKeyValueSymbol = canSymbol.for('can.onKeyValue'), onPatchesSymbol = canSymbol.for('can.onPatches');
+ function isObservableLike(obj) {
+ if (isPrimitive(obj)) {
+ return false;
+ }
+ return Boolean(obj[onValueSymbol] || obj[onKeyValueSymbol] || obj[onPatchesSymbol]);
+ }
+ function isListLike(list) {
+ var symbolValue, type = typeof list;
+ if (type === 'string') {
+ return true;
+ }
+ if (isPrimitive(list)) {
+ return false;
+ }
+ symbolValue = list[canSymbol.for('can.isListLike')];
+ if (typeof symbolValue !== 'undefined') {
+ return symbolValue;
+ }
+ var value = list[canSymbol.iterator];
+ if (value !== undefined) {
+ return !!value;
+ }
+ if (Array.isArray(list)) {
+ return true;
+ }
+ return helpers.hasLength(list);
+ }
+ var supportsSymbols = typeof Symbol !== 'undefined' && typeof Symbol.for === 'function';
+ var isSymbolLike;
+ if (supportsSymbols) {
+ isSymbolLike = function (symbol) {
+ return typeof symbol === 'symbol';
+ };
+ } else {
+ var symbolStart = '@@symbol';
+ isSymbolLike = function (symbol) {
+ if (typeof symbol === 'object' && !Array.isArray(symbol)) {
+ return symbol.toString().substr(0, symbolStart.length) === symbolStart;
+ } else {
+ return false;
+ }
+ };
+ }
+ var coreHasOwn = Object.prototype.hasOwnProperty;
+ var funcToString = Function.prototype.toString;
+ var objectCtorString = funcToString.call(Object);
+ function isPlainObject(obj) {
+ if (!obj || typeof obj !== 'object') {
+ return false;
+ }
+ var proto = Object.getPrototypeOf(obj);
+ if (proto === Object.prototype || proto === null) {
+ return true;
+ }
+ var Constructor = coreHasOwn.call(proto, 'constructor') && proto.constructor;
+ return typeof Constructor === 'function' && Constructor instanceof Constructor && funcToString.call(Constructor) === objectCtorString;
+ }
+ module.exports = {
+ isConstructorLike: isConstructorLike,
+ isFunctionLike: isFunctionLike,
+ isListLike: isListLike,
+ isMapLike: isMapLike,
+ isObservableLike: isObservableLike,
+ isPrimitive: isPrimitive,
+ isBuiltIn: isBuiltIn,
+ isValueLike: isValueLike,
+ isSymbolLike: isSymbolLike,
+ isMoreListLikeThanMapLike: function (obj) {
+ if (Array.isArray(obj)) {
+ return true;
+ }
+ if (obj instanceof Array) {
+ return true;
+ }
+ var value = obj[canSymbol.for('can.isMoreListLikeThanMapLike')];
+ if (value !== undefined) {
+ return value;
+ }
+ var isListLike = this.isListLike(obj), isMapLike = this.isMapLike(obj);
+ if (isListLike && !isMapLike) {
+ return true;
+ } else if (!isListLike && isMapLike) {
+ return false;
+ }
+ },
+ isIteratorLike: function (obj) {
+ return obj && typeof obj === 'object' && typeof obj.next === 'function' && obj.next.length === 0;
+ },
+ isPromise: function (obj) {
+ return obj instanceof Promise || Object.prototype.toString.call(obj) === '[object Promise]';
+ },
+ isPlainObject: isPlainObject
+ };
+});
+/*can-reflect@1.13.3#reflections/call/call*/
+define('can-reflect/reflections/call/call', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-symbol',
+ 'can-reflect/reflections/type/type'
+], function (require, exports, module) {
+ var canSymbol = require('can-symbol');
+ var typeReflections = require('can-reflect/reflections/type/type');
+ module.exports = {
+ call: function (func, context) {
+ var args = [].slice.call(arguments, 2);
+ var apply = func[canSymbol.for('can.apply')];
+ if (apply) {
+ return apply.call(func, context, args);
+ } else {
+ return func.apply(context, args);
+ }
+ },
+ apply: function (func, context, args) {
+ var apply = func[canSymbol.for('can.apply')];
+ if (apply) {
+ return apply.call(func, context, args);
+ } else {
+ return func.apply(context, args);
+ }
+ },
+ 'new': function (func) {
+ var args = [].slice.call(arguments, 1);
+ var makeNew = func[canSymbol.for('can.new')];
+ if (makeNew) {
+ return makeNew.apply(func, args);
+ } else {
+ var context = Object.create(func.prototype);
+ var ret = func.apply(context, args);
+ if (typeReflections.isPrimitive(ret)) {
+ return context;
+ } else {
+ return ret;
+ }
+ }
+ }
+ };
+});
+/*can-reflect@1.13.3#reflections/get-set/get-set*/
+define('can-reflect/reflections/get-set/get-set', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-symbol',
+ 'can-reflect/reflections/type/type'
+], function (require, exports, module) {
+ var canSymbol = require('can-symbol');
+ var typeReflections = require('can-reflect/reflections/type/type');
+ var setKeyValueSymbol = canSymbol.for('can.setKeyValue'), getKeyValueSymbol = canSymbol.for('can.getKeyValue'), getValueSymbol = canSymbol.for('can.getValue'), setValueSymbol = canSymbol.for('can.setValue');
+ var reflections = {
+ setKeyValue: function (obj, key, value) {
+ if (typeReflections.isSymbolLike(key)) {
+ if (typeof key === 'symbol') {
+ obj[key] = value;
+ } else {
+ Object.defineProperty(obj, key, {
+ enumerable: false,
+ configurable: true,
+ value: value,
+ writable: true
+ });
+ }
+ return;
+ }
+ var setKeyValue = obj[setKeyValueSymbol];
+ if (setKeyValue !== undefined) {
+ return setKeyValue.call(obj, key, value);
+ } else {
+ obj[key] = value;
+ }
+ },
+ getKeyValue: function (obj, key) {
+ var getKeyValue = obj[getKeyValueSymbol];
+ if (getKeyValue) {
+ return getKeyValue.call(obj, key);
+ }
+ return obj[key];
+ },
+ deleteKeyValue: function (obj, key) {
+ var deleteKeyValue = obj[canSymbol.for('can.deleteKeyValue')];
+ if (deleteKeyValue) {
+ return deleteKeyValue.call(obj, key);
+ }
+ delete obj[key];
+ },
+ getValue: function (value) {
+ if (typeReflections.isPrimitive(value)) {
+ return value;
+ }
+ var getValue = value[getValueSymbol];
+ if (getValue) {
+ return getValue.call(value);
+ }
+ return value;
+ },
+ setValue: function (item, value) {
+ var setValue = item && item[setValueSymbol];
+ if (setValue) {
+ return setValue.call(item, value);
+ } else {
+ throw new Error('can-reflect.setValue - Can not set value.');
+ }
+ },
+ splice: function (obj, index, removing, adding) {
+ var howMany;
+ if (typeof removing !== 'number') {
+ var updateValues = obj[canSymbol.for('can.updateValues')];
+ if (updateValues) {
+ return updateValues.call(obj, index, removing, adding);
+ }
+ howMany = removing.length;
+ } else {
+ howMany = removing;
+ }
+ var splice = obj[canSymbol.for('can.splice')];
+ if (splice) {
+ return splice.call(obj, index, howMany, adding);
+ }
+ return [].splice.apply(obj, [
+ index,
+ howMany
+ ].concat(adding));
+ },
+ addValues: function (obj, adding, index) {
+ var add = obj[canSymbol.for('can.addValues')];
+ if (add) {
+ return add.call(obj, adding, index);
+ }
+ if (Array.isArray(obj) && index === undefined) {
+ return obj.push.apply(obj, adding);
+ }
+ return reflections.splice(obj, index, [], adding);
+ },
+ removeValues: function (obj, removing, index) {
+ var removeValues = obj[canSymbol.for('can.removeValues')];
+ if (removeValues) {
+ return removeValues.call(obj, removing, index);
+ }
+ if (Array.isArray(obj) && index === undefined) {
+ removing.forEach(function (item) {
+ var index = obj.indexOf(item);
+ if (index >= 0) {
+ obj.splice(index, 1);
+ }
+ });
+ return;
+ }
+ return reflections.splice(obj, index, removing, []);
+ }
+ };
+ reflections.get = reflections.getKeyValue;
+ reflections.set = reflections.setKeyValue;
+ reflections['delete'] = reflections.deleteKeyValue;
+ module.exports = reflections;
+});
+/*can-reflect@1.13.3#reflections/observe/observe*/
+define('can-reflect/reflections/observe/observe', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-symbol'
+], function (require, exports, module) {
+ var canSymbol = require('can-symbol');
+ var slice = [].slice;
+ function makeFallback(symbolName, fallbackName) {
+ return function (obj, event, handler, queueName) {
+ var method = obj[canSymbol.for(symbolName)];
+ if (method !== undefined) {
+ return method.call(obj, event, handler, queueName);
+ }
+ return this[fallbackName].apply(this, arguments);
+ };
+ }
+ function makeErrorIfMissing(symbolName, errorMessage) {
+ return function (obj) {
+ var method = obj[canSymbol.for(symbolName)];
+ if (method !== undefined) {
+ var args = slice.call(arguments, 1);
+ return method.apply(obj, args);
+ }
+ throw new Error(errorMessage);
+ };
+ }
+ module.exports = {
+ onKeyValue: makeFallback('can.onKeyValue', 'onEvent'),
+ offKeyValue: makeFallback('can.offKeyValue', 'offEvent'),
+ onKeys: makeErrorIfMissing('can.onKeys', 'can-reflect: can not observe an onKeys event'),
+ onKeysAdded: makeErrorIfMissing('can.onKeysAdded', 'can-reflect: can not observe an onKeysAdded event'),
+ onKeysRemoved: makeErrorIfMissing('can.onKeysRemoved', 'can-reflect: can not unobserve an onKeysRemoved event'),
+ getKeyDependencies: makeErrorIfMissing('can.getKeyDependencies', 'can-reflect: can not determine dependencies'),
+ getWhatIChange: makeErrorIfMissing('can.getWhatIChange', 'can-reflect: can not determine dependencies'),
+ getChangesDependencyRecord: function getChangesDependencyRecord(handler) {
+ var fn = handler[canSymbol.for('can.getChangesDependencyRecord')];
+ if (typeof fn === 'function') {
+ return fn();
+ }
+ },
+ keyHasDependencies: makeErrorIfMissing('can.keyHasDependencies', 'can-reflect: can not determine if this has key dependencies'),
+ onValue: makeErrorIfMissing('can.onValue', 'can-reflect: can not observe value change'),
+ offValue: makeErrorIfMissing('can.offValue', 'can-reflect: can not unobserve value change'),
+ getValueDependencies: makeErrorIfMissing('can.getValueDependencies', 'can-reflect: can not determine dependencies'),
+ valueHasDependencies: makeErrorIfMissing('can.valueHasDependencies', 'can-reflect: can not determine if value has dependencies'),
+ onPatches: makeErrorIfMissing('can.onPatches', 'can-reflect: can not observe patches on object'),
+ offPatches: makeErrorIfMissing('can.offPatches', 'can-reflect: can not unobserve patches on object'),
+ onInstancePatches: makeErrorIfMissing('can.onInstancePatches', 'can-reflect: can not observe onInstancePatches on Type'),
+ offInstancePatches: makeErrorIfMissing('can.offInstancePatches', 'can-reflect: can not unobserve onInstancePatches on Type'),
+ onInstanceBoundChange: makeErrorIfMissing('can.onInstanceBoundChange', 'can-reflect: can not observe bound state change in instances.'),
+ offInstanceBoundChange: makeErrorIfMissing('can.offInstanceBoundChange', 'can-reflect: can not unobserve bound state change'),
+ isBound: makeErrorIfMissing('can.isBound', 'can-reflect: cannot determine if object is bound'),
+ onEvent: function (obj, eventName, callback, queue) {
+ if (obj) {
+ var onEvent = obj[canSymbol.for('can.onEvent')];
+ if (onEvent !== undefined) {
+ return onEvent.call(obj, eventName, callback, queue);
+ } else if (obj.addEventListener) {
+ obj.addEventListener(eventName, callback, queue);
+ }
+ }
+ },
+ offEvent: function (obj, eventName, callback, queue) {
+ if (obj) {
+ var offEvent = obj[canSymbol.for('can.offEvent')];
+ if (offEvent !== undefined) {
+ return offEvent.call(obj, eventName, callback, queue);
+ } else if (obj.removeEventListener) {
+ obj.removeEventListener(eventName, callback, queue);
+ }
+ }
+ },
+ setPriority: function (obj, priority) {
+ if (obj) {
+ var setPriority = obj[canSymbol.for('can.setPriority')];
+ if (setPriority !== undefined) {
+ setPriority.call(obj, priority);
+ return true;
+ }
+ }
+ return false;
+ },
+ getPriority: function (obj) {
+ if (obj) {
+ var getPriority = obj[canSymbol.for('can.getPriority')];
+ if (getPriority !== undefined) {
+ return getPriority.call(obj);
+ }
+ }
+ return undefined;
+ }
+ };
+});
+/*can-reflect@1.13.3#reflections/shape/shape*/
+define('can-reflect/reflections/shape/shape', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-symbol',
+ 'can-reflect/reflections/get-set/get-set',
+ 'can-reflect/reflections/type/type',
+ 'can-reflect/reflections/helpers'
+], function (require, exports, module) {
+ var canSymbol = require('can-symbol');
+ var getSetReflections = require('can-reflect/reflections/get-set/get-set');
+ var typeReflections = require('can-reflect/reflections/type/type');
+ var helpers = require('can-reflect/reflections/helpers');
+ var ArrayMap;
+ if (typeof Map === 'function') {
+ ArrayMap = Map;
+ } else {
+ function isEven(num) {
+ return !(num % 2);
+ }
+ ArrayMap = function () {
+ this.contents = [];
+ };
+ ArrayMap.prototype = {
+ _getIndex: function (key) {
+ var idx;
+ do {
+ idx = this.contents.indexOf(key, idx);
+ } while (idx !== -1 && !isEven(idx));
+ return idx;
+ },
+ has: function (key) {
+ return this._getIndex(key) !== -1;
+ },
+ get: function (key) {
+ var idx = this._getIndex(key);
+ if (idx !== -1) {
+ return this.contents[idx + 1];
+ }
+ },
+ set: function (key, value) {
+ var idx = this._getIndex(key);
+ if (idx !== -1) {
+ this.contents[idx + 1] = value;
+ } else {
+ this.contents.push(key);
+ this.contents.push(value);
+ }
+ }
+ };
+ }
+ var shapeReflections;
+ var shiftFirstArgumentToThis = function (func) {
+ return function () {
+ var args = [this];
+ args.push.apply(args, arguments);
+ return func.apply(null, args);
+ };
+ };
+ var getKeyValueSymbol = canSymbol.for('can.getKeyValue');
+ var shiftedGetKeyValue = shiftFirstArgumentToThis(getSetReflections.getKeyValue);
+ var setKeyValueSymbol = canSymbol.for('can.setKeyValue');
+ var shiftedSetKeyValue = shiftFirstArgumentToThis(getSetReflections.setKeyValue);
+ var sizeSymbol = canSymbol.for('can.size');
+ var serializeMap = null;
+ var hasUpdateSymbol = helpers.makeGetFirstSymbolValue([
+ 'can.updateDeep',
+ 'can.assignDeep',
+ 'can.setKeyValue'
+ ]);
+ var shouldUpdateOrAssign = function (obj) {
+ return typeReflections.isPlainObject(obj) || Array.isArray(obj) || !!hasUpdateSymbol(obj);
+ };
+ function isSerializable(obj) {
+ if (typeReflections.isPrimitive(obj)) {
+ return true;
+ }
+ if (hasUpdateSymbol(obj)) {
+ return false;
+ }
+ return typeReflections.isBuiltIn(obj) && !typeReflections.isPlainObject(obj);
+ }
+ var Object_Keys;
+ try {
+ Object.keys(1);
+ Object_Keys = Object.keys;
+ } catch (e) {
+ Object_Keys = function (obj) {
+ if (typeReflections.isPrimitive(obj)) {
+ return [];
+ } else {
+ return Object.keys(obj);
+ }
+ };
+ }
+ function makeSerializer(methodName, symbolsToCheck) {
+ return function serializer(value, MapType) {
+ if (isSerializable(value)) {
+ return value;
+ }
+ var firstSerialize;
+ if (!serializeMap) {
+ serializeMap = {
+ unwrap: MapType ? new MapType() : new ArrayMap(),
+ serialize: MapType ? new MapType() : new ArrayMap()
+ };
+ firstSerialize = true;
+ }
+ var serialized;
+ if (typeReflections.isValueLike(value)) {
+ serialized = this[methodName](getSetReflections.getValue(value));
+ } else {
+ var isListLike = typeReflections.isIteratorLike(value) || typeReflections.isMoreListLikeThanMapLike(value);
+ serialized = isListLike ? [] : {};
+ if (serializeMap) {
+ if (serializeMap[methodName].has(value)) {
+ return serializeMap[methodName].get(value);
+ } else {
+ serializeMap[methodName].set(value, serialized);
+ }
+ }
+ for (var i = 0, len = symbolsToCheck.length; i < len; i++) {
+ var serializer = value[symbolsToCheck[i]];
+ if (serializer) {
+ var result = serializer.call(value, serialized);
+ if (firstSerialize) {
+ serializeMap = null;
+ }
+ return result;
+ }
+ }
+ if (typeof obj === 'function') {
+ if (serializeMap) {
+ serializeMap[methodName].set(value, value);
+ }
+ serialized = value;
+ } else if (isListLike) {
+ this.eachIndex(value, function (childValue, index) {
+ serialized[index] = this[methodName](childValue);
+ }, this);
+ } else {
+ this.eachKey(value, function (childValue, prop) {
+ serialized[prop] = this[methodName](childValue);
+ }, this);
+ }
+ }
+ if (firstSerialize) {
+ serializeMap = null;
+ }
+ return serialized;
+ };
+ }
+ var makeMap;
+ if (typeof Map !== 'undefined') {
+ makeMap = function (keys) {
+ var map = new Map();
+ shapeReflections.eachIndex(keys, function (key) {
+ map.set(key, true);
+ });
+ return map;
+ };
+ } else {
+ makeMap = function (keys) {
+ var map = {};
+ keys.forEach(function (key) {
+ map[key] = true;
+ });
+ return {
+ get: function (key) {
+ return map[key];
+ },
+ set: function (key, value) {
+ map[key] = value;
+ },
+ keys: function () {
+ return keys;
+ }
+ };
+ };
+ }
+ var fastHasOwnKey = function (obj) {
+ var hasOwnKey = obj[canSymbol.for('can.hasOwnKey')];
+ if (hasOwnKey) {
+ return hasOwnKey.bind(obj);
+ } else {
+ var map = makeMap(shapeReflections.getOwnEnumerableKeys(obj));
+ return function (key) {
+ return map.get(key);
+ };
+ }
+ };
+ function addPatch(patches, patch) {
+ var lastPatch = patches[patches.length - 1];
+ if (lastPatch) {
+ if (lastPatch.deleteCount === lastPatch.insert.length && patch.index - lastPatch.index === lastPatch.deleteCount) {
+ lastPatch.insert.push.apply(lastPatch.insert, patch.insert);
+ lastPatch.deleteCount += patch.deleteCount;
+ return;
+ }
+ }
+ patches.push(patch);
+ }
+ function updateDeepList(target, source, isAssign) {
+ var sourceArray = this.toArray(source);
+ var patches = [], lastIndex = -1;
+ this.eachIndex(target, function (curVal, index) {
+ lastIndex = index;
+ if (index >= sourceArray.length) {
+ if (!isAssign) {
+ addPatch(patches, {
+ index: index,
+ deleteCount: target.length - index + 1,
+ insert: []
+ });
+ }
+ return false;
+ }
+ var newVal = sourceArray[index];
+ if (typeReflections.isPrimitive(curVal) || typeReflections.isPrimitive(newVal) || shouldUpdateOrAssign(curVal) === false) {
+ addPatch(patches, {
+ index: index,
+ deleteCount: 1,
+ insert: [newVal]
+ });
+ } else {
+ this.updateDeep(curVal, newVal);
+ }
+ }, this);
+ if (sourceArray.length > lastIndex) {
+ addPatch(patches, {
+ index: lastIndex + 1,
+ deleteCount: 0,
+ insert: sourceArray.slice(lastIndex + 1)
+ });
+ }
+ for (var i = 0, patchLen = patches.length; i < patchLen; i++) {
+ var patch = patches[i];
+ getSetReflections.splice(target, patch.index, patch.deleteCount, patch.insert);
+ }
+ return target;
+ }
+ shapeReflections = {
+ each: function (obj, callback, context) {
+ if (typeReflections.isIteratorLike(obj) || typeReflections.isMoreListLikeThanMapLike(obj)) {
+ return this.eachIndex(obj, callback, context);
+ } else {
+ return this.eachKey(obj, callback, context);
+ }
+ },
+ eachIndex: function (list, callback, context) {
+ if (Array.isArray(list)) {
+ return this.eachListLike(list, callback, context);
+ } else {
+ var iter, iterator = list[canSymbol.iterator];
+ if (typeReflections.isIteratorLike(list)) {
+ iter = list;
+ } else if (iterator) {
+ iter = iterator.call(list);
+ }
+ if (iter) {
+ var res, index = 0;
+ while (!(res = iter.next()).done) {
+ if (callback.call(context || list, res.value, index++, list) === false) {
+ break;
+ }
+ }
+ } else {
+ this.eachListLike(list, callback, context);
+ }
+ }
+ return list;
+ },
+ eachListLike: function (list, callback, context) {
+ var index = -1;
+ var length = list.length;
+ if (length === undefined) {
+ var size = list[sizeSymbol];
+ if (size) {
+ length = size.call(list);
+ } else {
+ throw new Error('can-reflect: unable to iterate.');
+ }
+ }
+ while (++index < length) {
+ var item = list[index];
+ if (callback.call(context || item, item, index, list) === false) {
+ break;
+ }
+ }
+ return list;
+ },
+ toArray: function (obj) {
+ var arr = [];
+ this.each(obj, function (value) {
+ arr.push(value);
+ });
+ return arr;
+ },
+ eachKey: function (obj, callback, context) {
+ if (obj) {
+ var enumerableKeys = this.getOwnEnumerableKeys(obj);
+ var getKeyValue = obj[getKeyValueSymbol] || shiftedGetKeyValue;
+ return this.eachIndex(enumerableKeys, function (key) {
+ var value = getKeyValue.call(obj, key);
+ return callback.call(context || obj, value, key, obj);
+ });
+ }
+ return obj;
+ },
+ 'hasOwnKey': function (obj, key) {
+ var hasOwnKey = obj[canSymbol.for('can.hasOwnKey')];
+ if (hasOwnKey) {
+ return hasOwnKey.call(obj, key);
+ }
+ var getOwnKeys = obj[canSymbol.for('can.getOwnKeys')];
+ if (getOwnKeys) {
+ var found = false;
+ this.eachIndex(getOwnKeys.call(obj), function (objKey) {
+ if (objKey === key) {
+ found = true;
+ return false;
+ }
+ });
+ return found;
+ }
+ return obj.hasOwnProperty(key);
+ },
+ getOwnEnumerableKeys: function (obj) {
+ var getOwnEnumerableKeys = obj[canSymbol.for('can.getOwnEnumerableKeys')];
+ if (getOwnEnumerableKeys) {
+ return getOwnEnumerableKeys.call(obj);
+ }
+ if (obj[canSymbol.for('can.getOwnKeys')] && obj[canSymbol.for('can.getOwnKeyDescriptor')]) {
+ var keys = [];
+ this.eachIndex(this.getOwnKeys(obj), function (key) {
+ var descriptor = this.getOwnKeyDescriptor(obj, key);
+ if (descriptor.enumerable) {
+ keys.push(key);
+ }
+ }, this);
+ return keys;
+ } else {
+ return Object_Keys(obj);
+ }
+ },
+ getOwnKeys: function (obj) {
+ var getOwnKeys = obj[canSymbol.for('can.getOwnKeys')];
+ if (getOwnKeys) {
+ return getOwnKeys.call(obj);
+ } else {
+ return Object.getOwnPropertyNames(obj);
+ }
+ },
+ getOwnKeyDescriptor: function (obj, key) {
+ var getOwnKeyDescriptor = obj[canSymbol.for('can.getOwnKeyDescriptor')];
+ if (getOwnKeyDescriptor) {
+ return getOwnKeyDescriptor.call(obj, key);
+ } else {
+ return Object.getOwnPropertyDescriptor(obj, key);
+ }
+ },
+ unwrap: makeSerializer('unwrap', [canSymbol.for('can.unwrap')]),
+ serialize: makeSerializer('serialize', [
+ canSymbol.for('can.serialize'),
+ canSymbol.for('can.unwrap')
+ ]),
+ assignMap: function (target, source) {
+ var hasOwnKey = fastHasOwnKey(target);
+ var getKeyValue = target[getKeyValueSymbol] || shiftedGetKeyValue;
+ var setKeyValue = target[setKeyValueSymbol] || shiftedSetKeyValue;
+ this.eachKey(source, function (value, key) {
+ if (!hasOwnKey(key) || getKeyValue.call(target, key) !== value) {
+ setKeyValue.call(target, key, value);
+ }
+ });
+ return target;
+ },
+ assignList: function (target, source) {
+ var inserting = this.toArray(source);
+ getSetReflections.splice(target, 0, inserting, inserting);
+ return target;
+ },
+ assign: function (target, source) {
+ if (typeReflections.isIteratorLike(source) || typeReflections.isMoreListLikeThanMapLike(source)) {
+ this.assignList(target, source);
+ } else {
+ this.assignMap(target, source);
+ }
+ return target;
+ },
+ assignDeepMap: function (target, source) {
+ var hasOwnKey = fastHasOwnKey(target);
+ var getKeyValue = target[getKeyValueSymbol] || shiftedGetKeyValue;
+ var setKeyValue = target[setKeyValueSymbol] || shiftedSetKeyValue;
+ this.eachKey(source, function (newVal, key) {
+ if (!hasOwnKey(key)) {
+ getSetReflections.setKeyValue(target, key, newVal);
+ } else {
+ var curVal = getKeyValue.call(target, key);
+ if (newVal === curVal) {
+ } else if (typeReflections.isPrimitive(curVal) || typeReflections.isPrimitive(newVal) || shouldUpdateOrAssign(curVal) === false) {
+ setKeyValue.call(target, key, newVal);
+ } else {
+ this.assignDeep(curVal, newVal);
+ }
+ }
+ }, this);
+ return target;
+ },
+ assignDeepList: function (target, source) {
+ return updateDeepList.call(this, target, source, true);
+ },
+ assignDeep: function (target, source) {
+ var assignDeep = target[canSymbol.for('can.assignDeep')];
+ if (assignDeep) {
+ assignDeep.call(target, source);
+ } else if (typeReflections.isMoreListLikeThanMapLike(source)) {
+ this.assignDeepList(target, source);
+ } else {
+ this.assignDeepMap(target, source);
+ }
+ return target;
+ },
+ updateMap: function (target, source) {
+ var sourceKeyMap = makeMap(this.getOwnEnumerableKeys(source));
+ var sourceGetKeyValue = source[getKeyValueSymbol] || shiftedGetKeyValue;
+ var targetSetKeyValue = target[setKeyValueSymbol] || shiftedSetKeyValue;
+ this.eachKey(target, function (curVal, key) {
+ if (!sourceKeyMap.get(key)) {
+ getSetReflections.deleteKeyValue(target, key);
+ return;
+ }
+ sourceKeyMap.set(key, false);
+ var newVal = sourceGetKeyValue.call(source, key);
+ if (newVal !== curVal) {
+ targetSetKeyValue.call(target, key, newVal);
+ }
+ }, this);
+ this.eachIndex(sourceKeyMap.keys(), function (key) {
+ if (sourceKeyMap.get(key)) {
+ targetSetKeyValue.call(target, key, sourceGetKeyValue.call(source, key));
+ }
+ });
+ return target;
+ },
+ updateList: function (target, source) {
+ var inserting = this.toArray(source);
+ getSetReflections.splice(target, 0, target, inserting);
+ return target;
+ },
+ update: function (target, source) {
+ if (typeReflections.isIteratorLike(source) || typeReflections.isMoreListLikeThanMapLike(source)) {
+ this.updateList(target, source);
+ } else {
+ this.updateMap(target, source);
+ }
+ return target;
+ },
+ updateDeepMap: function (target, source) {
+ var sourceKeyMap = makeMap(this.getOwnEnumerableKeys(source));
+ var sourceGetKeyValue = source[getKeyValueSymbol] || shiftedGetKeyValue;
+ var targetSetKeyValue = target[setKeyValueSymbol] || shiftedSetKeyValue;
+ this.eachKey(target, function (curVal, key) {
+ if (!sourceKeyMap.get(key)) {
+ getSetReflections.deleteKeyValue(target, key);
+ return;
+ }
+ sourceKeyMap.set(key, false);
+ var newVal = sourceGetKeyValue.call(source, key);
+ if (typeReflections.isPrimitive(curVal) || typeReflections.isPrimitive(newVal) || shouldUpdateOrAssign(curVal) === false) {
+ targetSetKeyValue.call(target, key, newVal);
+ } else {
+ this.updateDeep(curVal, newVal);
+ }
+ }, this);
+ this.eachIndex(sourceKeyMap.keys(), function (key) {
+ if (sourceKeyMap.get(key)) {
+ targetSetKeyValue.call(target, key, sourceGetKeyValue.call(source, key));
+ }
+ });
+ return target;
+ },
+ updateDeepList: function (target, source) {
+ return updateDeepList.call(this, target, source);
+ },
+ updateDeep: function (target, source) {
+ var updateDeep = target[canSymbol.for('can.updateDeep')];
+ if (updateDeep) {
+ updateDeep.call(target, source);
+ } else if (typeReflections.isMoreListLikeThanMapLike(source)) {
+ this.updateDeepList(target, source);
+ } else {
+ this.updateDeepMap(target, source);
+ }
+ return target;
+ },
+ 'hasKey': function (obj, key) {
+ var hasKey = obj[canSymbol.for('can.hasKey')];
+ if (hasKey) {
+ return hasKey.call(obj, key);
+ }
+ var found = shapeReflections.hasOwnKey(obj, key);
+ return found || key in obj;
+ },
+ getAllEnumerableKeys: function () {
+ },
+ getAllKeys: function () {
+ },
+ assignSymbols: function (target, source) {
+ this.eachKey(source, function (value, key) {
+ var symbol = typeReflections.isSymbolLike(canSymbol[key]) ? canSymbol[key] : canSymbol.for(key);
+ getSetReflections.setKeyValue(target, symbol, value);
+ });
+ return target;
+ },
+ isSerializable: isSerializable,
+ size: function (obj) {
+ var size = obj[sizeSymbol];
+ var count = 0;
+ if (size) {
+ return size.call(obj);
+ } else if (helpers.hasLength(obj)) {
+ return obj.length;
+ } else if (typeReflections.isListLike(obj)) {
+ this.each(obj, function () {
+ count++;
+ });
+ return count;
+ } else if (obj) {
+ for (var prop in obj) {
+ if (obj.hasOwnProperty(prop)) {
+ count++;
+ }
+ }
+ return count;
+ } else {
+ return undefined;
+ }
+ },
+ defineInstanceKey: function (cls, key, properties) {
+ var defineInstanceKey = cls[canSymbol.for('can.defineInstanceKey')];
+ if (defineInstanceKey) {
+ return defineInstanceKey.call(cls, key, properties);
+ }
+ var proto = cls.prototype;
+ defineInstanceKey = proto[canSymbol.for('can.defineInstanceKey')];
+ if (defineInstanceKey) {
+ defineInstanceKey.call(proto, key, properties);
+ } else {
+ Object.defineProperty(proto, key, shapeReflections.assign({
+ configurable: true,
+ enumerable: !typeReflections.isSymbolLike(key),
+ writable: true
+ }, properties));
+ }
+ }
+ };
+ shapeReflections.keys = shapeReflections.getOwnEnumerableKeys;
+ module.exports = shapeReflections;
+});
+/*can-reflect@1.13.3#reflections/get-name/get-name*/
+define('can-reflect/reflections/get-name/get-name', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-symbol',
+ 'can-reflect/reflections/type/type'
+], function (require, exports, module) {
+ var canSymbol = require('can-symbol');
+ var typeReflections = require('can-reflect/reflections/type/type');
+ var getNameSymbol = canSymbol.for('can.getName');
+ function setName(obj, nameGetter) {
+ if (typeof nameGetter !== 'function') {
+ var value = nameGetter;
+ nameGetter = function () {
+ return value;
+ };
+ }
+ Object.defineProperty(obj, getNameSymbol, { value: nameGetter });
+ }
+ function getName(obj) {
+ var nameGetter = obj[getNameSymbol];
+ if (nameGetter) {
+ return nameGetter.call(obj);
+ }
+ if (typeof obj === 'function') {
+ return obj.name;
+ }
+ if (obj.constructor && obj !== obj.constructor) {
+ var parent = getName(obj.constructor);
+ if (parent) {
+ if (typeReflections.isValueLike(obj)) {
+ return parent + '<>';
+ }
+ if (typeReflections.isMoreListLikeThanMapLike(obj)) {
+ return parent + '[]';
+ }
+ if (typeReflections.isMapLike(obj)) {
+ return parent + '{}';
+ }
+ }
+ }
+ return undefined;
+ }
+ module.exports = {
+ setName: setName,
+ getName: getName
+ };
+});
+/*can-reflect@1.13.3#types/map*/
+define('can-reflect/types/map', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-reflect/reflections/shape/shape',
+ 'can-symbol'
+], function (require, exports, module) {
+ var shape = require('can-reflect/reflections/shape/shape');
+ var CanSymbol = require('can-symbol');
+ function keysPolyfill() {
+ var keys = [];
+ var currentIndex = 0;
+ this.forEach(function (val, key) {
+ keys.push(key);
+ });
+ return {
+ next: function () {
+ return {
+ value: keys[currentIndex],
+ done: currentIndex++ === keys.length
+ };
+ }
+ };
+ }
+ if (typeof Map !== 'undefined') {
+ shape.assignSymbols(Map.prototype, {
+ 'can.getOwnEnumerableKeys': Map.prototype.keys,
+ 'can.setKeyValue': Map.prototype.set,
+ 'can.getKeyValue': Map.prototype.get,
+ 'can.deleteKeyValue': Map.prototype['delete'],
+ 'can.hasOwnKey': Map.prototype.has
+ });
+ if (typeof Map.prototype.keys !== 'function') {
+ Map.prototype.keys = Map.prototype[CanSymbol.for('can.getOwnEnumerableKeys')] = keysPolyfill;
+ }
+ }
+ if (typeof WeakMap !== 'undefined') {
+ shape.assignSymbols(WeakMap.prototype, {
+ 'can.getOwnEnumerableKeys': function () {
+ throw new Error('can-reflect: WeakMaps do not have enumerable keys.');
+ },
+ 'can.setKeyValue': WeakMap.prototype.set,
+ 'can.getKeyValue': WeakMap.prototype.get,
+ 'can.deleteKeyValue': WeakMap.prototype['delete'],
+ 'can.hasOwnKey': WeakMap.prototype.has
+ });
+ }
+});
+/*can-reflect@1.13.3#types/set*/
+define('can-reflect/types/set', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-reflect/reflections/shape/shape',
+ 'can-symbol'
+], function (require, exports, module) {
+ var shape = require('can-reflect/reflections/shape/shape');
+ var CanSymbol = require('can-symbol');
+ if (typeof Set !== 'undefined') {
+ shape.assignSymbols(Set.prototype, {
+ 'can.isMoreListLikeThanMapLike': true,
+ 'can.updateValues': function (index, removing, adding) {
+ if (removing !== adding) {
+ shape.each(removing, function (value) {
+ this.delete(value);
+ }, this);
+ }
+ shape.each(adding, function (value) {
+ this.add(value);
+ }, this);
+ },
+ 'can.size': function () {
+ return this.size;
+ }
+ });
+ if (typeof Set.prototype[CanSymbol.iterator] !== 'function') {
+ Set.prototype[CanSymbol.iterator] = function () {
+ var arr = [];
+ var currentIndex = 0;
+ this.forEach(function (val) {
+ arr.push(val);
+ });
+ return {
+ next: function () {
+ return {
+ value: arr[currentIndex],
+ done: currentIndex++ === arr.length
+ };
+ }
+ };
+ };
+ }
+ }
+ if (typeof WeakSet !== 'undefined') {
+ shape.assignSymbols(WeakSet.prototype, {
+ 'can.isListLike': true,
+ 'can.isMoreListLikeThanMapLike': true,
+ 'can.updateValues': function (index, removing, adding) {
+ if (removing !== adding) {
+ shape.each(removing, function (value) {
+ this.delete(value);
+ }, this);
+ }
+ shape.each(adding, function (value) {
+ this.add(value);
+ }, this);
+ },
+ 'can.size': function () {
+ throw new Error('can-reflect: WeakSets do not have enumerable keys.');
+ }
+ });
+ }
+});
+/*can-reflect@1.13.3#can-reflect*/
+define('can-reflect', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-reflect/reflections/call/call',
+ 'can-reflect/reflections/get-set/get-set',
+ 'can-reflect/reflections/observe/observe',
+ 'can-reflect/reflections/shape/shape',
+ 'can-reflect/reflections/type/type',
+ 'can-reflect/reflections/get-name/get-name',
+ 'can-namespace',
+ 'can-reflect/types/map',
+ 'can-reflect/types/set'
+], function (require, exports, module) {
+ var functionReflections = require('can-reflect/reflections/call/call');
+ var getSet = require('can-reflect/reflections/get-set/get-set');
+ var observe = require('can-reflect/reflections/observe/observe');
+ var shape = require('can-reflect/reflections/shape/shape');
+ var type = require('can-reflect/reflections/type/type');
+ var getName = require('can-reflect/reflections/get-name/get-name');
+ var namespace = require('can-namespace');
+ var reflect = {};
+ [
+ functionReflections,
+ getSet,
+ observe,
+ shape,
+ type,
+ getName
+ ].forEach(function (reflections) {
+ for (var prop in reflections) {
+ reflect[prop] = reflections[prop];
+ }
+ });
+ require('can-reflect/types/map');
+ require('can-reflect/types/set');
+ module.exports = namespace.Reflect = reflect;
+});
+/*can-globals@1.0.1#can-globals-proto*/
+define('can-globals/can-globals-proto', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-reflect'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ var canReflect = require('can-reflect');
+ function dispatch(key) {
+ var handlers = this.eventHandlers[key];
+ if (handlers) {
+ var handlersCopy = handlers.slice();
+ var value = this.getKeyValue(key);
+ for (var i = 0; i < handlersCopy.length; i++) {
+ handlersCopy[i](value);
+ }
+ }
+ }
+ function Globals() {
+ this.eventHandlers = {};
+ this.properties = {};
+ }
+ Globals.prototype.define = function (key, value, enableCache) {
+ if (enableCache === undefined) {
+ enableCache = true;
+ }
+ if (!this.properties[key]) {
+ this.properties[key] = {
+ default: value,
+ value: value,
+ enableCache: enableCache
+ };
+ }
+ return this;
+ };
+ Globals.prototype.getKeyValue = function (key) {
+ var property = this.properties[key];
+ if (property) {
+ if (typeof property.value === 'function') {
+ if (property.cachedValue) {
+ return property.cachedValue;
+ }
+ if (property.enableCache) {
+ property.cachedValue = property.value();
+ return property.cachedValue;
+ } else {
+ return property.value();
+ }
+ }
+ return property.value;
+ }
+ };
+ Globals.prototype.makeExport = function (key) {
+ return function (value) {
+ if (arguments.length === 0) {
+ return this.getKeyValue(key);
+ }
+ if (typeof value === 'undefined' || value === null) {
+ this.deleteKeyValue(key);
+ } else {
+ if (typeof value === 'function') {
+ this.setKeyValue(key, function () {
+ return value;
+ });
+ } else {
+ this.setKeyValue(key, value);
+ }
+ return value;
+ }
+ }.bind(this);
+ };
+ Globals.prototype.offKeyValue = function (key, handler) {
+ if (this.properties[key]) {
+ var handlers = this.eventHandlers[key];
+ if (handlers) {
+ var i = handlers.indexOf(handler);
+ handlers.splice(i, 1);
+ }
+ }
+ return this;
+ };
+ Globals.prototype.onKeyValue = function (key, handler) {
+ if (this.properties[key]) {
+ if (!this.eventHandlers[key]) {
+ this.eventHandlers[key] = [];
+ }
+ this.eventHandlers[key].push(handler);
+ }
+ return this;
+ };
+ Globals.prototype.deleteKeyValue = function (key) {
+ var property = this.properties[key];
+ if (property !== undefined) {
+ property.value = property.default;
+ property.cachedValue = undefined;
+ dispatch.call(this, key);
+ }
+ return this;
+ };
+ Globals.prototype.setKeyValue = function (key, value) {
+ if (!this.properties[key]) {
+ return this.define(key, value);
+ }
+ var property = this.properties[key];
+ property.value = value;
+ property.cachedValue = undefined;
+ dispatch.call(this, key);
+ return this;
+ };
+ Globals.prototype.reset = function () {
+ for (var key in this.properties) {
+ if (this.properties.hasOwnProperty(key)) {
+ this.properties[key].value = this.properties[key].default;
+ this.properties[key].cachedValue = undefined;
+ dispatch.call(this, key);
+ }
+ }
+ return this;
+ };
+ canReflect.assignSymbols(Globals.prototype, {
+ 'can.getKeyValue': Globals.prototype.getKeyValue,
+ 'can.setKeyValue': Globals.prototype.setKeyValue,
+ 'can.deleteKeyValue': Globals.prototype.deleteKeyValue,
+ 'can.onKeyValue': Globals.prototype.onKeyValue,
+ 'can.offKeyValue': Globals.prototype.offKeyValue
+ });
+ module.exports = Globals;
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
+/*can-globals@1.0.1#can-globals-instance*/
+define('can-globals/can-globals-instance', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-namespace',
+ 'can-globals/can-globals-proto'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ var namespace = require('can-namespace');
+ var Globals = require('can-globals/can-globals-proto');
+ var globals = new Globals();
+ if (namespace.globals) {
+ throw new Error('You can\'t have two versions of can-globals, check your dependencies');
+ } else {
+ module.exports = namespace.globals = globals;
+ }
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
+/*can-globals@1.0.1#global/global*/
+define('can-globals/global/global', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-globals/can-globals-instance'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ var globals = require('can-globals/can-globals-instance');
+ globals.define('global', function () {
+ return typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope ? self : typeof process === 'object' && {}.toString.call(process) === '[object process]' ? global : window;
+ });
+ module.exports = globals.makeExport('global');
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
+/*can-parse-uri@1.0.1#can-parse-uri*/
+define('can-parse-uri', function (require, exports, module) {
+ module.exports = function (url) {
+ var m = String(url).replace(/^\s+|\s+$/g, '').match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);
+ return m ? {
+ href: m[0] || '',
+ protocol: m[1] || '',
+ authority: m[2] || '',
+ host: m[3] || '',
+ hostname: m[4] || '',
+ port: m[5] || '',
+ pathname: m[6] || '',
+ search: m[7] || '',
+ hash: m[8] || ''
+ } : null;
+ };
+});
+/*can-param@1.0.3#can-param*/
+define('can-param', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-namespace'
+], function (require, exports, module) {
+ var namespace = require('can-namespace');
+ function buildParam(prefix, obj, add) {
+ if (Array.isArray(obj)) {
+ for (var i = 0, l = obj.length; i < l; ++i) {
+ add(prefix + '[]', obj[i]);
+ }
+ } else if (obj && typeof obj === 'object') {
+ for (var name in obj) {
+ buildParam(prefix + '[' + name + ']', obj[name], add);
+ }
+ } else {
+ add(prefix, obj);
+ }
+ }
+ module.exports = namespace.param = function param(object) {
+ var pairs = [], add = function (key, value) {
+ pairs.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));
+ };
+ for (var name in object) {
+ buildParam(name, object[name], add);
+ }
+ return pairs.join('&').replace(/%20/g, '+');
+ };
+});
+/*can-ajax@1.1.4#can-ajax*/
+define('can-ajax', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-globals/global/global',
+ 'can-reflect',
+ 'can-namespace',
+ 'can-parse-uri',
+ 'can-param'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ var Global = require('can-globals/global/global');
+ var canReflect = require('can-reflect');
+ var namespace = require('can-namespace');
+ var parseURI = require('can-parse-uri');
+ var param = require('can-param');
+ var xhrs = [
+ function () {
+ return new XMLHttpRequest();
+ },
+ function () {
+ return new ActiveXObject('Microsoft.XMLHTTP');
+ },
+ function () {
+ return new ActiveXObject('MSXML2.XMLHTTP.3.0');
+ },
+ function () {
+ return new ActiveXObject('MSXML2.XMLHTTP');
+ }
+ ], _xhrf = null;
+ var originUrl = parseURI(Global().location.href);
+ var globalSettings = {};
+ var makeXhr = function () {
+ if (_xhrf != null) {
+ return _xhrf();
+ }
+ for (var i = 0, l = xhrs.length; i < l; i++) {
+ try {
+ var f = xhrs[i], req = f();
+ if (req != null) {
+ _xhrf = f;
+ return req;
+ }
+ } catch (e) {
+ continue;
+ }
+ }
+ return function () {
+ };
+ };
+ var contentTypes = {
+ json: 'application/json',
+ form: 'application/x-www-form-urlencoded'
+ };
+ var _xhrResp = function (xhr, options) {
+ switch (options.dataType || xhr.getResponseHeader('Content-Type').split(';')[0]) {
+ case 'text/xml':
+ case 'xml':
+ return xhr.responseXML;
+ case 'text/json':
+ case 'application/json':
+ case 'text/javascript':
+ case 'application/javascript':
+ case 'application/x-javascript':
+ case 'json':
+ return xhr.responseText && JSON.parse(xhr.responseText);
+ default:
+ return xhr.responseText;
+ }
+ };
+ function ajax(o) {
+ var xhr = makeXhr(), timer, n = 0;
+ var deferred = {};
+ var promise = new Promise(function (resolve, reject) {
+ deferred.resolve = resolve;
+ deferred.reject = reject;
+ });
+ var requestUrl;
+ promise.abort = function () {
+ xhr.abort();
+ };
+ o = [
+ {
+ userAgent: 'XMLHttpRequest',
+ lang: 'en',
+ type: 'GET',
+ data: null,
+ dataType: 'json'
+ },
+ globalSettings,
+ o
+ ].reduce(function (a, b, i) {
+ return canReflect.assignDeep(a, b);
+ });
+ if (!o.contentType) {
+ o.contentType = o.type.toUpperCase() === 'GET' ? contentTypes.form : contentTypes.json;
+ }
+ if (o.crossDomain == null) {
+ try {
+ requestUrl = parseURI(o.url);
+ o.crossDomain = !!(requestUrl.protocol && requestUrl.protocol !== originUrl.protocol || requestUrl.host && requestUrl.host !== originUrl.host);
+ } catch (e) {
+ o.crossDomain = true;
+ }
+ }
+ if (o.timeout) {
+ timer = setTimeout(function () {
+ xhr.abort();
+ if (o.timeoutFn) {
+ o.timeoutFn(o.url);
+ }
+ }, o.timeout);
+ }
+ xhr.onreadystatechange = function () {
+ try {
+ if (xhr.readyState === 4) {
+ if (timer) {
+ clearTimeout(timer);
+ }
+ if (xhr.status < 300) {
+ if (o.success) {
+ o.success(_xhrResp(xhr, o));
+ }
+ } else if (o.error) {
+ o.error(xhr, xhr.status, xhr.statusText);
+ }
+ if (o.complete) {
+ o.complete(xhr, xhr.statusText);
+ }
+ if (xhr.status >= 200 && xhr.status < 300) {
+ deferred.resolve(_xhrResp(xhr, o));
+ } else {
+ deferred.reject(xhr);
+ }
+ } else if (o.progress) {
+ o.progress(++n);
+ }
+ } catch (e) {
+ deferred.reject(e);
+ }
+ };
+ var url = o.url, data = null, type = o.type.toUpperCase();
+ var isJsonContentType = o.contentType === contentTypes.json;
+ var isPost = type === 'POST' || type === 'PUT';
+ if (!isPost && o.data) {
+ url += '?' + (isJsonContentType ? JSON.stringify(o.data) : param(o.data));
+ }
+ xhr.open(type, url);
+ var isSimpleCors = o.crossDomain && [
+ 'GET',
+ 'POST',
+ 'HEAD'
+ ].indexOf(type) !== -1;
+ if (isPost) {
+ data = isJsonContentType && !isSimpleCors ? typeof o.data === 'object' ? JSON.stringify(o.data) : o.data : param(o.data);
+ var setContentType = isJsonContentType && !isSimpleCors ? 'application/json' : 'application/x-www-form-urlencoded';
+ xhr.setRequestHeader('Content-Type', setContentType);
+ } else {
+ xhr.setRequestHeader('Content-Type', o.contentType);
+ }
+ if (!isSimpleCors) {
+ xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
+ }
+ if (o.xhrFields) {
+ for (var f in o.xhrFields) {
+ xhr[f] = o.xhrFields[f];
+ }
+ }
+ xhr.send(data);
+ return promise;
+ }
+ module.exports = namespace.ajax = ajax;
+ module.exports.ajaxSetup = function (o) {
+ globalSettings = o || {};
+ };
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
+/*can-util@3.11.2#dom/ajax/ajax*/
+define('can-util/dom/ajax/ajax', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-log/dev/dev',
+ 'can-ajax'
+], function (require, exports, module) {
+ 'use strict';
+ var canDev = require('can-log/dev/dev');
+ module.exports = require('can-ajax');
+});
+/*can-util@3.11.2#js/set-immediate/set-immediate*/
+define('can-util/js/set-immediate/set-immediate', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-globals/global/global'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ var global = require('can-globals/global/global')();
+ module.exports = global.setImmediate || function (cb) {
+ return setTimeout(cb, 0);
+ };
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
+/*can-globals@1.0.1#document/document*/
+define('can-globals/document/document', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-globals/global/global',
+ 'can-globals/can-globals-instance'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ require('can-globals/global/global');
+ var globals = require('can-globals/can-globals-instance');
+ globals.define('document', function () {
+ return globals.getKeyValue('global').document;
+ });
+ module.exports = globals.makeExport('document');
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
+/*can-util@3.11.2#dom/is-of-global-document/is-of-global-document*/
+define('can-util/dom/is-of-global-document/is-of-global-document', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-globals/document/document'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ var getDocument = require('can-globals/document/document');
+ module.exports = function (el) {
+ return (el.ownerDocument || el) === getDocument();
+ };
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
+/*can-cid@1.1.2#can-cid*/
+define('can-cid', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-namespace'
+], function (require, exports, module) {
+ var namespace = require('can-namespace');
+ var _cid = 0;
+ var domExpando = 'can' + new Date();
+ var cid = function (object, name) {
+ var propertyName = object.nodeName ? domExpando : '_cid';
+ if (!object[propertyName]) {
+ _cid++;
+ object[propertyName] = (name || '') + _cid;
+ }
+ return object[propertyName];
+ };
+ cid.domExpando = domExpando;
+ cid.get = function (object) {
+ var type = typeof object;
+ var isObject = type !== null && (type === 'object' || type === 'function');
+ return isObject ? cid(object) : type + ':' + object;
+ };
+ if (namespace.cid) {
+ throw new Error('You can\'t have two versions of can-cid, check your dependencies');
+ } else {
+ module.exports = namespace.cid = cid;
+ }
+});
+/*can-dom-data-state@0.2.0#can-dom-data-state*/
+define('can-dom-data-state', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-namespace',
+ 'can-cid'
+], function (require, exports, module) {
+ 'use strict';
+ var namespace = require('can-namespace');
+ var CID = require('can-cid');
+ var data = {};
+ var isEmptyObject = function (obj) {
+ for (var prop in obj) {
+ return false;
+ }
+ return true;
+ };
+ var setData = function (name, value) {
+ var id = CID(this);
+ var store = data[id] || (data[id] = {});
+ if (name !== undefined) {
+ store[name] = value;
+ }
+ return store;
+ };
+ var deleteNode = function () {
+ var id = CID.get(this);
+ var nodeDeleted = false;
+ if (id && data[id]) {
+ nodeDeleted = true;
+ delete data[id];
+ }
+ return nodeDeleted;
+ };
+ var domDataState = {
+ _data: data,
+ getCid: function () {
+ return CID.get(this);
+ },
+ cid: function () {
+ return CID(this);
+ },
+ expando: CID.domExpando,
+ get: function (key) {
+ var id = CID.get(this), store = id && data[id];
+ return key === undefined ? store : store && store[key];
+ },
+ set: setData,
+ clean: function (prop) {
+ var id = CID.get(this);
+ var itemData = data[id];
+ if (itemData && itemData[prop]) {
+ delete itemData[prop];
+ }
+ if (isEmptyObject(itemData)) {
+ deleteNode.call(this);
+ }
+ },
+ delete: deleteNode
+ };
+ if (namespace.domDataState) {
+ throw new Error('You can\'t have two versions of can-dom-data-state, check your dependencies');
+ } else {
+ module.exports = namespace.domDataState = domDataState;
+ }
+});
+/*can-globals@1.0.1#mutation-observer/mutation-observer*/
+define('can-globals/mutation-observer/mutation-observer', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-globals/global/global',
+ 'can-globals/can-globals-instance'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ require('can-globals/global/global');
+ var globals = require('can-globals/can-globals-instance');
+ globals.define('MutationObserver', function () {
+ var GLOBAL = globals.getKeyValue('global');
+ return GLOBAL.MutationObserver || GLOBAL.WebKitMutationObserver || GLOBAL.MozMutationObserver;
+ });
+ module.exports = globals.makeExport('MutationObserver');
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
+/*can-util@3.11.2#js/is-array-like/is-array-like*/
+define('can-util/js/is-array-like/is-array-like', function (require, exports, module) {
+ 'use strict';
+ function isArrayLike(obj) {
+ var type = typeof obj;
+ if (type === 'string') {
+ return true;
+ } else if (type === 'number') {
+ return false;
+ }
+ var length = obj && type !== 'boolean' && typeof obj !== 'number' && 'length' in obj && obj.length;
+ return typeof obj !== 'function' && (length === 0 || typeof length === 'number' && length > 0 && length - 1 in obj);
+ }
+ module.exports = isArrayLike;
+});
+/*can-util@3.11.2#js/is-iterable/is-iterable*/
+define('can-util/js/is-iterable/is-iterable', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-symbol'
+], function (require, exports, module) {
+ 'use strict';
+ var canSymbol = require('can-symbol');
+ module.exports = function (obj) {
+ return obj && !!obj[canSymbol.iterator || canSymbol.for('iterator')];
+ };
+});
+/*can-util@3.11.2#js/each/each*/
+define('can-util/js/each/each', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-util/js/is-array-like/is-array-like',
+ 'can-util/js/is-iterable/is-iterable',
+ 'can-symbol'
+], function (require, exports, module) {
+ 'use strict';
+ var isArrayLike = require('can-util/js/is-array-like/is-array-like');
+ var has = Object.prototype.hasOwnProperty;
+ var isIterable = require('can-util/js/is-iterable/is-iterable');
+ var canSymbol = require('can-symbol');
+ function each(elements, callback, context) {
+ var i = 0, key, len, item;
+ if (elements) {
+ if (isArrayLike(elements)) {
+ for (len = elements.length; i < len; i++) {
+ item = elements[i];
+ if (callback.call(context || item, item, i, elements) === false) {
+ break;
+ }
+ }
+ } else if (isIterable(elements)) {
+ var iter = elements[canSymbol.iterator || canSymbol.for('iterator')]();
+ var res, value;
+ while (!(res = iter.next()).done) {
+ value = res.value;
+ callback.call(context || elements, Array.isArray(value) ? value[1] : value, value[0]);
+ }
+ } else if (typeof elements === 'object') {
+ for (key in elements) {
+ if (has.call(elements, key) && callback.call(context || elements[key], elements[key], key, elements) === false) {
+ break;
+ }
+ }
+ }
+ }
+ return elements;
+ }
+ module.exports = each;
+});
+/*can-cid@1.1.2#helpers*/
+define('can-cid/helpers', function (require, exports, module) {
+ module.exports = {
+ each: function (obj, cb, context) {
+ for (var prop in obj) {
+ cb.call(context, obj[prop], prop);
+ }
+ return obj;
+ }
+ };
+});
+/*can-cid@1.1.2#set/set*/
+define('can-cid/set/set', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-cid',
+ 'can-cid/helpers'
+], function (require, exports, module) {
+ 'use strict';
+ var getCID = require('can-cid').get;
+ var helpers = require('can-cid/helpers');
+ var CIDSet;
+ if (typeof Set !== 'undefined') {
+ CIDSet = Set;
+ } else {
+ var CIDSet = function () {
+ this.values = {};
+ };
+ CIDSet.prototype.add = function (value) {
+ this.values[getCID(value)] = value;
+ };
+ CIDSet.prototype['delete'] = function (key) {
+ var has = getCID(key) in this.values;
+ if (has) {
+ delete this.values[getCID(key)];
+ }
+ return has;
+ };
+ CIDSet.prototype.forEach = function (cb, thisArg) {
+ helpers.each(this.values, cb, thisArg);
+ };
+ CIDSet.prototype.has = function (value) {
+ return getCID(value) in this.values;
+ };
+ CIDSet.prototype.clear = function () {
+ return this.values = {};
+ };
+ Object.defineProperty(CIDSet.prototype, 'size', {
+ get: function () {
+ var size = 0;
+ helpers.each(this.values, function () {
+ size++;
+ });
+ return size;
+ }
+ });
+ }
+ module.exports = CIDSet;
+});
+/*can-util@3.11.2#js/make-array/make-array*/
+define('can-util/js/make-array/make-array', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-util/js/each/each',
+ 'can-util/js/is-array-like/is-array-like'
+], function (require, exports, module) {
+ 'use strict';
+ var each = require('can-util/js/each/each');
+ var isArrayLike = require('can-util/js/is-array-like/is-array-like');
+ function makeArray(element) {
+ var ret = [];
+ if (isArrayLike(element)) {
+ each(element, function (a, i) {
+ ret[i] = a;
+ });
+ } else if (element === 0 || element) {
+ ret.push(element);
+ }
+ return ret;
+ }
+ module.exports = makeArray;
+});
+/*can-util@3.11.2#js/is-container/is-container*/
+define('can-util/js/is-container/is-container', function (require, exports, module) {
+ 'use strict';
+ module.exports = function (current) {
+ return /^f|^o/.test(typeof current);
+ };
+});
+/*can-util@3.11.2#js/get/get*/
+define('can-util/js/get/get', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-util/js/is-container/is-container'
+], function (require, exports, module) {
+ 'use strict';
+ var isContainer = require('can-util/js/is-container/is-container');
+ function get(obj, name) {
+ var parts = typeof name !== 'undefined' ? (name + '').replace(/\[/g, '.').replace(/]/g, '').split('.') : [], length = parts.length, current, i, container;
+ if (!length) {
+ return obj;
+ }
+ current = obj;
+ for (i = 0; i < length && isContainer(current); i++) {
+ container = current;
+ current = container[parts[i]];
+ }
+ return current;
+ }
+ module.exports = get;
+});
+/*can-util@3.11.2#js/is-array/is-array*/
+define('can-util/js/is-array/is-array', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-log/dev/dev'
+], function (require, exports, module) {
+ 'use strict';
+ var dev = require('can-log/dev/dev');
+ var hasWarned = false;
+ module.exports = function (arr) {
+ return Array.isArray(arr);
+ };
+});
+/*can-util@3.11.2#js/string/string*/
+define('can-util/js/string/string', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-util/js/get/get',
+ 'can-util/js/is-container/is-container',
+ 'can-log/dev/dev',
+ 'can-util/js/is-array/is-array'
+], function (require, exports, module) {
+ 'use strict';
+ var get = require('can-util/js/get/get');
+ var isContainer = require('can-util/js/is-container/is-container');
+ var canDev = require('can-log/dev/dev');
+ var isArray = require('can-util/js/is-array/is-array');
+ var strUndHash = /_|-/, strColons = /\=\=/, strWords = /([A-Z]+)([A-Z][a-z])/g, strLowUp = /([a-z\d])([A-Z])/g, strDash = /([a-z\d])([A-Z])/g, strReplacer = /\{([^\}]+)\}/g, strQuote = /"/g, strSingleQuote = /'/g, strHyphenMatch = /-+(.)?/g, strCamelMatch = /[a-z][A-Z]/g, convertBadValues = function (content) {
+ var isInvalid = content === null || content === undefined || isNaN(content) && '' + content === 'NaN';
+ return '' + (isInvalid ? '' : content);
+ }, deleteAtPath = function (data, path) {
+ var parts = path ? path.replace(/\[/g, '.').replace(/]/g, '').split('.') : [];
+ var current = data;
+ for (var i = 0; i < parts.length - 1; i++) {
+ if (current) {
+ current = current[parts[i]];
+ }
+ }
+ if (current) {
+ delete current[parts[parts.length - 1]];
+ }
+ };
+ var string = {
+ esc: function (content) {
+ return convertBadValues(content).replace(/&/g, '&').replace(//g, '>').replace(strQuote, '"').replace(strSingleQuote, ''');
+ },
+ getObject: function (name, roots) {
+ roots = isArray(roots) ? roots : [roots || window];
+ var result, l = roots.length;
+ for (var i = 0; i < l; i++) {
+ result = get(roots[i], name);
+ if (result) {
+ return result;
+ }
+ }
+ },
+ capitalize: function (s, cache) {
+ return s.charAt(0).toUpperCase() + s.slice(1);
+ },
+ camelize: function (str) {
+ return convertBadValues(str).replace(strHyphenMatch, function (match, chr) {
+ return chr ? chr.toUpperCase() : '';
+ });
+ },
+ hyphenate: function (str) {
+ return convertBadValues(str).replace(strCamelMatch, function (str, offset) {
+ return str.charAt(0) + '-' + str.charAt(1).toLowerCase();
+ });
+ },
+ underscore: function (s) {
+ return s.replace(strColons, '/').replace(strWords, '$1_$2').replace(strLowUp, '$1_$2').replace(strDash, '_').toLowerCase();
+ },
+ sub: function (str, data, remove) {
+ var obs = [];
+ str = str || '';
+ obs.push(str.replace(strReplacer, function (whole, inside) {
+ var ob = get(data, inside);
+ if (remove === true) {
+ deleteAtPath(data, inside);
+ }
+ if (ob === undefined || ob === null) {
+ obs = null;
+ return '';
+ }
+ if (isContainer(ob) && obs) {
+ obs.push(ob);
+ return '';
+ }
+ return '' + ob;
+ }));
+ return obs === null ? obs : obs.length <= 1 ? obs[0] : obs;
+ },
+ replaceWith: function (str, data, replacer, shouldRemoveMatchedPaths) {
+ return str.replace(strReplacer, function (whole, path) {
+ var value = get(data, path);
+ if (shouldRemoveMatchedPaths) {
+ deleteAtPath(data, path);
+ }
+ return replacer(path, value);
+ });
+ },
+ replacer: strReplacer,
+ undHash: strUndHash
+ };
+ module.exports = string;
+});
+/*can-util@3.11.2#dom/mutation-observer/document/document*/
+define('can-util/dom/mutation-observer/document/document', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-globals/document/document',
+ 'can-dom-data-state',
+ 'can-globals/mutation-observer/mutation-observer',
+ 'can-util/js/each/each',
+ 'can-cid/set/set',
+ 'can-util/js/make-array/make-array',
+ 'can-util/js/string/string'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ var getDocument = require('can-globals/document/document');
+ var domDataState = require('can-dom-data-state');
+ var getMutationObserver = require('can-globals/mutation-observer/mutation-observer');
+ var each = require('can-util/js/each/each');
+ var CIDStore = require('can-cid/set/set');
+ var makeArray = require('can-util/js/make-array/make-array');
+ var string = require('can-util/js/string/string');
+ var dispatchIfListening = function (mutatedNode, nodes, dispatched) {
+ if (dispatched.has(mutatedNode)) {
+ return true;
+ }
+ dispatched.add(mutatedNode);
+ if (nodes.name === 'removedNodes') {
+ var documentElement = getDocument().documentElement;
+ if (documentElement.contains(mutatedNode)) {
+ return;
+ }
+ }
+ nodes.handlers.forEach(function (handler) {
+ handler(mutatedNode);
+ });
+ nodes.afterHandlers.forEach(function (handler) {
+ handler(mutatedNode);
+ });
+ };
+ var mutationObserverDocument = {
+ add: function (handler) {
+ var MO = getMutationObserver();
+ if (MO) {
+ var documentElement = getDocument().documentElement;
+ var globalObserverData = domDataState.get.call(documentElement, 'globalObserverData');
+ if (!globalObserverData) {
+ var observer = new MO(function (mutations) {
+ globalObserverData.handlers.forEach(function (handler) {
+ handler(mutations);
+ });
+ });
+ observer.observe(documentElement, {
+ childList: true,
+ subtree: true
+ });
+ globalObserverData = {
+ observer: observer,
+ handlers: []
+ };
+ domDataState.set.call(documentElement, 'globalObserverData', globalObserverData);
+ }
+ globalObserverData.handlers.push(handler);
+ }
+ },
+ remove: function (handler) {
+ var documentElement = getDocument().documentElement;
+ var globalObserverData = domDataState.get.call(documentElement, 'globalObserverData');
+ if (globalObserverData) {
+ var index = globalObserverData.handlers.indexOf(handler);
+ if (index >= 0) {
+ globalObserverData.handlers.splice(index, 1);
+ }
+ if (globalObserverData.handlers.length === 0) {
+ globalObserverData.observer.disconnect();
+ domDataState.clean.call(documentElement, 'globalObserverData');
+ }
+ }
+ }
+ };
+ var makeMutationMethods = function (name) {
+ var mutationName = name.toLowerCase() + 'Nodes';
+ var getMutationData = function () {
+ var documentElement = getDocument().documentElement;
+ var mutationData = domDataState.get.call(documentElement, mutationName + 'MutationData');
+ if (!mutationData) {
+ mutationData = {
+ name: mutationName,
+ handlers: [],
+ afterHandlers: [],
+ hander: null
+ };
+ if (getMutationObserver()) {
+ domDataState.set.call(documentElement, mutationName + 'MutationData', mutationData);
+ }
+ }
+ return mutationData;
+ };
+ var setup = function () {
+ var mutationData = getMutationData();
+ if (mutationData.handlers.length === 0 || mutationData.afterHandlers.length === 0) {
+ mutationData.handler = function (mutations) {
+ var dispatched = new CIDStore();
+ mutations.forEach(function (mutation) {
+ each(mutation[mutationName], function (mutatedNode) {
+ var children = mutatedNode.getElementsByTagName && makeArray(mutatedNode.getElementsByTagName('*'));
+ var alreadyChecked = dispatchIfListening(mutatedNode, mutationData, dispatched);
+ if (children && !alreadyChecked) {
+ for (var j = 0, child; (child = children[j]) !== undefined; j++) {
+ dispatchIfListening(child, mutationData, dispatched);
+ }
+ }
+ });
+ });
+ };
+ this.add(mutationData.handler);
+ }
+ return mutationData;
+ };
+ var teardown = function () {
+ var documentElement = getDocument().documentElement;
+ var mutationData = getMutationData();
+ if (mutationData.handlers.length === 0 && mutationData.afterHandlers.length === 0) {
+ this.remove(mutationData.handler);
+ domDataState.clean.call(documentElement, mutationName + 'MutationData');
+ }
+ };
+ var createOnOffHandlers = function (name, handlerList) {
+ mutationObserverDocument['on' + name] = function (handler) {
+ var mutationData = setup.call(this);
+ mutationData[handlerList].push(handler);
+ };
+ mutationObserverDocument['off' + name] = function (handler) {
+ var mutationData = getMutationData();
+ var index = mutationData[handlerList].indexOf(handler);
+ if (index >= 0) {
+ mutationData[handlerList].splice(index, 1);
+ }
+ teardown.call(this);
+ };
+ };
+ var createHandlers = function (name) {
+ createOnOffHandlers(name, 'handlers');
+ createOnOffHandlers('After' + name, 'afterHandlers');
+ };
+ createHandlers(string.capitalize(mutationName));
+ };
+ makeMutationMethods('added');
+ makeMutationMethods('removed');
+ module.exports = mutationObserverDocument;
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
+/*can-util@3.11.2#dom/data/data*/
+define('can-util/dom/data/data', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-dom-data-state',
+ 'can-util/dom/mutation-observer/document/document'
+], function (require, exports, module) {
+ 'use strict';
+ var domDataState = require('can-dom-data-state');
+ var mutationDocument = require('can-util/dom/mutation-observer/document/document');
+ var elementSetCount = 0;
+ var deleteNode = function () {
+ elementSetCount -= 1;
+ return domDataState.delete.call(this);
+ };
+ var cleanupDomData = function (node) {
+ if (domDataState.get.call(node) !== undefined) {
+ deleteNode.call(node);
+ }
+ if (elementSetCount === 0) {
+ mutationDocument.offAfterRemovedNodes(cleanupDomData);
+ }
+ };
+ module.exports = {
+ getCid: domDataState.getCid,
+ cid: domDataState.cid,
+ expando: domDataState.expando,
+ clean: domDataState.clean,
+ get: domDataState.get,
+ set: function (name, value) {
+ if (elementSetCount === 0) {
+ mutationDocument.onAfterRemovedNodes(cleanupDomData);
+ }
+ elementSetCount += domDataState.get.call(this) ? 0 : 1;
+ domDataState.set.call(this, name, value);
+ },
+ delete: deleteNode,
+ _getElementSetCount: function () {
+ return elementSetCount;
+ }
+ };
+});
+/*can-util@3.11.2#dom/contains/contains*/
+define('can-util/dom/contains/contains', function (require, exports, module) {
+ 'use strict';
+ module.exports = function (child) {
+ return this.contains(child);
+ };
+});
+/*can-globals@1.0.1#is-node/is-node*/
+define('can-globals/is-node/is-node', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-globals/can-globals-instance'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ var globals = require('can-globals/can-globals-instance');
+ globals.define('isNode', function () {
+ return typeof process === 'object' && {}.toString.call(process) === '[object process]';
+ });
+ module.exports = globals.makeExport('isNode');
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
+/*can-globals@1.0.1#is-browser-window/is-browser-window*/
+define('can-globals/is-browser-window/is-browser-window', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-globals/can-globals-instance',
+ 'can-globals/is-node/is-node'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ var globals = require('can-globals/can-globals-instance');
+ require('can-globals/is-node/is-node');
+ globals.define('isBrowserWindow', function () {
+ var isNode = globals.getKeyValue('isNode');
+ return typeof window !== 'undefined' && typeof document !== 'undefined' && isNode === false;
+ });
+ module.exports = globals.makeExport('isBrowserWindow');
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
+/*can-util@3.11.2#dom/events/events*/
+define('can-util/dom/events/events', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-globals/document/document',
+ 'can-globals/is-browser-window/is-browser-window',
+ 'can-util/js/is-plain-object/is-plain-object',
+ 'can-log/dev/dev'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ var getDocument = require('can-globals/document/document');
+ var isBrowserWindow = require('can-globals/is-browser-window/is-browser-window');
+ var isPlainObject = require('can-util/js/is-plain-object/is-plain-object');
+ var fixSyntheticEventsOnDisabled = false;
+ var dev = require('can-log/dev/dev');
+ function isDispatchingOnDisabled(element, ev) {
+ var isInsertedOrRemoved = isPlainObject(ev) ? ev.type === 'inserted' || ev.type === 'removed' : ev === 'inserted' || ev === 'removed';
+ var isDisabled = !!element.disabled;
+ return isInsertedOrRemoved && isDisabled;
+ }
+ module.exports = {
+ addEventListener: function () {
+ this.addEventListener.apply(this, arguments);
+ },
+ removeEventListener: function () {
+ this.removeEventListener.apply(this, arguments);
+ },
+ canAddEventListener: function () {
+ return this.nodeName && (this.nodeType === 1 || this.nodeType === 9) || this === window;
+ },
+ dispatch: function (event, args, bubbles) {
+ var ret;
+ var dispatchingOnDisabled = fixSyntheticEventsOnDisabled && isDispatchingOnDisabled(this, event);
+ var doc = this.ownerDocument || getDocument();
+ var ev = doc.createEvent('HTMLEvents');
+ var isString = typeof event === 'string';
+ ev.initEvent(isString ? event : event.type, bubbles === undefined ? true : bubbles, false);
+ if (!isString) {
+ for (var prop in event) {
+ if (ev[prop] === undefined) {
+ ev[prop] = event[prop];
+ }
+ }
+ }
+ if (this.disabled === true && ev.type !== 'fix_synthetic_events_on_disabled_test') {
+ }
+ ev.args = args;
+ if (dispatchingOnDisabled) {
+ this.disabled = false;
+ }
+ ret = this.dispatchEvent(ev);
+ if (dispatchingOnDisabled) {
+ this.disabled = true;
+ }
+ return ret;
+ }
+ };
+ (function () {
+ if (!isBrowserWindow()) {
+ return;
+ }
+ var testEventName = 'fix_synthetic_events_on_disabled_test';
+ var input = document.createElement('input');
+ input.disabled = true;
+ var timer = setTimeout(function () {
+ fixSyntheticEventsOnDisabled = true;
+ }, 50);
+ var onTest = function onTest() {
+ clearTimeout(timer);
+ module.exports.removeEventListener.call(input, testEventName, onTest);
+ };
+ module.exports.addEventListener.call(input, testEventName, onTest);
+ try {
+ module.exports.dispatch.call(input, testEventName, [], false);
+ } catch (e) {
+ onTest();
+ fixSyntheticEventsOnDisabled = true;
+ }
+ }());
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
+/*can-util@3.11.2#dom/dispatch/dispatch*/
+define('can-util/dom/dispatch/dispatch', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-util/dom/events/events'
+], function (require, exports, module) {
+ 'use strict';
+ var domEvents = require('can-util/dom/events/events');
+ module.exports = function () {
+ return domEvents.dispatch.apply(this, arguments);
+ };
+});
+/*can-types@1.1.6#can-types*/
+define('can-types', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-namespace',
+ 'can-reflect',
+ 'can-symbol',
+ 'can-log/dev/dev'
+], function (require, exports, module) {
+ var namespace = require('can-namespace');
+ var canReflect = require('can-reflect');
+ var canSymbol = require('can-symbol');
+ var dev = require('can-log/dev/dev');
+ var types = {
+ isMapLike: function (obj) {
+ return canReflect.isObservableLike(obj) && canReflect.isMapLike(obj);
+ },
+ isListLike: function (obj) {
+ return canReflect.isObservableLike(obj) && canReflect.isListLike(obj);
+ },
+ isPromise: function (obj) {
+ return canReflect.isPromise(obj);
+ },
+ isConstructor: function (func) {
+ return canReflect.isConstructorLike(func);
+ },
+ isCallableForValue: function (obj) {
+ return obj && canReflect.isFunctionLike(obj) && !canReflect.isConstructorLike(obj);
+ },
+ isCompute: function (obj) {
+ return obj && obj.isComputed;
+ },
+ get iterator() {
+ return canSymbol.iterator || canSymbol.for('iterator');
+ },
+ DefaultMap: null,
+ DefaultList: null,
+ queueTask: function (task) {
+ var args = task[2] || [];
+ task[0].apply(task[1], args);
+ },
+ wrapElement: function (element) {
+ return element;
+ },
+ unwrapElement: function (element) {
+ return element;
+ }
+ };
+ if (namespace.types) {
+ throw new Error('You can\'t have two versions of can-types, check your dependencies');
+ } else {
+ module.exports = namespace.types = types;
+ }
+});
+/*can-util@3.11.2#js/diff/diff*/
+define('can-util/js/diff/diff', function (require, exports, module) {
+ 'use strict';
+ var slice = [].slice;
+ var defaultIdentity = function (a, b) {
+ return a === b;
+ };
+ function reverseDiff(oldDiffStopIndex, newDiffStopIndex, oldList, newList, identity) {
+ var oldIndex = oldList.length - 1, newIndex = newList.length - 1;
+ while (oldIndex > oldDiffStopIndex && newIndex > newDiffStopIndex) {
+ var oldItem = oldList[oldIndex], newItem = newList[newIndex];
+ if (identity(oldItem, newItem)) {
+ oldIndex--;
+ newIndex--;
+ continue;
+ } else {
+ return [{
+ index: newDiffStopIndex,
+ deleteCount: oldIndex - oldDiffStopIndex + 1,
+ insert: slice.call(newList, newDiffStopIndex, newIndex + 1)
+ }];
+ }
+ }
+ return [{
+ index: newDiffStopIndex,
+ deleteCount: oldIndex - oldDiffStopIndex + 1,
+ insert: slice.call(newList, newDiffStopIndex, newIndex + 1)
+ }];
+ }
+ module.exports = exports = function (oldList, newList, identity) {
+ identity = identity || defaultIdentity;
+ var oldIndex = 0, newIndex = 0, oldLength = oldList.length, newLength = newList.length, patches = [];
+ while (oldIndex < oldLength && newIndex < newLength) {
+ var oldItem = oldList[oldIndex], newItem = newList[newIndex];
+ if (identity(oldItem, newItem)) {
+ oldIndex++;
+ newIndex++;
+ continue;
+ }
+ if (newIndex + 1 < newLength && identity(oldItem, newList[newIndex + 1])) {
+ patches.push({
+ index: newIndex,
+ deleteCount: 0,
+ insert: [newList[newIndex]]
+ });
+ oldIndex++;
+ newIndex += 2;
+ continue;
+ } else if (oldIndex + 1 < oldLength && identity(oldList[oldIndex + 1], newItem)) {
+ patches.push({
+ index: newIndex,
+ deleteCount: 1,
+ insert: []
+ });
+ oldIndex += 2;
+ newIndex++;
+ continue;
+ } else {
+ patches.push.apply(patches, reverseDiff(oldIndex, newIndex, oldList, newList, identity));
+ return patches;
+ }
+ }
+ if (newIndex === newLength && oldIndex === oldLength) {
+ return patches;
+ }
+ patches.push({
+ index: newIndex,
+ deleteCount: oldLength - oldIndex,
+ insert: slice.call(newList, newIndex)
+ });
+ return patches;
+ };
+});
+/*can-assign@1.1.1#can-assign*/
+define('can-assign', function (require, exports, module) {
+ module.exports = function (d, s) {
+ for (var prop in s) {
+ d[prop] = s[prop];
+ }
+ return d;
+ };
+});
+/*can-util@3.11.2#dom/events/attributes/attributes*/
+define('can-util/dom/events/attributes/attributes', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-util/dom/events/events',
+ 'can-util/dom/is-of-global-document/is-of-global-document',
+ 'can-util/dom/data/data',
+ 'can-globals/mutation-observer/mutation-observer',
+ 'can-assign',
+ 'can-util/dom/dispatch/dispatch'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ var events = require('can-util/dom/events/events');
+ var isOfGlobalDocument = require('can-util/dom/is-of-global-document/is-of-global-document');
+ var domData = require('can-util/dom/data/data');
+ var getMutationObserver = require('can-globals/mutation-observer/mutation-observer');
+ var assign = require('can-assign');
+ var domDispatch = require('can-util/dom/dispatch/dispatch');
+ var originalAdd = events.addEventListener, originalRemove = events.removeEventListener;
+ events.addEventListener = function (eventName) {
+ if (eventName === 'attributes') {
+ var MutationObserver = getMutationObserver();
+ if (isOfGlobalDocument(this) && MutationObserver) {
+ var existingObserver = domData.get.call(this, 'canAttributesObserver');
+ if (!existingObserver) {
+ var self = this;
+ var observer = new MutationObserver(function (mutations) {
+ mutations.forEach(function (mutation) {
+ var copy = assign({}, mutation);
+ domDispatch.call(self, copy, [], false);
+ });
+ });
+ observer.observe(this, {
+ attributes: true,
+ attributeOldValue: true
+ });
+ domData.set.call(this, 'canAttributesObserver', observer);
+ }
+ } else {
+ domData.set.call(this, 'canHasAttributesBindings', true);
+ }
+ }
+ return originalAdd.apply(this, arguments);
+ };
+ events.removeEventListener = function (eventName) {
+ if (eventName === 'attributes') {
+ var MutationObserver = getMutationObserver();
+ var observer;
+ if (isOfGlobalDocument(this) && MutationObserver) {
+ observer = domData.get.call(this, 'canAttributesObserver');
+ if (observer && observer.disconnect) {
+ observer.disconnect();
+ domData.clean.call(this, 'canAttributesObserver');
+ }
+ } else {
+ domData.clean.call(this, 'canHasAttributesBindings');
+ }
+ }
+ return originalRemove.apply(this, arguments);
+ };
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
+/*can-cid@1.1.2#map/map*/
+define('can-cid/map/map', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-cid',
+ 'can-cid/helpers'
+], function (require, exports, module) {
+ 'use strict';
+ var getCID = require('can-cid').get;
+ var helpers = require('can-cid/helpers');
+ var CIDMap;
+ if (typeof Map !== 'undefined') {
+ CIDMap = Map;
+ } else {
+ var CIDMap = function () {
+ this.values = {};
+ };
+ CIDMap.prototype.set = function (key, value) {
+ this.values[getCID(key)] = {
+ key: key,
+ value: value
+ };
+ };
+ CIDMap.prototype['delete'] = function (key) {
+ var has = getCID(key) in this.values;
+ if (has) {
+ delete this.values[getCID(key)];
+ }
+ return has;
+ };
+ CIDMap.prototype.forEach = function (cb, thisArg) {
+ helpers.each(this.values, function (pair) {
+ return cb.call(thisArg || this, pair.value, pair.key, this);
+ }, this);
+ };
+ CIDMap.prototype.has = function (key) {
+ return getCID(key) in this.values;
+ };
+ CIDMap.prototype.get = function (key) {
+ var obj = this.values[getCID(key)];
+ return obj && obj.value;
+ };
+ CIDMap.prototype.clear = function () {
+ return this.values = {};
+ };
+ Object.defineProperty(CIDMap.prototype, 'size', {
+ get: function () {
+ var size = 0;
+ helpers.each(this.values, function () {
+ size++;
+ });
+ return size;
+ }
+ });
+ }
+ module.exports = CIDMap;
+});
+/*can-util@3.11.2#dom/events/make-mutation-event/make-mutation-event*/
+define('can-util/dom/events/make-mutation-event/make-mutation-event', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-util/dom/events/events',
+ 'can-util/dom/data/data',
+ 'can-globals/mutation-observer/mutation-observer',
+ 'can-util/dom/dispatch/dispatch',
+ 'can-util/dom/mutation-observer/document/document',
+ 'can-globals/document/document',
+ 'can-cid/map/map',
+ 'can-util/js/string/string',
+ 'can-util/dom/is-of-global-document/is-of-global-document'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ var events = require('can-util/dom/events/events');
+ var domData = require('can-util/dom/data/data');
+ var getMutationObserver = require('can-globals/mutation-observer/mutation-observer');
+ var domDispatch = require('can-util/dom/dispatch/dispatch');
+ var mutationDocument = require('can-util/dom/mutation-observer/document/document');
+ var getDocument = require('can-globals/document/document');
+ var CIDMap = require('can-cid/map/map');
+ var string = require('can-util/js/string/string');
+ require('can-util/dom/is-of-global-document/is-of-global-document');
+ module.exports = function (specialEventName, mutationNodesProperty) {
+ var originalAdd = events.addEventListener, originalRemove = events.removeEventListener;
+ events.addEventListener = function (eventName) {
+ if (eventName === specialEventName && getMutationObserver()) {
+ var documentElement = getDocument().documentElement;
+ var specialEventData = domData.get.call(documentElement, specialEventName + 'Data');
+ if (!specialEventData) {
+ specialEventData = {
+ handler: function (mutatedNode) {
+ if (specialEventData.nodeIdsRespondingToInsert.has(mutatedNode)) {
+ domDispatch.call(mutatedNode, specialEventName, [], false);
+ specialEventData.nodeIdsRespondingToInsert.delete(mutatedNode);
+ }
+ },
+ nodeIdsRespondingToInsert: new CIDMap()
+ };
+ mutationDocument['on' + string.capitalize(mutationNodesProperty)](specialEventData.handler);
+ domData.set.call(documentElement, specialEventName + 'Data', specialEventData);
+ }
+ if (this.nodeType !== 11) {
+ var count = specialEventData.nodeIdsRespondingToInsert.get(this) || 0;
+ specialEventData.nodeIdsRespondingToInsert.set(this, count + 1);
+ }
+ }
+ return originalAdd.apply(this, arguments);
+ };
+ events.removeEventListener = function (eventName) {
+ if (eventName === specialEventName && getMutationObserver()) {
+ var documentElement = getDocument().documentElement;
+ var specialEventData = domData.get.call(documentElement, specialEventName + 'Data');
+ if (specialEventData) {
+ var newCount = specialEventData.nodeIdsRespondingToInsert.get(this) - 1;
+ if (newCount) {
+ specialEventData.nodeIdsRespondingToInsert.set(this, newCount);
+ } else {
+ specialEventData.nodeIdsRespondingToInsert.delete(this);
+ }
+ if (!specialEventData.nodeIdsRespondingToInsert.size) {
+ mutationDocument['off' + string.capitalize(mutationNodesProperty)](specialEventData.handler);
+ domData.clean.call(documentElement, specialEventName + 'Data');
+ }
+ }
+ }
+ return originalRemove.apply(this, arguments);
+ };
+ };
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
+/*can-util@3.11.2#dom/events/inserted/inserted*/
+define('can-util/dom/events/inserted/inserted', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-util/dom/events/make-mutation-event/make-mutation-event'
+], function (require, exports, module) {
+ 'use strict';
+ var makeMutationEvent = require('can-util/dom/events/make-mutation-event/make-mutation-event');
+ makeMutationEvent('inserted', 'addedNodes');
+});
+/*can-util@3.11.2#dom/attr/attr*/
+define('can-util/dom/attr/attr', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-util/js/set-immediate/set-immediate',
+ 'can-globals/document/document',
+ 'can-globals/global/global',
+ 'can-util/dom/is-of-global-document/is-of-global-document',
+ 'can-util/dom/data/data',
+ 'can-util/dom/contains/contains',
+ 'can-util/dom/events/events',
+ 'can-util/dom/dispatch/dispatch',
+ 'can-globals/mutation-observer/mutation-observer',
+ 'can-util/js/each/each',
+ 'can-types',
+ 'can-util/js/diff/diff',
+ 'can-util/dom/events/attributes/attributes',
+ 'can-util/dom/events/inserted/inserted'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ var setImmediate = require('can-util/js/set-immediate/set-immediate');
+ var getDocument = require('can-globals/document/document');
+ var global = require('can-globals/global/global')();
+ var isOfGlobalDocument = require('can-util/dom/is-of-global-document/is-of-global-document');
+ var setData = require('can-util/dom/data/data');
+ var domContains = require('can-util/dom/contains/contains');
+ var domEvents = require('can-util/dom/events/events');
+ var domDispatch = require('can-util/dom/dispatch/dispatch');
+ var getMutationObserver = require('can-globals/mutation-observer/mutation-observer');
+ var each = require('can-util/js/each/each');
+ var types = require('can-types');
+ var diff = require('can-util/js/diff/diff');
+ require('can-util/dom/events/attributes/attributes');
+ require('can-util/dom/events/inserted/inserted');
+ var namespaces = { 'xlink': 'http://www.w3.org/1999/xlink' };
+ var formElements = {
+ 'INPUT': true,
+ 'TEXTAREA': true,
+ 'SELECT': true
+ }, toString = function (value) {
+ if (value == null) {
+ return '';
+ } else {
+ return '' + value;
+ }
+ }, isSVG = function (el) {
+ return el.namespaceURI === 'http://www.w3.org/2000/svg';
+ }, truthy = function () {
+ return true;
+ }, getSpecialTest = function (special) {
+ return special && special.test || truthy;
+ }, propProp = function (prop, obj) {
+ obj = obj || {};
+ obj.get = function () {
+ return this[prop];
+ };
+ obj.set = function (value) {
+ if (this[prop] !== value) {
+ this[prop] = value;
+ }
+ return value;
+ };
+ return obj;
+ }, booleanProp = function (prop) {
+ return {
+ isBoolean: true,
+ set: function (value) {
+ if (prop in this) {
+ this[prop] = value !== false;
+ } else {
+ this.setAttribute(prop, '');
+ }
+ },
+ remove: function () {
+ this[prop] = false;
+ }
+ };
+ }, setupMO = function (el, callback) {
+ var attrMO = setData.get.call(el, 'attrMO');
+ if (!attrMO) {
+ var onMutation = function () {
+ callback.call(el);
+ };
+ var MO = getMutationObserver();
+ if (MO) {
+ var observer = new MO(onMutation);
+ observer.observe(el, {
+ childList: true,
+ subtree: true
+ });
+ setData.set.call(el, 'attrMO', observer);
+ } else {
+ setData.set.call(el, 'attrMO', true);
+ setData.set.call(el, 'canBindingCallback', { onMutation: onMutation });
+ }
+ }
+ }, _findOptionToSelect = function (parent, value) {
+ var child = parent.firstChild;
+ while (child) {
+ if (child.nodeName === 'OPTION' && value === child.value) {
+ return child;
+ }
+ if (child.nodeName === 'OPTGROUP') {
+ var groupChild = _findOptionToSelect(child, value);
+ if (groupChild) {
+ return groupChild;
+ }
+ }
+ child = child.nextSibling;
+ }
+ }, setChildOptions = function (el, value) {
+ var option;
+ if (value != null) {
+ option = _findOptionToSelect(el, value);
+ }
+ if (option) {
+ option.selected = true;
+ } else {
+ el.selectedIndex = -1;
+ }
+ }, forEachOption = function (parent, fn) {
+ var child = parent.firstChild;
+ while (child) {
+ if (child.nodeName === 'OPTION') {
+ fn(child);
+ }
+ if (child.nodeName === 'OPTGROUP') {
+ forEachOption(child, fn);
+ }
+ child = child.nextSibling;
+ }
+ }, collectSelectedOptions = function (parent) {
+ var selectedValues = [];
+ forEachOption(parent, function (option) {
+ if (option.selected) {
+ selectedValues.push(option.value);
+ }
+ });
+ return selectedValues;
+ }, markSelectedOptions = function (parent, values) {
+ forEachOption(parent, function (option) {
+ option.selected = values.indexOf(option.value) !== -1;
+ });
+ }, setChildOptionsOnChange = function (select, aEL) {
+ var handler = setData.get.call(select, 'attrSetChildOptions');
+ if (handler) {
+ return Function.prototype;
+ }
+ handler = function () {
+ setChildOptions(select, select.value);
+ };
+ setData.set.call(select, 'attrSetChildOptions', handler);
+ aEL.call(select, 'change', handler);
+ return function (rEL) {
+ setData.clean.call(select, 'attrSetChildOptions');
+ rEL.call(select, 'change', handler);
+ };
+ }, attr = {
+ special: {
+ checked: {
+ get: function () {
+ return this.checked;
+ },
+ set: function (val) {
+ var notFalse = !!val || val === '' || arguments.length === 0;
+ this.checked = notFalse;
+ if (notFalse && this.type === 'radio') {
+ this.defaultChecked = true;
+ }
+ return val;
+ },
+ remove: function () {
+ this.checked = false;
+ },
+ test: function () {
+ return this.nodeName === 'INPUT';
+ }
+ },
+ 'class': {
+ get: function () {
+ if (isSVG(this)) {
+ return this.getAttribute('class');
+ }
+ return this.className;
+ },
+ set: function (val) {
+ val = val || '';
+ if (isSVG(this)) {
+ this.setAttribute('class', '' + val);
+ } else {
+ this.className = val;
+ }
+ return val;
+ }
+ },
+ disabled: booleanProp('disabled'),
+ focused: {
+ get: function () {
+ return this === document.activeElement;
+ },
+ set: function (val) {
+ var cur = attr.get(this, 'focused');
+ var docEl = this.ownerDocument.documentElement;
+ var element = this;
+ function focusTask() {
+ if (val) {
+ element.focus();
+ } else {
+ element.blur();
+ }
+ }
+ if (cur !== val) {
+ if (!domContains.call(docEl, element)) {
+ var initialSetHandler = function () {
+ domEvents.removeEventListener.call(element, 'inserted', initialSetHandler);
+ focusTask();
+ };
+ domEvents.addEventListener.call(element, 'inserted', initialSetHandler);
+ } else {
+ types.queueTask([
+ focusTask,
+ this,
+ []
+ ]);
+ }
+ }
+ return !!val;
+ },
+ addEventListener: function (eventName, handler, aEL) {
+ aEL.call(this, 'focus', handler);
+ aEL.call(this, 'blur', handler);
+ return function (rEL) {
+ rEL.call(this, 'focus', handler);
+ rEL.call(this, 'blur', handler);
+ };
+ },
+ test: function () {
+ return this.nodeName === 'INPUT';
+ }
+ },
+ 'for': propProp('htmlFor'),
+ innertext: propProp('innerText'),
+ innerhtml: propProp('innerHTML'),
+ innerHTML: propProp('innerHTML', {
+ addEventListener: function (eventName, handler, aEL) {
+ var handlers = [];
+ var el = this;
+ each([
+ 'change',
+ 'blur'
+ ], function (eventName) {
+ var localHandler = function () {
+ handler.apply(this, arguments);
+ };
+ domEvents.addEventListener.call(el, eventName, localHandler);
+ handlers.push([
+ eventName,
+ localHandler
+ ]);
+ });
+ return function (rEL) {
+ each(handlers, function (info) {
+ rEL.call(el, info[0], info[1]);
+ });
+ };
+ }
+ }),
+ required: booleanProp('required'),
+ readonly: booleanProp('readOnly'),
+ selected: {
+ get: function () {
+ return this.selected;
+ },
+ set: function (val) {
+ val = !!val;
+ setData.set.call(this, 'lastSetValue', val);
+ return this.selected = val;
+ },
+ addEventListener: function (eventName, handler, aEL) {
+ var option = this;
+ var select = this.parentNode;
+ var lastVal = option.selected;
+ var localHandler = function (changeEvent) {
+ var curVal = option.selected;
+ lastVal = setData.get.call(option, 'lastSetValue') || lastVal;
+ if (curVal !== lastVal) {
+ lastVal = curVal;
+ domDispatch.call(option, eventName);
+ }
+ };
+ var removeChangeHandler = setChildOptionsOnChange(select, aEL);
+ domEvents.addEventListener.call(select, 'change', localHandler);
+ aEL.call(option, eventName, handler);
+ return function (rEL) {
+ removeChangeHandler(rEL);
+ domEvents.removeEventListener.call(select, 'change', localHandler);
+ rEL.call(option, eventName, handler);
+ };
+ },
+ test: function () {
+ return this.nodeName === 'OPTION' && this.parentNode && this.parentNode.nodeName === 'SELECT';
+ }
+ },
+ src: {
+ set: function (val) {
+ if (val == null || val === '') {
+ this.removeAttribute('src');
+ return null;
+ } else {
+ this.setAttribute('src', val);
+ return val;
+ }
+ }
+ },
+ style: {
+ set: function () {
+ var el = global.document && getDocument().createElement('div');
+ if (el && el.style && 'cssText' in el.style) {
+ return function (val) {
+ return this.style.cssText = val || '';
+ };
+ } else {
+ return function (val) {
+ return this.setAttribute('style', val);
+ };
+ }
+ }()
+ },
+ textcontent: propProp('textContent'),
+ value: {
+ get: function () {
+ var value = this.value;
+ if (this.nodeName === 'SELECT') {
+ if ('selectedIndex' in this && this.selectedIndex === -1) {
+ value = undefined;
+ }
+ }
+ return value;
+ },
+ set: function (value) {
+ var nodeName = this.nodeName.toLowerCase();
+ if (nodeName === 'input') {
+ value = toString(value);
+ }
+ if (this.value !== value || nodeName === 'option') {
+ this.value = value;
+ }
+ if (attr.defaultValue[nodeName]) {
+ this.defaultValue = value;
+ }
+ if (nodeName === 'select') {
+ setData.set.call(this, 'attrValueLastVal', value);
+ setChildOptions(this, value === null ? value : this.value);
+ var docEl = this.ownerDocument.documentElement;
+ if (!domContains.call(docEl, this)) {
+ var select = this;
+ var initialSetHandler = function () {
+ domEvents.removeEventListener.call(select, 'inserted', initialSetHandler);
+ setChildOptions(select, value === null ? value : select.value);
+ };
+ domEvents.addEventListener.call(this, 'inserted', initialSetHandler);
+ }
+ setupMO(this, function () {
+ var value = setData.get.call(this, 'attrValueLastVal');
+ attr.set(this, 'value', value);
+ domDispatch.call(this, 'change');
+ });
+ }
+ return value;
+ },
+ test: function () {
+ return formElements[this.nodeName];
+ }
+ },
+ values: {
+ get: function () {
+ return collectSelectedOptions(this);
+ },
+ set: function (values) {
+ values = values || [];
+ markSelectedOptions(this, values);
+ setData.set.call(this, 'stickyValues', attr.get(this, 'values'));
+ setupMO(this, function () {
+ var previousValues = setData.get.call(this, 'stickyValues');
+ attr.set(this, 'values', previousValues);
+ var currentValues = setData.get.call(this, 'stickyValues');
+ var changes = diff(previousValues.slice().sort(), currentValues.slice().sort());
+ if (changes.length) {
+ domDispatch.call(this, 'values');
+ }
+ });
+ return values;
+ },
+ addEventListener: function (eventName, handler, aEL) {
+ var localHandler = function () {
+ domDispatch.call(this, 'values');
+ };
+ domEvents.addEventListener.call(this, 'change', localHandler);
+ aEL.call(this, eventName, handler);
+ return function (rEL) {
+ domEvents.removeEventListener.call(this, 'change', localHandler);
+ rEL.call(this, eventName, handler);
+ };
+ }
+ }
+ },
+ defaultValue: {
+ input: true,
+ textarea: true
+ },
+ setAttrOrProp: function (el, attrName, val) {
+ attrName = attrName.toLowerCase();
+ var special = attr.special[attrName];
+ if (special && special.isBoolean && !val) {
+ this.remove(el, attrName);
+ } else {
+ this.set(el, attrName, val);
+ }
+ },
+ set: function (el, attrName, val) {
+ var usingMutationObserver = isOfGlobalDocument(el) && getMutationObserver();
+ attrName = attrName.toLowerCase();
+ var oldValue;
+ if (!usingMutationObserver) {
+ oldValue = attr.get(el, attrName);
+ }
+ var newValue;
+ var special = attr.special[attrName];
+ var setter = special && special.set;
+ var test = getSpecialTest(special);
+ if (typeof setter === 'function' && test.call(el)) {
+ if (arguments.length === 2) {
+ newValue = setter.call(el);
+ } else {
+ newValue = setter.call(el, val);
+ }
+ } else {
+ attr.setAttribute(el, attrName, val);
+ }
+ if (!usingMutationObserver && newValue !== oldValue) {
+ attr.trigger(el, attrName, oldValue);
+ }
+ },
+ setSelectValue: function (el, value) {
+ attr.set(el, 'value', value);
+ },
+ setAttribute: function () {
+ var doc = getDocument();
+ if (doc && document.createAttribute) {
+ try {
+ doc.createAttribute('{}');
+ } catch (e) {
+ var invalidNodes = {}, attributeDummy = document.createElement('div');
+ return function (el, attrName, val) {
+ var first = attrName.charAt(0), cachedNode, node, attr;
+ if ((first === '{' || first === '(' || first === '*') && el.setAttributeNode) {
+ cachedNode = invalidNodes[attrName];
+ if (!cachedNode) {
+ attributeDummy.innerHTML = '';
+ cachedNode = invalidNodes[attrName] = attributeDummy.childNodes[0].attributes[0];
+ }
+ node = cachedNode.cloneNode();
+ node.value = val;
+ el.setAttributeNode(node);
+ } else {
+ attr = attrName.split(':');
+ if (attr.length !== 1 && namespaces[attr[0]]) {
+ el.setAttributeNS(namespaces[attr[0]], attrName, val);
+ } else {
+ el.setAttribute(attrName, val);
+ }
+ }
+ };
+ }
+ }
+ return function (el, attrName, val) {
+ el.setAttribute(attrName, val);
+ };
+ }(),
+ trigger: function (el, attrName, oldValue) {
+ if (setData.get.call(el, 'canHasAttributesBindings')) {
+ attrName = attrName.toLowerCase();
+ return setImmediate(function () {
+ domDispatch.call(el, {
+ type: 'attributes',
+ attributeName: attrName,
+ target: el,
+ oldValue: oldValue,
+ bubbles: false
+ }, []);
+ });
+ }
+ },
+ get: function (el, attrName) {
+ attrName = attrName.toLowerCase();
+ var special = attr.special[attrName];
+ var getter = special && special.get;
+ var test = getSpecialTest(special);
+ if (typeof getter === 'function' && test.call(el)) {
+ return getter.call(el);
+ } else {
+ return el.getAttribute(attrName);
+ }
+ },
+ remove: function (el, attrName) {
+ attrName = attrName.toLowerCase();
+ var oldValue;
+ if (!getMutationObserver()) {
+ oldValue = attr.get(el, attrName);
+ }
+ var special = attr.special[attrName];
+ var setter = special && special.set;
+ var remover = special && special.remove;
+ var test = getSpecialTest(special);
+ if (typeof remover === 'function' && test.call(el)) {
+ remover.call(el);
+ } else if (typeof setter === 'function' && test.call(el)) {
+ setter.call(el, undefined);
+ } else {
+ el.removeAttribute(attrName);
+ }
+ if (!getMutationObserver() && oldValue != null) {
+ attr.trigger(el, attrName, oldValue);
+ }
+ },
+ has: function () {
+ var el = getDocument() && document.createElement('div');
+ if (el && el.hasAttribute) {
+ return function (el, name) {
+ return el.hasAttribute(name);
+ };
+ } else {
+ return function (el, name) {
+ return el.getAttribute(name) !== null;
+ };
+ }
+ }()
+ };
+ var oldAddEventListener = domEvents.addEventListener;
+ domEvents.addEventListener = function (eventName, handler) {
+ var special = attr.special[eventName];
+ if (special && special.addEventListener) {
+ var teardown = special.addEventListener.call(this, eventName, handler, oldAddEventListener);
+ var teardowns = setData.get.call(this, 'attrTeardowns');
+ if (!teardowns) {
+ setData.set.call(this, 'attrTeardowns', teardowns = {});
+ }
+ if (!teardowns[eventName]) {
+ teardowns[eventName] = [];
+ }
+ teardowns[eventName].push({
+ teardown: teardown,
+ handler: handler
+ });
+ return;
+ }
+ return oldAddEventListener.apply(this, arguments);
+ };
+ var oldRemoveEventListener = domEvents.removeEventListener;
+ domEvents.removeEventListener = function (eventName, handler) {
+ var special = attr.special[eventName];
+ if (special && special.addEventListener) {
+ var teardowns = setData.get.call(this, 'attrTeardowns');
+ if (teardowns && teardowns[eventName]) {
+ var eventTeardowns = teardowns[eventName];
+ for (var i = 0, len = eventTeardowns.length; i < len; i++) {
+ if (eventTeardowns[i].handler === handler) {
+ eventTeardowns[i].teardown.call(this, oldRemoveEventListener);
+ eventTeardowns.splice(i, 1);
+ break;
+ }
+ }
+ if (eventTeardowns.length === 0) {
+ delete teardowns[eventName];
+ }
+ }
+ return;
+ }
+ return oldRemoveEventListener.apply(this, arguments);
+ };
+ module.exports = exports = attr;
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
+/*can-util@3.11.2#dom/child-nodes/child-nodes*/
+define('can-util/dom/child-nodes/child-nodes', function (require, exports, module) {
+ 'use strict';
+ function childNodes(node) {
+ var childNodes = node.childNodes;
+ if ('length' in childNodes) {
+ return childNodes;
+ } else {
+ var cur = node.firstChild;
+ var nodes = [];
+ while (cur) {
+ nodes.push(cur);
+ cur = cur.nextSibling;
+ }
+ return nodes;
+ }
+ }
+ module.exports = childNodes;
+});
+/*can-util@3.11.2#dom/class-name/class-name*/
+define('can-util/dom/class-name/class-name', function (require, exports, module) {
+ 'use strict';
+ var has = function (className) {
+ if (this.classList) {
+ return this.classList.contains(className);
+ } else {
+ return !!this.className.match(new RegExp('(\\s|^)' + className + '(\\s|$)'));
+ }
+ };
+ module.exports = {
+ has: has,
+ add: function (className) {
+ if (this.classList) {
+ this.classList.add(className);
+ } else if (!has.call(this, className)) {
+ this.className += ' ' + className;
+ }
+ },
+ remove: function (className) {
+ if (this.classList) {
+ this.classList.remove(className);
+ } else if (has.call(this, className)) {
+ var reg = new RegExp('(\\s|^)' + className + '(\\s|$)');
+ this.className = this.className.replace(reg, ' ');
+ }
+ }
+ };
+});
+/*can-util@3.11.2#dom/document/document*/
+define('can-util/dom/document/document', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-globals/document/document'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ module.exports = require('can-globals/document/document');
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
+/*can-util@3.11.2#dom/fragment/fragment*/
+define('can-util/dom/fragment/fragment', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-globals/document/document',
+ 'can-util/dom/child-nodes/child-nodes'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ var getDocument = require('can-globals/document/document'), childNodes = require('can-util/dom/child-nodes/child-nodes');
+ var fragmentRE = /^\s*<(\w+)[^>]*>/, toString = {}.toString, fragment = function (html, name, doc) {
+ if (name === undefined) {
+ name = fragmentRE.test(html) && RegExp.$1;
+ }
+ if (html && toString.call(html.replace) === '[object Function]') {
+ html = html.replace(/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, '<$1>$2>');
+ }
+ var container = doc.createElement('div'), temp = doc.createElement('div');
+ if (name === 'tbody' || name === 'tfoot' || name === 'thead' || name === 'colgroup') {
+ temp.innerHTML = '';
+ container = temp.firstChild.nodeType === 3 ? temp.lastChild : temp.firstChild;
+ } else if (name === 'col') {
+ temp.innerHTML = '';
+ container = temp.firstChild.nodeType === 3 ? temp.lastChild : temp.firstChild.firstChild;
+ } else if (name === 'tr') {
+ temp.innerHTML = '';
+ container = temp.firstChild.nodeType === 3 ? temp.lastChild : temp.firstChild.firstChild;
+ } else if (name === 'td' || name === 'th') {
+ temp.innerHTML = '';
+ container = temp.firstChild.nodeType === 3 ? temp.lastChild : temp.firstChild.firstChild.firstChild;
+ } else if (name === 'option') {
+ temp.innerHTML = '';
+ container = temp.firstChild.nodeType === 3 ? temp.lastChild : temp.firstChild;
+ } else {
+ container.innerHTML = '' + html;
+ }
+ var tmp = {}, children = childNodes(container);
+ tmp.length = children.length;
+ for (var i = 0; i < children.length; i++) {
+ tmp[i] = children[i];
+ }
+ return [].slice.call(tmp);
+ };
+ var buildFragment = function (html, doc) {
+ if (html && html.nodeType === 11) {
+ return html;
+ }
+ if (!doc) {
+ doc = getDocument();
+ } else if (doc.length) {
+ doc = doc[0];
+ }
+ var parts = fragment(html, undefined, doc), frag = (doc || document).createDocumentFragment();
+ for (var i = 0, length = parts.length; i < length; i++) {
+ frag.appendChild(parts[i]);
+ }
+ return frag;
+ };
+ module.exports = buildFragment;
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
+/*can-util@3.11.2#dom/frag/frag*/
+define('can-util/dom/frag/frag', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-globals/document/document',
+ 'can-util/dom/fragment/fragment',
+ 'can-util/js/each/each',
+ 'can-util/dom/child-nodes/child-nodes'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ var getDocument = require('can-globals/document/document');
+ var fragment = require('can-util/dom/fragment/fragment');
+ var each = require('can-util/js/each/each');
+ var childNodes = require('can-util/dom/child-nodes/child-nodes');
+ var makeFrag = function (item, doc) {
+ var document = doc || getDocument();
+ var frag;
+ if (!item || typeof item === 'string') {
+ frag = fragment(item == null ? '' : '' + item, document);
+ if (!frag.childNodes.length) {
+ frag.appendChild(document.createTextNode(''));
+ }
+ return frag;
+ } else if (item.nodeType === 11) {
+ return item;
+ } else if (typeof item.nodeType === 'number') {
+ frag = document.createDocumentFragment();
+ frag.appendChild(item);
+ return frag;
+ } else if (typeof item.length === 'number') {
+ frag = document.createDocumentFragment();
+ each(item, function (item) {
+ frag.appendChild(makeFrag(item));
+ });
+ if (!childNodes(frag).length) {
+ frag.appendChild(document.createTextNode(''));
+ }
+ return frag;
+ } else {
+ frag = fragment('' + item, document);
+ if (!childNodes(frag).length) {
+ frag.appendChild(document.createTextNode(''));
+ }
+ return frag;
+ }
+ };
+ module.exports = makeFrag;
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
+/*can-util@3.11.2#dom/matches/matches*/
+define('can-util/dom/matches/matches', function (require, exports, module) {
+ 'use strict';
+ var matchesMethod = function (element) {
+ return element.matches || element.webkitMatchesSelector || element.webkitMatchesSelector || element.mozMatchesSelector || element.msMatchesSelector || element.oMatchesSelector;
+ };
+ module.exports = function () {
+ var method = matchesMethod(this);
+ return method ? method.apply(this, arguments) : false;
+ };
+});
+/*can-util@3.11.2#dom/mutate/mutate*/
+define('can-util/dom/mutate/mutate', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-util/js/make-array/make-array',
+ 'can-util/js/set-immediate/set-immediate',
+ 'can-cid',
+ 'can-globals/mutation-observer/mutation-observer',
+ 'can-util/dom/child-nodes/child-nodes',
+ 'can-util/dom/contains/contains',
+ 'can-util/dom/dispatch/dispatch',
+ 'can-globals/document/document',
+ 'can-util/dom/data/data'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ var makeArray = require('can-util/js/make-array/make-array');
+ var setImmediate = require('can-util/js/set-immediate/set-immediate');
+ var CID = require('can-cid');
+ var getMutationObserver = require('can-globals/mutation-observer/mutation-observer');
+ var childNodes = require('can-util/dom/child-nodes/child-nodes');
+ var domContains = require('can-util/dom/contains/contains');
+ var domDispatch = require('can-util/dom/dispatch/dispatch');
+ var getDocument = require('can-globals/document/document');
+ var domData = require('can-util/dom/data/data');
+ var mutatedElements;
+ var checks = {
+ inserted: function (root, elem) {
+ return domContains.call(root, elem);
+ },
+ removed: function (root, elem) {
+ return !domContains.call(root, elem);
+ }
+ };
+ var fireOn = function (elems, root, check, event, dispatched) {
+ if (!elems.length) {
+ return;
+ }
+ var children, cid;
+ for (var i = 0, elem; (elem = elems[i]) !== undefined; i++) {
+ cid = CID(elem);
+ if (elem.getElementsByTagName && check(root, elem) && !dispatched[cid]) {
+ dispatched[cid] = true;
+ children = makeArray(elem.getElementsByTagName('*'));
+ domDispatch.call(elem, event, [], false);
+ if (event === 'removed') {
+ domData.delete.call(elem);
+ }
+ for (var j = 0, child; (child = children[j]) !== undefined; j++) {
+ cid = CID(child);
+ if (!dispatched[cid]) {
+ domDispatch.call(child, event, [], false);
+ if (event === 'removed') {
+ domData.delete.call(child);
+ }
+ dispatched[cid] = true;
+ }
+ }
+ }
+ }
+ };
+ var fireMutations = function () {
+ var mutations = mutatedElements;
+ mutatedElements = null;
+ var firstElement = mutations[0][1][0];
+ var doc = getDocument() || firstElement.ownerDocument || firstElement;
+ var root = doc.contains ? doc : doc.documentElement;
+ var dispatched = {
+ inserted: {},
+ removed: {}
+ };
+ mutations.forEach(function (mutation) {
+ fireOn(mutation[1], root, checks[mutation[0]], mutation[0], dispatched[mutation[0]]);
+ });
+ };
+ var mutated = function (elements, type) {
+ if (!getMutationObserver() && elements.length) {
+ var firstElement = elements[0];
+ var doc = getDocument() || firstElement.ownerDocument || firstElement;
+ var root = doc.contains ? doc : doc.documentElement;
+ if (checks.inserted(root, firstElement)) {
+ if (!mutatedElements) {
+ mutatedElements = [];
+ setImmediate(fireMutations);
+ }
+ mutatedElements.push([
+ type,
+ elements
+ ]);
+ }
+ }
+ };
+ module.exports = {
+ appendChild: function (child) {
+ if (getMutationObserver()) {
+ this.appendChild(child);
+ } else {
+ var children;
+ if (child.nodeType === 11) {
+ children = makeArray(childNodes(child));
+ } else {
+ children = [child];
+ }
+ this.appendChild(child);
+ mutated(children, 'inserted');
+ }
+ },
+ insertBefore: function (child, ref, document) {
+ if (getMutationObserver()) {
+ this.insertBefore(child, ref);
+ } else {
+ var children;
+ if (child.nodeType === 11) {
+ children = makeArray(childNodes(child));
+ } else {
+ children = [child];
+ }
+ this.insertBefore(child, ref);
+ mutated(children, 'inserted');
+ }
+ },
+ removeChild: function (child) {
+ if (getMutationObserver()) {
+ this.removeChild(child);
+ } else {
+ mutated([child], 'removed');
+ this.removeChild(child);
+ }
+ },
+ replaceChild: function (newChild, oldChild) {
+ if (getMutationObserver()) {
+ this.replaceChild(newChild, oldChild);
+ } else {
+ var children;
+ if (newChild.nodeType === 11) {
+ children = makeArray(childNodes(newChild));
+ } else {
+ children = [newChild];
+ }
+ mutated([oldChild], 'removed');
+ this.replaceChild(newChild, oldChild);
+ mutated(children, 'inserted');
+ }
+ },
+ inserted: function (elements) {
+ mutated(elements, 'inserted');
+ },
+ removed: function (elements) {
+ mutated(elements, 'removed');
+ }
+ };
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
+/*can-globals@1.0.1#location/location*/
+define('can-globals/location/location', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-globals/global/global',
+ 'can-globals/can-globals-instance'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ require('can-globals/global/global');
+ var globals = require('can-globals/can-globals-instance');
+ globals.define('location', function () {
+ return globals.getKeyValue('global').location;
+ });
+ module.exports = globals.makeExport('location');
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
+/*can-globals@1.0.1#custom-elements/custom-elements*/
+define('can-globals/custom-elements/custom-elements', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-globals/global/global',
+ 'can-globals/can-globals-instance'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ require('can-globals/global/global');
+ var globals = require('can-globals/can-globals-instance');
+ globals.define('customElements', function () {
+ var GLOBAL = globals.getKeyValue('global');
+ return GLOBAL.customElements;
+ });
+ module.exports = globals.makeExport('customElements');
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
+/*can-globals@1.0.1#can-globals*/
+define('can-globals', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-globals/can-globals-instance',
+ 'can-globals/global/global',
+ 'can-globals/document/document',
+ 'can-globals/location/location',
+ 'can-globals/mutation-observer/mutation-observer',
+ 'can-globals/is-browser-window/is-browser-window',
+ 'can-globals/is-node/is-node',
+ 'can-globals/custom-elements/custom-elements'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ var globals = require('can-globals/can-globals-instance');
+ require('can-globals/global/global');
+ require('can-globals/document/document');
+ require('can-globals/location/location');
+ require('can-globals/mutation-observer/mutation-observer');
+ require('can-globals/is-browser-window/is-browser-window');
+ require('can-globals/is-node/is-node');
+ require('can-globals/custom-elements/custom-elements');
+ module.exports = globals;
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
+/*can-util@3.11.2#dom/mutation-observer/mutation-observer*/
+define('can-util/dom/mutation-observer/mutation-observer', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-globals'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ var globals = require('can-globals');
+ module.exports = function (setMO) {
+ if (setMO !== undefined) {
+ globals.setKeyValue('MutationObserver', function () {
+ return setMO;
+ });
+ }
+ return globals.getKeyValue('MutationObserver');
+ };
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
+/*can-util@3.11.2#dom/dom*/
+define('can-util/dom/dom', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-util/dom/ajax/ajax',
+ 'can-util/dom/attr/attr',
+ 'can-util/dom/child-nodes/child-nodes',
+ 'can-util/dom/class-name/class-name',
+ 'can-util/dom/contains/contains',
+ 'can-util/dom/data/data',
+ 'can-util/dom/dispatch/dispatch',
+ 'can-util/dom/document/document',
+ 'can-util/dom/events/events',
+ 'can-util/dom/frag/frag',
+ 'can-util/dom/fragment/fragment',
+ 'can-util/dom/is-of-global-document/is-of-global-document',
+ 'can-util/dom/matches/matches',
+ 'can-util/dom/mutate/mutate',
+ 'can-util/dom/mutation-observer/mutation-observer'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ module.exports = {
+ ajax: require('can-util/dom/ajax/ajax'),
+ attr: require('can-util/dom/attr/attr'),
+ childNodes: require('can-util/dom/child-nodes/child-nodes'),
+ className: require('can-util/dom/class-name/class-name'),
+ contains: require('can-util/dom/contains/contains'),
+ data: require('can-util/dom/data/data'),
+ dispatch: require('can-util/dom/dispatch/dispatch'),
+ document: require('can-util/dom/document/document'),
+ events: require('can-util/dom/events/events'),
+ frag: require('can-util/dom/frag/frag'),
+ fragment: require('can-util/dom/fragment/fragment'),
+ isOfGlobalDocument: require('can-util/dom/is-of-global-document/is-of-global-document'),
+ matches: require('can-util/dom/matches/matches'),
+ mutate: require('can-util/dom/mutate/mutate'),
+ mutationObserver: require('can-util/dom/mutation-observer/mutation-observer')
+ };
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
+/*can-util@3.11.2#js/dev/dev*/
+define('can-util/js/dev/dev', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-log/dev/dev'
+], function (require, exports, module) {
+ 'use strict';
+ module.exports = require('can-log/dev/dev');
+});
+/*can-util@3.11.2#js/global/global*/
+define('can-util/js/global/global', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-globals/global/global'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ module.exports = require('can-globals/global/global');
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
+/*can-util@3.11.2#js/import/import*/
+define('can-util/js/import/import', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-util/js/is-function/is-function',
+ 'can-globals/global/global'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ var isFunction = require('can-util/js/is-function/is-function');
+ var global = require('can-globals/global/global')();
+ module.exports = function (moduleName, parentName) {
+ return new Promise(function (resolve, reject) {
+ try {
+ if (typeof global.System === 'object' && isFunction(global.System['import'])) {
+ global.System['import'](moduleName, { name: parentName }).then(resolve, reject);
+ } else if (global.define && global.define.amd) {
+ global.require([moduleName], function (value) {
+ resolve(value);
+ });
+ } else if (global.require) {
+ resolve(global.require(moduleName));
+ } else {
+ if (typeof stealRequire !== 'undefined') {
+ steal.import(moduleName, { name: parentName }).then(resolve, reject);
+ } else {
+ resolve();
+ }
+ }
+ } catch (err) {
+ reject(err);
+ }
+ });
+ };
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
+/*can-util@3.11.2#js/is-browser-window/is-browser-window*/
+define('can-util/js/is-browser-window/is-browser-window', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-globals/is-browser-window/is-browser-window'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ module.exports = require('can-globals/is-browser-window/is-browser-window');
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
+/*can-util@3.11.2#js/is-empty-object/is-empty-object*/
+define('can-util/js/is-empty-object/is-empty-object', function (require, exports, module) {
+ 'use strict';
+ module.exports = function (obj) {
+ for (var prop in obj) {
+ return false;
+ }
+ return true;
+ };
+});
+/*can-util@3.11.2#js/is-node/is-node*/
+define('can-util/js/is-node/is-node', function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ module.exports = function () {
+ return typeof process === 'object' && {}.toString.call(process) === '[object process]';
+ };
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
+/*can-util@3.11.2#js/is-promise/is-promise*/
+define('can-util/js/is-promise/is-promise', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-reflect'
+], function (require, exports, module) {
+ 'use strict';
+ var canReflect = require('can-reflect');
+ module.exports = function (obj) {
+ return canReflect.isPromise(obj);
+ };
+});
+/*can-util@3.11.2#js/is-string/is-string*/
+define('can-util/js/is-string/is-string', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-log/dev/dev'
+], function (require, exports, module) {
+ 'use strict';
+ var dev = require('can-log/dev/dev');
+ var hasWarned = false;
+ module.exports = function isString(obj) {
+ return typeof obj === 'string';
+ };
+});
+/*can-util@3.11.2#js/is-web-worker/is-web-worker*/
+define('can-util/js/is-web-worker/is-web-worker', function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ module.exports = function () {
+ return typeof WorkerGlobalScope !== 'undefined' && this instanceof WorkerGlobalScope;
+ };
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
+/*can-util@3.11.2#js/join-uris/join-uris*/
+define('can-util/js/join-uris/join-uris', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-parse-uri'
+], function (require, exports, module) {
+ 'use strict';
+ var parseURI = require('can-parse-uri');
+ module.exports = function (base, href) {
+ function removeDotSegments(input) {
+ var output = [];
+ input.replace(/^(\.\.?(\/|$))+/, '').replace(/\/(\.(\/|$))+/g, '/').replace(/\/\.\.$/, '/../').replace(/\/?[^\/]*/g, function (p) {
+ if (p === '/..') {
+ output.pop();
+ } else {
+ output.push(p);
+ }
+ });
+ return output.join('').replace(/^\//, input.charAt(0) === '/' ? '/' : '');
+ }
+ href = parseURI(href || '');
+ base = parseURI(base || '');
+ return !href || !base ? null : (href.protocol || base.protocol) + (href.protocol || href.authority ? href.authority : base.authority) + removeDotSegments(href.protocol || href.authority || href.pathname.charAt(0) === '/' ? href.pathname : href.pathname ? (base.authority && !base.pathname ? '/' : '') + base.pathname.slice(0, base.pathname.lastIndexOf('/') + 1) + href.pathname : base.pathname) + (href.protocol || href.authority || href.pathname ? href.search : href.search || base.search) + href.hash;
+ };
+});
+/*can-util@3.11.2#js/last/last*/
+define('can-util/js/last/last', function (require, exports, module) {
+ 'use strict';
+ module.exports = function (arr) {
+ return arr && arr[arr.length - 1];
+ };
+});
+/*can-util@3.11.2#js/js*/
+define('can-util/js/js', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-assign',
+ 'can-cid',
+ 'can-util/js/deep-assign/deep-assign',
+ 'can-util/js/dev/dev',
+ 'can-util/js/diff/diff',
+ 'can-util/js/each/each',
+ 'can-util/js/global/global',
+ 'can-util/js/import/import',
+ 'can-util/js/is-array/is-array',
+ 'can-util/js/is-array-like/is-array-like',
+ 'can-util/js/is-browser-window/is-browser-window',
+ 'can-util/js/is-empty-object/is-empty-object',
+ 'can-util/js/is-function/is-function',
+ 'can-util/js/is-node/is-node',
+ 'can-util/js/is-plain-object/is-plain-object',
+ 'can-util/js/is-promise/is-promise',
+ 'can-util/js/is-string/is-string',
+ 'can-util/js/is-web-worker/is-web-worker',
+ 'can-util/js/join-uris/join-uris',
+ 'can-util/js/last/last',
+ 'can-util/js/make-array/make-array',
+ 'can-util/js/omit/omit',
+ 'can-util/js/set-immediate/set-immediate',
+ 'can-util/js/string/string',
+ 'can-types'
+], function (require, exports, module) {
+ (function (global, require, exports, module) {
+ 'use strict';
+ module.exports = {
+ assign: require('can-assign'),
+ cid: require('can-cid'),
+ deepAssign: require('can-util/js/deep-assign/deep-assign'),
+ dev: require('can-util/js/dev/dev'),
+ diff: require('can-util/js/diff/diff'),
+ each: require('can-util/js/each/each'),
+ global: require('can-util/js/global/global'),
+ 'import': require('can-util/js/import/import'),
+ isArray: require('can-util/js/is-array/is-array'),
+ isArrayLike: require('can-util/js/is-array-like/is-array-like'),
+ isBrowserWindow: require('can-util/js/is-browser-window/is-browser-window'),
+ isEmptyObject: require('can-util/js/is-empty-object/is-empty-object'),
+ isFunction: require('can-util/js/is-function/is-function'),
+ isNode: require('can-util/js/is-node/is-node'),
+ isPlainObject: require('can-util/js/is-plain-object/is-plain-object'),
+ isPromise: require('can-util/js/is-promise/is-promise'),
+ isString: require('can-util/js/is-string/is-string'),
+ isWebWorker: require('can-util/js/is-web-worker/is-web-worker'),
+ joinURIs: require('can-util/js/join-uris/join-uris'),
+ last: require('can-util/js/last/last'),
+ makeArray: require('can-util/js/make-array/make-array'),
+ omit: require('can-util/js/omit/omit'),
+ setImmediate: require('can-util/js/set-immediate/set-immediate'),
+ string: require('can-util/js/string/string'),
+ types: require('can-types')
+ };
+ }(function () {
+ return this;
+ }(), require, exports, module));
+});
+/*can-util@3.11.2#can-util*/
+define('can-util', [
+ 'require',
+ 'exports',
+ 'module',
+ 'can-util/js/deep-assign/deep-assign',
+ 'can-util/js/omit/omit',
+ 'can-namespace',
+ 'can-util/dom/dom',
+ 'can-util/js/js'
+], function (require, exports, module) {
+ var deepAssign = require('can-util/js/deep-assign/deep-assign');
+ var omit = require('can-util/js/omit/omit');
+ var namespace = require('can-namespace');
+ module.exports = deepAssign(namespace, require('can-util/dom/dom'), omit(require('can-util/js/js'), [
+ 'cid',
+ 'types'
+ ]));
+});
+/*[global-shim-end]*/
+(function(global) { // jshint ignore:line
+ global._define = global.define;
+ global.define = global.define.orig;
+}
+)(typeof self == "object" && self.Object == Object ? self : window);
\ No newline at end of file