forked from osmarks/potatOS
4 lines
17 KiB
JavaScript
4 lines
17 KiB
JavaScript
/** vim: et:ts=4:sw=4:sts=4
|
|
* @license RequireJS 2.3.6 Copyright jQuery Foundation and other contributors.
|
|
* Released under MIT license, https://github.com/requirejs/requirejs/blob/master/LICENSE
|
|
*/var requirejs,require,define;!function(global,setTimeout){var req,s,head,baseElement,dataMain,src,interactiveScript,currentlyAddingScript,mainScript,subPath,version="2.3.6",commentRegExp=/\/\*[\s\S]*?\*\/|([^:"'=]|^)\/\/.*$/mg,cjsRequireRegExp=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,jsSuffixRegExp=/\.js$/,currDirRegExp=/^\.\//,op=Object.prototype,ostring=op.toString,hasOwn=op.hasOwnProperty,isBrowser=!!("undefined"!=typeof window&&"undefined"!=typeof navigator&&window.document),isWebWorker=!isBrowser&&"undefined"!=typeof importScripts,readyRegExp=isBrowser&&"PLAYSTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/,defContextName="_",isOpera="undefined"!=typeof opera&&"[object Opera]"===opera.toString(),contexts={},cfg={},globalDefQueue=[],useInteractive=!1;function commentReplace(t,n){return n||""}function isFunction(t){return"[object Function]"===ostring.call(t)}function isArray(t){return"[object Array]"===ostring.call(t)}function each(t,n){if(t){var r;for(r=0;r<t.length&&!(t[r]&&n(t[r],r,t));r+=1);}}function eachReverse(t,n){if(t){var r;for(r=t.length-1;r>-1&&!(t[r]&&n(t[r],r,t));r-=1);}}function hasProp(t,n){return hasOwn.call(t,n)}function getOwn(t,n){return hasProp(t,n)&&t[n]}function eachProp(t,n){var r;for(r in t)if(hasProp(t,r)&&n(t[r],r))break}function mixin(t,n,r,o){return n&&eachProp(n,function(n,a){(r||!hasProp(t,a))&&(!o||"object"!=typeof n||!n||isArray(n)||isFunction(n)||n instanceof RegExp?t[a]=n:(t[a]||(t[a]={}),mixin(t[a],n,r,o)))}),t}function bind(t,n){return function(){return n.apply(t,arguments)}}function scripts(){return document.getElementsByTagName("script")}function defaultOnError(t){throw t}function getGlobal(t){if(!t)return t;var n=global;return each(t.split("."),function(t){n=n[t]}),n}function makeError(t,n,r,o){var a=Error(n+"\nhttps://requirejs.org/docs/errors.html#"+t);return a.requireType=t,a.requireModules=o,r&&(a.originalError=r),a}if(void 0===define){if(void 0!==requirejs){if(isFunction(requirejs))return;cfg=requirejs,requirejs=void 0}void 0===require||isFunction(require)||(cfg=require,require=void 0),req=requirejs=function(t,n,r,o){var a,u,d=defContextName;return isArray(t)||"string"==typeof t||(u=t,isArray(n)?(t=n,n=r,r=o):t=[]),u&&u.context&&(d=u.context),(a=getOwn(contexts,d))||(a=contexts[d]=req.s.newContext(d)),u&&a.configure(u),a.require(t,n,r)},req.config=function(t){return req(t)},req.nextTick=void 0!==setTimeout?function(t){setTimeout(t,4)}:function(t){t()},require||(require=req),req.version=version,req.jsExtRegExp=/^\/|:|\?|\.js$/,req.isBrowser=isBrowser,s=req.s={contexts:contexts,newContext:newContext},req({}),each(["toUrl","undef","defined","specified"],function(t){req[t]=function(){var n=contexts[defContextName];return n.require[t].apply(n,arguments)}}),isBrowser&&(head=s.head=document.getElementsByTagName("head")[0],(baseElement=document.getElementsByTagName("base")[0])&&(head=s.head=baseElement.parentNode)),req.onError=defaultOnError,req.createNode=function(t,n,r){var o=t.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");return o.type=t.scriptType||"text/javascript",o.charset="utf-8",o.async=!0,o},req.load=function(t,n,r){var o,a=t&&t.config||{};if(isBrowser)return(o=req.createNode(a,n,r)).setAttribute("data-requirecontext",t.contextName),o.setAttribute("data-requiremodule",n),!o.attachEvent||o.attachEvent.toString&&0>o.attachEvent.toString().indexOf("[native code")||isOpera?(o.addEventListener("load",t.onScriptLoad,!1),o.addEventListener("error",t.onScriptError,!1)):(useInteractive=!0,o.attachEvent("onreadystatechange",t.onScriptLoad)),o.src=r,a.onNodeCreated&&a.onNodeCreated(o,a,n,r),currentlyAddingScript=o,baseElement?head.insertBefore(o,baseElement):head.appendChild(o),currentlyAddingScript=null,o;if(isWebWorker)try{setTimeout(function(){},0),importScripts(r),t.completeLoad(n)}catch(o){t.onError(makeError("importscripts","importScripts failed for "+n+" at "+r,o,[n]))}},isBrowser&&!cfg.skipDataMain&&eachReverse(scripts(),function(t){if(head||(head=t.parentNode),dataMain=t.getAttribute("data-main"))return mainScript=dataMain,cfg.baseUrl||-1!==mainScript.indexOf("!")||(mainScript=(src=mainScript.split("/")).pop(),subPath=src.length?src.join("/")+"/":"./",cfg.baseUrl=subPath),mainScript=mainScript.replace(jsSuffixRegExp,""),req.jsExtRegExp.test(mainScript)&&(mainScript=dataMain),cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript],!0}),define=function(t,n,r){var o,a;"string"!=typeof t&&(r=n,n=t,t=null),isArray(n)||(r=n,n=null),!n&&isFunction(r)&&(n=[],r.length&&(r.toString().replace(commentRegExp,commentReplace).replace(cjsRequireRegExp,function(t,r){n.push(r)}),n=(1===r.length?["require"]:["require","exports","module"]).concat(n))),useInteractive&&(o=currentlyAddingScript||getInteractiveScript())&&(t||(t=o.getAttribute("data-requiremodule")),a=contexts[o.getAttribute("data-requirecontext")]),a?(a.defQueue.push([t,n,r]),a.defQueueMap[t]=!0):globalDefQueue.push([t,n,r])},define.amd={jQuery:!0},req.exec=function(text){return eval(text)},req(cfg)}function newContext(t){var n,r,o,a,u,d={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},f={},c={},p={},l=[],h={},m={},x={},b=1,q=1;function M(t){var n,r;for(n=0;n<t.length;n++)if("."===(r=t[n]))t.splice(n,1),n-=1;else if(".."===r){if(0===n||1===n&&".."===t[2]||".."===t[n-1])continue;n>0&&(t.splice(n-1,2),n-=2)}}function y(t,n,r){var o,a,u,f,c,p,l,h,m,x,b,q=n&&n.split("/"),y=d.map,E=y&&y["*"];if(t&&(l=(t=t.split("/")).length-1,d.nodeIdCompat&&jsSuffixRegExp.test(t[l])&&(t[l]=t[l].replace(jsSuffixRegExp,"")),"."===t[0].charAt(0)&&q&&(t=q.slice(0,q.length-1).concat(t)),M(t),t=t.join("/")),r&&y&&(q||E)){u=t.split("/");e:for(f=u.length;f>0;f-=1){if(p=u.slice(0,f).join("/"),q){for(c=q.length;c>0;c-=1)if((a=getOwn(y,q.slice(0,c).join("/")))&&(a=getOwn(a,p))){h=a,m=f;break e}}!x&&E&&getOwn(E,p)&&(x=getOwn(E,p),b=f)}!h&&x&&(h=x,m=b),h&&(u.splice(0,m,h),t=u.join("/"))}return(o=getOwn(d.pkgs,t))||t}function E(t){isBrowser&&each(scripts(),function(n){if(n.getAttribute("data-requiremodule")===t&&n.getAttribute("data-requirecontext")===o.contextName)return n.parentNode.removeChild(n),!0})}function k(t){var n=getOwn(d.paths,t);if(n&&isArray(n)&&n.length>1)return n.shift(),o.require.undef(t),o.makeRequire(null,{skipMap:!0})([t]),!0}function T(t){var n,r=t?t.indexOf("!"):-1;return r>-1&&(n=t.substring(0,r),t=t.substring(r+1,t.length)),[n,t]}function S(t,n,r,a){var u,d,f,c,p=null,l=n?n.name:null,m=t,x=!0,M="";return t||(x=!1,t="_@r"+(b+=1)),p=(c=T(t))[0],t=c[1],p&&(d=getOwn(h,p=y(p,l,a))),t&&(p?M=r?t:d&&d.normalize?d.normalize(t,function(t){return y(t,l,a)}):-1===t.indexOf("!")?y(t,l,a):t:(p=(c=T(M=y(t,l,a)))[0],M=c[1],r=!0,u=o.nameToUrl(M))),f=!p||d||r?"":"_unnormalized"+(q+=1),{prefix:p,name:M,parentMap:n,unnormalized:!!f,url:u,originalName:m,isDefine:x,id:(p?p+"!"+M:M)+f}}function w(t){var n=t.id,r=getOwn(f,n);return r||(r=f[n]=new o.Module(t)),r}function A(t,n,r){var o=t.id,a=getOwn(f,o);hasProp(h,o)&&(!a||a.defineEmitComplete)?"defined"===n&&r(h[o]):(a=w(t)).error&&"error"===n?r(a.error):a.on(n,r)}function C(t,n){var r=t.requireModules,o=!1;n?n(t):(each(r,function(n){var r=getOwn(f,n);r&&(r.error=t,r.events.error&&(o=!0,r.emit("error",t)))}),o||req.onError(t))}function N(){globalDefQueue.length&&(each(globalDefQueue,function(t){var n=t[0];"string"==typeof n&&(o.defQueueMap[n]=!0),l.push(t)}),globalDefQueue=[])}function D(t){delete f[t],delete c[t]}function U(t,n,r){var o=t.map.id;t.error?t.emit("error",t.error):(n[o]=!0,each(t.depMaps,function(o,a){var u=o.id,d=getOwn(f,u);!d||t.depMatched[a]||r[u]||(getOwn(n,u)?(t.defineDep(a,h[u]),t.check()):U(d,n,r))}),r[o]=!0)}function L(){var t,r,a=1e3*d.waitSeconds,f=a&&o.startTime+a<new Date().getTime(),p=[],l=[],h=!1,m=!0;if(!n){if(n=!0,eachProp(c,function(t){var n=t.map,o=n.id;if(t.enabled&&(n.isDefine||l.push(t),!t.error)){if(!t.inited&&f)k(o)?(r=!0,h=!0):(p.push(o),E(o));else if(!t.inited&&t.fetched&&n.isDefine&&(h=!0,!n.prefix))return m=!1}}),f&&p.length)return(t=makeError("timeout","Load timeout for modules: "+p,null,p)).contextName=o.contextName,C(t);m&&each(l,function(t){U(t,{},{})}),(!f||r)&&h&&(isBrowser||isWebWorker)&&!u&&(u=setTimeout(function(){u=0,L()},50)),n=!1}}function O(t){hasProp(h,t[0])||w(S(t[0],null,!0)).init(t[1],t[2])}function R(t,n,r,o){t.detachEvent&&!isOpera?o&&t.detachEvent(o,n):t.removeEventListener(r,n,!1)}function z(t){var n=t.currentTarget||t.srcElement;return R(n,o.onScriptLoad,"load","onreadystatechange"),R(n,o.onScriptError,"error"),{node:n,id:n&&n.getAttribute("data-requiremodule")}}function B(){var t;for(N();l.length;){if(null===(t=l.shift())[0])return C(makeError("mismatch","Mismatched anonymous define() module: "+t[t.length-1]));O(t)}o.defQueueMap={}}return a={require:function(t){return t.require?t.require:t.require=o.makeRequire(t.map)},exports:function(t){if(t.usingExports=!0,t.map.isDefine)return t.exports?h[t.map.id]=t.exports:t.exports=h[t.map.id]={}},module:function(t){return t.module?t.module:t.module={id:t.map.id,uri:t.map.url,config:function(){return getOwn(d.config,t.map.id)||{}},exports:t.exports||(t.exports={})}}},(r=function(t){this.events=getOwn(p,t.id)||{},this.map=t,this.shim=getOwn(d.shim,t.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0}).prototype={init:function(t,n,r,o){o=o||{},this.inited||(this.factory=n,r?this.on("error",r):this.events.error&&(r=bind(this,function(t){this.emit("error",t)})),this.depMaps=t&&t.slice(0),this.errback=r,this.inited=!0,this.ignore=o.ignore,o.enabled||this.enabled?this.enable():this.check())},defineDep:function(t,n){this.depMatched[t]||(this.depMatched[t]=!0,this.depCount-=1,this.depExports[t]=n)},fetch:function(){if(!this.fetched){this.fetched=!0,o.startTime=new Date().getTime();var t=this.map;if(!this.shim)return t.prefix?this.callPlugin():this.load();o.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],bind(this,function(){return t.prefix?this.callPlugin():this.load()}))}},load:function(){var t=this.map.url;m[t]||(m[t]=!0,o.load(this.map.id,t))},check:function(){if(this.enabled&&!this.enabling){var t,n,r=this.map.id,a=this.depExports,u=this.exports,d=this.factory;if(this.inited){if(this.error)this.emit("error",this.error);else if(!this.defining){if(this.defining=!0,this.depCount<1&&!this.defined){if(isFunction(d)){if(this.events.error&&this.map.isDefine||req.onError!==defaultOnError)try{u=o.execCb(r,d,a,u)}catch(n){t=n}else u=o.execCb(r,d,a,u);if(this.map.isDefine&&void 0===u&&((n=this.module)?u=n.exports:this.usingExports&&(u=this.exports)),t)return t.requireMap=this.map,t.requireModules=this.map.isDefine?[this.map.id]:null,t.requireType=this.map.isDefine?"define":"require",C(this.error=t)}else u=d;if(this.exports=u,this.map.isDefine&&!this.ignore&&(h[r]=u,req.onResourceLoad)){var f=[];each(this.depMaps,function(t){f.push(t.normalizedMap||t)}),req.onResourceLoad(o,this.map,f)}D(r),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else hasProp(o.defQueueMap,r)||this.fetch()}},callPlugin:function(){var t=this.map,n=t.id,r=S(t.prefix);this.depMaps.push(r),A(r,"defined",bind(this,function(r){var a,u,c,p=getOwn(x,this.map.id),l=this.map.name,h=this.map.parentMap?this.map.parentMap.name:null,m=o.makeRequire(t.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){r.normalize&&(l=r.normalize(l,function(t){return y(t,h,!0)})||""),A(u=S(t.prefix+"!"+l,this.map.parentMap,!0),"defined",bind(this,function(t){this.map.normalizedMap=u,this.init([],function(){return t},null,{enabled:!0,ignore:!0})})),(c=getOwn(f,u.id))&&(this.depMaps.push(u),this.events.error&&c.on("error",bind(this,function(t){this.emit("error",t)})),c.enable());return}if(p){this.map.url=o.nameToUrl(p),this.load();return}(a=bind(this,function(t){this.init([],function(){return t},null,{enabled:!0})})).error=bind(this,function(t){this.inited=!0,this.error=t,t.requireModules=[n],eachProp(f,function(t){0===t.map.id.indexOf(n+"_unnormalized")&&D(t.map.id)}),C(t)}),a.fromText=bind(this,function(r,u){var f=t.name,c=S(f),p=useInteractive;u&&(r=u),p&&(useInteractive=!1),w(c),hasProp(d.config,n)&&(d.config[f]=d.config[n]);try{req.exec(r)}catch(t){return C(makeError("fromtexteval","fromText eval for "+n+" failed: "+t,t,[n]))}p&&(useInteractive=!0),this.depMaps.push(c),o.completeLoad(f),m([f],a)}),r.load(t.name,m,a,d)})),o.enable(r,this),this.pluginMaps[r.id]=r},enable:function(){c[this.map.id]=this,this.enabled=!0,this.enabling=!0,each(this.depMaps,bind(this,function(t,n){var r,u,d;if("string"==typeof t){if(t=S(t,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[n]=t,d=getOwn(a,t.id)){this.depExports[n]=d(this);return}this.depCount+=1,A(t,"defined",bind(this,function(t){this.undefed||(this.defineDep(n,t),this.check())})),this.errback?A(t,"error",bind(this,this.errback)):this.events.error&&A(t,"error",bind(this,function(t){this.emit("error",t)}))}u=f[r=t.id],hasProp(a,r)||!u||u.enabled||o.enable(t,this)})),eachProp(this.pluginMaps,bind(this,function(t){var n=getOwn(f,t.id);n&&!n.enabled&&o.enable(t,this)})),this.enabling=!1,this.check()},on:function(t,n){var r=this.events[t];r||(r=this.events[t]=[]),r.push(n)},emit:function(t,n){each(this.events[t],function(t){t(n)}),"error"===t&&delete this.events[t]}},(o={config:d,contextName:t,registry:f,defined:h,urlFetched:m,defQueue:l,defQueueMap:{},Module:r,makeModuleMap:S,nextTick:req.nextTick,onError:C,configure:function(t){if(t.baseUrl&&"/"!==t.baseUrl.charAt(t.baseUrl.length-1)&&(t.baseUrl+="/"),"string"==typeof t.urlArgs){var n=t.urlArgs;t.urlArgs=function(t,r){return(-1===r.indexOf("?")?"?":"&")+n}}var r=d.shim,a={paths:!0,bundles:!0,config:!0,map:!0};eachProp(t,function(t,n){a[n]?(d[n]||(d[n]={}),mixin(d[n],t,!0,!0)):d[n]=t}),t.bundles&&eachProp(t.bundles,function(t,n){each(t,function(t){t!==n&&(x[t]=n)})}),t.shim&&(eachProp(t.shim,function(t,n){isArray(t)&&(t={deps:t}),(t.exports||t.init)&&!t.exportsFn&&(t.exportsFn=o.makeShimExports(t)),r[n]=t}),d.shim=r),t.packages&&each(t.packages,function(t){var n;n=(t="string"==typeof t?{name:t}:t).name,t.location&&(d.paths[n]=t.location),d.pkgs[n]=t.name+"/"+(t.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}),eachProp(f,function(t,n){t.inited||t.map.unnormalized||(t.map=S(n,null,!0))}),(t.deps||t.callback)&&o.require(t.deps||[],t.callback)},makeShimExports:function(t){return function(){var n;return t.init&&(n=t.init.apply(global,arguments)),n||t.exports&&getGlobal(t.exports)}},makeRequire:function(n,r){function u(d,c,p){var l,m;return(r.enableBuildCallback&&c&&isFunction(c)&&(c.__requireJsBuild=!0),"string"==typeof d)?isFunction(c)?C(makeError("requireargs","Invalid require call"),p):n&&hasProp(a,d)?a[d](f[n.id]):req.get?req.get(o,d,n,u):hasProp(h,l=S(d,n,!1,!0).id)?h[l]:C(makeError("notloaded",'Module name "'+l+'" has not been loaded yet for context: '+t+(n?"":". Use require([])"))):(B(),o.nextTick(function(){B(),(m=w(S(null,n))).skipMap=r.skipMap,m.init(d,c,p,{enabled:!0}),L()}),u)}return r=r||{},mixin(u,{isBrowser:isBrowser,toUrl:function(t){var r,a=t.lastIndexOf("."),u=t.split("/")[0],d="."===u||".."===u;return -1!==a&&(!d||a>1)&&(r=t.substring(a,t.length),t=t.substring(0,a)),o.nameToUrl(y(t,n&&n.id,!0),r,!0)},defined:function(t){return hasProp(h,S(t,n,!1,!0).id)},specified:function(t){return hasProp(h,t=S(t,n,!1,!0).id)||hasProp(f,t)}}),n||(u.undef=function(t){N();var r=S(t,n,!0),a=getOwn(f,t);a.undefed=!0,E(t),delete h[t],delete m[r.url],delete p[t],eachReverse(l,function(n,r){n[0]===t&&l.splice(r,1)}),delete o.defQueueMap[t],a&&(a.events.defined&&(p[t]=a.events),D(t))}),u},enable:function(t){getOwn(f,t.id)&&w(t).enable()},completeLoad:function(t){var n,r,a,u=getOwn(d.shim,t)||{},c=u.exports;for(N();l.length;){if(null===(r=l.shift())[0]){if(r[0]=t,n)break;n=!0}else r[0]===t&&(n=!0);O(r)}if(o.defQueueMap={},a=getOwn(f,t),!n&&!hasProp(h,t)&&a&&!a.inited){if(!d.enforceDefine||c&&getGlobal(c))O([t,u.deps||[],u.exportsFn]);else{if(k(t))return;return C(makeError("nodefine","No define call for "+t,null,[t]))}}L()},nameToUrl:function(t,n,r){var a,u,f,c,p,l,h=getOwn(d.pkgs,t);if(h&&(t=h),l=getOwn(x,t))return o.nameToUrl(l,n,r);if(req.jsExtRegExp.test(t))c=t+(n||"");else{for(a=d.paths,f=(u=t.split("/")).length;f>0;f-=1)if(p=getOwn(a,u.slice(0,f).join("/"))){isArray(p)&&(p=p[0]),u.splice(0,f,p);break}c=u.join("/"),c+=n||(/^data\:|^blob\:|\?/.test(c)||r?"":".js"),c=("/"===c.charAt(0)||c.match(/^[\w\+\.\-]+:/)?"":d.baseUrl)+c}return d.urlArgs&&!/^blob\:/.test(c)?c+d.urlArgs(t,c):c},load:function(t,n){req.load(o,t,n)},execCb:function(t,n,r,o){return n.apply(o,r)},onScriptLoad:function(t){if("load"===t.type||readyRegExp.test((t.currentTarget||t.srcElement).readyState)){interactiveScript=null;var n=z(t);o.completeLoad(n.id)}},onScriptError:function(t){var n=z(t);if(!k(n.id)){var r=[];return eachProp(f,function(t,o){0!==o.indexOf("_@r")&&each(t.depMaps,function(t){if(t.id===n.id)return r.push(o),!0})}),C(makeError("scripterror",'Script error for "'+n.id+(r.length?'", needed by: '+r.join(", "):'"'),t,[n.id]))}}}).require=o.makeRequire(),o}function getInteractiveScript(){return interactiveScript&&"interactive"===interactiveScript.readyState||eachReverse(scripts(),function(t){if("interactive"===t.readyState)return interactiveScript=t}),interactiveScript}}(this,"undefined"==typeof setTimeout?void 0:setTimeout); |