(function(f){if(typeofexports==="object"&&typeofmodule!=="undefined"){module.exports=f()}elseif(typeofdefine==="function"&&define.amd){define([],f)}else{varg;if(typeofwindow!=="undefined"){g=window}elseif(typeofglobal!=="undefined"){g=global}elseif(typeofself!=="undefined"){g=self}else{g=this}g.dat=f()}})(function(){vardefine,module,exports;returnfunctione(t,n,r){functions(o,u){if(!n[o]){if(!t[o]){vara=typeofrequire=="function"&&require;if(!u&&a)returna(o,!0);if(i)returni(o,!0);varf=newError("Cannot find module '"+o+"'");throwf.code="MODULE_NOT_FOUND",f}varl=n[o]={exports:{}};t[o][0].call(l.exports,function(e){varn=t[o][1][e];returns(n?n:e)},l,l.exports,e,t,n,r)}returnn[o].exports}vari=typeofrequire=="function"&&require;for(varo=0;o<r.length;o++)s(r[o]);returns}({1:[function(require,module,exports){varcommon=require("../utils/common.js");vartoString=require("./toString.js");varmath=require("./math.js");varinterpret=require("./interpret.js");module.exports=Color;functionColor(){this.__state=interpret.apply(this,arguments);if(this.__state===false){throw"Failed to interpret color arguments"}this.__state.a=this.__state.a||1}Color.COMPONENTS=["r","g","b","h","s","v","hex","a"];common.extend(Color.prototype,{toString:function(){returntoString(this)},toOriginal:function(){returnthis.__state.conversion.write(this)}});defineRGBComponent(Color.prototype,"r",2);defineRGBComponent(Color.prototype,"g",1);defineRGBComponent(Color.prototype,"b",0);defineHSVComponent(Color.prototype,"h");defineHSVComponent(Color.prototype,"s");defineHSVComponent(Color.prototype,"v");Object.defineProperty(Color.prototype,"a",{get:function(){returnthis.__state.a},set:function(v){this.__state.a=v}});Object.defineProperty(Color.prototype,"hex",{get:function(){if(!this.__state.space!=="HEX"){this.__state.hex=math.rgb_to_hex(this.r,this.g,this.b)}returnthis.__state.hex},set:function(v){this.__state.space="HEX";this.__state.hex=v}});functiondefineRGBComponent(target,component,componentHexIndex){Object.defineProperty(target,component,{get:function(){if(this.__state.space==="RGB"){returnthis.__state[component]}recalculateRGB(this,component,componentHexIndex);returnthis.__state[component]},set:function(v){if(this.__state.space!=="RGB"){recalculateRGB(this,component,componentHexIndex);this.__state.space="RGB"}this.__state[component]=v}})}functiondefineHSVComponent(target,component){Object.defineProperty(target,component,{get:function(){if(this.__state.space==="HSV")returnthis.__state[component];recalculateHSV(this);returnthis.__state[component]},set:function(v){if(this.__state.space!=="HSV"){recalculateHSV(this);this.__state.space="HSV"}this.__state[component]=v}})}functionrecalculateRGB(color,component,componentHexIndex){if(color.__state.space==="HEX"){color.__state[component]=math.component_from_hex(color.__state.hex,componentHexIndex)}elseif(color.__state.space==="HSV"){common.extend(color.__state,math.hsv_to_rgb(color.__state.h,color.__state.s,color.__state.v))}else{throw"Corrupted color state"}}functionrecalculateHSV(color){varresult=math.rgb_to_hsv(color.r,color.g,color.b);common.extend(color.__state,{s:result.s,v:result.v});if(!common.isNaN(result.h)){color.__state.h=result.h}elseif(common.isUndefined(color.__state.h)){color.__state.h=0}}},{"../utils/common.js":18,"./interpret.js":2,"./math.js":3,"./toString.js":4}],2:[function(require,module,exports){module.exports=createInterpert();functioncreateInterpert(){varcommon=require("../utils/common.js");vartoString=require("./toString.js");varresult,toReturn;varinterpret=function(){toReturn=false;varoriginal=arguments.length>1?common.toArray(arguments):arguments[0];common.each(INTERPRETATIONS,function(family){if(family.litmus(original)){common.each(family.conversions,function(conversion,conversionName){result=conversion.read(original);if(toReturn===false&&result!==false){toReturn=result;result.conversionName=conversionName;result.conversion=conversion;returncommon.BREAK}});returncommon.BREAK}});returntoReturn};varINTERPRETATIONS=[{litmus:common.isString
elem.dispatchEvent(evt)},bind:function(elem,event,func,bool){bool=bool||false;if(elem.addEventListener)elem.addEventListener(event,func,bool);elseif(elem.attachEvent)elem.attachEvent("on"+event,func);returndom},unbind:function(elem,event,func,bool){bool=bool||false;if(elem.removeEventListener)elem.removeEventListener(event,func,bool);elseif(elem.detachEvent)elem.detachEvent("on"+event,func);returndom},addClass:function(elem,className){if(elem.className===undefined){elem.className=className}elseif(elem.className!==className){varclasses=elem.className.split(/ +/);if(classes.indexOf(className)==-1){classes.push(className);elem.className=classes.join(" ").replace(/^\s+/,"").replace(/\s+$/,"")}}returndom},removeClass:function(elem,className){if(className){if(elem.className===undefined){}elseif(elem.className===className){elem.removeAttribute("class")}else{varclasses=elem.className.split(/ +/);varindex=classes.indexOf(className);if(index!=-1){classes.splice(index,1);elem.className=classes.join(" ")}}}else{elem.className=undefined}returndom},hasClass:function(elem,className){returnnewRegExp("(?:^|\\s+)"+className+"(?:\\s+|$)").test(elem.className)||false},getWidth:function(elem){varstyle=getComputedStyle(elem);returncssValueToPixels(style["border-left-width"])+cssValueToPixels(style["border-right-width"])+cssValueToPixels(style["padding-left"])+cssValueToPixels(style["padding-right"])+cssValueToPixels(style["width"])},getHeight:function(elem){varstyle=getComputedStyle(elem);returncssValueToPixels(style["border-top-width"])+cssValueToPixels(style["border-bottom-width"])+cssValueToPixels(style["padding-top"])+cssValueToPixels(style["padding-bottom"])+cssValueToPixels(style["height"])},getOffset:function(elem){varoffset={left:0,top:0};if(elem.offsetParent){do{offset.left+=elem.offsetLeft;offset.top+=elem.offsetTop}while(elem=elem.offsetParent)}returnoffset},isActive:function(elem){returnelem===document.activeElement&&(elem.type||elem.href)}};module.exports=dom},{"../utils/common.js":18}],17:[function(require,module,exports){varcss=require("../utils/css.js");varsaveDialogueContents='<div id="dg-save" class="dg dialogue">\n\n Here\'s the new load parameter for your <code>GUI</code>\'s constructor:\n\n <textarea id="dg-new-constructor"></textarea>\n\n <div id="dg-save-locally">\n\n <input id="dg-local-storage" type="checkbox"/> Automatically save\n values to <code>localStorage</code> on exit.\n\n <div id="dg-local-explain">The values saved to <code>localStorage</code> will\n override those passed to <code>dat.GUI</code>\'s constructor. This makes it\n easier to work incrementally, but <code>localStorage</code> is fragile,\n and your friends may not see the same values you do.\n \n </div>\n \n </div>\n\n</div>';varstyleSheet=".dg{\n/** Clear list styles */\n/* Auto-place container */\n/* Auto-placed GUI's */\n/* Line items that don't contain folders. */\n/** Folder names */\n/** Hides closed items */\n/** Controller row */\n/** Name-half (left) */\n/** Controller-half (right) */\n/** Controller placement */\n/** Shorter number boxes when slider is present. */\n/** Ensure the entire boolean and function row shows a hand */}\n.dgul{\nlist-style:none;\nmargin:0;\npadding:0;\nwidth:100%;\nclear:both;}\n.dg.ac{\nposition:fixed;\ntop:0;\nleft:0;\nright:0;\nheight:0;\nz-index:0;}\n.dg:not(.ac).main{\n/** Exclude mains in ac so that we don't hide close button */\noverflow:hidden;}\n.dg.main{\n-webkit-transition:opacity0.1slinear;\n-o-transition:opacity0.1slinear;\n-moz-transition:opacity0.1slinear;\ntransition:opacity0.1slinear;}\n.dg.main.taller-than-window{\noverflow-y:auto;}\n.dg.main.taller-than-window.close-button{\nopacity:1;\n/* TODO, these are style notes */\nmargin-top:-1px;\nborder-top:1pxsolid#2c2c2c;}\n.dg.mainul.closed.close-button{\nopacity:1!important;}\n