dispatch.to("Foundry/2.1 Core Plugins").at(function(e,t){e.script=function(){var t=function(e){if(e===undefined)return;typeof e=="string"&&(e={url:e});var t=new n(e);return t},n=function(t){var n=e.extend(this,t);n.manager=e.Deferred(),e.extend(n,n.manager.promise()),n.load()},r=document.getElementsByTagName("head")[0],i=document.getElementsByTagName("base")[0];return e.extend(n.prototype,{timeout:7e3,retry:3,retryCount:1,type:"text/javascript",async:!1,charset:"UTF-8",verbose:!1,insert:function(){var e=this.node;i?r.insertBefore(e,i):r.appendChild(e)},remove:function(){var e=this.node;setTimeout(function(){e.onload=e.onerror=e.onreadystatechange=null;try{r.removeChild(e)}catch(t){}},1e3)},load:function(){var t=this,n;t.endTime=undefined,t.startTime=new Date,t.node=n=document.createElement("script"),t.insert(),t._ready=e.proxy(t.ready,t),t._error=e.proxy(t.error,t),n.attachEvent&&!e.browser.opera?(n.attachEvent("onreadystatechange",t._ready),n.attachEvent("onerror",t._error)):(n.addEventListener("load",t._ready,!1),n.addEventListener("error",t._error,!1)),e(n).attr({type:t.type,async:t.async,charset:t.charset,src:t.url}),t.monitor()},monitor:function(){var e=this;if(e.retryCount>e.retry){e._error();return}setTimeout(function(){e.state()!=="resolved"&&(e.verbose&&console.warn("$.script: Load timeout. [Retry: "+e.retryCount+"]",e),e.remove(),e.retryCount++,e.load())},e.timeout*e.retryCount)},ready:function(e){var t=this,n=t.node;if(e.type==="load"||/loaded|complete/.test(n.readyState))t.complete.call(t,e),t.manager.resolve(t)},error:function(e){var t=this;t.verbose&&console.error("$.script: Unable to load ",t),t.complete.call(t,e),t.remove(),t.manager.reject(t)},complete:function(t){var n=this,r=n.node;n.endTime=new Date,r.detachEvent&&!e.browser.opera?(r.detachEvent("onreadystatechange",n._ready),r.detachEvent("onerror",n._error)):(r.removeEventListener("load",n._ready,!1),r.removeEventListener("error",n._error,!1))}}),t}()});