blob: 81a7e7aec2f71a242777fd64023556b3c6be5588 [file] [log] [blame]
{"version":3,"file":"polymer.js","sources":["../src/polymer.js","../src/boot.js","../src/lib/lang.js","../src/lib/job.js","../src/lib/dom.js","../src/lib/super.js","../src/lib/deserialize.js","../src/api.js","../src/instance/utils.js","../src/instance/events.js","../src/instance/attributes.js","../src/instance/properties.js","../src/instance/mdv.js","../src/instance/base.js","../src/instance/styles.js","../src/declaration/polymer.js","../src/declaration/path.js","../src/declaration/styles.js","../src/declaration/events.js","../src/declaration/properties.js","../src/declaration/attributes.js","../src/declaration/prototype.js","../src/declaration/queue.js","../src/declaration/import.js","../src/declaration/polymer-element.js"],"names":["Polymer","window","scope","extend","prototype","api","Object","getOwnPropertyNames","forEach","n","pd","getOwnPropertyDescriptor","defineProperty","value","nom","job","callback","wait","stop","Job","this","go","inContext","context","boundComplete","complete","bind","h","setTimeout","handle","clearTimeout","requestAnimationFrame","cancelAnimationFrame","call","registry","HTMLElement","register","tag","getPrototypeForTag","getPrototypeOf","document","createElement","originalStopPropagation","Event","stopPropagation","cancelBubble","apply","arguments","$super","arrayOfArgs","caller","_super","nameInThis","console","warn","memoizeSuper","fn","nextSuper","proto","name","method","p","__proto__","n$","i","l","length","d","super","deserializeValue","currentValue","inferredType","Date","typeHandlers","string","date","parse","now","boolean","number","parseFloat","parseInt","isNaN","object","JSON","replace","e","function","declaration","instance","publish","apis","utils","async","args","timeout","Platform","flush","cancelAsync","fire","type","detail","onNode","bubbles","cancelable","node","event","CustomEvent","undefined","dispatchEvent","asyncFire","classFollows","anew","old","className","classList","remove","add","nop","nob","asyncMethod","log","logFlags","EVENT_PREFIX","events","addHostListeners","eventDelegates","keys","localName","bindable","eventName","self","PolymerExpressions","prepareEventBinding","Path","get","resolveEventHandler","model","path","getValueFrom","dispatchMethod","obj","group","groupEnd","attributes","copyInstanceAttributes","a$","_instanceAttributes","k","hasAttribute","setAttribute","takeAttributes","_publishLC","a","attributeToProperty","propertyForAttribute","search","bindPattern","match","stringValue","serializeValue","reflectPropertyToAttribute","serializedValue","removeAttribute","bindProperties","inA","inProperty","observable","LOG_BIND_PROPS","inB","inPath","v","discardChanges","setValue","Observer","defineComputedProperty","properties","observeProperties","_observeNames","pn$","_publishNames","o","_propertyObserver","CompoundObserver","registerObservers","addPath","observeArrayValue","observe","open","notifyPropertyChanges","newValues","oldValues","paths","called","invokeMethod","callbackName","Array","isArray","closeNamedObserver","observer","ArrayObserver","registerNamedObserver","bindProperty","property","observers","_observers","push","closeObservers","closeObserverArray","observerArray","close","o$","_namedObservers","closeNamedObservers","findEventController","parentNode","lightDomController","host","syntax","ctlr","mdv","instanceTemplate","template","dom","createInstance","bindings_","enableBindingsReflection","path_","mixinSuper","asyncUnbindAll","_unbound","unbind","_unbindAllJob","unbindAll","cancelUnbindAll","mustachePattern","isBase","hasOwnProperty","PolymerBase","base","created","ready","createdCallback","templateInstance","prepareElement","_elementPrepared","shadowRoots","parseDeclarations","attachedCallback","attached","enteredView","hasBeenAttached","domReady","detachedCallback","preventDispose","detached","leftView","enteredViewCallback","leftViewCallback","enteredDocumentCallback","leftDocumentCallback","element","parseDeclaration","elementElement","fetchTemplate","root","shadowFromTemplate","querySelector","createShadowRoot","appendChild","shadowRootReady","lightFromTemplate","refNode","insertBefore","marshalNodeReferences","PointerGestures","$","querySelectorAll","id","attributeChangedCallback","getAttribute","attributeChanged","onMutation","listener","MutationObserver","mutations","disconnect","childList","subtree","constructor","Base","shimCssText","cssText","is","selector","ShadowCSS","makeScopeSelector","STYLE_SCOPE_ATTRIBUTE","STYLE_CONTROLLER_SCOPE","styles","installControllerStyles","findStyleScope","scopeHasNamedStyle","cssTextForScope","installScopeCssText","installScopeStyle","style","s","textContent","ShadowDOMPolyfill","cssTextToScopeStyle","applyStyleToScope","_scopeStyles","script","_currentScript","getRegisteredPrototype","registerPrototype","notifyPrototype","waitingForPrototype","client","waitPrototype","registerWhenReady","prototypesByName","declarations","deliverDeclarations","resolveElementPaths","urlResolver","resolveDom","addResolvePathApi","assetPath","URL","ownerDocument","baseURI","resolvePath","urlPath","u","href","importRuleForSheet","sheet","baseUrl","head","clone","createStyleElement","attr","firstElementChild","s$","nextElementSibling","cssTextFromSheet","__resource","matchesSelector","inSelector","matches","STYLE_SELECTOR","STYLE_LOADABLE_MATCH","SHEET_SELECTOR","STYLE_GLOBAL_SCOPE","SCOPE_ATTR","loadStyles","content","templateContent","convertSheetsToStyles","findLoadableStyles","styleResolver","c","copySheetAttributes","replaceChild","link","loadables","installSheets","cacheSheets","cacheStyles","installLocalSheets","installGlobalStyles","sheets","findNodes","removeChild","filter","firstChild","matcher","nodes","array","templateNodes","concat","styleForScope","scopeDescriptor","webkitMatchesSelector","mozMatchesSelector","parseHostEvents","delegates","addAttributeDelegates","hasEventPrefix","removeEventPrefix","trim","slice","prefixLength","inferObservers","explodeObservers","exploded","ni","names","split","optimizePropertyMaps","publishProperties","requireProperties","lowerCaseMap","map","toLowerCase","ATTRIBUTES_ATTRIBUTE","ATTRIBUTES_REGEX","inheritAttributesObjects","inheritObject","publishAttributes","accumulateInstanceAttributes","clonable","isInstanceAttribute","blackList","extends","noscript","assetpath","cache-csstext","ensurePrototypeTraversal","ancestor","extendeeName","buildPrototype","publishConstructor","extension","generateBasePrototype","desugarBeforeChaining","chainPrototypes","desugarAfterChaining","inheritMetaData","chained","chainObject","extendee","shimStyling","registerCallback","symbol","ctor","extnds","findBasePrototype","ensureBaseApi","memoizedBases","extended","create","mixinMethod","source","info","typeExtension","findTypeExtension","registerElement","indexOf","inherited","queueForElement","contains","mainQueue","importQueue","nextQueued","whenPolymerReady","queue","waitToReady","CustomElements","HTMLImports","whenImportsReady","addReadyCallback","check","__check","__go","useNative","readied","shift","nextElement","canReady","isEmpty","upgradeDocumentTree","readyCallbacks","addEventListener","importElements","elementOrFragment","importUrls","urls","url","frag","createDocumentFragment","rel","import","isRegistered","Boolean","isCustomTag","init","loadResources","registered","waitingForQueue","waitingForResources","_register","handleNoScript","_needsResources","body"],"mappings":";;;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ACdjV,KAAK2d,iBAAkB,EACvB3d,KAAK6S,qBACLvS,KAAKN,SASXf,GAAIqF,QAAQrF,EAAImF,YAAapF,GAc7BF,EAAMyT,uBAAyBA,EAI/B8I,EAAiB,WACfja,SAASwc,KAAK7U,gBAAgB,cAC9B3H,SAASqE,cACP,GAAIF,aAAY,iBAAkBJ,SAAS,OAM/C/D,SAASyZ,gBAAgB,mBAAoB7b,UAAWA,KAEvDJ","sourcesContent":["/*\n * Copyright 2013 The Polymer Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\nPolymer = {};\n","/*\n * Copyright 2013 The Polymer Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n\n// TODO(sorvell): this ensures Polymer is an object and not a function\n// Platform is currently defining it as a function to allow for async loading\n// of polymer; once we refine the loading process this likely goes away.\nif (typeof window.Polymer === 'function') {\n Polymer = {};\n}\n\n","/*\n * Copyright 2013 The Polymer Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n(function(scope) {\n\n // copy own properties from 'api' to 'prototype, with name hinting for 'super'\n function extend(prototype, api) {\n if (prototype && api) {\n // use only own properties of 'api'\n Object.getOwnPropertyNames(api).forEach(function(n) {\n // acquire property descriptor\n var pd = Object.getOwnPropertyDescriptor(api, n);\n if (pd) {\n // clone property via descriptor\n Object.defineProperty(prototype, n, pd);\n // cache name-of-method for 'super' engine\n if (typeof pd.value == 'function') {\n // hint the 'super' engine\n pd.value.nom = n;\n }\n }\n });\n }\n return prototype;\n }\n \n // exports\n\n scope.extend = extend;\n\n})(Polymer);\n","/* \n * Copyright 2013 The Polymer Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n\n(function(scope) {\n \n // usage\n \n // invoke cb.call(this) in 100ms, unless the job is re-registered,\n // which resets the timer\n // \n // this.myJob = this.job(this.myJob, cb, 100)\n //\n // returns a job handle which can be used to re-register a job\n\n var Job = function(inContext) {\n this.context = inContext;\n this.boundComplete = this.complete.bind(this)\n };\n Job.prototype = {\n go: function(callback, wait) {\n this.callback = callback;\n var h;\n if (!wait) {\n h = requestAnimationFrame(this.boundComplete);\n this.handle = function() {\n cancelAnimationFrame(h);\n }\n } else {\n h = setTimeout(this.boundComplete, wait);\n this.handle = function() {\n clearTimeout(h);\n }\n }\n },\n stop: function() {\n if (this.handle) {\n this.handle();\n this.handle = null;\n }\n },\n complete: function() {\n if (this.handle) {\n this.stop();\n this.callback.call(this.context);\n }\n }\n };\n \n function job(job, callback, wait) {\n if (job) {\n job.stop();\n } else {\n job = new Job(this);\n }\n job.go(callback, wait);\n return job;\n }\n \n // exports \n\n scope.job = job;\n \n})(Polymer);\n","/*\n * Copyright 2013 The Polymer Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n(function(scope) {\n\n var registry = {};\n\n HTMLElement.register = function(tag, prototype) {\n registry[tag] = prototype;\n }\n\n // get prototype mapped to node <tag>\n HTMLElement.getPrototypeForTag = function(tag) {\n var prototype = !tag ? HTMLElement.prototype : registry[tag];\n // TODO(sjmiles): creating <tag> is likely to have wasteful side-effects\n return prototype || Object.getPrototypeOf(document.createElement(tag));\n };\n\n // we have to flag propagation stoppage for the event dispatcher\n var originalStopPropagation = Event.prototype.stopPropagation;\n Event.prototype.stopPropagation = function() {\n this.cancelBubble = true;\n originalStopPropagation.apply(this, arguments);\n };\n \n // TODO(sorvell): remove when we're sure imports does not need\n // to load stylesheets\n /*\n HTMLImports.importer.preloadSelectors += \n ', polymer-element link[rel=stylesheet]';\n */\n})(Polymer);\n","/*\n * Copyright 2013 The Polymer Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n (function(scope) {\n // super\n\n // `arrayOfArgs` is an optional array of args like one might pass\n // to `Function.apply`\n\n // TODO(sjmiles):\n // $super must be installed on an instance or prototype chain\n // as `super`, and invoked via `this`, e.g.\n // `this.super();`\n\n // will not work if function objects are not unique, for example,\n // when using mixins.\n // The memoization strategy assumes each function exists on only one \n // prototype chain i.e. we use the function object for memoizing)\n // perhaps we can bookkeep on the prototype itself instead\n function $super(arrayOfArgs) {\n // since we are thunking a method call, performance is important here: \n // memoize all lookups, once memoized the fast path calls no other \n // functions\n //\n // find the caller (cannot be `strict` because of 'caller')\n var caller = $super.caller;\n // memoized 'name of method' \n var nom = caller.nom;\n // memoized next implementation prototype\n var _super = caller._super;\n if (!_super) {\n if (!nom) {\n nom = caller.nom = nameInThis.call(this, caller);\n }\n if (!nom) {\n console.warn('called super() on a method not installed declaratively (has no .nom property)');\n }\n // super prototype is either cached or we have to find it\n // by searching __proto__ (at the 'top')\n _super = memoizeSuper(caller, nom, getPrototypeOf(this));\n }\n if (!_super) {\n // if _super is falsey, there is no super implementation\n //console.warn('called $super(' + nom + ') where there is no super implementation');\n } else {\n // our super function\n var fn = _super[nom];\n // memoize information so 'fn' can call 'super'\n if (!fn._super) {\n memoizeSuper(fn, nom, _super);\n }\n // invoke the inherited method\n // if 'fn' is not function valued, this will throw\n return fn.apply(this, arrayOfArgs || []);\n }\n }\n\n function nextSuper(proto, name, caller) {\n // look for an inherited prototype that implements name\n while (proto) {\n if ((proto[name] !== caller) && proto[name]) {\n return proto;\n }\n proto = getPrototypeOf(proto);\n }\n }\n\n function memoizeSuper(method, name, proto) {\n // find and cache next prototype containing `name`\n // we need the prototype so we can do another lookup\n // from here\n method._super = nextSuper(proto, name, method);\n if (method._super) {\n // _super is a prototype, the actual method is _super[name]\n // tag super method with it's name for further lookups\n method._super[name].nom = name;\n }\n return method._super;\n }\n\n function nameInThis(value) {\n var p = this.__proto__;\n while (p && p !== HTMLElement.prototype) {\n // TODO(sjmiles): getOwnPropertyNames is absurdly expensive\n var n$ = Object.getOwnPropertyNames(p);\n for (var i=0, l=n$.length, n; i<l && (n=n$[i]); i++) {\n var d = Object.getOwnPropertyDescriptor(p, n);\n if (typeof d.value === 'function' && d.value === value) {\n return n;\n }\n }\n p = p.__proto__;\n }\n }\n\n // NOTE: In some platforms (IE10) the prototype chain is faked via \n // __proto__. Therefore, always get prototype via __proto__ instead of\n // the more standard Object.getPrototypeOf.\n function getPrototypeOf(prototype) {\n return prototype.__proto__;\n }\n\n // utility function to precompute name tags for functions\n // in a (unchained) prototype\n function hintSuper(prototype) {\n // tag functions with their prototype name to optimize\n // super call invocations\n for (var n in prototype) {\n var pd = Object.getOwnPropertyDescriptor(prototype, n);\n if (pd && typeof pd.value === 'function') {\n pd.value.nom = n;\n }\n }\n }\n\n // exports\n\n scope.super = $super;\n\n})(Polymer);\n","/* \n * Copyright 2013 The Polymer Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n\n(function(scope) {\n\n var typeHandlers = {\n string: function(value) {\n return value;\n },\n date: function(value) {\n return new Date(Date.parse(value) || Date.now());\n },\n boolean: function(value) {\n if (value === '') {\n return true;\n }\n return value === 'false' ? false : !!value;\n },\n number: function(value) {\n var n = parseFloat(value);\n // hex values like \"0xFFFF\" parseFloat as 0\n if (n === 0) {\n n = parseInt(value);\n }\n return isNaN(n) ? value : n;\n // this code disabled because encoded values (like \"0xFFFF\")\n // do not round trip to their original format\n //return (String(floatVal) === value) ? floatVal : value;\n },\n object: function(value, currentValue) {\n if (currentValue === null) {\n return value;\n }\n try {\n // If the string is an object, we can parse is with the JSON library.\n // include convenience replace for single-quotes. If the author omits\n // quotes altogether, parse will fail.\n return JSON.parse(value.replace(/'/g, '\"'));\n } catch(e) {\n // The object isn't valid JSON, return the raw value\n return value;\n }\n },\n // avoid deserialization of functions\n 'function': function(value, currentValue) {\n return currentValue;\n }\n };\n\n function deserializeValue(value, currentValue) {\n // attempt to infer type from default value\n var inferredType = typeof currentValue;\n // invent 'date' type value for Date\n if (currentValue instanceof Date) {\n inferredType = 'date';\n }\n // delegate deserialization via type string\n return typeHandlers[inferredType](value, currentValue);\n }\n\n // exports\n\n scope.deserializeValue = deserializeValue;\n\n})(Polymer);\n","/*\n * Copyright 2013 The Polymer Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n(function(scope) {\n\n // imports\n\n var extend = scope.extend;\n\n // module\n\n var api = {};\n\n api.declaration = {};\n api.instance = {};\n\n api.publish = function(apis, prototype) {\n for (var n in apis) {\n extend(prototype, apis[n]);\n }\n }\n\n // exports\n\n scope.api = api;\n\n})(Polymer);\n","/*\n * Copyright 2013 The Polymer Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n(function(scope) {\n\n var utils = {\n /**\n * Invokes a function asynchronously. The context of the callback\n * function is bound to 'this' automatically.\n * @method async\n * @param {Function|String} method\n * @param {any|Array} args\n * @param {number} timeout\n */\n async: function(method, args, timeout) {\n // when polyfilling Object.observe, ensure changes \n // propagate before executing the async method\n Platform.flush();\n // second argument to `apply` must be an array\n args = (args && args.length) ? args : [args];\n // function to invoke\n var fn = function() {\n (this[method] || method).apply(this, args);\n }.bind(this);\n // execute `fn` sooner or later\n var handle = timeout ? setTimeout(fn, timeout) :\n requestAnimationFrame(fn);\n // NOTE: switch on inverting handle to determine which time is used.\n return timeout ? handle : ~handle;\n },\n cancelAsync: function(handle) {\n if (handle < 0) {\n cancelAnimationFrame(~handle);\n } else {\n clearTimeout(handle);\n }\n },\n /**\n * Fire an event.\n * @method fire\n * @returns {Object} event\n * @param {string} type An event name.\n * @param {any} detail\n * @param {Node} onNode Target node.\n */\n fire: function(type, detail, onNode, bubbles, cancelable) {\n var node = onNode || this;\n var detail = detail || {};\n var event = new CustomEvent(type, {\n bubbles: (bubbles !== undefined ? bubbles : true), \n cancelable: (cancelable !== undefined ? cancelable : true), \n detail: detail\n });\n node.dispatchEvent(event);\n return event;\n },\n /**\n * Fire an event asynchronously.\n * @method asyncFire\n * @param {string} type An event name.\n * @param detail\n * @param {Node} toNode Target node.\n */\n asyncFire: function(/*inType, inDetail*/) {\n this.async(\"fire\", arguments);\n },\n /**\n * Remove class from old, add class to anew, if they exist\n * @param classFollows\n * @param anew A node.\n * @param old A node\n * @param className\n */\n classFollows: function(anew, old, className) {\n if (old) {\n old.classList.remove(className);\n }\n if (anew) {\n anew.classList.add(className);\n }\n }\n };\n\n // no-operation function for handy stubs\n var nop = function() {};\n\n // null-object for handy stubs\n var nob = {};\n\n // deprecated\n\n utils.asyncMethod = utils.async;\n\n // exports\n\n scope.api.instance.utils = utils;\n scope.nop = nop;\n scope.nob = nob;\n\n})(Polymer);\n","/*\n * Copyright 2013 The Polymer Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n\n(function(scope) {\n\n // imports\n\n var log = window.logFlags || {};\n var EVENT_PREFIX = 'on-';\n\n // instance events api\n var events = {\n // read-only\n EVENT_PREFIX: EVENT_PREFIX,\n // event listeners on host\n addHostListeners: function() {\n var events = this.eventDelegates;\n log.events && (Object.keys(events).length > 0) && console.log('[%s] addHostListeners:', this.localName, events);\n // NOTE: host events look like bindings but really are not;\n // (1) we don't want the attribute to be set and (2) we want to support\n // multiple event listeners ('host' and 'instance') and Node.bind\n // by default supports 1 thing being bound.\n // We do, however, leverage the event hookup code in PolymerExpressions\n // so that we have a common code path for handling declarative events.\n var self = this, bindable, eventName;\n for (var n in events) {\n eventName = EVENT_PREFIX + n;\n bindable = PolymerExpressions.prepareEventBinding(\n Path.get(events[n]),\n eventName, \n {\n resolveEventHandler: function(model, path, node) {\n var fn = path.getValueFrom(self);\n if (fn) {\n return fn.bind(self);\n }\n }\n }\n );\n bindable(this, this, false);\n }\n },\n // call 'method' or function method on 'obj' with 'args', if the method exists\n dispatchMethod: function(obj, method, args) {\n if (obj) {\n log.events && console.group('[%s] dispatch [%s]', obj.localName, method);\n var fn = typeof method === 'function' ? method : obj[method];\n if (fn) {\n fn[args ? 'apply' : 'call'](obj, args);\n }\n log.events && console.groupEnd();\n Platform.flush();\n }\n }\n };\n\n // exports\n\n scope.api.instance.events = events;\n\n})(Polymer);\n","/*\r\n * Copyright 2013 The Polymer Authors. All rights reserved.\r\n * Use of this source code is governed by a BSD-style\r\n * license that can be found in the LICENSE file.\r\n */\r\n(function(scope) {\r\n\r\n // instance api for attributes\r\n\r\n var attributes = {\r\n copyInstanceAttributes: function () {\r\n var a$ = this._instanceAttributes;\r\n for (var k in a$) {\r\n if (!this.hasAttribute(k)) {\r\n this.setAttribute(k, a$[k]);\r\n }\r\n }\r\n },\r\n // for each attribute on this, deserialize value to property as needed\r\n takeAttributes: function() {\r\n // if we have no publish lookup table, we have no attributes to take\r\n // TODO(sjmiles): ad hoc\r\n if (this._publishLC) {\r\n for (var i=0, a$=this.attributes, l=a$.length, a; (a=a$[i]) && i<l; i++) {\r\n this.attributeToProperty(a.name, a.value);\r\n }\r\n }\r\n },\r\n // if attribute 'name' is mapped to a property, deserialize\r\n // 'value' into that property\r\n attributeToProperty: function(name, value) {\r\n // try to match this attribute to a property (attributes are\r\n // all lower-case, so this is case-insensitive search)\r\n var name = this.propertyForAttribute(name);\r\n if (name) {\r\n // filter out 'mustached' values, these are to be\r\n // replaced with bound-data and are not yet values\r\n // themselves\r\n if (value && value.search(scope.bindPattern) >= 0) {\r\n return;\r\n }\r\n // get original value\r\n var currentValue = this[name];\r\n // deserialize Boolean or Number values from attribute\r\n var value = this.deserializeValue(value, currentValue);\r\n // only act if the value has changed\r\n if (value !== currentValue) {\r\n // install new value (has side-effects)\r\n this[name] = value;\r\n }\r\n }\r\n },\r\n // return the published property matching name, or undefined\r\n propertyForAttribute: function(name) {\r\n var match = this._publishLC && this._publishLC[name];\r\n //console.log('propertyForAttribute:', name, 'matches', match);\r\n return match;\r\n },\r\n // convert representation of 'stringValue' based on type of 'currentValue'\r\n deserializeValue: function(stringValue, currentValue) {\r\n return scope.deserializeValue(stringValue, currentValue);\r\n },\r\n serializeValue: function(value, inferredType) {\r\n if (inferredType === 'boolean') {\r\n return value ? '' : undefined;\r\n } else if (inferredType !== 'object' && inferredType !== 'function'\r\n && value !== undefined) {\r\n return value;\r\n }\r\n },\r\n reflectPropertyToAttribute: function(name) {\r\n var inferredType = typeof this[name];\r\n // try to intelligently serialize property value\r\n var serializedValue = this.serializeValue(this[name], inferredType);\r\n // boolean properties must reflect as boolean attributes\r\n if (serializedValue !== undefined) {\r\n this.setAttribute(name, serializedValue);\r\n // TODO(sorvell): we should remove attr for all properties\r\n // that have undefined serialization; however, we will need to\r\n // refine the attr reflection system to achieve this; pica, for example,\r\n // relies on having inferredType object properties not removed as\r\n // attrs.\r\n } else if (inferredType === 'boolean') {\r\n this.removeAttribute(name);\r\n }\r\n }\r\n };\r\n\r\n // exports\r\n\r\n scope.api.instance.attributes = attributes;\r\n\r\n})(Polymer);\r\n","/*\n * Copyright 2013 The Polymer Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n(function(scope) {\n\n // imports\n\n var log = window.logFlags || {};\n\n // magic words\n\n var OBSERVE_SUFFIX = 'Changed';\n\n // element api\n\n var empty = [];\n\n var properties = {\n observeProperties: function() {\n var n$ = this._observeNames, pn$ = this._publishNames;\n if ((n$ && n$.length) || (pn$ && pn$.length)) {\n var self = this;\n var o = this._propertyObserver = new CompoundObserver();\n // keep track of property observer so we can shut it down\n this.registerObservers([o]);\n for (var i=0, l=n$.length, n; (i<l) && (n=n$[i]); i++) {\n o.addPath(this, n);\n // observer array properties\n var pd = Object.getOwnPropertyDescriptor(this.__proto__, n);\n if (pd && pd.value) {\n this.observeArrayValue(n, pd.value, null);\n }\n }\n for (var i=0, l=pn$.length, n; (i<l) && (n=pn$[i]); i++) {\n if (!this.observe || (this.observe[n] === undefined)) {\n o.addPath(this, n);\n }\n }\n o.open(this.notifyPropertyChanges, this);\n }\n },\n notifyPropertyChanges: function(newValues, oldValues, paths) {\n var name, method, called = {};\n for (var i in oldValues) {\n // note: paths is of form [object, path, object, path]\n name = paths[2 * i + 1];\n if (this.publish[name] !== undefined) {\n this.reflectPropertyToAttribute(name);\n }\n method = this.observe[name];\n if (method) {\n this.observeArrayValue(name, newValues[i], oldValues[i]);\n if (!called[method]) {\n called[method] = true;\n // observes the value if it is an array\n this.invokeMethod(method, [oldValues[i], newValues[i], arguments]);\n }\n }\n }\n },\n observeArrayValue: function(name, value, old) {\n // we only care if there are registered side-effects\n var callbackName = this.observe[name];\n if (callbackName) {\n // if we are observing the previous value, stop\n if (Array.isArray(old)) {\n log.observe && console.log('[%s] observeArrayValue: unregister observer [%s]', this.localName, name);\n this.closeNamedObserver(name + '__array');\n }\n // if the new value is an array, being observing it\n if (Array.isArray(value)) {\n log.observe && console.log('[%s] observeArrayValue: register observer [%s]', this.localName, name, value);\n var observer = new ArrayObserver(value);\n observer.open(function(value, old) {\n this.invokeMethod(callbackName, [old]);\n }, this);\n this.registerNamedObserver(name + '__array', observer);\n }\n }\n },\n bindProperty: function(property, observable) {\n // apply Polymer two-way reference binding\n return bindProperties(this, property, observable);\n },\n invokeMethod: function(method, args) {\n var fn = this[method] || method;\n if (typeof fn === 'function') {\n fn.apply(this, args);\n }\n },\n registerObservers: function(observers) {\n this._observers.push(observers);\n },\n // observer array items are arrays of observers.\n closeObservers: function() {\n for (var i=0, l=this._observers.length; i<l; i++) {\n this.closeObserverArray(this._observers[i]);\n }\n this._observers = [];\n },\n closeObserverArray: function(observerArray) {\n for (var i=0, l=observerArray.length, o; i<l; i++) {\n o = observerArray[i];\n if (o && o.close) {\n o.close();\n }\n }\n },\n // bookkeeping observers for memory management\n registerNamedObserver: function(name, observer) {\n var o$ = this._namedObservers || (this._namedObservers = {});\n o$[name] = observer;\n },\n closeNamedObserver: function(name) {\n var o$ = this._namedObservers;\n if (o$ && o$[name]) {\n o$[name].close();\n o$[name] = null;\n return true;\n }\n },\n closeNamedObservers: function() {\n if (this._namedObservers) {\n var keys=Object.keys(this._namedObservers);\n for (var i=0, l=keys.length, k, o; (i < l) && (k=keys[i]); i++) {\n o = this._namedObservers[k];\n o.close();\n }\n this._namedObservers = {};\n }\n }\n };\n\n // property binding\n // bind a property in A to a path in B by converting A[property] to a\n // getter/setter pair that accesses B[...path...]\n function bindProperties(inA, inProperty, observable) {\n log.bind && console.log(LOG_BIND_PROPS, inB.localName || 'object', inPath, inA.localName, inProperty);\n // capture A's value if B's value is null or undefined,\n // otherwise use B's value\n // TODO(sorvell): need to review, can do with ObserverTransform\n var v = observable.discardChanges();\n if (v === null || v === undefined) {\n observable.setValue(inA[inProperty]);\n }\n return Observer.defineComputedProperty(inA, inProperty, observable);\n }\n\n // logging\n var LOG_OBSERVE = '[%s] watching [%s]';\n var LOG_OBSERVED = '[%s#%s] watch: [%s] now [%s] was [%s]';\n var LOG_CHANGED = '[%s#%s] propertyChanged: [%s] now [%s] was [%s]';\n var LOG_BIND_PROPS = \"[%s]: bindProperties: [%s] to [%s].[%s]\";\n\n // exports\n\n scope.api.instance.properties = properties;\n\n})(Polymer);\n","/*\n * Copyright 2013 The Polymer Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n(function(scope) {\n\n // imports\n\n var log = window.logFlags || 0;\n var events = scope.api.instance.events;\n\n var syntax = new PolymerExpressions();\n syntax.resolveEventHandler = function(model, path, node) {\n var ctlr = findEventController(node);\n if (ctlr) {\n var fn = path.getValueFrom(ctlr);\n if (fn) {\n return fn.bind(ctlr);\n }\n }\n }\n\n // An event controller is the host element for the shadowRoot in which \n // the node exists, or the first ancestor with a 'lightDomController'\n // property.\n function findEventController(node) {\n while (node.parentNode) {\n if (node.lightDomController) {\n return node;\n }\n node = node.parentNode;\n }\n return node.host;\n };\n\n // element api supporting mdv\n\n var mdv = {\n syntax: syntax,\n instanceTemplate: function(template) {\n var dom = template.createInstance(this, this.syntax);\n this.registerObservers(dom.bindings_);\n return dom;\n },\n bind: function(name, observable, oneTime) {\n var property = this.propertyForAttribute(name);\n if (!property) {\n // TODO(sjmiles): this mixin method must use the special form\n // of `super` installed by `mixinMethod` in declaration/prototype.js\n return this.mixinSuper(arguments);\n } else {\n // use n-way Polymer binding\n var observer = this.bindProperty(property, observable);\n this.reflectPropertyToAttribute(property);\n // NOTE: reflecting binding information is typically required only for\n // tooling. It has a performance cost so it's opt-in in Node.bind.\n if (Platform.enableBindingsReflection) {\n observer.path = observable.path_;\n this.bindings_ = this.bindings_ || {};\n this.bindings_[name] = observer;\n }\n return observer;\n }\n },\n // TODO(sorvell): unbind/unbindAll has been removed, as public api, from\n // TemplateBinding. We still need to close/dispose of observers but perhaps\n // we should choose a more explicit name.\n asyncUnbindAll: function() {\n if (!this._unbound) {\n log.unbind && console.log('[%s] asyncUnbindAll', this.localName);\n this._unbindAllJob = this.job(this._unbindAllJob, this.unbindAll, 0);\n }\n },\n unbindAll: function() {\n if (!this._unbound) {\n this.closeObservers();\n this.closeNamedObservers();\n this._unbound = true;\n }\n },\n cancelUnbindAll: function() {\n if (this._unbound) {\n log.unbind && console.warn('[%s] already unbound, cannot cancel unbindAll', this.localName);\n return;\n }\n log.unbind && console.log('[%s] cancelUnbindAll', this.localName);\n if (this._unbindAllJob) {\n this._unbindAllJob = this._unbindAllJob.stop();\n }\n }\n };\n\n function unbindNodeTree(node) {\n forNodeTree(node, _nodeUnbindAll);\n }\n\n function _nodeUnbindAll(node) {\n node.unbindAll();\n }\n\n function forNodeTree(node, callback) {\n if (node) {\n callback(node);\n for (var child = node.firstChild; child; child = child.nextSibling) {\n forNodeTree(child, callback);\n }\n }\n }\n\n var mustachePattern = /\\{\\{([^{}]*)}}/;\n\n // exports\n\n scope.bindPattern = mustachePattern;\n scope.api.instance.mdv = mdv;\n\n})(Polymer);\n","/*\n * Copyright 2013 The Polymer Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n(function(scope) {\n\n var base = {\n PolymerBase: true,\n job: function(job, callback, wait) {\n if (typeof job === 'string') {\n var n = '___' + job;\n this[n] = Polymer.job.call(this, this[n], callback, wait);\n } else {\n return Polymer.job.call(this, job, callback, wait);\n }\n },\n super: Polymer.super,\n // user entry point for element has had its createdCallback called\n created: function() {\n },\n // user entry point for element has shadowRoot and is ready for\n // api interaction\n ready: function() {\n },\n createdCallback: function() {\n if (this.templateInstance && this.templateInstance.model) {\n console.warn('Attributes on ' + this.localName + ' were data bound ' +\n 'prior to Polymer upgrading the element. This may result in ' +\n 'incorrect binding types.');\n }\n this.created();\n this.prepareElement();\n },\n // system entry point, do not override\n prepareElement: function() {\n this._elementPrepared = true;\n // install shadowRoots storage\n this.shadowRoots = {};\n // storage for closeable observers.\n this._observers = [];\n // install property observers\n this.observeProperties();\n // install boilerplate attributes\n this.copyInstanceAttributes();\n // process input attributes\n this.takeAttributes();\n // add event listeners\n this.addHostListeners();\n // process declarative resources\n this.parseDeclarations(this.__proto__);\n // TODO(sorvell): CE polyfill uses unresolved attribute to simulate\n // :unresolved; remove this attribute to be compatible with native\n // CE.\n this.removeAttribute('unresolved');\n // user entry point\n this.ready();\n },\n attachedCallback: function() {\n this.cancelUnbindAll();\n // invoke user action\n if (this.attached) {\n this.attached();\n }\n // TODO(sorvell): bc\n if (this.enteredView) {\n this.enteredView();\n }\n // NOTE: domReady can be used to access elements in dom (descendants, \n // ancestors, siblings) such that the developer is enured to upgrade\n // ordering. If the element definitions have loaded, domReady\n // can be used to access upgraded elements.\n if (!this.hasBeenAttached) {\n this.hasBeenAttached = true;\n if (this.domReady) {\n this.async('domReady');\n }\n }\n },\n detachedCallback: function() {\n if (!this.preventDispose) {\n this.asyncUnbindAll();\n }\n // invoke user action\n if (this.detached) {\n this.detached();\n }\n // TODO(sorvell): bc\n if (this.leftView) {\n this.leftView();\n }\n },\n // TODO(sorvell): bc\n enteredViewCallback: function() {\n this.attachedCallback();\n },\n // TODO(sorvell): bc\n leftViewCallback: function() {\n this.detachedCallback();\n },\n // TODO(sorvell): bc\n enteredDocumentCallback: function() {\n this.attachedCallback();\n },\n // TODO(sorvell): bc\n leftDocumentCallback: function() {\n this.detachedCallback();\n },\n // recursive ancestral <element> initialization, oldest first\n parseDeclarations: function(p) {\n if (p && p.element) {\n this.parseDeclarations(p.__proto__);\n p.parseDeclaration.call(this, p.element);\n }\n },\n // parse input <element> as needed, override for custom behavior\n parseDeclaration: function(elementElement) {\n var template = this.fetchTemplate(elementElement);\n if (template) {\n var root = this.shadowFromTemplate(template);\n this.shadowRoots[elementElement.name] = root;\n }\n },\n // return a shadow-root template (if desired), override for custom behavior\n fetchTemplate: function(elementElement) {\n return elementElement.querySelector('template');\n },\n // utility function that creates a shadow root from a <template>\n shadowFromTemplate: function(template) {\n if (template) {\n // make a shadow root\n var root = this.createShadowRoot();\n // stamp template\n // which includes parsing and applying MDV bindings before being \n // inserted (to avoid {{}} in attribute values)\n // e.g. to prevent <img src=\"images/{{icon}}\"> from generating a 404.\n var dom = this.instanceTemplate(template);\n // append to shadow dom\n root.appendChild(dom);\n // perform post-construction initialization tasks on shadow root\n this.shadowRootReady(root, template);\n // return the created shadow root\n return root;\n }\n },\n // utility function that stamps a <template> into light-dom\n lightFromTemplate: function(template, refNode) {\n if (template) {\n // TODO(sorvell): mark this element as a lightDOMController so that\n // event listeners on bound nodes inside it will be called on it.\n // Note, the expectation here is that events on all descendants \n // should be handled by this element.\n this.lightDomController = true;\n // stamp template\n // which includes parsing and applying MDV bindings before being \n // inserted (to avoid {{}} in attribute values)\n // e.g. to prevent <img src=\"images/{{icon}}\"> from generating a 404.\n var dom = this.instanceTemplate(template);\n // append to shadow dom\n if (refNode) {\n this.insertBefore(dom, refNode); \n } else {\n this.appendChild(dom);\n }\n // perform post-construction initialization tasks on ahem, light root\n this.shadowRootReady(this);\n // return the created shadow root\n return dom;\n }\n },\n shadowRootReady: function(root) {\n // locate nodes with id and store references to them in this.$ hash\n this.marshalNodeReferences(root);\n // set up pointer gestures\n PointerGestures.register(root);\n },\n // locate nodes with id and store references to them in this.$ hash\n marshalNodeReferences: function(root) {\n // establish $ instance variable\n var $ = this.$ = this.$ || {};\n // populate $ from nodes with ID from the LOCAL tree\n if (root) {\n var n$ = root.querySelectorAll(\"[id]\");\n for (var i=0, l=n$.length, n; (i<l) && (n=n$[i]); i++) {\n $[n.id] = n;\n };\n }\n },\n attributeChangedCallback: function(name, oldValue) {\n // TODO(sjmiles): adhoc filter\n if (name !== 'class' && name !== 'style') {\n this.attributeToProperty(name, this.getAttribute(name));\n }\n if (this.attributeChanged) {\n this.attributeChanged.apply(this, arguments);\n }\n },\n onMutation: function(node, listener) {\n var observer = new MutationObserver(function(mutations) {\n listener.call(this, observer, mutations);\n observer.disconnect();\n }.bind(this));\n observer.observe(node, {childList: true, subtree: true});\n }\n };\n\n // true if object has own PolymerBase api\n function isBase(object) {\n return object.hasOwnProperty('PolymerBase') \n }\n\n // name a base constructor for dev tools\n\n function PolymerBase() {};\n PolymerBase.prototype = base;\n base.constructor = PolymerBase;\n \n // exports\n\n scope.Base = PolymerBase;\n scope.isBase = isBase;\n scope.api.instance.base = base;\n \n})(Polymer);\n","/*\n * Copyright 2013 The Polymer Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n(function(scope) {\n\n // imports\n\n var log = window.logFlags || {};\n \n // magic words\n \n var STYLE_SCOPE_ATTRIBUTE = 'element';\n var STYLE_CONTROLLER_SCOPE = 'controller';\n \n var styles = {\n STYLE_SCOPE_ATTRIBUTE: STYLE_SCOPE_ATTRIBUTE,\n /**\n * Installs external stylesheets and <style> elements with the attribute \n * polymer-scope='controller' into the scope of element. This is intended\n * to be a called during custom element construction.\n */\n installControllerStyles: function() {\n // apply controller styles, but only if they are not yet applied\n var scope = this.findStyleScope();\n if (scope && !this.scopeHasNamedStyle(scope, this.localName)) {\n // allow inherited controller styles\n var proto = getPrototypeOf(this), cssText = '';\n while (proto && proto.element) {\n cssText += proto.element.cssTextForScope(STYLE_CONTROLLER_SCOPE);\n proto = getPrototypeOf(proto);\n }\n if (cssText) {\n this.installScopeCssText(cssText, scope);\n }\n }\n },\n installScopeStyle: function(style, name, scope) {\n var scope = scope || this.findStyleScope(), name = name || '';\n if (scope && !this.scopeHasNamedStyle(scope, this.localName + name)) {\n var cssText = '';\n if (style instanceof Array) {\n for (var i=0, l=style.length, s; (i<l) && (s=style[i]); i++) {\n cssText += s.textContent + '\\n\\n';\n }\n } else {\n cssText = style.textContent;\n }\n this.installScopeCssText(cssText, scope, name);\n }\n },\n installScopeCssText: function(cssText, scope, name) {\n scope = scope || this.findStyleScope();\n name = name || '';\n if (!scope) {\n return;\n }\n if (window.ShadowDOMPolyfill) {\n cssText = shimCssText(cssText, scope.host);\n }\n var style = this.element.cssTextToScopeStyle(cssText,\n STYLE_CONTROLLER_SCOPE);\n Polymer.applyStyleToScope(style, scope);\n // cache that this style has been applied\n scope._scopeStyles[this.localName + name] = true;\n },\n findStyleScope: function(node) {\n // find the shadow root that contains this element\n var n = node || this;\n while (n.parentNode) {\n n = n.parentNode;\n }\n return n;\n },\n scopeHasNamedStyle: function(scope, name) {\n scope._scopeStyles = scope._scopeStyles || {};\n return scope._scopeStyles[name];\n }\n };\n \n // NOTE: use raw prototype traversal so that we ensure correct traversal\n // on platforms where the protoype chain is simulated via __proto__ (IE10)\n function getPrototypeOf(prototype) {\n return prototype.__proto__;\n }\n\n function shimCssText(cssText, host) {\n var name = '', is = false;\n if (host) {\n name = host.localName;\n is = host.hasAttribute('is');\n }\n var selector = Platform.ShadowCSS.makeScopeSelector(name, is);\n return Platform.ShadowCSS.shimCssText(cssText, selector);\n }\n\n // exports\n\n scope.api.instance.styles = styles;\n \n})(Polymer);\n","/*\n * Copyright 2013 The Polymer Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n(function(scope) {\n\n // imports\n\n var extend = scope.extend;\n var api = scope.api;\n\n // imperative implementation: Polymer()\n\n // specify an 'own' prototype for tag `name`\n function element(name, prototype) {\n if (arguments.length === 1 && typeof arguments[0] !== 'string') {\n prototype = name;\n var script = document._currentScript;\n name = script && script.parentNode && script.parentNode.getAttribute ?\n script.parentNode.getAttribute('name') : '';\n if (!name) {\n throw 'Element name could not be inferred.';\n }\n }\n if (getRegisteredPrototype[name]) {\n throw 'Already registered (Polymer) prototype for element ' + name;\n }\n // cache the prototype\n registerPrototype(name, prototype);\n // notify the registrar waiting for 'name', if any\n notifyPrototype(name);\n }\n\n // async prototype source\n\n function waitingForPrototype(name, client) {\n waitPrototype[name] = client;\n }\n\n var waitPrototype = {};\n\n function notifyPrototype(name) {\n if (waitPrototype[name]) {\n waitPrototype[name].registerWhenReady();\n delete waitPrototype[name];\n }\n }\n\n // utility and bookkeeping\n\n // maps tag names to prototypes, as registered with\n // Polymer. Prototypes associated with a tag name\n // using document.registerElement are available from\n // HTMLElement.getPrototypeForTag().\n // If an element was fully registered by Polymer, then\n // Polymer.getRegisteredPrototype(name) === \n // HTMLElement.getPrototypeForTag(name)\n\n var prototypesByName = {};\n\n function registerPrototype(name, prototype) {\n return prototypesByName[name] = prototype || {};\n }\n\n function getRegisteredPrototype(name) {\n return prototypesByName[name];\n }\n\n // exports\n\n scope.getRegisteredPrototype = getRegisteredPrototype;\n scope.waitingForPrototype = waitingForPrototype;\n\n // namespace shenanigans so we can expose our scope on the registration \n // function\n\n // make window.Polymer reference `element()`\n\n window.Polymer = element;\n\n // TODO(sjmiles): find a way to do this that is less terrible\n // copy window.Polymer properties onto `element()`\n\n extend(Polymer, scope);\n\n // Under the HTMLImports polyfill, scripts in the main document\n // do not block on imports; we want to allow calls to Polymer in the main\n // document. Platform collects those calls until we can process them, which\n // we do here.\n\n var declarations = Platform.deliverDeclarations();\n if (declarations) {\n for (var i=0, l=declarations.length, d; (i<l) && (d=declarations[i]); i++) {\n element.apply(null, d);\n }\n }\n\n})(Polymer);\n","/* \n * Copyright 2013 The Polymer Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n\n(function(scope) {\n\nvar path = {\n resolveElementPaths: function(node) {\n Platform.urlResolver.resolveDom(node);\n },\n addResolvePathApi: function() {\n // let assetpath attribute modify the resolve path\n var assetPath = this.getAttribute('assetpath') || '';\n var root = new URL(assetPath, this.ownerDocument.baseURI);\n this.prototype.resolvePath = function(urlPath, base) {\n var u = new URL(urlPath, base || root);\n return u.href;\n };\n }\n};\n\n// exports\nscope.api.declaration.path = path;\n\n})(Polymer);\n","/*\n * Copyright 2013 The Polymer Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n(function(scope) {\n\n // imports\n\n var log = window.logFlags || {};\n var api = scope.api.instance.styles;\n var STYLE_SCOPE_ATTRIBUTE = api.STYLE_SCOPE_ATTRIBUTE;\n\n // magic words\n\n var STYLE_SELECTOR = 'style';\n var STYLE_LOADABLE_MATCH = '@import';\n var SHEET_SELECTOR = 'link[rel=stylesheet]';\n var STYLE_GLOBAL_SCOPE = 'global';\n var SCOPE_ATTR = 'polymer-scope';\n\n var styles = {\n // returns true if resources are loading\n loadStyles: function(callback) {\n var content = this.templateContent();\n if (content) {\n this.convertSheetsToStyles(content);\n }\n var styles = this.findLoadableStyles(content);\n if (styles.length) {\n Platform.styleResolver.loadStyles(styles, callback);\n } else if (callback) {\n callback();\n }\n },\n convertSheetsToStyles: function(root) {\n var s$ = root.querySelectorAll(SHEET_SELECTOR);\n for (var i=0, l=s$.length, s, c; (i<l) && (s=s$[i]); i++) {\n c = createStyleElement(importRuleForSheet(s, this.ownerDocument.baseURI),\n this.ownerDocument);\n this.copySheetAttributes(c, s);\n s.parentNode.replaceChild(c, s);\n }\n },\n copySheetAttributes: function(style, link) {\n for (var i=0, a$=link.attributes, l=a$.length, a; (a=a$[i]) && i<l; i++) {\n if (a.name !== 'rel' && a.name !== 'href') {\n style.setAttribute(a.name, a.value);\n }\n }\n },\n findLoadableStyles: function(root) {\n var loadables = [];\n if (root) {\n var s$ = root.querySelectorAll(STYLE_SELECTOR);\n for (var i=0, l=s$.length, s; (i<l) && (s=s$[i]); i++) {\n if (s.textContent.match(STYLE_LOADABLE_MATCH)) {\n loadables.push(s);\n }\n }\n }\n return loadables;\n },\n /**\n * Install external stylesheets loaded in <polymer-element> elements into the \n * element's template.\n * @param elementElement The <element> element to style.\n */\n installSheets: function() {\n this.cacheSheets();\n this.cacheStyles();\n this.installLocalSheets();\n this.installGlobalStyles();\n },\n /**\n * Remove all sheets from element and store for later use.\n */\n cacheSheets: function() {\n this.sheets = this.findNodes(SHEET_SELECTOR);\n this.sheets.forEach(function(s) {\n if (s.parentNode) {\n s.parentNode.removeChild(s);\n }\n });\n },\n cacheStyles: function() {\n this.styles = this.findNodes(STYLE_SELECTOR + '[' + SCOPE_ATTR + ']');\n this.styles.forEach(function(s) {\n if (s.parentNode) {\n s.parentNode.removeChild(s);\n }\n });\n },\n /**\n * Takes external stylesheets loaded in an <element> element and moves\n * their content into a <style> element inside the <element>'s template.\n * The sheet is then removed from the <element>. This is done only so \n * that if the element is loaded in the main document, the sheet does\n * not become active.\n * Note, ignores sheets with the attribute 'polymer-scope'.\n * @param elementElement The <element> element to style.\n */\n installLocalSheets: function () {\n var sheets = this.sheets.filter(function(s) {\n return !s.hasAttribute(SCOPE_ATTR);\n });\n var content = this.templateContent();\n if (content) {\n var cssText = '';\n sheets.forEach(function(sheet) {\n cssText += cssTextFromSheet(sheet) + '\\n';\n });\n if (cssText) {\n var style = createStyleElement(cssText, this.ownerDocument);\n content.insertBefore(style, content.firstChild);\n }\n }\n },\n findNodes: function(selector, matcher) {\n var nodes = this.querySelectorAll(selector).array();\n var content = this.templateContent();\n if (content) {\n var templateNodes = content.querySelectorAll(selector).array();\n nodes = nodes.concat(templateNodes);\n }\n return matcher ? nodes.filter(matcher) : nodes;\n },\n templateContent: function() {\n var template = this.querySelector('template');\n return template && templateContent(template);\n },\n /**\n * Promotes external stylesheets and <style> elements with the attribute \n * polymer-scope='global' into global scope.\n * This is particularly useful for defining @keyframe rules which \n * currently do not function in scoped or shadow style elements.\n * (See wkb.ug/72462)\n * @param elementElement The <element> element to style.\n */\n // TODO(sorvell): remove when wkb.ug/72462 is addressed.\n installGlobalStyles: function() {\n var style = this.styleForScope(STYLE_GLOBAL_SCOPE);\n applyStyleToScope(style, document.head);\n },\n cssTextForScope: function(scopeDescriptor) {\n var cssText = '';\n // handle stylesheets\n var selector = '[' + SCOPE_ATTR + '=' + scopeDescriptor + ']';\n var matcher = function(s) {\n return matchesSelector(s, selector);\n };\n var sheets = this.sheets.filter(matcher);\n sheets.forEach(function(sheet) {\n cssText += cssTextFromSheet(sheet) + '\\n\\n';\n });\n // handle cached style elements\n var styles = this.styles.filter(matcher);\n styles.forEach(function(style) {\n cssText += style.textContent + '\\n\\n';\n });\n return cssText;\n },\n styleForScope: function(scopeDescriptor) {\n var cssText = this.cssTextForScope(scopeDescriptor);\n return this.cssTextToScopeStyle(cssText, scopeDescriptor);\n },\n cssTextToScopeStyle: function(cssText, scopeDescriptor) {\n if (cssText) {\n var style = createStyleElement(cssText);\n style.setAttribute(STYLE_SCOPE_ATTRIBUTE, this.getAttribute('name') +\n '-' + scopeDescriptor);\n return style;\n }\n }\n };\n\n function importRuleForSheet(sheet, baseUrl) {\n var href = new URL(sheet.getAttribute('href'), baseUrl).href;\n return '@import \\'' + href + '\\';';\n }\n\n function applyStyleToScope(style, scope) {\n if (style) {\n if (scope === document) {\n scope = document.head;\n }\n if (window.ShadowDOMPolyfill) {\n scope = document.head;\n }\n // TODO(sorvell): necessary for IE\n // see https://connect.microsoft.com/IE/feedback/details/790212/\n // cloning-a-style-element-and-adding-to-document-produces\n // -unexpected-result#details\n // var clone = style.cloneNode(true);\n var clone = createStyleElement(style.textContent);\n var attr = style.getAttribute(STYLE_SCOPE_ATTRIBUTE);\n if (attr) {\n clone.setAttribute(STYLE_SCOPE_ATTRIBUTE, attr);\n }\n // TODO(sorvell): probably too brittle; try to figure out \n // where to put the element.\n var refNode = scope.firstElementChild;\n if (scope === document.head) {\n var selector = 'style[' + STYLE_SCOPE_ATTRIBUTE + ']';\n var s$ = document.head.querySelectorAll(selector);\n if (s$.length) {\n refNode = s$[s$.length-1].nextElementSibling;\n }\n }\n scope.insertBefore(clone, refNode);\n }\n }\n\n function createStyleElement(cssText, scope) {\n scope = scope || document;\n scope = scope.createElement ? scope : scope.ownerDocument;\n var style = scope.createElement('style');\n style.textContent = cssText;\n return style;\n }\n\n function cssTextFromSheet(sheet) {\n return (sheet && sheet.__resource) || '';\n }\n\n function matchesSelector(node, inSelector) {\n if (matches) {\n return matches.call(node, inSelector);\n }\n }\n var p = HTMLElement.prototype;\n var matches = p.matches || p.matchesSelector || p.webkitMatchesSelector \n || p.mozMatchesSelector;\n \n // exports\n\n scope.api.declaration.styles = styles;\n scope.applyStyleToScope = applyStyleToScope;\n \n})(Polymer);\n","/*\n * Copyright 2013 The Polymer Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n\n(function(scope) {\n\n // imports\n\n var log = window.logFlags || {};\n var api = scope.api.instance.events;\n var EVENT_PREFIX = api.EVENT_PREFIX;\n // polymer-element declarative api: events feature\n\n var events = { \n parseHostEvents: function() {\n // our delegates map\n var delegates = this.prototype.eventDelegates;\n // extract data from attributes into delegates\n this.addAttributeDelegates(delegates);\n },\n addAttributeDelegates: function(delegates) {\n // for each attribute\n for (var i=0, a; a=this.attributes[i]; i++) {\n // does it have magic marker identifying it as an event delegate?\n if (this.hasEventPrefix(a.name)) {\n // if so, add the info to delegates\n delegates[this.removeEventPrefix(a.name)] = a.value.replace('{{', '')\n .replace('}}', '').trim();\n }\n }\n },\n // starts with 'on-'\n hasEventPrefix: function (n) {\n return n && (n[0] === 'o') && (n[1] === 'n') && (n[2] === '-');\n },\n removeEventPrefix: function(n) {\n return n.slice(prefixLength);\n }\n };\n\n var prefixLength = EVENT_PREFIX.length;\n\n // exports\n scope.api.declaration.events = events;\n\n})(Polymer);","/*\r\n * Copyright 2013 The Polymer Authors. All rights reserved.\r\n * Use of this source code is governed by a BSD-style\r\n * license that can be found in the LICENSE file.\r\n */\r\n(function(scope) {\r\n\r\n // element api\r\n\r\n var properties = {\r\n inferObservers: function(prototype) {\r\n // called before prototype.observe is chained to inherited object\r\n var observe = prototype.observe, property;\r\n for (var n in prototype) {\r\n if (n.slice(-7) === 'Changed') {\r\n if (!observe) {\r\n observe = (prototype.observe = {});\r\n }\r\n property = n.slice(0, -7)\r\n observe[property] = observe[property] || n;\r\n }\r\n }\r\n },\r\n explodeObservers: function(prototype) {\r\n // called before prototype.observe is chained to inherited object\r\n var o = prototype.observe;\r\n if (o) {\r\n var exploded = {};\r\n for (var n in o) {\r\n var names = n.split(' ');\r\n for (var i=0, ni; ni=names[i]; i++) {\r\n exploded[ni] = o[n];\r\n }\r\n }\r\n prototype.observe = exploded;\r\n }\r\n },\r\n optimizePropertyMaps: function(prototype) {\r\n if (prototype.observe) {\r\n // construct name list\r\n var a = prototype._observeNames = [];\r\n for (var n in prototype.observe) {\r\n var names = n.split(' ');\r\n for (var i=0, ni; ni=names[i]; i++) {\r\n a.push(ni);\r\n }\r\n }\r\n }\r\n if (prototype.publish) {\r\n // construct name list\r\n var a = prototype._publishNames = [];\r\n for (var n in prototype.publish) {\r\n a.push(n);\r\n }\r\n }\r\n },\r\n publishProperties: function(prototype, base) {\r\n // if we have any properties to publish\r\n var publish = prototype.publish;\r\n if (publish) {\r\n // transcribe `publish` entries onto own prototype\r\n this.requireProperties(publish, prototype, base);\r\n // construct map of lower-cased property names\r\n prototype._publishLC = this.lowerCaseMap(publish);\r\n }\r\n },\r\n requireProperties: function(properties, prototype, base) {\r\n // ensure a prototype value for each property\r\n for (var n in properties) {\r\n if (prototype[n] === undefined && base[n] === undefined) {\r\n prototype[n] = properties[n];\r\n }\r\n }\r\n },\r\n lowerCaseMap: function(properties) {\r\n var map = {};\r\n for (var n in properties) {\r\n map[n.toLowerCase()] = n;\r\n }\r\n return map;\r\n }\r\n };\r\n\r\n // exports\r\n\r\n scope.api.declaration.properties = properties;\r\n\r\n})(Polymer);\r\n","/*\n * Copyright 2013 The Polymer Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n(function(scope) {\n\n // magic words\n\n var ATTRIBUTES_ATTRIBUTE = 'attributes';\n var ATTRIBUTES_REGEX = /\\s|,/;\n\n // attributes api\n\n var attributes = {\n inheritAttributesObjects: function(prototype) {\n // chain our lower-cased publish map to the inherited version\n this.inheritObject(prototype, 'publishLC');\n // chain our instance attributes map to the inherited version\n this.inheritObject(prototype, '_instanceAttributes');\n },\n publishAttributes: function(prototype, base) {\n // merge names from 'attributes' attribute\n var attributes = this.getAttribute(ATTRIBUTES_ATTRIBUTE);\n if (attributes) {\n // get properties to publish\n var publish = prototype.publish || (prototype.publish = {});\n // names='a b c' or names='a,b,c'\n var names = attributes.split(ATTRIBUTES_REGEX);\n // record each name for publishing\n for (var i=0, l=names.length, n; i<l; i++) {\n // remove excess ws\n n = names[i].trim();\n // do not override explicit entries\n if (n && publish[n] === undefined && base[n] === undefined) {\n publish[n] = null;\n }\n }\n }\n },\n // record clonable attributes from <element>\n accumulateInstanceAttributes: function() {\n // inherit instance attributes\n var clonable = this.prototype._instanceAttributes;\n // merge attributes from element\n var a$ = this.attributes;\n for (var i=0, l=a$.length, a; (i<l) && (a=a$[i]); i++) { \n if (this.isInstanceAttribute(a.name)) {\n clonable[a.name] = a.value;\n }\n }\n },\n isInstanceAttribute: function(name) {\n return !this.blackList[name] && name.slice(0,3) !== 'on-';\n },\n // do not clone these attributes onto instances\n blackList: {\n name: 1,\n 'extends': 1,\n constructor: 1,\n noscript: 1,\n assetpath: 1,\n 'cache-csstext': 1\n }\n };\n\n // add ATTRIBUTES_ATTRIBUTE to the blacklist\n attributes.blackList[ATTRIBUTES_ATTRIBUTE] = 1;\n\n // exports\n\n scope.api.declaration.attributes = attributes;\n\n})(Polymer);\n","/*\n * Copyright 2013 The Polymer Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n(function(scope) {\n\n // imports\n \n var api = scope.api;\n var isBase = scope.isBase;\n var extend = scope.extend;\n\n // prototype api\n\n var prototype = {\n\n register: function(name, extendeeName) {\n // build prototype combining extendee, Polymer base, and named api\n this.buildPrototype(name, extendeeName);\n // register our custom element with the platform\n this.registerPrototype(name, extendeeName);\n // reference constructor in a global named by 'constructor' attribute\n this.publishConstructor();\n },\n\n buildPrototype: function(name, extendeeName) {\n // get our custom prototype (before chaining)\n var extension = scope.getRegisteredPrototype(name);\n // get basal prototype\n var base = this.generateBasePrototype(extendeeName);\n // implement declarative features\n this.desugarBeforeChaining(extension, base);\n // join prototypes\n this.prototype = this.chainPrototypes(extension, base);\n // more declarative features\n this.desugarAfterChaining(name, extendeeName);\n },\n\n desugarBeforeChaining: function(prototype, base) {\n // back reference declaration element\n // TODO(sjmiles): replace `element` with `elementElement` or `declaration`\n prototype.element = this;\n // transcribe `attributes` declarations onto own prototype's `publish`\n this.publishAttributes(prototype, base);\n // `publish` properties to the prototype and to attribute watch\n this.publishProperties(prototype, base);\n // infer observers for `observe` list based on method names\n this.inferObservers(prototype);\n // desugar compound observer syntax, e.g. 'a b c' \n this.explodeObservers(prototype);\n },\n\n chainPrototypes: function(prototype, base) {\n // chain various meta-data objects to inherited versions\n this.inheritMetaData(prototype, base);\n // chain custom api to inherited\n var chained = this.chainObject(prototype, base);\n // x-platform fixup\n ensurePrototypeTraversal(chained);\n return chained;\n },\n\n inheritMetaData: function(prototype, base) {\n // chain observe object to inherited\n this.inheritObject('observe', prototype, base);\n // chain publish object to inherited\n this.inheritObject('publish', prototype, base);\n // chain our lower-cased publish map to the inherited version\n this.inheritObject('_publishLC', prototype, base);\n // chain our instance attributes map to the inherited version\n this.inheritObject('_instanceAttributes', prototype, base);\n // chain our event delegates map to the inherited version\n this.inheritObject('eventDelegates', prototype, base);\n },\n\n // implement various declarative features\n desugarAfterChaining: function(name, extendee) {\n // build side-chained lists to optimize iterations\n this.optimizePropertyMaps(this.prototype);\n // install external stylesheets as if they are inline\n this.installSheets();\n // adjust any paths in dom from imports\n this.resolveElementPaths(this);\n // compile list of attributes to copy to instances\n this.accumulateInstanceAttributes();\n // parse on-* delegates declared on `this` element\n this.parseHostEvents();\n //\n // install a helper method this.resolvePath to aid in \n // setting resource urls. e.g.\n // this.$.image.src = this.resolvePath('images/foo.png')\n this.addResolvePathApi();\n // under ShadowDOMPolyfill, transforms to approximate missing CSS features\n if (window.ShadowDOMPolyfill) {\n Platform.ShadowCSS.shimStyling(this.templateContent(), name, extendee);\n }\n // allow custom element access to the declarative context\n if (this.prototype.registerCallback) {\n this.prototype.registerCallback(this);\n }\n },\n\n // if a named constructor is requested in element, map a reference\n // to the constructor to the given symbol\n publishConstructor: function() {\n var symbol = this.getAttribute('constructor');\n if (symbol) {\n window[symbol] = this.ctor;\n }\n },\n\n // build prototype combining extendee, Polymer base, and named api\n generateBasePrototype: function(extnds) {\n var prototype = this.findBasePrototype(extnds);\n if (!prototype) {\n // create a prototype based on tag-name extension\n var prototype = HTMLElement.getPrototypeForTag(extnds);\n // insert base api in inheritance chain (if needed)\n prototype = this.ensureBaseApi(prototype);\n // memoize this base\n memoizedBases[extnds] = prototype;\n }\n return prototype;\n },\n\n findBasePrototype: function(name) {\n return memoizedBases[name];\n },\n\n // install Polymer instance api into prototype chain, as needed \n ensureBaseApi: function(prototype) {\n if (prototype.PolymerBase) {\n return prototype;\n }\n var extended = Object.create(prototype);\n // we need a unique copy of base api for each base prototype\n // therefore we 'extend' here instead of simply chaining\n api.publish(api.instance, extended);\n // TODO(sjmiles): sharing methods across prototype chains is\n // not supported by 'super' implementation which optimizes\n // by memoizing prototype relationships.\n // Probably we should have a version of 'extend' that is \n // share-aware: it could study the text of each function,\n // look for usage of 'super', and wrap those functions in\n // closures.\n // As of now, there is only one problematic method, so \n // we just patch it manually.\n // To avoid re-entrancy problems, the special super method\n // installed is called `mixinSuper` and the mixin method\n // must use this method instead of the default `super`.\n this.mixinMethod(extended, prototype, api.instance.mdv, 'bind');\n // return buffed-up prototype\n return extended;\n },\n\n mixinMethod: function(extended, prototype, api, name) {\n var $super = function(args) {\n return prototype[name].apply(this, args);\n };\n extended[name] = function() {\n this.mixinSuper = $super;\n return api[name].apply(this, arguments);\n }\n },\n\n // ensure prototype[name] inherits from a prototype.prototype[name]\n inheritObject: function(name, prototype, base) {\n // require an object\n var source = prototype[name] || {};\n // chain inherited properties onto a new object\n prototype[name] = this.chainObject(source, base[name]);\n },\n\n // register 'prototype' to custom element 'name', store constructor \n registerPrototype: function(name, extendee) { \n var info = {\n prototype: this.prototype\n }\n // native element must be specified in extends\n var typeExtension = this.findTypeExtension(extendee);\n if (typeExtension) {\n info.extends = typeExtension;\n }\n // register the prototype with HTMLElement for name lookup\n HTMLElement.register(name, this.prototype);\n // register the custom type\n this.ctor = document.registerElement(name, info);\n },\n\n findTypeExtension: function(name) {\n if (name && name.indexOf('-') < 0) {\n return name;\n } else {\n var p = this.findBasePrototype(name);\n if (p.element) {\n return this.findTypeExtension(p.element.extends);\n }\n }\n }\n\n };\n\n // memoize base prototypes\n var memoizedBases = {};\n\n // implementation of 'chainObject' depends on support for __proto__\n if (Object.__proto__) {\n prototype.chainObject = function(object, inherited) {\n if (object && inherited && object !== inherited) {\n object.__proto__ = inherited;\n }\n return object;\n }\n } else {\n prototype.chainObject = function(object, inherited) {\n if (object && inherited && object !== inherited) {\n var chained = Object.create(inherited);\n object = extend(chained, object);\n }\n return object;\n }\n }\n\n // On platforms that do not support __proto__ (versions of IE), the prototype\n // chain of a custom element is simulated via installation of __proto__.\n // Although custom elements manages this, we install it here so it's\n // available during desugaring.\n function ensurePrototypeTraversal(prototype) {\n if (!Object.__proto__) {\n var ancestor = Object.getPrototypeOf(prototype);\n prototype.__proto__ = ancestor;\n if (isBase(ancestor)) {\n ancestor.__proto__ = Object.getPrototypeOf(ancestor);\n }\n }\n }\n\n // exports\n\n api.declaration.prototype = prototype;\n\n})(Polymer);\n","/*\n * Copyright 2013 The Polymer Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n(function(scope) {\n\n var queue = {\n // tell the queue to wait for an element to be ready\n wait: function(element, check, go) {\n if (this.indexOf(element) === -1) {\n this.add(element);\n element.__check = check;\n element.__go = go;\n }\n return (this.indexOf(element) !== 0);\n },\n add: function(element) {\n //console.log('queueing', element.name);\n queueForElement(element).push(element);\n },\n indexOf: function(element) {\n var i = queueForElement(element).indexOf(element);\n if (i >= 0 && document.contains(element)) {\n i += (HTMLImports.useNative || HTMLImports.ready) ? \n importQueue.length : 1e9;\n }\n return i; \n },\n // tell the queue an element is ready to be registered\n go: function(element) {\n var readied = this.remove(element);\n if (readied) {\n readied.__go.call(readied);\n readied.__check = readied.__go = null;\n this.check();\n }\n },\n remove: function(element) {\n var i = this.indexOf(element);\n if (i !== 0) {\n //console.warn('queue order wrong', i);\n return;\n }\n return queueForElement(element).shift();\n },\n check: function() {\n // next\n var element = this.nextElement();\n if (element) {\n element.__check.call(element);\n }\n if (this.canReady()) {\n this.ready();\n return true;\n }\n },\n nextElement: function() {\n return nextQueued();\n },\n canReady: function() {\n return !this.waitToReady && this.isEmpty();\n },\n isEmpty: function() {\n return !importQueue.length && !mainQueue.length;\n },\n ready: function() {\n // TODO(sorvell): As an optimization, turn off CE polyfill upgrading\n // while registering. This way we avoid having to upgrade each document\n // piecemeal per registration and can instead register all elements\n // and upgrade once in a batch. Without this optimization, upgrade time\n // degrades significantly when SD polyfill is used. This is mainly because\n // querying the document tree for elements is slow under the SD polyfill.\n if (CustomElements.ready === false) {\n CustomElements.upgradeDocumentTree(document);\n CustomElements.ready = true;\n }\n if (readyCallbacks) {\n var fn;\n while (readyCallbacks.length) {\n fn = readyCallbacks.shift();\n fn();\n }\n }\n },\n addReadyCallback: function(callback) {\n if (callback) {\n readyCallbacks.push(callback);\n }\n },\n waitToReady: true\n };\n\n var importQueue = [];\n var mainQueue = [];\n var readyCallbacks = [];\n\n function queueForElement(element) {\n return document.contains(element) ? mainQueue : importQueue;\n }\n\n function nextQueued() {\n return importQueue.length ? importQueue[0] : mainQueue[0];\n }\n\n var polymerReadied = false; \n\n document.addEventListener('WebComponentsReady', function() {\n CustomElements.ready = false;\n });\n \n function whenPolymerReady(callback) {\n queue.waitToReady = true;\n CustomElements.ready = false;\n HTMLImports.whenImportsReady(function() {\n queue.addReadyCallback(callback);\n queue.waitToReady = false;\n queue.check();\n });\n }\n\n // exports\n scope.queue = queue;\n scope.whenPolymerReady = whenPolymerReady;\n})(Polymer);\n","/*\n * Copyright 2013 The Polymer Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n(function(scope) {\n\n var whenPolymerReady = scope.whenPolymerReady;\n\n function importElements(elementOrFragment, callback) {\n if (elementOrFragment) {\n document.head.appendChild(elementOrFragment);\n whenPolymerReady(callback);\n } else if (callback) {\n callback();\n }\n }\n\n function importUrls(urls, callback) {\n if (urls && urls.length) {\n var frag = document.createDocumentFragment();\n for (var i=0, l=urls.length, url, link; (i<l) && (url=urls[i]); i++) {\n link = document.createElement('link');\n link.rel = 'import';\n link.href = url;\n frag.appendChild(link);\n }\n importElements(frag, callback);\n } else if (callback) {\n callback();\n }\n }\n\n // exports\n scope.import = importUrls;\n scope.importElements = importElements;\n\n})(Polymer);\n","/*\n * Copyright 2013 The Polymer Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n(function(scope) {\n\n // imports\n\n var extend = scope.extend;\n var api = scope.api;\n var queue = scope.queue;\n var whenPolymerReady = scope.whenPolymerReady;\n var getRegisteredPrototype = scope.getRegisteredPrototype;\n var waitingForPrototype = scope.waitingForPrototype;\n\n // declarative implementation: <polymer-element>\n\n var prototype = extend(Object.create(HTMLElement.prototype), {\n\n createdCallback: function() {\n if (this.getAttribute('name')) {\n this.init();\n }\n },\n\n init: function() {\n // fetch declared values\n this.name = this.getAttribute('name');\n this.extends = this.getAttribute('extends');\n // initiate any async resource fetches\n this.loadResources();\n // register when all constraints are met\n this.registerWhenReady();\n },\n\n registerWhenReady: function() {\n if (this.registered\n || this.waitingForPrototype(this.name)\n || this.waitingForQueue()\n || this.waitingForResources()) {\n return;\n }\n // TODO(sorvell): ends up calling '_register' by virtue\n // of `waitingForQueue` (see below)\n queue.go(this);\n },\n\n // TODO(sorvell): refactor, this method is private-ish, but it's being\n // called by the queue object.\n _register: function() {\n //console.log('registering', this.name);\n //console.group('registering', this.name);\n // warn if extending from a custom element not registered via Polymer\n if (isCustomTag(this.extends) && !isRegistered(this.extends)) {\n console.warn('%s is attempting to extend %s, an unregistered element ' +\n 'or one that was not registered with Polymer.', this.name,\n this.extends);\n }\n this.register(this.name, this.extends);\n this.registered = true;\n //console.groupEnd();\n },\n\n waitingForPrototype: function(name) {\n if (!getRegisteredPrototype(name)) {\n // then wait for a prototype\n waitingForPrototype(name, this);\n // emulate script if user is not supplying one\n this.handleNoScript(name);\n // prototype not ready yet\n return true;\n }\n },\n\n handleNoScript: function(name) {\n // if explicitly marked as 'noscript'\n if (this.hasAttribute('noscript') && !this.noscript) {\n this.noscript = true;\n // TODO(sorvell): CustomElements polyfill awareness:\n // noscript elements should upgrade in logical order\n // script injection ensures this under native custom elements;\n // under imports + ce polyfills, scripts run before upgrades.\n // dependencies should be ready at upgrade time so register\n // prototype at this time.\n if (window.CustomElements && !CustomElements.useNative) {\n Polymer(name);\n } else {\n var script = document.createElement('script');\n script.textContent = 'Polymer(\\'' + name + '\\');';\n this.appendChild(script);\n }\n }\n },\n\n waitingForResources: function() {\n return this._needsResources;\n },\n\n // NOTE: Elements must be queued in proper order for inheritance/composition\n // dependency resolution. Previously this was enforced for inheritance,\n // and by rule for composition. It's now entirely by rule.\n waitingForQueue: function() {\n return queue.wait(this, this.registerWhenReady, this._register);\n },\n\n loadResources: function() {\n this._needsResources = true;\n this.loadStyles(function() {\n this._needsResources = false;\n this.registerWhenReady();\n }.bind(this));\n }\n\n });\n\n // semi-pluggable APIs \n\n // TODO(sjmiles): should be fully pluggable (aka decoupled, currently\n // the various plugins are allowed to depend on each other directly)\n api.publish(api.declaration, prototype);\n\n // utility and bookkeeping\n\n function isRegistered(name) {\n return Boolean(HTMLElement.getPrototypeForTag(name));\n }\n\n function isCustomTag(name) {\n return (name && name.indexOf('-') >= 0);\n }\n\n // exports\n\n scope.getRegisteredPrototype = getRegisteredPrototype;\n \n // boot tasks\n\n whenPolymerReady(function() {\n document.body.removeAttribute('unresolved');\n document.dispatchEvent(\n new CustomEvent('polymer-ready', {bubbles: true})\n );\n });\n\n // register polymer-element with document\n\n document.registerElement('polymer-element', {prototype: prototype});\n\n})(Polymer);\n"]}