// Copyright (C) 2013: // Alex Russell // Yehuda Katz // // Use of this source code is governed by // http://www.apache.org/licenses/LICENSE-2.0 /** @license * RequireJS plugin for async dependency load like JSONP and Google Maps * Author: Miller Medeiros * Version: 0.1.1 (2011/11/17) * Released under the MIT license */ /** * teleprolly * https://github.com/marcoscaceres/teleprolly * * Copyright (c) 2013 Marcos Caceres * Licensed under the MIT license. */ define("deps/webidlParser",["require","exports","module"],function(e,t,n){var r=function(e){var t=[],n={"float":/^-?(([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([Ee][-+]?[0-9]+)?|[0-9]+[Ee][-+]?[0-9]+)/,integer:/^-?(0([Xx][0-9A-Fa-f]+|[0-7]*)|[1-9][0-9]*)/,identifier:/^[A-Z_a-z][0-9A-Z_a-z]*/,string:/^"[^"]*"/,whitespace:/^(?:[\t\n\r ]+|[\t\n\r ]*((\/\/.*|\/\*(.|\n|\r)*?\*\/)[\t\n\r ]*))+/,other:/^[^\t\n\r 0-9A-Z_a-z]/},r=[];for(var i in n)r.push(i);while(e.length>0){var s=!1;for(var o=0,u=r.length;oi)r+=e[i].value,i++;throw new u(n,t,r,e.slice(0,5))},f=null,l=function(t,n){if(!e.length||e[0].type!==t)return;if(typeof n=="undefined"||e[0].value===n)return f=e.shift(),t===i&&(f.value=f.value.replace(/^_/,"")),f},c=function(){if(!e.length)return;if(e[0].type==="whitespace"){var n=e.shift();return n.value.replace(/\n/g,function(e){return t++,e}),n}},h=function(){var e={type:"whitespace",value:""};for(;;){var t=c();if(!t)break;e.value+=t.value}if(e.value.length>0)return e},p=function(){var e="";h(),l(i,"unsigned")&&(e="unsigned "),h();if(l(i,"short"))return e+"short";if(l(i,"long"))return e+="long",h(),l(i,"long")?e+" long":e;e&&a("Failed to parse integer type")},d=function(){var e="";h(),l(i,"unrestricted")&&(e="unrestricted "),h();if(l(i,"float"))return e+"float";if(l(i,"double"))return e+"double";e&&a("Failed to parse float type")},v=function(){var e=p()||d();if(e)return e;h();if(l(i,"boolean"))return"boolean";if(l(i,"byte"))return"byte";if(l(i,"octet"))return"octet"},m=function(){if(l(i,"true"))return{type:"boolean",value:!0};if(l(i,"false"))return{type:"boolean",value:!1};if(l(i,"null"))return{type:"null"};if(l(i,"Infinity"))return{type:"Infinity",negative:!1};if(l(i,"NaN"))return{type:"NaN"};var t=l(n)||l(r);if(t)return{type:"number",value:1*t.value};var s=l(o,"-");if(s){if(l(i,"Infinity"))return{type:"Infinity",negative:!0};e.unshift(s)}},g=function(e){for(;;){h();if(l(o,"?"))e.nullable&&a("Can't nullable more than once"),e.nullable=!0;else{if(!l(o,"["))return;h(),l(o,"]")||a("Unterminated array type"),e.array?(e.array++,e.nullableArray.push(e.nullable)):(e.array=1,e.nullableArray=[e.nullable]),e.nullable=!1}}},y=function(){var e=v(),t={sequence:!1,nullable:!1,array:!1,union:!1};if(e)t.idlType=e;else if(l(i,"sequence")){h();if(!!l(o,"<"))return t.sequence=!0,t.idlType=w()||a("Error parsing sequence type"),h(),l(o,">")||a("Unterminated sequence"),h(),l(o,"?")&&(t.nullable=!0),t;t.idlType="sequence"}else{var n=l(i);if(!n)return;t.idlType=n.value}return g(t),t.nullable&&!t.array&&t.idlType==="any"&&a("Type any cannot be made nullable"),t},b=function(){h();if(!l(o,"("))return;var e={sequence:!1,nullable:!1,array:!1,union:!0,idlType:[]},t=w()||a("Union type with no content");e.idlType.push(t);for(;;){h();if(!l(i,"or"))break;var n=w()||a("No type after 'or' in union type");e.idlType.push(n)}return l(o,")")||a("Unterminated union type"),g(e),e},w=function(){return y()||b()},E=function(){var t={optional:!1,variadic:!1};t.extAttrs=T(),h(),l(i,"optional")&&(t.optional=!0,h()),t.idlType=w();if(!t.idlType)return;t.optional||(h(),e.length>=3&&e[0].type==="other"&&e[0].value==="."&&e[1].type==="other"&&e[1].value==="."&&e[2].type==="other"&&e[2].value==="."&&(e.shift(),e.shift(),e.shift(),t.variadic=!0)),h();var n=l(i)||a("No name in argument");return t.name=n.value,t.optional&&(h(),t["default"]=N()),t},S=function(){var e=E(),t=[];if(!e)return t;t.push(e);for(;;){h();if(!l(o,","))return t;h();var n=E()||a("Trailing comma in arguments list");t.push(n)}},x=function(){h();var e=l(i);if(!e)return;var t={name:e.value,arguments:null};h();var n=l(o,"=");if(n){h(),t.rhs=l(i);if(!t.rhs)return a("No right hand side to extended attribute assignment")}return h(),l(o,"(")&&(t.arguments=S(),h(),l(o,")")||a("Unclosed argument in extended attribute")),t},T=function(){var e=[];h();if(!l(o,"["))return e;e[0]=x()||a("Extended attribute with not content"),h();while(l(o,","))h(),e.push(x()||a("Trailing comma in extended attribute")),h();return l(o,"]")||a("No end of extended attribute"),e},N=function(){h();if(l(o,"=")){h();var e=m();if(e)return e;var t=l(s)||a("No value for default");return t.value=t.value.replace(/^"/,"").replace(/"$/,""),t}},C=function(){h();if(!l(i,"const"))return;var e={type:"const",nullable:!1};h();var t=v();t||(t=l(i)||a("No type for const"),t=t.value),e.idlType=t,h(),l(o,"?")&&(e.nullable=!0,h());var n=l(i)||a("No name for const");e.name=n.value,h(),l(o,"=")||a("No value assignment for const"),h();var r=m();return r?e.value=r:a("No value for const"),h(),l(o,";")||a("Unterminated const"),e},k=function(){h();if(l(o,":")){h();var e=l(i)||a("No type in inheritance");return e.value}},L=function(e){h(),e||(e={});var t=l(i);return e.name=t?t.value:null,h(),l(o,"(")||a("Invalid operation"),e.arguments=S(),h(),l(o,")")||a("Unterminated operation"),h(),l(o,";")||a("Unterminated operation"),e},A=function(){h();var t;if(!l(i,"callback"))return;h();var n=l(i,"interface");if(n)return e.unshift(n),t=H(),t.type="callback interface",t;var r=l(i)||a("No name for callback");return t={type:"callback",name:r.value},h(),l(o,"=")||a("No assignment in callback"),h(),t.idlType=M(),h(),l(o,"(")||a("No arguments in callback"),t.arguments=S(),h(),l(o,")")||a("Unterminated callback"),h(),l(o,";")||a("Unterminated callback"),t},O=function(){h();var t=[],n={type:"attribute","static":!1,stringifier:!1,inherit:!1,readonly:!1};l(i,"static")?(n["static"]=!0,t.push(f)):l(i,"stringifier")&&(n.stringifier=!0,t.push(f));var r=h();r&&t.push(r);if(l(i,"inherit")){(n["static"]||n.stringifier)&&a("Cannot have a static or stringifier inherit"),n.inherit=!0,t.push(f);var r=h();r&&t.push(r)}if(l(i,"readonly")){n.readonly=!0,t.push(f);var r=h();r&&t.push(r)}if(!l(i,"attribute")){e=t.concat(e);return}h(),n.idlType=w()||a("No type in attribute"),n.idlType.sequence&&a("Attributes cannot accept sequence types"),h();var s=l(i)||a("No name in attribute");return n.name=s.value,h(),l(o,";")||a("Unterminated attribute"),n},M=function(){var e=w();if(!e){if(l(i,"void"))return"void";a("No return type")}return e},_=function(){h();var e={type:"operation",getter:!1,setter:!1,creator:!1,deleter:!1,legacycaller:!1,"static":!1,stringifier:!1};for(;;){h();if(l(i,"getter"))e.getter=!0;else if(l(i,"setter"))e.setter=!0;else if(l(i,"creator"))e.creator=!0;else if(l(i,"deleter"))e.deleter=!0;else{if(!l(i,"legacycaller"))break;e.legacycaller=!0}}if(e.getter||e.setter||e.creator||e.deleter||e.legacycaller)return h(),e.idlType=M(),L(e),e;if(l(i,"static"))return e["static"]=!0,e.idlType=M(),L(e),e;if(l(i,"stringifier"))return e.stringifier=!0,h(),l(o,";")?e:(e.idlType=M(),L(e),e);e.idlType=M(),h();if(l(i,"iterator")){h(),e.type="iterator";if(l(i,"object"))e.iteratorObject="object";else if(l(o,"=")){h();var t=l(i)||a("No right hand side in iterator");e.iteratorObject=t.value}return h(),l(o,";")||a("Unterminated iterator"),e}return L(e),e},D=function(e){for(;;){h();if(!l(o,","))break;h();var t=l(i)||a("Trailing comma in identifiers list");e.push(t.value)}},P=function(){h();if(!l(i,"serializer"))return;var e={type:"serializer"};h();if(l(o,"=")){h();if(l(o,"{")){e.patternMap=!0,h();var t=l(i);t&&t.value==="getter"?e.names=["getter"]:t&&t.value==="inherit"?(e.names=["inherit"],D(e.names)):t?(e.names=[t.value],D(e.names)):e.names=[],h(),l(o,"}")||a("Unterminated serializer pattern map")}else if(l(o,"[")){e.patternList=!0,h();var t=l(i);t&&t.value==="getter"?e.names=["getter"]:t?(e.names=[t.value],D(e.names)):e.names=[],h(),l(o,"]")||a("Unterminated serializer pattern list")}else{var n=l(i)||a("Invalid serializer");e.name=n.value}return h(),l(o,";")||a("Unterminated serializer"),e}return l(o,";")||(e.idlType=M(),h(),e.operation=L()),e},H=function(e){h();if(!l(i,"interface"))return;h();var t=l(i)||a("No name for interface"),n={type:"interface",name:t.value,partial:!1,members:[]};e||(n.inheritance=k()||null),h(),l(o,"{")||a("Bodyless interface");for(;;){h();if(l(o,"}"))return h(),l(o,";")||a("Missing semicolon after interface"),n;var r=T();h();var s=C();if(s){s.extAttrs=r,n.members.push(s);continue}var u=P()||O()||_()||a("Unknown member");u.extAttrs=r,n.members.push(u)}},B=function(){h();if(!l(i,"partial"))return;var e=j(!0)||H(!0)||a("Partial doesn't apply to anything");return e.partial=!0,e},j=function(e){h();if(!l(i,"dictionary"))return;h();var t=l(i)||a("No name for dictionary"),n={type:"dictionary",name:t.value,partial:!1,members:[]};e||(n.inheritance=k()||null),h(),l(o,"{")||a("Bodyless dictionary");for(;;){h();if(l(o,"}"))return h(),l(o,";")||a("Missing semicolon after dictionary"),n;var r=T();h();var s=w()||a("No type for dictionary member");h();var t=l(i)||a("No name for dictionary member");n.members.push({type:"field",name:t.value,idlType:s,extAttrs:r,"default":N()}),h(),l(o,";")||a("Unterminated dictionary member")}},F=function(){h();if(!l(i,"exception"))return;h();var e=l(i)||a("No name for exception"),t={type:"exception",name:e.value,members:[]};t.inheritance=k()||null,h(),l(o,"{")||a("Bodyless exception");for(;;){h();if(l(o,"}"))return h(),l(o,";")||a("Missing semicolon after exception"),t;var n=T();h();var r=C();if(r)r.extAttrs=n,t.members.push(r);else{var s=w();h();var e=l(i);h(),(!s||!e||!l(o,";"))&&a("Unknown member in exception body"),t.members.push({type:"field",name:e.value,idlType:s,extAttrs:n})}}},I=function(){h();if(!l(i,"enum"))return;h();var e=l(i)||a("No name for enum"),t={type:"enum",name:e.value,values:[]};h(),l(o,"{")||a("No curly for enum");var n=!1;for(;;){h();if(l(o,"}"))return h(),n&&a("Trailing comma in enum"),l(o,";")||a("No semicolon after enum"),t;var r=l(s)||a("Unexpected value in enum");t.values.push(r.value.replace(/"/g,"")),h(),l(o,",")?(h(),n=!0):n=!1}},q=function(){h();if(!l(i,"typedef"))return;var e={type:"typedef"};h(),e.typeExtAttrs=T(),h(),e.idlType=w()||a("No type in typedef"),h();var t=l(i)||a("No name in typedef");return e.name=t.value,h(),l(o,";")||a("Unterminated typedef"),e},R=function(){h();var t=l(i);if(!t)return;var n=h();if(l(i,"implements")){var r={type:"implements",target:t.value};h();var s=l(i)||a("Incomplete implements statement");return r["implements"]=s.value,h(),l(o,";")||a("No terminating ; for implements statement"),r}e.unshift(n),e.unshift(t)},U=function(){return A()||H()||B()||j()||F()||I()||q()||R()},z=function(){if(!e.length)return[];var t=[];for(;;){var n=T(),r=U();if(!r){n.length&&a("Stray extended attributes");break}r.extAttrs=n,t.push(r)}return t},W=z();return e.length&&a("Unrecognised tokens"),W},s={parse:function(e){var t=r(e);return i(t)}};typeof n!="undefined"&&n.exports?n.exports=s:window.WebIDL2=s}),define("WebIDL",["require","deps/webidlParser"],function(e){function r(){t.call(this)}function i(e,t,n){var r={writable:!0,enumerable:!0,configurable:!0};return r.value=n,Object.defineProperty(e,t,r),e[t]}function s(e,t,n,r,i,s,o){var u={get:i,set:undefined,enumerable:!0,configurable:!!o.unforgable||!0},a;if(typeof e!="object"||typeof t!="string")throw new TypeError;n||(u.set=function(){if(arguments.length===0)throw new TypeError;return s(arguments[0])});if(!!r){if(typeof e!="function"){a=Object.getProtoTypeOf(e).prototype;if(typeof a!="function")throw new TypeError}e=a;return}Object.defineProperty(e,t,u)}function o(e,t){function u(e){return function(){return"function "+e+"() { [native code] }"}}var n="return function "+t+"(){throw new TypeError('DOM object constructor cannot be called as a function')}",r=(new Function(n))(),i=null,s=null,o;return i=u(t),o=function(){return this instanceof e?"[object "+t+"]":"[object "+t+"Prototype]"},e.prototype.toString=o,r.prototype=e.prototype,s={writable:!1,enumerable:!1,configurable:!1},Object.defineProperty(r,"prototype",s),e.prototype.constructor=r,Object.defineProperty(e.prototype,"constructor",{enumerable:!1}),r.__proto__=Object.create({}),e.toString=r.toString=i,Object.defineProperty(window,t,{value:r}),r}function u(e){if(!(e instanceof r))throw new TypeError("Illegal invocation")}var t=e("deps/webidlParser"),n=o(r,"WebIDL");return r.prototype=Object.create(t),i(n,"implementAttr",s),i(n,"implementOperation",i),i(n,"exportInterface",o),r.prototype.implement=function(){throw u(this),"Not implemented yet"},r.prototype.toJS=function(){throw u(this),"Not implemented yet"},n}),function(e,t,n){n=!!n;var r,i=t.MutationObserver||t.WebKitMutationObserver,s;if(typeof process!="undefined"&&{}.toString.call(process)==="[object process]")r=function(e,t){process.nextTick(function(){e.call(t)})};else if(i){var o=[],u=new i(function(){var e=o.slice();o=[],e.forEach(function(e){e[0].call(e[1])})}),a=document.createElement("div");u.observe(a,{attributes:!0}),window.addEventListener("unload",function(){u.disconnect(),u=null}),r=function(e,t){o.push([e,t]),a.setAttribute("drainQueue","drainQueue")}}else r=function(e,t){setTimeout(function(){e.call(t)},1)};var f=function(e){return{enumerable:!0,configurable:!1,get:e}},l=function(e,t,n,r){return{enumerable:!!t||!1,configurable:!!n||!0,writable:!!r||!0,value:e||function(){}}},c=function(e){return l(e,0,1,0)},h=function(e){return l(e,1)},p=function(e){try{var t=e.then;if(typeof t=="function")return!0}catch(n){}return!1},d=function(e){Error.call(this,e)};d.prototype=Object.create(Error.prototype);var v=function(){var e=[];return e.pump=function(t){r(function(){var n=e.length,r=0;while(r=0;r--)if(n===e[r].owner)return e[r].listeners;return t(n)}}function o(e){if(!(e instanceof u))throw new TypeError("Illegal invocation")}function u(){}var t=e("WebIDL"),n=e("WebIDL/types/Boolean"),r=e("WebIDL/types/DOMString"),i;return i=new s,u.prototype.addEventListener=function(e,t,s){var u;o(this),e=r(e),s=n(s),u=i.getListeners(this),u[e]===undefined&&(u[e]=[]),u[e].indexOf(t)===-1&&u[e].push(t)},u.prototype.dispatchEvent=function(e){var t,n;o(this);if(!(e instanceof Event))throw new TypeError("Not an Event");t=i.getListeners(this),n=t[e.type];if(n!==undefined)for(var r=0,s=n.length;r0?1:-1)*Math.floor(Math.abs(n));if(nMath.pow(2,7)-1)throw new TypeError;return n}return t==="Clamp"?(n=Math.min(Math.max(n,Math.pow(-2,7)),Math.pow(2,7)-1),n=Math.abs(n-Math.round(n))===.5?Math.round(n)%2===0?Math.round(n):Math.floor(n):Math.round(n),n=n===0&&i(n)?0:n,n):isNaN(n)||n===0||n===+Infinity||n===-Infinity?0:(n=(n>0?1:-1)*Math.floor(Math.abs(n)),r=Math.pow(2,8),n=(n%r+r)%r,n>=Math.pow(2,7)?n-Math.pow(2,8):n)}var t=e("WebIDL/types/IDLType"),n=e("WebIDL");return n.Byte=function(e,i){var s="Byte";if(!(this instanceof n.Byte))return r(e,i);t.call(this,s,r,e,i)},n.Byte.prototype=t,n.Byte}),define("async",[],function(){function n(e){var t,n;t=document.createElement("script"),t.type="text/javascript",t.async=!0,t.src=e,n=document.getElementsByTagName("script")[0],n.parentNode.insertBefore(t,n)}function r(t,n){var r=/!(.+)/,i=t.replace(r,""),s=r.test(t)?t.replace(/.+!/,""):e;return i+=i.indexOf("?")<0?"?":"&",i+s+"="+n}function i(){return t+=1,"__async_req_"+t+"__"}var e="callback",t=0;return{load:function(e,t,s,o){if(o.isBuild)s(null);else{var u=i();window[u]=s,n(r(e,u))}}}}),define("interfaces/TelephonyManager",["Promises","support/EmergencyNumbers","support/Dialer","DOM/EventTarget","DOM/EventHandler","WebIDL/types/Byte","WebIDL/types/DOMString","WebIDL/types/Boolean","Geocoder"],function(e,t,n){function l(e){f=navigator.geolocation.watchPosition(c),c(e)}function c(e){var t=new window.google.maps.LatLng(e.coords.latitude,e.coords.longitude);p(t)}function h(e){for(var t,n=e.length-1;n>=0;n--){t=e[n];for(var r,i=t.address_components.length-1;i>=0;i--){r=t.address_components[i];for(var s,o=r.types.length-1;o>=0;o--){s=r.types[o];if(s==="country")return t.address_components[0].short_name}}}}function p(e){o.geocode({latLng:e},function(e,n){var r,i;if(n===window.google.maps.GeocoderStatus.OK){r=h(e);if(r){i=t.findByCountry(r);for(var s=u.length-1;s>=0;s--)if(u[s]===i)return;u.splice(0,0,i)}}else alert("Geocoder failed due to: "+n)})}function d(){r.call(this)}function v(){return u}function m(e){n.dial(e)}var r=require("DOM/EventTarget"),i=require("DOM/EventHandler"),s=require("WebIDL"),o=require("Geocoder"),u=t.UNIVERSAL_NUMBERS,a,f=0;return d.prototype=new r,s.implementAttr(d.prototype,"emergencyNumbers",!0,!1,v,undefined,{}),s.implementOperation(d.prototype,"dial",m),s.exportInterface(d,"TelephonyManager"),a=new d,i.implement(a,"onincoming"),i.implement(a,"oncallschanged"),i.implement(a,"onserviceadded"),i.implement(a,"onserviceremoved"),navigator.geolocation.getCurrentPosition(l),window.Dialer=n,a}),define("interfaces/Navigator",["WebIDL","interfaces/TelephonyManager"],function(){var e=require("WebIDL"),t=require("interfaces/TelephonyManager"),n=function(){return t},r=!0,i=!1,s={};"navigator"in window&&!("telephony"in navigator)&&e.implementAttr(window.navigator,"telephony",r,i,n,undefined,s)}),function(){require.config({paths:{deps:"../deps",DOM:"../deps/DOM",WebIDL:"../webidl/lib/WebIDL","deps/webidlParser":"../webidl/deps/webidlParser","DOM/Promises":"../deps/DOM/Promises","DOM/EventHandler":"../deps/DOM/EventHandler","DOM/EventTarget":"../deps/DOM/EventTarget",async:"../deps/require-plugins/async",goog:"../deps/require-plugins/goog",json:"../deps/require-plugins/json",noext:"../deps/require-plugins/noext",propertyParser:"../deps/sync/propertyParser"}}),define("Promises",["DOM/Promises"],function(){return window.Future}),define("Geocoder",["async!http://maps.google.com/maps/api/js?v=3&sensor=false"],function(){return new window.google.maps.Geocoder}),require(["interfaces/Navigator"])}(),define("teleprolly",function(){});