atsid/circuits-js

View on GitHub
circuits-min.js

Summary

Maintainability
A
0 mins
Test Coverage
define("circuits/declare",[],function(){function a(e,t){throw new Error("declare"+(t?" "+t:"")+": "+e)}function f(e,t){var r=[],s=[{cls:0,refs:[]}],o={},u=1,f=e.length,l=0,c,h,p,d,v,m,g,y;for(l=0;l<f;l+=1){p=e[l],p?n.call(p)!=="[object Function]"&&a("mixin #"+l+" is not a callable constructor.",t):a("mixin #"+l+" is unknown. Did you use dojo.require to pull it in?",t),h=p._meta?p._meta.bases:[p],d=0;for(c=h.length-1;c>=0;c-=1)v=h[c].prototype,v.hasOwnProperty("declaredClass")||(v.declaredClass="uniqName_"+(i+=1)),g=v.declaredClass,o.hasOwnProperty(g)||(o[g]={count:0,refs:[],cls:h[c]},u+=1),m=o[g],d&&d!==m&&(m.refs.push(d),d.count+=1),d=m;d.count+=1,s[0].refs.push(d)}while(s.length){d=s.pop(),r.push(d.cls),u-=1;while((y=d.refs).length===1){d=y[0];if(!d||(d.count-=1)){d=0;break}r.push(d.cls),u-=1}if(d)for(l=0,f=y.length;l<f;l+=1)d=y[l],(d.count-=1)||s.push(d)}return u&&a("can't build consistent linearization",t),p=e[0],r[0]=p?p._meta&&p===r[r.length-p._meta.bases.length]?p._meta.bases.length:1:0,r}function l(e,n,r){var i,o,u,f,l,c,h,p,d,v=this._inherited=this._inherited||{};typeof e=="string"&&(i=e,e=n,n=r),r=0,f=e.callee,i=i||f.nom,i||a("can't deduce a name to call inherited()",this.declaredClass),l=this.constructor._meta,u=l.bases,d=v.p;if(i!==s){if(v.c!==f){d=0,c=u[0],l=c._meta;if(l.hidden[i]!==f){o=l.chains,o&&typeof o[i]=="string"&&a("calling chained method with inherited: "+i,this.declaredClass);do{l=c._meta,h=c.prototype;if(l&&(h[i]===f&&h.hasOwnProperty(i)||l.hidden[i]===f))break}while(c=u[d+=1]);d=c?d:-1}}c=u[d+=1];if(c){h=c.prototype;if(c._meta&&h.hasOwnProperty(i))r=h[i];else{p=t[i];do{h=c.prototype,r=h[i];if(r&&(c._meta?h.hasOwnProperty(i):r!==p))break}while(c=u[d+=1])}}r=c&&r||t[i]}else{if(v.c!==f){d=0,l=u[0]._meta;if(l&&l.ctor!==f){o=l.chains,(!o||o.constructor!=="manual")&&a("calling chained constructor with inherited",this.declaredClass);while(c=u[d+=1]){l=c._meta;if(l&&l.ctor===f)break}d=c?d:-1}}while(c=u[d+=1]){l=c._meta,r=l?l.ctor:c;if(r)break}r=c&&r}v.c=r,v.p=d;if(r)return n===!0?r:r.apply(this,n||e)}function c(e,t){return typeof e=="string"?this.__inherited(e,t,!0):this.__inherited(e,!0)}function h(e,t,n){var r=this.getInherited(e,t);if(r)return r.apply(this,n||t||e)}function d(e){var t,n,r=this.constructor._meta.bases;for(t=0,n=r.length;t<n;t+=1)if(r[t]===e)return!0;return this instanceof e}function v(e,t){var n;for(n in t)n!==s&&t.hasOwnProperty(n)&&(e[n]=t[n])}function m(e,r){var i,o;for(i in r)o=r[i],(o!==t[i]||!(i in t))&&i!==s&&(n.call(o)==="[object Function]"&&(o.nom=i),e[i]=o);return e}function g(e){return T.safeMixin(this.prototype,e),this}function y(e,t){return function(){var n=arguments,r=n,i=n[0],s,o,u,a=e.length,f;if(!(this instanceof n.callee))return x(n);if(t&&(i&&i.preamble||this.preamble)){f=new Array(e.length),f[0]=n;for(o=0;;){i=n[0],i&&(s=i.preamble,s&&(n=s.apply(this,n)||n)),s=e[o].prototype,s=s.hasOwnProperty("preamble")&&s.preamble,s&&(n=s.apply(this,n)||n);if((o+=1)===a)break;f[o]=n}}for(o=a-1;o>=0;o-=1)s=e[o],u=s._meta,s=u?u.ctor:s,s&&s.apply(this,f?f[o]:n);s=this.postscript,s&&s.apply(this,r)}}function b(e,t){return function(){var n=arguments,r=n,i=n[0],s;if(!(this instanceof n.callee))return x(n);t&&(i&&(s=i.preamble,s&&(r=s.apply(this,r)||r)),s=this.preamble,s&&s.apply(this,r)),e&&e.apply(this,n),s=this.postscript,s&&s.apply(this,n)}}function w(e){return function(){var t=arguments,n=0,r,i;if(!(this instanceof t.callee))return x(t);for(;r=e[n];n+=1){i=r._meta,r=i?i.ctor:r;if(r){r.apply(this,t);break}}r=this.postscript,r&&r.apply(this,t)}}function E(e,t,n){return function(){var r,i,s,o=0,u=1;n&&(o=t.length-1,u=-1);for(;r=t[o];o+=u)i=r._meta,s=(i?i.hidden:r.prototype)[e],s&&s.apply(this,arguments)}}function S(e){r.prototype=e.prototype;var t=new r;return r.prototype=null,t}function x(e){var t=e.callee,n=S(t);return t.apply(n,e),n}function T(r,i,h){typeof r!="string"&&(h=i,i=r,r=""),h=h||{};var m,x,N,C,k,L,A,O=1,M=i;n.call(i)==="[object Array]"?(L=f(i,r),N=L[0],O=L.length-N,i=L[O]):(L=[0],i?n.call(i)==="[object Function]"?(N=i._meta,L=L.concat(N?N.bases:i)):a("base class is not a callable constructor.",r):i!==null&&a("unknown base class. Did you use dojo.require to pull it in?",r));if(i)for(x=O-1;;x-=1){m=S(i);if(!x)break;N=L[x],(N._meta?v:e)(m,N.prototype),C=new Function,C.superclass=i,C.prototype=m,i=m.constructor=C}else m={};T.safeMixin(m,h),N=h.constructor,N!==t.constructor&&(N.nom=s,m.constructor=N);for(x=O-1;x;x-=1)N=L[x]._meta,N&&N.chains&&(A=e(A||{},N.chains));m["-chains-"]&&(A=e(A||{},m["-chains-"])),N=!A||!A.hasOwnProperty(s),L[0]=C=A&&A.constructor==="manual"?w(L):L.length===1?b(h.constructor,N):y(L,N),C._meta={bases:L,hidden:h,chains:A,parents:M,ctor:h.constructor},C.superclass=i&&i.prototype,C.extend=g,C.prototype=m,m.constructor=C,m.getInherited=c,m.isInstanceOf=d,m.inherited=p,m.__inherited=l,r&&(m.declaredClass=r,u.setObject(r,C,o));if(A)for(k in A)m[k]&&typeof A[k]=="string"&&k!==s&&(N=m[k]=E(k,L,A[k]==="after"),N.nom=k);return C}var e,t,n,r,i,s,o="ORELang",u={_mixin:function(e,t,n){var r,i,s,o={};for(r in t)if(t.hasOwnProperty(r)){i=t[r];if(!e.hasOwnProperty(r)||e[r]!==i&&(!o.hasOwnProperty(r)||o[r]!==i))e[r]=n?n(i):i}return e},mix:function(){var e,t,n;for(t=0,n=arguments.length;t<n;t+=1)e=u.mixin(e,arguments[t]);return e},mixin:function(e,t){var n,r;arguments.length===1&&(t=e);for(r=1,n=arguments.length;r<n;r+=1)u._mixin(e,arguments[r]);return e},getProp:function(e,t,n){var r,i=0;while(n&&typeof (r=e[i+=1])!="undefined")n=typeof n[r]=="undefined"?n[r]:t?n[r]={}:undefined;return n},setObject:function(e,t,n){n=n||o;var r=e.split("."),i=r.pop(),s=u.getProp(r,!0,n);return s&&i?s[i]=t:undefined},getObject:function(e,t,n){var r,i;return n=n||o,u.isArray(e)?i=e.map(function(e){var r={},i,s;if(u.isObject(e)){for(i in e)e.hasOwnProperty(i)&&(r[i]=u.getProp(e[i].split("."),t,n));s=r}else s=u.getProp(e.split("."),t,n);return s}):(r=e.split("."),i=u.getProp(r,t,n)),i},exists:function(e,t){return u.getObject(e,!1,t)!==undefined}};e=u.mixin,t=Object.prototype,n=t.toString,r=function(){},i=0,s="constructor";var p=h;return u.safeMixin=T.safeMixin=m,u.declare=T,u.declare}),define("circuits/Logger",[],function(){return function(e,t,n){var r={TRACE:1,DEBUG:2,INFO:3,WARN:4,ERROR:5},i,s=[];e=r[e.toUpperCase()],t||(t=console),typeof n=="undefined"&&(n=""),i=function(e,r,i,o,u){var a=t[e]||t.info;r=n+r;if(o)i?a.call(t,r+" --> "+JSON.stringify(i)):a.call(t,r);else try{u[0]&&(u[0]=n+u[0]),a.apply(t,u)}catch(f){a(r,i,o,u)}s.forEach(function(t){t.log(e,r,i,o)})},this.addPlugin=function(e){s.push(e)},this.trace=function(t,n,s){e<=r.TRACE&&i("debug",t,n,s,arguments)},this.debug=function(t,n,s){e<=r.DEBUG&&i("debug",t,n,s,arguments)},this.info=function(t,n,s){e<=r.INFO&&i("info",t,n,s,arguments)},this.warn=function(t,n,s){e<=r.WARN&&i("warn",t,n,s,arguments)},this.error=function(t,n,s){e<=r.ERROR&&i("error",t,n,s,arguments)},this.time=function(e){t.time.apply(t,arguments)},this.timeEnd=function(e){t.timeEnd.apply(t,arguments)}}}),define("circuits/log",["./Logger","module"],function(e,t){"use strict";var n=t.config(),r=n&&n.logLevel;return new e(r||"warn")}),define("circuits/util",["./declare","./log"],function(e,t){var n=e(null,{mixin:function(e,t){for(var n in t)e[n]=t[n];return e},isArray:function(e){return Object.prototype.toString.call(e)==="[object Array]"},isUndefined:function(e){return typeof e=="undefined"},fullSchemaName:function(e,n){var r,i=n||"/";return e.indexOf(i)>=0?r=e:e.indexOf("Service")>=0?r="Schema"+i+"services"+i+e:r="Schema"+i+"services"+i+e+"Service",t.debug("Service util created full name ["+r+"] from ["+e+"]"),r},serviceName:function(e,t){var n=t||(e.indexOf(".")!==-1?".":"/"),r=this.fullSchemaName(e,n);return r.substring(r.lastIndexOf(n)+1)},shortName:function(e){return this.serviceName(e).replace("Service","")},executePluginChain:function(e,t){var n,r=null;for(n=1;n<=e.length;n+=1){r=e[e.length-n],t(r);if(r.stopProcessing)break}}});return n}),define("circuits/WebStorage",["./declare"],function(e){var t=e(null,{constructor:function(e){var t=e&&e.namespace||this.declaredClass,n=function(e,n){var r=JSON.parse(n.getItem(t));return r[e]},r=function(e,n,r){var i=JSON.parse(r.getItem(t));i[e]=n,r.setItem(t,JSON.stringify(i))};if(!localStorage)throw new Error("Web storage is not supported by this runtime.");Object.defineProperty(this,"localStorage",{get:function(){return localStorage},set:function(e){throw new Error("The storage attribute is protected.")},enumerable:!0}),Object.defineProperty(this,"sessionStorage",{get:function(){return sessionStorage},set:function(e){throw new Error("The storage attribute is protected.")},enumerable:!0}),this.localStorage.getItem(t)||this.localStorage.setItem(t,"{}"),this.sessionStorage.getItem(t)||this.sessionStorage.setItem(t,"{}"),this.isLocalEmpty=function(){return this.localStorage.getItem(t)==="{}"},this.isSessionEmpty=function(){return this.sessionStorage.getItem(t)==="{}"},this.clearSession=function(){this.sessionStorage.setItem(t,"{}")},this.clearLocal=function(){this.localStorage.setItem(t,"{}")},this.getLocalObject=function(e){return n(e,this.localStorage)},this.setLocalObject=function(e,t){r(e,t,this.localStorage)},this.getSessionObject=function(e){return n(e,this.sessionStorage)},this.setSessionObject=function(e,t){r(e,t,this.sessionStorage)}}});return t}),define("circuits/DataProvider",["./declare"],function(e){var t=e("DataProvider",null,{test:function(e){throw new Error("Must implement DataProvider.test()")},create:function(e){throw new Error("Must implement DataProvider.create()")},read:function(e){throw new Error("Must implement DataProvider.read()")},update:function(e){throw new Error("Must implement DataProvider.update()")},del:function(e){throw new Error("Must implement DataProvider.del()")},supportsTransport:function(e){},httpMethodMap:{GET:{method:"read",hasPayload:!1},POST:{method:"create",hasPayload:!0},PUT:{method:"update",hasPayload:!0},DELETE:{method:"del",hasPayload:!1},JSONP:{method:"read",hasPayload:!1}}});return t}),define("circuits/Request",["./declare","./util","./log"],function(e,t,n){var r=0,i=new t,s=e("Request",null,{constructor:function(e,t){this.params=e,this.fn=t,this.id=r+=1,this.pending=!1,this.complete=!1,this.canceled=!1,this.inError=!1},cancel:function(){n.debug("Canceling request: "+this.id),this.pending=!1,this.canceled=!0},execute:function(){function s(r,i,s){e.xhr=s.xhr,e.statusCode=e.xhr&&!e.xhr.timedOut&&e.xhr.status||0,e.canceled?n.debug("Request ["+e.id+"] was canceled, not calling handler"):(e.pending=!1,e.complete=!0,t(r,i,s))}var e=this,t=this.params.handler,r=i.mixin({},this.params);this.canceled?n.debug("Request ["+e.id+"] was canceled, not executing"):(this.pending=!0,this.fn(i.mixin(r,{handler:s})))}});return s}),define("circuits/OfflineTolerantProvider",["./declare","./util","./WebStorage","./DataProvider","./Request"],function(e,t,n,r,i){var s=new t,o=e("OfflineTolerantProvider",r,{constructor:function(e){var t=new n,r="circuits.retrycache",i=function(e){var n=t.getLocalObject(r);n=n||{},n[e.url]=e,t.setLocalObject(r,n)},o=function(e,n){var i=t.getLocalObject(r);i=i||{},delete i[n.url],t.setLocalObject(r,i)},u=function(){var n=!0,i=t.getLocalObject(r)||{},u=Object.keys(i);return u.length>0&&(n=e.test(i[u[0]])),n&&Object.keys(u).forEach(function(t,n){var r,u=s.mixin({load:function(e,t,n){o(t)},error:function(e,t){}},i[t]),a=e[i[t].methodName];r=a.call(e,i[t]),r.execute()}),n},a=function(t,n){var r=u(),o=s.mixin({},n),a=s.mixin(o,{dontExecute:!0,methodName:t,load:function(e,t){t&&t.xhr&&t.xhr.status===0?t.load.call(t.scope,n.payload,n):t.load.call(t.scope,e,t)},error:function(e,t){i(a),n.load.call(n.scope||this,n.payload||n,n)}}),f=e[t](a);return r?f.execute():i(a),f};this.create=function(t){return e.create(t)},this.read=function(t){return e.read(t)},this.update=function(e){a("update",e)},this.del=function(e){a("del",e)},this.test=function(t){return e.test(t)}}});return o}),define("circuits/DojoXhrDataProvider",["dojo","./declare","./log","./DataProvider","./Request"],function(e,t,n,r,i){var s=t(r,{test:function(e){var t=!0,n;try{n=new XMLHttpRequest,n.open("HEAD",e,!1),n.send()}catch(r){t=!1}return t},create:function(t){var r=e.toJson(t.payload),s=new i({url:t.url,handleAs:t.handleAs||"json",headers:t.headers||{"Content-Type":"application/json"},postData:r,load:t.load||this.defaultLoad,error:t.error||this.defaultError},e.xhrPost);return n.debug("Xhr-based store executing POST to "+t.url,r),t.dontExecute||s.execute(),s},read:function(t){var r=new i({url:t.url,handleAs:t.handleAs||"json",load:t.load||this.defaultLoad,error:t.error||this.defaultError},e.xhrGet);return n.debug("Xhr-based store executing GET to "+t.url),t.dontExecute||r.execute(),r},update:function(t){var r=e.toJson(t.payload),s=new i({url:t.url,handleAs:t.handleAs||"json",headers:t.headers||{"Content-Type":"application/json"},putData:r,load:t.load||this.defaultLoad,error:t.error||this.defaultError},e.xhrPut);return n.debug("Xhr-based store executing PUT to "+t.url,r),t.dontExecute||s.execute(),s},del:function(t){var r=new i({url:t.url,load:t.load||this.defaultLoad,error:t.error||this.defaultError},e.xhrDelete);return n.debug("Xhr-based store executing DELETE to "+t.url),t.dontExecute||r.execute(),r},defaultLoad:function(e,t){n.warn("No load handler specified for XHR call to "+t.url)},defaultError:function(e,t){n.warn("No error handler specified for XHR call to "+t.url),n.error(e)}});return s}),define("circuits/NativeXhrDataProvider",["./declare","./DataProvider","./Request","./log"],function(e,t,n,r){var i=e(t,{constructor:function(e){var t=new XMLHttpRequest,n=this;t.upload||r.warn("NativeXhrDataProvider: This runtime is not XHR level 2 compliant."),this.asynchronous=e&&typeof e.asynchronous=="boolean"?e.asynchronous:!0,this.hitchedInvoke=function(){n.invokeXhrSend.apply(n,arguments)}},test:function(e){var t=!0,n;try{n=new XMLHttpRequest,n.open("HEAD",e,!1),n.send()}catch(r){t=!1}return t},create:function(e){var t=e.payload,i,s=e.headers&&e.headers["Content-Type"];return s=s||"application/json",s==="application/json"&&(t=JSON.stringify(e.payload)),i=new n({url:e.url,method:"POST",headers:e.headers||{"Content-Type":s},payload:t,asynchronous:e.asynchronous,responseType:e.responseType||"json",onprogress:e.onprogress||this.defaultOnProgress,handler:e.handler||this.defaultHandler,timeout:e.timeout||"none"},this.hitchedInvoke),r.debug("Xhr-based store executing POST to "+e.url,t),e.dontExecute||i.execute(),i},read:function(e){var t=new n({url:e.url,method:"GET",asynchronous:e.asynchronous,handler:e.handler||this.defaultHandler,responseType:e.responseType||"json",timeout:e.timeout||"none"},this.hitchedInvoke);return r.debug("Xhr-based store executing GET to "+e.url),e.dontExecute||t.execute(),t},update:function(e){var t=e.payload,i,s=e.headers&&e.headers["Content-Type"];return s=s||"application/json",s==="application/json"&&(t=JSON.stringify(e.payload)),i=new n({url:e.url,method:"PUT",asynchronous:e.asynchronous,headers:e.headers||{"Content-Type":s},payload:t,responseType:e.responseType||"json",handler:e.handler||this.defaultHandler,timeout:e.timeout||"none"},this.hitchedInvoke),r.debug("Xhr-based store executing PUT to "+e.url,t),e.dontExecute||i.execute(),i},del:function(e){var t=new n({url:e.url,asynchronous:e.asynchronous,method:"DELETE",handler:e.handler||this.defaultHandler,responseType:e.responseType||"json",timeout:e.timeout||"none"},this.hitchedInvoke);return r.debug("Xhr-based store executing DELETE to "+e.url),e.dontExecute||t.execute(),t},supportsTransport:function(e){return e==="REST"},invokeXhrSend:function(e){var t=new XMLHttpRequest,n=typeof e.asynchronous=="boolean"?e.asynchronous:this.asynchronous,i=function(){if(e.onreadystatechange)e.onreadystatechange.call(this);else if(this.readyState===this.DONE&&!this.loadcalled){var n;t.timedOut||(n=this.response||this.responseText),this.loadcalled=!0;if(n&&!this.responseType&&e.responseType==="json")try{n=JSON.parse(n)}catch(i){r.debug("Unable to parse JSON: "+n+"\n"+i)}e.handler.call(this,t.timedOut?-1:this.status,n,e)}};e.xhr=t,e.responseType&&typeof t.responseType=="string"&&r.debug("Ignoring responseType on XHR until fully supported."),t.open(e.method,e.url,n),Object.keys(e.headers||{}).forEach(function(n){(n!=="Content-Type"||e.headers[n]!=="multipart/form-data")&&t.setRequestHeader(n,e.headers[n])}),t.upload&&Object.keys(e).forEach(function(n){n.indexOf("on")===0&&typeof e[n]=="function"&&(typeof t[n]!="undefined"&&(t[n]=e[n]),typeof t.upload[n]!="undefined"&&(t.upload[n]=e[n]))});if(e.handler||e.onreadystatechange)t.onreadystatechange=i;e.timeout&&typeof e.timeout=="number"&&(t.timeout=e.timeout,t.ontimeout=function(){t.timedOut=!0,t.abort()},setTimeout(function(){this.response={},t.readyState<4&&!t.timedOut&&t.ontimeout()},t.timeout)),t.send(e.payload)},defaultHandler:function(e,t){r.debug("No handler specified for XHR call to "+t.url)},defaultProgress:function(e,t){r.debug("No handler specified for XHR call to "+t.url)},defaultOnProgress:function(e){r.warn("No progress handler specified for XHR call to "+e)}});return i}),define("circuits/NativeJsonpDataProvider",["./declare","./DataProvider","./Request","./log"],function(e,t,n,r){var i=e(t,{constructor:function(e){var t=this;this.hitchedInvoke=function(){t.invokeJsonpRequest.apply(t,arguments)}},read:function(e){var t="jsonp"+(new Date).getTime(),r=new n({callbackName:e.jsonpCallbackParam,load:e.handler,error:e.handler,jsonpCallback:t,jsonpUrl:e.url,timeout:e.timeout},this.hitchedInvoke);return r},create:function(e){throw new Error("Can not do create via JSONP")},update:function(e){throw new Error("Can not do updates via JSONP")},del:function(e){throw new Error("Can not do deletes via JSONP")},supportsTransport:function(e){return e==="JSONP"},invokeJsonpRequest:function(e){var t=document.createElement("script"),n=document.getElementsByTagName("head")[0],r=e.load,i=e.error,s=e.jsonpCallback,o=e.timeout||1e4,u,a=function(e){window.clearTimeout(u),delete window[s],n.removeChild(t),i&&i("500",{message:e})};window[s]=function(e){window.clearTimeout(u),r("200",e),delete window[s],n.removeChild(t)},t.onerror=a,t.onreadystatechange=function(){var e=t.readyState;e!=="loaded"&&a({type:"error"})},u=window.setTimeout(a,o,"timeout"),t.type="text/javascript",t.src=this.updateQueryString(e.jsonpUrl,e.callbackName,s),t.id=s,t.async=!0,t.charset="utf-8",n.appendChild(t)},updateQueryString:function(e,t,n){var r=new RegExp("([?|&])"+t+"=.*?(&|#|$)(.*)","gi"),i,s;return r.test(e)?e=e.replace(r,"$1"+t+"="+n+"$2$3"):(i=e.indexOf("?")!==-1?"&":"?",s=e.split("#"),e=s[0]+i+t+"="+n),e}});return i}),define("circuits/Plugin",["./declare","./util","./log"],function(e,t,n){var r=new t,i=e(null,{constructor:function(e){n.debug("Applying config to new plugin: ",e&&(e.name||e.type)),r.mixin(this,e)}});return i}),define("circuits/plugins/DataProviderPlugin",["../declare","../Plugin"],function(e,t){var n=e(t,{constructor:function(e){this.type="mixin",this.fn=function(e){e.create=e[this.create],e.read=e[this.read],e.update=e[this.update],e.remove=e[this.remove]}}});return n}),define("circuits/plugins/DojoReadApiPlugin",["../util","../log","../Plugin","../declare"],function(e,t,n,r){var i=new e,s=r(n,{constructor:function(){this.type="mixin",this.fn=function(e){e.methodName=this.methodName,e.methodArgs=this.methodArgs,e.identityAttributes=this.identityAttributes,e.getValue=function(e,t,n){var r=e[t];return typeof r=="undefined"&&(r=n),r},e.getValues=function(t,n){var r;return e.hasAttribute(t,n)?r=t[n]:r=[],r},e.getAttributes=function(e){return Object.keys(e)},e.hasAttribute=function(e,t){return typeof e[t]!="undefined"},e.containsValue=function(e,t,n){return this.getValue(e,t)===n},e.isItem=function(e){return t.warn("isItem no-op"),!0},e.isItemLoaded=function(e){return t.warn("isItem no-op"),this.isItem(e)},e.loadItem=function(e){t.warn("loadItem no-op")},typeof this.methodName=="function"?e.fetch=this.methodName:e.fetch=function(e){var t=this.methodName,n={};return this.methodArgs.forEach(function(e){n[e]=this[e]},this),e.onComplete&&(e.load=function(t,n,r){return e.onBegin&&e.onBegin(r),e.onComplete(t,n,r)}),i.mixin(e,n),this[t].call(e.scope||this,e,e)},e.getFeatures=function(){return{"dojo.data.api.Read":!0,"dojo.data.api.Identity":!0}},e.getLabel=function(e){return this.isItem(e)?this.getValue(e,"label"):undefined},e.getLabelAttributes=function(e){return["label"]},e.close=function(e){return undefined},e.getIdentity=function(e){return e[this.getIdentityAttributes()]},e.getIdentityAttributes=function(e){var t;return typeof this.identityAttributes=="undefined"?t="id":t=this.identityAttributes,t},e.fetchItemByIdentity=function(e){t.warn("fetchItemByIdentity no-op: "+e)}}}});return s}),define("circuits/plugins/DojoSimpleQueryFilterSortPlugin",["../declare","../log","../Plugin","dojo/store/util/SimpleQueryEngine"],function(e,t,n,r){var i=e(n,{constructor:function(){var e=this;this.type="mixin",this.queryEngine=r,this.fn=function(n){n.filterAndSort=function(r,i){var s=n.getMethod(r.methodName),o=s.data;t.info("filter/sort of service data from ["+n.name+"."+r.methodName+"]",r);try{o=e.filter(r.filter,r.sort,o),i.onLoad&&i.onLoad.call(i.scope,o)}catch(u){i.onError?i.onError.call(i.scope):t.error("Plugin: "+e.declaredClass+" got exception "+u+" in service "+n.name)}}}},filter:function(e,t,n){return this.queryEngine(e,{sort:t})(n)}});return i}),define("circuits/plugins/GetValuePlugin",["../declare","../Plugin"],function(e,t){var n=e(t,{constructor:function(){this.type="mixin",this.fn=function(e){e.getValue=function(e,t,n){var r=e[t];return typeof r=="undefined"&&(r=n),r}}}});return n}),define("circuits/plugins/HandlerPlugin",["../declare","../Plugin"],function(e,t){var n=e(t,{constructor:function(){this.type="handler",this.statusPattern="\\.*"}});return n}),define("circuits/plugins/HandlerErrorPlugin",["../declare","./HandlerPlugin"],function(e,t){var n=e(t,{constructor:function(){this.statusPattern="(4|5)\\d\\d"}});return n}),define("circuits/plugins/RetryOnErrorPlugin",["../declare","./HandlerErrorPlugin"],function(e,t){var n=e([t],{constructor:function(e){var t=this,n=0;this.fn=function(e,r){n<t.retry?(n+=1,r.request.execute()):(n=0,t.callback.call(t.scope||t.callback,e,r))}}});return n}),define("circuits/plugins/ServiceCallWrapperPlugin",["../declare","../Plugin"],function(e,t){var n=e(t,{constructor:function(e){this.type="mixin";var t=e.wrapperMethod;this.fn=function(e,n){n.forEach(function(n){var r=e[n];e[n]=function(){var e,n=[];for(e=0;e<arguments.length;e+=1)n.push(arguments[e]);n.push(r),t.apply(this,n)}})}}});return n}),define("circuits/plugins/StringPropertyPrefixPlugin",["../declare","../Plugin"],function(e,t){var n=e(t,{constructor:function(){this.type="read",this.fn=function(e){this.properties.forEach(function(t){var n=e[t],r,i;if(Object.prototype.toString.call(n)==="[object Array]")for(r=0,i=n.length;r<i;r+=1)n[r]=this.prefix+n[r];else e[t]=this.prefix+n},this)}}});return n}),define("circuits/plugins/UrlPrefixPlugin",["../declare","../Plugin"],function(e,t){var n=e(t,{constructor:function(){this.type="url",this.fn=function(e){return this.prefix+e}}});return n}),define("circuits/pluginpack",["./OfflineTolerantProvider","./DojoXhrDataProvider","./NativeXhrDataProvider","./NativeJsonpDataProvider","./plugins/DataProviderPlugin","./plugins/DojoReadApiPlugin","./plugins/DojoSimpleQueryFilterSortPlugin","./plugins/GetValuePlugin","./plugins/RetryOnErrorPlugin","./plugins/ServiceCallWrapperPlugin","./plugins/StringPropertyPrefixPlugin","./plugins/UrlPrefixPlugin"],function(){}),define("circuits/ServiceDescriptorReader",["./declare"],function(e){var t=e(null,{getSchemaId:function(){throw new Error("Not Implemented")},getRootPath:function(){throw new Error("Not Implemented")},getMethodNames:function(){throw new Error("Not Implemented")},getMethods:function(){throw new Error("Not Implemented")},getMethod:function(e){throw new Error("Not Implemented")},getParameterNames:function(e){throw new Error("Not Implemented")},getParameters:function(e){throw new Error("Not Implemented")},isArgumentRequired:function(e,t){throw new Error("Not Implemented")},getServiceUrl:function(e,t){throw new Error("Not Implemented")},getMethodTransport:function(e){throw new Error("Not Implemented")},getAndValidateArgument:function(e,t){throw new Error("Not Implemented")},replacePathParamsInUrl:function(e,t,n){throw new Error("Not Implemented")},addQueryParamsToUrl:function(e,t,n){throw new Error("Not Implemented")},enumerateParameters:function(e){throw new Error("Not Implemented")},getResponseSchema:function(e){throw new Error("Not Implemented")}});return t}),define("circuits/AmdResolver",["./declare"],function(e){var t=e(null,{constructor:function(e){var t=e&&e.path,n=e&&e.loud,r=e&&e.altSeparator,i=e&&e.synchronous;this.resolver=function(e,s){var o,u=t+e;r&&(u=u.replace(new RegExp(r,"g"),"/"));try{dojo?require({async:!i},[u],function(e){o=e}):require([u],function(e){o=e})}catch(a){if(n)throw a}return o}}});return t}),define("circuits/ZypSMDReader",["./declare","./ServiceDescriptorReader","./log","./util","./AmdResolver"],function(e,t,n,r,i){var s=new r,o=e(t,{constructor:function(e,t){function r(e,i,o){e.resolved||Object.keys(e).forEach(function(u){var a,f=e[u];u==="$ref"?(n.debug("Resolving $ref: "+f),a=t(f),f=typeof a=="function"?new a:a,!s.isUndefined(f)&&!f.resolved&&(e.resolved=!0,r(f,e,u)),i[o]=f):typeof f=="object"&&r(f,e,u)})}function o(e,t){var n=e&&e["extends"],r=[],i=[],u;return typeof n!="undefined"&&(i=s.isArray(n)?n:[n],i.forEach(function(e){u=e.properties||{},Object.keys(u).forEach(function(t){var n=e.properties[t];t!=="__parent"&&r.push({parentId:e.id,key:t,value:n})})},this),t.push(r),t=o(n,t)),t}function u(e){function r(t){e.properties[t.key]=t.val}var t,n;t=o(e,[]),e.properties=e.properties||{};while(t.length>0)n=t.pop(),n.forEach(r)}function a(e){e["extends"]&&(a(e["extends"]),e.parameters=e.parameters||[],e.parameters=e.parameters.concat(e["extends"].parameters))}function f(e){n.debug("Resolving sub-properties for "+e.id),a(e),Object.keys(e.services||{}).forEach(function(t){var n=e.services[t];n.returns=n.returns||e.returns,n.transport=n.transport||e.transport,n.contentType=n.contentType||e.contentType,n.envelope=n.envelope||e.envelope||"URL",n.description=n.description||"",n.returns&&u(n.returns),n.parameters&&n.parameters.forEach(function(e){e.envelope=e.envelope||n.envelope,e.description=e.description||""});var r=n["extends"];if(r){if(!r.id)throw new Error("Parent schema for method ["+t+"] in schema "+e.id+" is invalid.");n.parameters?n.parameters=n.parameters.concat(r.parameters):n.parameters=r.parameters}}),e.tag||(e.tag={}),e.tag.resolved=!0,e.resolvedProperties=!0}n.debug("Creating reader for schema",e),t||(t=(new i({path:"",altSeparator:"\\.",synchronous:!0})).resolver),this.smd=e,e.resolved||(r(e,null,null),e.resolved=!0),e.resolvedProperties||f(e);var l={};l.parameters={},this.getMethodNames().forEach(function(e){var t=this.smd.services[e];t.parameters&&t.parameters.forEach(function(t){l[e+"-"+t.name]=t})},this),this.findParameter=function(e,t){return l[e+"-"+t]}},getSchemaId:function(){return this.smd.id},getRootPath:function(){return this.smd.target},getJsonpCallbackParameter:function(){return this.smd.jsonpCallbackParameter},getTransport:function(){return this.smd.transport},getMethodNames:function(){var e=[];return Object.keys(this.smd.services||{}).forEach(function(t){e.push(t)}),e},getMethods:function(){var e=[],t=this.smd.services;return Object.keys(t||[]).forEach(function(n){e.push(t[n])}),e},getMethod:function(e){var t=this.smd.services[e];if(!t)throw new Error("no such method");return t},getParameterNames:function(e){var t=[],n=this.getParameters(e);return n.forEach(function(e){t.push(e.name)}),t},getParameters:function(e){var t=this.smd.parameters||[];return t=t.concat(this.smd.services[e].parameters||[]),t},isArgumentRequired:function(e,t){var n=this.findParameter(e,t).required;return n?!0:!1},getServiceUrl:function(e,t){var n=this.smd.services[e],r=this.getRootPath(),i,s=this.enumerateParameters(n);return i=r+(n.target?"/"+n.target:""),i=this.replacePathParamsInUrl(i,s.PATH,t),i=this.addQueryParamsToUrl(i,s.URL,t),i},getMethodTransport:function(e){return this.smd.services[e].transport},getMethodTimeout:function(e){return this.smd.services[e].timeout},getAndValidateArgument:function(e,t){t=t||{};var n=typeof t[e.name]!="undefined"?t[e.name]:e["default"];if(typeof n!="undefined"||e.required!==!0&&e.optional!==!1)return n;throw new Error("Missing required param for service call: "+e.name)},replacePathParamsInUrl:function(e,t,n){var r,i,s,o;for(r=0,i=t.length;r<i;r+=1)s=t[r],o=this.getAndValidateArgument(s,n),typeof o!="undefined"&&(e=e.replace("{"+s.name+"}",encodeURIComponent(o)));return e},addQueryParamsToUrl:function(e,t,n){var r,i,s="",o,u,a,f=!0;for(r=0,i=t.length;r<i;r+=1)o=t[r],u=this.getAndValidateArgument(o,n),typeof u!="undefined"&&(a=o.name+"="+encodeURIComponent(u),f?(f=!1,s+="?"+a):s+="&"+a);return e+=s,e},enumerateParameters:function(e){var t,n,r=this.smd.parameters,i,s=e.parameters||[],o={PATH:[],URL:[],JSON:[],ENTITY:[]};r=r?r.concat(s):s;if(r)for(t=0,n=r.length;t<n;t+=1)i=r[t],o[i.envelope].push(i);return o},getResponseSchema:function(e){return this.smd.services[e].returns},getRequestPayloadParam:function(e){var t=this.getParameters(e),n;return t.forEach(function(e){e&&(e.envelope==="JSON"||e.envelope==="ENTITY")&&(n=e)}),n},getRequestSchema:function(e){var t=this.getRequestPayloadParam(e),n=t&&t.type;return n},getResponsePayloadName:function(e){var t=this.smd,n=t.services[e],r=n&&n.payload||t.payload;return r},getRequestPayloadName:function(e){var t=this.getRequestPayloadParam(e),n=t&&t.payload;return n},isListResponse:function(e){var t=this.getResponseSchema(e),n=this.getResponsePayloadName(e),r=!1;return t.type!=="null"&&(n&&t.properties[n]&&t.properties[n].type==="array"||t.type&&t.type==="array")&&(r=!0),r}});return o}),define("circuits/ServiceMethod",["./log","./util","./declare"],function(e,t,n){var r=new t,i=n(null,{constructor:function(e,t,n){this.name=e,this.reader=t,this.provider=n,this.responsePayloadName=t.getResponsePayloadName(this.name),this.requestPayloadName=t.getRequestPayloadName(this.name),this.transport=t.getMethodTransport(this.name),this.smdMethod=t.getMethod(this.name)},invoke:function(t,n){e.debug("Calling service method: "+this.name+" with params",t);var i=this,s=this.provider,o=this.transport,u=this.reader.getServiceUrl(this.name,t),a=this.reader.getJsonpCallbackParameter(),f=this.reader.getResponseSchema(this.name),l=this.reader.getRequestPayloadParam(this.name),c,h=t.payload||t,p=r.mixin({},t),d,v=f.type==="any"?"blob":"json",m=this.reader.getMethodTimeout(this.name),g=function(e,t,s){var o=e.toString(),u=e<400?i.processResponse(e,t,n,s):t,a=0;p.request.total=t&&t.total,p.response=t,p.links=t&&t.links,a=t&&t.total,r.executePluginChain(n.handler,function(e){var t=new RegExp(e.statusPattern);p.plugin=e,t.test(o)&&e.fn.call(e.scope||e,u,p,a)})},y=function(e){r.executePluginChain(n.progress,function(t){t.fn.call(t.scope||t,e.lengthComputable,e.loaded,e.total)})};return r.executePluginChain(n.url,function(e){u=e.fn.call(e.scope||e,u,i)}),n.provider&&n.provider.length>0&&(s=n.provider[n.provider.length-1],s=s.fn.call(s.scope||s,this)),l&&l.enctype?c={"Content-Type":l.enctype}:h=this.processRequest(h,n),e.debug("Calling method ["+this.name+"] with URL: "+u),d={url:u,headers:c,payload:h,handler:g,onprogress:y,asynchronous:t.asynchronous,timeout:m||"none",dontExecute:!0},a&&(d.jsonpCallbackParam=a),p.request=s[s.httpMethodMap[o].method](d),f.type==="any"?(p.request.url=u,p.request.mediaType=this.smdMethod.contentType||"",e.debug("Setting request for returnType=any  "+p.request)):p.request.execute(),p.request},processRequest:function(e,t,n){var i=e||"",s,o=this;return this.requestPayloadName&&!e[this.requestPayloadName]&&(e={},e[this.requestPayloadName]=i),r.executePluginChain(t.request,function(t){s=t.fn.call(t.scope||t,e,o,n),e=s||e}),i=this.requestPayloadName&&e[this.requestPayloadName]||e,r.executePluginChain(t.write,function(e){r.isArray(i)?i.forEach(function(t,n){s=e.fn.call(e.scope||e,t,o),i[n]=s||i[n]},o):(s=e.fn.call(e.scope||e,i,o),i=s||i)}),this.requestPayloadName?e[this.requestPayloadName]=i:e=i,e},processResponse:function(t,n,i,s){var o=this.reader.isListResponse(this.name),u=this.reader.getResponseSchema(this.name).type||"any",a,f=this,l,c="(2|3)\\d\\d";return u&&u!=="null"&&(typeof n=="object"&&r.executePluginChain(i.response,function(e){var r=e.statusPattern||c,i=new RegExp(r);i.test(t)&&(l=e.fn.call(e.scope||e,n,f,s),n=l||n)}),a=n,this.responsePayloadName&&n&&n[this.responsePayloadName]&&(a=n[this.responsePayloadName],e.debug("Extracting payload for ["+this.name+"] from ["+this.payloadName+"] property",a)),r.executePluginChain(i.read,function(e){var n=e.statusPattern||c,r=new RegExp(n);r.test(t)&&(o?a.some(function(t,n){l=e.fn.call(e.scope||e,t,f),a[n]=l||a[n]},f):(l=e.fn.call(e.scope||e,a,f),a=l||a))})),this.data=a,a}});return i}),define("circuits/PluginMatcher",["./declare","./util","./log"],function(e,t,n){var r=new t,i=e(null,{constructor:function(){this.defaults={read:[],write:[],url:[],request:[],response:[],mixin:[],provider:[],progress:[],handler:[]}},match:function(e,t){var n,r;return r=t&&(t.pointcut||t.pattern)||t,t&&t.pointcut||typeof t=="string"?n=this.matchPointcut:n=this.matchPattern,n(e,r)},matchPointcut:function(e,t){var r,i,s;return t=t||"*.*",r=t.replace(/\./g,"\\.").replace(/\*/g,".*"),n.debug("pointcut is: "+t),t.indexOf("*")!==0&&(r="\\b"+r),t.lastIndexOf("*")!==t.length-1&&(r+="\\b"),n.debug("regexString is: "+r),i=new RegExp(r),n.debug("PluginMatcher match testing ["+e+"] against regex ["+r+"]"),s=i.exec(e),s!==null},matchPattern:function(e,t){var r,i;return t=t||".*",r=new RegExp(t),n.debug("PluginMatcher matchPattern testing ["+e+"] against regex ["+t+"]"),i=r.exec(e),i!==null},list:function(e,t,r,i){var s=e+"."+t,o=[];return i&&i.length>0&&i.forEach(function(e){var t=this.match(s,e);n.debug("match for "+e.name+": "+t),t&&e.type===r?(n.debug("adding "+e.name+" to list"),o.push(e)):n.debug("not adding "+e.name+" to list")},this),o},listForServiceOnly:function(e,t,r,i){var s=[];return i&&i.length>0&&i.forEach(function(i){var o=this.matchingMethodNames(e,t,i);o.length&&i.type===r?(n.debug("adding "+i.name+" to service only list"),s.push(i)):n.debug("not adding "+i.name+" to service only list")},this),s},matchingMethodNames:function(e,t,n){var r,i=[];return t.forEach(function(t){r=e+"."+t;var s=this.match(r,n);s&&i.push(t)},this),i},getPhaseChains:function(e,t,n,i,s){var o=r.mixin({},this.defaults),u=this;return Object.keys(o).forEach(function(r){var a=u.list(e,t,r,n),f=u.list(e,t,r,i),l=u.list(e,t,r,s);o[r]=[].concat(a||[],f||[],l||[])}),o}});return i}),define("circuits/plugins/HandlerSuccessPlugin",["../declare","./HandlerPlugin"],function(e,t){var n=e(t,{constructor:function(){this.statusPattern="(2|3)\\d\\d"}});return n}),define("circuits/plugins/HandlerTimeoutPlugin",["../declare","./HandlerPlugin"],function(e,t){var n=e(t,{constructor:function(){this.statusPattern="-1"}});return n}),define("circuits/Service",["./declare","./ServiceMethod","./PluginMatcher","./util","./log","./plugins/HandlerErrorPlugin","./plugins/HandlerSuccessPlugin","./NativeJsonpDataProvider","./plugins/HandlerTimeoutPlugin"],function(e,t,n,r,i,s,o,u,a){var f=new r,l=e(null,{constructor:function(e,r,l,c){var h=this,p={},d=[],v=e.getSchemaId(),m=e.getTransport();i.debug("Creating new Service based on schema: "+v),i.debug("Got service plugins",c),i.debug("Got factory plugins",l),this.reader=e,this.name=f.serviceName(v),this.factoryPlugins=l,this.plugins=c,this.pluginMatcher=new n,m==="JSONP"&&!r.supportsTransport("JSONP")&&this.addPlugin({type:"provider",fn:function(){return new u({})}}),e.getMethodNames().forEach(function(n){var i=new t(n,e,r);p[n]=i,d.push(i),this[n]=function(e,t){var r=h.convertCallbackParam(t),s=h.resolvePlugins(n,r);return i.invoke(e,s)}},this),this.getMethod=function(e){return p[e]},this.convertCallbackParam=function(e){var t=e||[],n;return e&&Object.prototype.toString.call(e)!=="[object Array]"&&(t=[],e.timeout&&(i.debug("Generating handler plugin on timeout (timeout)"),n={name:"generatedHandlerTimeout",fn:e.timeout},n.scope=e.scope||n,t.push(new a(n))),e.load&&(i.debug("Generating handler plugin on load (load)"),n={name:"generatedHandlerSuccess",fn:e.load},n.scope=e.scope||n,t.push(new o(n))),e.error&&(i.debug("Generating handler plugin on error (error)"),n={name:"generatedHandlerError",fn:e.error},n.scope=e.scope||n,t.push(new s(n))),e.onTimeout&&(i.debug("Generating handler plugin on timeout (onTimeout)"),n={name:"generatedHandlerTimeout",fn:e.timeout},n.scope=e.scope||n,t.push(new a(n))),e.onLoad&&(i.debug("Generating handler plugin on load (onLoad)"),n={name:"generatedHandlerSuccess",fn:e.onLoad},n.scope=e.scope||n,t.push(new o(n))),e.success&&(i.debug("Generating handler plugin for load (success)"),n={name:"generatedHandlerSuccess",fn:e.success},n.scope=e.scope||n,t.push(new o(n))),e.onError&&(i.debug("Generating handler plugin on error (onError)"),n={name:"generatedHandlerError",fn:e.onError},n.scope=e.scope||n,t.push(new s(n))),e.onProgress&&(i.debug("Generating plugin on load (onLoad)"),n={name:"generatedOnProgress",fn:e.onProgress,type:"progress"},n.scope=e.scope||n,t.push(n)),e.progress&&(i.debug("Generating plugin on error (onError)"),n={name:"generatedOnProgress",fn:e.progress,type:"progress"},n.scope=e.scope||n,t.push(n))),t},this.getMethods=function(){return d},i.debug("Service initialized",this)},addPlugin:function(e){this.plugins.push(e),i.debug(e.name+" has been added")},removePlugin:function(e){var t,n,r=this.plugins;i.debug("Attempting to remove "+e.name);for(t=0;t<r.length;t+=1){n=r[t];if(n.name===e.name&&n.type===e.type){r.splice(t,1),i.debug(e.name+" has been removed");break}}},resolvePlugins:function(e,t){i.debug("Resolving plugins for "+this.name+" "+e);var n=this.pluginMatcher.getPhaseChains(this.name,e,this.factoryPlugins,this.plugins,t);return n}});return l}),define("circuits/ServiceQueue",["./util","./declare"],function(e,t){var n=new e,r=t(null,{constructor:function(e){var t=[],r=!1,i=[];this.autoRefreshInterval=e.autoRefreshInterval||0,this.clear=function(){t=[],i=[],r=!1,this.lastTimer&&clearTimeout(this.lastTimer)},this.reset=function(){var e=t;this.clear(),t=e},this.hasBeenExecuted=function(){return this.executed},this.executionComplete=function(){return t.length===i.length},this.add=function(e,n,r){t.push({fn:e,params:n,callbacks:r})},this.hasErrors=function(){var e=!1;return i.forEach(function(t){t.inError&&(e=!0)},this),e},this.getCompletedRequests=function(){var e=[].concat(i);return e},this.isEmpty=function(){return t.length===0},this.execute=function(e,r){var s=this;if(this.hasBeenExecuted()){if(!this.executionComplete())throw new Error("Attempt to re-execute an in-progress queue.");this.reset()}this.executed=!0,t.forEach(function(o){var u=n.mixin({},o.callbacks),a=u.load;u.load=function(n,u,f){i.push(u.request),a.call(o.callbacks.scope,n,u,f),t.length===i.length&&(r?e.call(r,s):e(s),s.autoRefreshInterval&&(s.lastTimer=setTimeout(function(){s.execute(e,r)},s.autoRefreshInterval)))},o.fn.call(u.scope,o.params,u)},this),this.isEmpty()&&(r?e.call(r,s):e(s))}}});return r}),define("circuits/ServiceFactory",["./declare","./ZypSMDReader","./Service","./PluginMatcher","./util","./log","./ServiceQueue","./NativeXhrDataProvider"],function(e,t,n,r,i,s,o,u){var a=new i,f=e(null,{pluginMatcher:new r,constructor:function(e){this.config=a.mixin({plugins:[],provider:new u({}),resolver:function(e){var t;return require({async:!1},[e],function(e){t=e}),t},resolverByModel:function(e){var t;return require({async:!1},[e+"Service"],function(e){t=e}),t}},e)},getServiceForModel:function(e,t){s.debug("Getting service for model: "+e);var n=this.config.resolverByModel(e);return this.getService(n,t)},getServiceByName:function(e,t){s.debug("Getting service: "+e);var n=this.config.resolver(e);return this.getService(n,t)},getServiceQueue:function(e){return new o(e||{})},getService:function(e,t){var r=this.newReader(e),i=this.config.provider,o=this.pluginMatcher,u=t||[],f=[],l,c;return f=f.concat(this.pluginMatcher.listForServiceOnly(a.serviceName(r.getSchemaId()),r.getMethodNames(),"mixin",this.config.plugins),this.pluginMatcher.listForServiceOnly(a.serviceName(r.getSchemaId()),r.getMethodNames(),"mixin",u)),c=new n(r,i,this.config.plugins,u),s.debug("Mixin plugins for "+c.name,f),a.executePluginChain(f,function(e){l=o.matchingMethodNames(c.name,r.getMethodNames(),e),e.fn.call(e.scope||e,c,l)}),c},addPlugin:function(e){this.config.plugins.push(e),s.debug("Plugin: "+e.name+" has been added")},removePlugin:function(e){this.removePluginByName(e.name,e.type),s.debug("Plugin: "+e.name+" has been removed")},removePluginByName:function(e,t){s.debug("Attempting to remove plugin: "+e);var n,r,i=this.config.plugins;for(n=0;n<i.length;n+=1){r=i[n];if(r.name===e&&r.type===t){i.splice(n,1),s.debug("Plugin: "+e+" has been removed");break}}},newReader:function(e){var n=new t(e,this.config.resolver);if(!e.SMDVersion)throw new Error("Argument is not an SMD.");return n}});return f}),define("circuits/allpack",["./pluginpack","./ServiceFactory"],function(){});