@perceptimagery/dita-configurator-staging 0.1.6001 → 0.1.6101

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +345 -2738
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -62,8 +62,8 @@ var __publicField = (obj, key, value) => {
62
62
  */
63
63
  async Get(url) {
64
64
  const response = await fetch(this.config.HOST + url, this.RequestOptions("GET"));
65
- const result2 = await response.json();
66
- return result2;
65
+ const result = await response.json();
66
+ return result;
67
67
  }
68
68
  /**
69
69
  * @description nice and tidy reuqest wrapper
@@ -73,8 +73,8 @@ var __publicField = (obj, key, value) => {
73
73
  */
74
74
  async Post(url, data) {
75
75
  const response = await fetch(this.config.HOST + url, this.RequestOptions("POST", data || {}));
76
- const result2 = await response.json();
77
- return result2;
76
+ const result = await response.json();
77
+ return result;
78
78
  }
79
79
  StoreConfig(config2) {
80
80
  if (config2.JWT) {
@@ -111,7 +111,7 @@ var __publicField = (obj, key, value) => {
111
111
  host: "https://api.sprie.io"
112
112
  };
113
113
  const config = Object.freeze(Config$1);
114
- const version = "0.1.6001";
114
+ const version = "0.1.6101";
115
115
  function modifyLensArr(arr, element) {
116
116
  const index = arr.findIndex((e) => e["sku"] === element["sku"]);
117
117
  if (index !== -1) {
@@ -1334,7 +1334,7 @@ var __publicField = (obj, key, value) => {
1334
1334
  stringify: function(wordArray) {
1335
1335
  var words = wordArray.words;
1336
1336
  var sigBytes = wordArray.sigBytes;
1337
- var map2 = this._map;
1337
+ var map = this._map;
1338
1338
  wordArray.clamp();
1339
1339
  var base64Chars = [];
1340
1340
  for (var i = 0; i < sigBytes; i += 3) {
@@ -1343,10 +1343,10 @@ var __publicField = (obj, key, value) => {
1343
1343
  var byte3 = words[i + 2 >>> 2] >>> 24 - (i + 2) % 4 * 8 & 255;
1344
1344
  var triplet = byte1 << 16 | byte2 << 8 | byte3;
1345
1345
  for (var j = 0; j < 4 && i + j * 0.75 < sigBytes; j++) {
1346
- base64Chars.push(map2.charAt(triplet >>> 6 * (3 - j) & 63));
1346
+ base64Chars.push(map.charAt(triplet >>> 6 * (3 - j) & 63));
1347
1347
  }
1348
1348
  }
1349
- var paddingChar = map2.charAt(64);
1349
+ var paddingChar = map.charAt(64);
1350
1350
  if (paddingChar) {
1351
1351
  while (base64Chars.length % 4) {
1352
1352
  base64Chars.push(paddingChar);
@@ -1369,15 +1369,15 @@ var __publicField = (obj, key, value) => {
1369
1369
  */
1370
1370
  parse: function(base64Str) {
1371
1371
  var base64StrLength = base64Str.length;
1372
- var map2 = this._map;
1372
+ var map = this._map;
1373
1373
  var reverseMap = this._reverseMap;
1374
1374
  if (!reverseMap) {
1375
1375
  reverseMap = this._reverseMap = [];
1376
- for (var j = 0; j < map2.length; j++) {
1377
- reverseMap[map2.charCodeAt(j)] = j;
1376
+ for (var j = 0; j < map.length; j++) {
1377
+ reverseMap[map.charCodeAt(j)] = j;
1378
1378
  }
1379
1379
  }
1380
- var paddingChar = map2.charAt(64);
1380
+ var paddingChar = map.charAt(64);
1381
1381
  if (paddingChar) {
1382
1382
  var paddingIndex = base64Str.indexOf(paddingChar);
1383
1383
  if (paddingIndex !== -1) {
@@ -1447,7 +1447,7 @@ var __publicField = (obj, key, value) => {
1447
1447
  }
1448
1448
  var words = wordArray.words;
1449
1449
  var sigBytes = wordArray.sigBytes;
1450
- var map2 = urlSafe ? this._safe_map : this._map;
1450
+ var map = urlSafe ? this._safe_map : this._map;
1451
1451
  wordArray.clamp();
1452
1452
  var base64Chars = [];
1453
1453
  for (var i = 0; i < sigBytes; i += 3) {
@@ -1456,10 +1456,10 @@ var __publicField = (obj, key, value) => {
1456
1456
  var byte3 = words[i + 2 >>> 2] >>> 24 - (i + 2) % 4 * 8 & 255;
1457
1457
  var triplet = byte1 << 16 | byte2 << 8 | byte3;
1458
1458
  for (var j = 0; j < 4 && i + j * 0.75 < sigBytes; j++) {
1459
- base64Chars.push(map2.charAt(triplet >>> 6 * (3 - j) & 63));
1459
+ base64Chars.push(map.charAt(triplet >>> 6 * (3 - j) & 63));
1460
1460
  }
1461
1461
  }
1462
- var paddingChar = map2.charAt(64);
1462
+ var paddingChar = map.charAt(64);
1463
1463
  if (paddingChar) {
1464
1464
  while (base64Chars.length % 4) {
1465
1465
  base64Chars.push(paddingChar);
@@ -1487,15 +1487,15 @@ var __publicField = (obj, key, value) => {
1487
1487
  urlSafe = true;
1488
1488
  }
1489
1489
  var base64StrLength = base64Str.length;
1490
- var map2 = urlSafe ? this._safe_map : this._map;
1490
+ var map = urlSafe ? this._safe_map : this._map;
1491
1491
  var reverseMap = this._reverseMap;
1492
1492
  if (!reverseMap) {
1493
1493
  reverseMap = this._reverseMap = [];
1494
- for (var j = 0; j < map2.length; j++) {
1495
- reverseMap[map2.charCodeAt(j)] = j;
1494
+ for (var j = 0; j < map.length; j++) {
1495
+ reverseMap[map.charCodeAt(j)] = j;
1496
1496
  }
1497
1497
  }
1498
- var paddingChar = map2.charAt(64);
1498
+ var paddingChar = map.charAt(64);
1499
1499
  if (paddingChar) {
1500
1500
  var paddingIndex = base64Str.indexOf(paddingChar);
1501
1501
  if (paddingIndex !== -1) {
@@ -8735,13 +8735,13 @@ var __publicField = (obj, key, value) => {
8735
8735
  for (let i = 0, l = chunks.length; i < l; i++) {
8736
8736
  len += chunks[i].length;
8737
8737
  }
8738
- const result2 = new Uint8Array(len);
8738
+ const result = new Uint8Array(len);
8739
8739
  for (let i = 0, pos = 0, l = chunks.length; i < l; i++) {
8740
8740
  let chunk = chunks[i];
8741
- result2.set(chunk, pos);
8741
+ result.set(chunk, pos);
8742
8742
  pos += chunk.length;
8743
8743
  }
8744
- return result2;
8744
+ return result;
8745
8745
  };
8746
8746
  var common$1 = {
8747
8747
  assign,
@@ -8808,11 +8808,11 @@ var __publicField = (obj, key, value) => {
8808
8808
  return String.fromCharCode.apply(null, buf.length === len ? buf : buf.subarray(0, len));
8809
8809
  }
8810
8810
  }
8811
- let result2 = "";
8811
+ let result = "";
8812
8812
  for (let i = 0; i < len; i++) {
8813
- result2 += String.fromCharCode(buf[i]);
8813
+ result += String.fromCharCode(buf[i]);
8814
8814
  }
8815
- return result2;
8815
+ return result;
8816
8816
  };
8817
8817
  var buf2string = (buf, max) => {
8818
8818
  const len = max || buf.length;
@@ -11042,2462 +11042,6 @@ var __publicField = (obj, key, value) => {
11042
11042
  return { decodedData: f, events: { fileDownloadTime: a, fileUnzipTime: p2, fileDecryptionTime: y } };
11043
11043
  }
11044
11044
  var A$1 = c;
11045
- function ___$insertStyle(css2) {
11046
- if (!css2) {
11047
- return;
11048
- }
11049
- if (typeof window === "undefined") {
11050
- return;
11051
- }
11052
- var style = document.createElement("style");
11053
- style.setAttribute("type", "text/css");
11054
- style.innerHTML = css2;
11055
- document.head.appendChild(style);
11056
- return css2;
11057
- }
11058
- function colorToString(color, forceCSSHex) {
11059
- var colorFormat = color.__state.conversionName.toString();
11060
- var r = Math.round(color.r);
11061
- var g2 = Math.round(color.g);
11062
- var b = Math.round(color.b);
11063
- var a = color.a;
11064
- var h = Math.round(color.h);
11065
- var s2 = color.s.toFixed(1);
11066
- var v = color.v.toFixed(1);
11067
- if (forceCSSHex || colorFormat === "THREE_CHAR_HEX" || colorFormat === "SIX_CHAR_HEX") {
11068
- var str = color.hex.toString(16);
11069
- while (str.length < 6) {
11070
- str = "0" + str;
11071
- }
11072
- return "#" + str;
11073
- } else if (colorFormat === "CSS_RGB") {
11074
- return "rgb(" + r + "," + g2 + "," + b + ")";
11075
- } else if (colorFormat === "CSS_RGBA") {
11076
- return "rgba(" + r + "," + g2 + "," + b + "," + a + ")";
11077
- } else if (colorFormat === "HEX") {
11078
- return "0x" + color.hex.toString(16);
11079
- } else if (colorFormat === "RGB_ARRAY") {
11080
- return "[" + r + "," + g2 + "," + b + "]";
11081
- } else if (colorFormat === "RGBA_ARRAY") {
11082
- return "[" + r + "," + g2 + "," + b + "," + a + "]";
11083
- } else if (colorFormat === "RGB_OBJ") {
11084
- return "{r:" + r + ",g:" + g2 + ",b:" + b + "}";
11085
- } else if (colorFormat === "RGBA_OBJ") {
11086
- return "{r:" + r + ",g:" + g2 + ",b:" + b + ",a:" + a + "}";
11087
- } else if (colorFormat === "HSV_OBJ") {
11088
- return "{h:" + h + ",s:" + s2 + ",v:" + v + "}";
11089
- } else if (colorFormat === "HSVA_OBJ") {
11090
- return "{h:" + h + ",s:" + s2 + ",v:" + v + ",a:" + a + "}";
11091
- }
11092
- return "unknown format";
11093
- }
11094
- var ARR_EACH = Array.prototype.forEach;
11095
- var ARR_SLICE = Array.prototype.slice;
11096
- var Common = {
11097
- BREAK: {},
11098
- extend: function extend(target) {
11099
- this.each(ARR_SLICE.call(arguments, 1), function(obj) {
11100
- var keys = this.isObject(obj) ? Object.keys(obj) : [];
11101
- keys.forEach((function(key) {
11102
- if (!this.isUndefined(obj[key])) {
11103
- target[key] = obj[key];
11104
- }
11105
- }).bind(this));
11106
- }, this);
11107
- return target;
11108
- },
11109
- defaults: function defaults(target) {
11110
- this.each(ARR_SLICE.call(arguments, 1), function(obj) {
11111
- var keys = this.isObject(obj) ? Object.keys(obj) : [];
11112
- keys.forEach((function(key) {
11113
- if (this.isUndefined(target[key])) {
11114
- target[key] = obj[key];
11115
- }
11116
- }).bind(this));
11117
- }, this);
11118
- return target;
11119
- },
11120
- compose: function compose() {
11121
- var toCall = ARR_SLICE.call(arguments);
11122
- return function() {
11123
- var args = ARR_SLICE.call(arguments);
11124
- for (var i = toCall.length - 1; i >= 0; i--) {
11125
- args = [toCall[i].apply(this, args)];
11126
- }
11127
- return args[0];
11128
- };
11129
- },
11130
- each: function each(obj, itr, scope) {
11131
- if (!obj) {
11132
- return;
11133
- }
11134
- if (ARR_EACH && obj.forEach && obj.forEach === ARR_EACH) {
11135
- obj.forEach(itr, scope);
11136
- } else if (obj.length === obj.length + 0) {
11137
- var key = void 0;
11138
- var l = void 0;
11139
- for (key = 0, l = obj.length; key < l; key++) {
11140
- if (key in obj && itr.call(scope, obj[key], key) === this.BREAK) {
11141
- return;
11142
- }
11143
- }
11144
- } else {
11145
- for (var _key in obj) {
11146
- if (itr.call(scope, obj[_key], _key) === this.BREAK) {
11147
- return;
11148
- }
11149
- }
11150
- }
11151
- },
11152
- defer: function defer(fnc) {
11153
- setTimeout(fnc, 0);
11154
- },
11155
- debounce: function debounce(func, threshold, callImmediately) {
11156
- var timeout = void 0;
11157
- return function() {
11158
- var obj = this;
11159
- var args = arguments;
11160
- function delayed() {
11161
- timeout = null;
11162
- if (!callImmediately)
11163
- func.apply(obj, args);
11164
- }
11165
- var callNow = callImmediately || !timeout;
11166
- clearTimeout(timeout);
11167
- timeout = setTimeout(delayed, threshold);
11168
- if (callNow) {
11169
- func.apply(obj, args);
11170
- }
11171
- };
11172
- },
11173
- toArray: function toArray(obj) {
11174
- if (obj.toArray)
11175
- return obj.toArray();
11176
- return ARR_SLICE.call(obj);
11177
- },
11178
- isUndefined: function isUndefined(obj) {
11179
- return obj === void 0;
11180
- },
11181
- isNull: function isNull(obj) {
11182
- return obj === null;
11183
- },
11184
- isNaN: function(_isNaN) {
11185
- function isNaN2(_x2) {
11186
- return _isNaN.apply(this, arguments);
11187
- }
11188
- isNaN2.toString = function() {
11189
- return _isNaN.toString();
11190
- };
11191
- return isNaN2;
11192
- }(function(obj) {
11193
- return isNaN(obj);
11194
- }),
11195
- isArray: Array.isArray || function(obj) {
11196
- return obj.constructor === Array;
11197
- },
11198
- isObject: function isObject(obj) {
11199
- return obj === Object(obj);
11200
- },
11201
- isNumber: function isNumber(obj) {
11202
- return obj === obj + 0;
11203
- },
11204
- isString: function isString(obj) {
11205
- return obj === obj + "";
11206
- },
11207
- isBoolean: function isBoolean(obj) {
11208
- return obj === false || obj === true;
11209
- },
11210
- isFunction: function isFunction(obj) {
11211
- return obj instanceof Function;
11212
- }
11213
- };
11214
- var INTERPRETATIONS = [
11215
- {
11216
- litmus: Common.isString,
11217
- conversions: {
11218
- THREE_CHAR_HEX: {
11219
- read: function read(original) {
11220
- var test = original.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);
11221
- if (test === null) {
11222
- return false;
11223
- }
11224
- return {
11225
- space: "HEX",
11226
- hex: parseInt("0x" + test[1].toString() + test[1].toString() + test[2].toString() + test[2].toString() + test[3].toString() + test[3].toString(), 0)
11227
- };
11228
- },
11229
- write: colorToString
11230
- },
11231
- SIX_CHAR_HEX: {
11232
- read: function read(original) {
11233
- var test = original.match(/^#([A-F0-9]{6})$/i);
11234
- if (test === null) {
11235
- return false;
11236
- }
11237
- return {
11238
- space: "HEX",
11239
- hex: parseInt("0x" + test[1].toString(), 0)
11240
- };
11241
- },
11242
- write: colorToString
11243
- },
11244
- CSS_RGB: {
11245
- read: function read(original) {
11246
- var test = original.match(/^rgb\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/);
11247
- if (test === null) {
11248
- return false;
11249
- }
11250
- return {
11251
- space: "RGB",
11252
- r: parseFloat(test[1]),
11253
- g: parseFloat(test[2]),
11254
- b: parseFloat(test[3])
11255
- };
11256
- },
11257
- write: colorToString
11258
- },
11259
- CSS_RGBA: {
11260
- read: function read(original) {
11261
- var test = original.match(/^rgba\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/);
11262
- if (test === null) {
11263
- return false;
11264
- }
11265
- return {
11266
- space: "RGB",
11267
- r: parseFloat(test[1]),
11268
- g: parseFloat(test[2]),
11269
- b: parseFloat(test[3]),
11270
- a: parseFloat(test[4])
11271
- };
11272
- },
11273
- write: colorToString
11274
- }
11275
- }
11276
- },
11277
- {
11278
- litmus: Common.isNumber,
11279
- conversions: {
11280
- HEX: {
11281
- read: function read(original) {
11282
- return {
11283
- space: "HEX",
11284
- hex: original,
11285
- conversionName: "HEX"
11286
- };
11287
- },
11288
- write: function write(color) {
11289
- return color.hex;
11290
- }
11291
- }
11292
- }
11293
- },
11294
- {
11295
- litmus: Common.isArray,
11296
- conversions: {
11297
- RGB_ARRAY: {
11298
- read: function read(original) {
11299
- if (original.length !== 3) {
11300
- return false;
11301
- }
11302
- return {
11303
- space: "RGB",
11304
- r: original[0],
11305
- g: original[1],
11306
- b: original[2]
11307
- };
11308
- },
11309
- write: function write(color) {
11310
- return [color.r, color.g, color.b];
11311
- }
11312
- },
11313
- RGBA_ARRAY: {
11314
- read: function read(original) {
11315
- if (original.length !== 4)
11316
- return false;
11317
- return {
11318
- space: "RGB",
11319
- r: original[0],
11320
- g: original[1],
11321
- b: original[2],
11322
- a: original[3]
11323
- };
11324
- },
11325
- write: function write(color) {
11326
- return [color.r, color.g, color.b, color.a];
11327
- }
11328
- }
11329
- }
11330
- },
11331
- {
11332
- litmus: Common.isObject,
11333
- conversions: {
11334
- RGBA_OBJ: {
11335
- read: function read(original) {
11336
- if (Common.isNumber(original.r) && Common.isNumber(original.g) && Common.isNumber(original.b) && Common.isNumber(original.a)) {
11337
- return {
11338
- space: "RGB",
11339
- r: original.r,
11340
- g: original.g,
11341
- b: original.b,
11342
- a: original.a
11343
- };
11344
- }
11345
- return false;
11346
- },
11347
- write: function write(color) {
11348
- return {
11349
- r: color.r,
11350
- g: color.g,
11351
- b: color.b,
11352
- a: color.a
11353
- };
11354
- }
11355
- },
11356
- RGB_OBJ: {
11357
- read: function read(original) {
11358
- if (Common.isNumber(original.r) && Common.isNumber(original.g) && Common.isNumber(original.b)) {
11359
- return {
11360
- space: "RGB",
11361
- r: original.r,
11362
- g: original.g,
11363
- b: original.b
11364
- };
11365
- }
11366
- return false;
11367
- },
11368
- write: function write(color) {
11369
- return {
11370
- r: color.r,
11371
- g: color.g,
11372
- b: color.b
11373
- };
11374
- }
11375
- },
11376
- HSVA_OBJ: {
11377
- read: function read(original) {
11378
- if (Common.isNumber(original.h) && Common.isNumber(original.s) && Common.isNumber(original.v) && Common.isNumber(original.a)) {
11379
- return {
11380
- space: "HSV",
11381
- h: original.h,
11382
- s: original.s,
11383
- v: original.v,
11384
- a: original.a
11385
- };
11386
- }
11387
- return false;
11388
- },
11389
- write: function write(color) {
11390
- return {
11391
- h: color.h,
11392
- s: color.s,
11393
- v: color.v,
11394
- a: color.a
11395
- };
11396
- }
11397
- },
11398
- HSV_OBJ: {
11399
- read: function read(original) {
11400
- if (Common.isNumber(original.h) && Common.isNumber(original.s) && Common.isNumber(original.v)) {
11401
- return {
11402
- space: "HSV",
11403
- h: original.h,
11404
- s: original.s,
11405
- v: original.v
11406
- };
11407
- }
11408
- return false;
11409
- },
11410
- write: function write(color) {
11411
- return {
11412
- h: color.h,
11413
- s: color.s,
11414
- v: color.v
11415
- };
11416
- }
11417
- }
11418
- }
11419
- }
11420
- ];
11421
- var result = void 0;
11422
- var toReturn = void 0;
11423
- var interpret = function interpret2() {
11424
- toReturn = false;
11425
- var original = arguments.length > 1 ? Common.toArray(arguments) : arguments[0];
11426
- Common.each(INTERPRETATIONS, function(family) {
11427
- if (family.litmus(original)) {
11428
- Common.each(family.conversions, function(conversion, conversionName) {
11429
- result = conversion.read(original);
11430
- if (toReturn === false && result !== false) {
11431
- toReturn = result;
11432
- result.conversionName = conversionName;
11433
- result.conversion = conversion;
11434
- return Common.BREAK;
11435
- }
11436
- });
11437
- return Common.BREAK;
11438
- }
11439
- });
11440
- return toReturn;
11441
- };
11442
- var tmpComponent = void 0;
11443
- var ColorMath = {
11444
- hsv_to_rgb: function hsv_to_rgb(h, s2, v) {
11445
- var hi = Math.floor(h / 60) % 6;
11446
- var f = h / 60 - Math.floor(h / 60);
11447
- var p2 = v * (1 - s2);
11448
- var q = v * (1 - f * s2);
11449
- var t2 = v * (1 - (1 - f) * s2);
11450
- var c2 = [[v, t2, p2], [q, v, p2], [p2, v, t2], [p2, q, v], [t2, p2, v], [v, p2, q]][hi];
11451
- return {
11452
- r: c2[0] * 255,
11453
- g: c2[1] * 255,
11454
- b: c2[2] * 255
11455
- };
11456
- },
11457
- rgb_to_hsv: function rgb_to_hsv(r, g2, b) {
11458
- var min = Math.min(r, g2, b);
11459
- var max = Math.max(r, g2, b);
11460
- var delta = max - min;
11461
- var h = void 0;
11462
- var s2 = void 0;
11463
- if (max !== 0) {
11464
- s2 = delta / max;
11465
- } else {
11466
- return {
11467
- h: NaN,
11468
- s: 0,
11469
- v: 0
11470
- };
11471
- }
11472
- if (r === max) {
11473
- h = (g2 - b) / delta;
11474
- } else if (g2 === max) {
11475
- h = 2 + (b - r) / delta;
11476
- } else {
11477
- h = 4 + (r - g2) / delta;
11478
- }
11479
- h /= 6;
11480
- if (h < 0) {
11481
- h += 1;
11482
- }
11483
- return {
11484
- h: h * 360,
11485
- s: s2,
11486
- v: max / 255
11487
- };
11488
- },
11489
- rgb_to_hex: function rgb_to_hex(r, g2, b) {
11490
- var hex = this.hex_with_component(0, 2, r);
11491
- hex = this.hex_with_component(hex, 1, g2);
11492
- hex = this.hex_with_component(hex, 0, b);
11493
- return hex;
11494
- },
11495
- component_from_hex: function component_from_hex(hex, componentIndex) {
11496
- return hex >> componentIndex * 8 & 255;
11497
- },
11498
- hex_with_component: function hex_with_component(hex, componentIndex, value) {
11499
- return value << (tmpComponent = componentIndex * 8) | hex & ~(255 << tmpComponent);
11500
- }
11501
- };
11502
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(obj) {
11503
- return typeof obj;
11504
- } : function(obj) {
11505
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
11506
- };
11507
- var classCallCheck = function(instance, Constructor) {
11508
- if (!(instance instanceof Constructor)) {
11509
- throw new TypeError("Cannot call a class as a function");
11510
- }
11511
- };
11512
- var createClass = function() {
11513
- function defineProperties(target, props) {
11514
- for (var i = 0; i < props.length; i++) {
11515
- var descriptor = props[i];
11516
- descriptor.enumerable = descriptor.enumerable || false;
11517
- descriptor.configurable = true;
11518
- if ("value" in descriptor)
11519
- descriptor.writable = true;
11520
- Object.defineProperty(target, descriptor.key, descriptor);
11521
- }
11522
- }
11523
- return function(Constructor, protoProps, staticProps) {
11524
- if (protoProps)
11525
- defineProperties(Constructor.prototype, protoProps);
11526
- if (staticProps)
11527
- defineProperties(Constructor, staticProps);
11528
- return Constructor;
11529
- };
11530
- }();
11531
- var get = function get2(object, property, receiver) {
11532
- if (object === null)
11533
- object = Function.prototype;
11534
- var desc = Object.getOwnPropertyDescriptor(object, property);
11535
- if (desc === void 0) {
11536
- var parent = Object.getPrototypeOf(object);
11537
- if (parent === null) {
11538
- return void 0;
11539
- } else {
11540
- return get2(parent, property, receiver);
11541
- }
11542
- } else if ("value" in desc) {
11543
- return desc.value;
11544
- } else {
11545
- var getter = desc.get;
11546
- if (getter === void 0) {
11547
- return void 0;
11548
- }
11549
- return getter.call(receiver);
11550
- }
11551
- };
11552
- var inherits = function(subClass, superClass) {
11553
- if (typeof superClass !== "function" && superClass !== null) {
11554
- throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
11555
- }
11556
- subClass.prototype = Object.create(superClass && superClass.prototype, {
11557
- constructor: {
11558
- value: subClass,
11559
- enumerable: false,
11560
- writable: true,
11561
- configurable: true
11562
- }
11563
- });
11564
- if (superClass)
11565
- Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
11566
- };
11567
- var possibleConstructorReturn = function(self2, call) {
11568
- if (!self2) {
11569
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
11570
- }
11571
- return call && (typeof call === "object" || typeof call === "function") ? call : self2;
11572
- };
11573
- var Color$1 = function() {
11574
- function Color2() {
11575
- classCallCheck(this, Color2);
11576
- this.__state = interpret.apply(this, arguments);
11577
- if (this.__state === false) {
11578
- throw new Error("Failed to interpret color arguments");
11579
- }
11580
- this.__state.a = this.__state.a || 1;
11581
- }
11582
- createClass(Color2, [{
11583
- key: "toString",
11584
- value: function toString2() {
11585
- return colorToString(this);
11586
- }
11587
- }, {
11588
- key: "toHexString",
11589
- value: function toHexString() {
11590
- return colorToString(this, true);
11591
- }
11592
- }, {
11593
- key: "toOriginal",
11594
- value: function toOriginal() {
11595
- return this.__state.conversion.write(this);
11596
- }
11597
- }]);
11598
- return Color2;
11599
- }();
11600
- function defineRGBComponent(target, component, componentHexIndex) {
11601
- Object.defineProperty(target, component, {
11602
- get: function get$$1() {
11603
- if (this.__state.space === "RGB") {
11604
- return this.__state[component];
11605
- }
11606
- Color$1.recalculateRGB(this, component, componentHexIndex);
11607
- return this.__state[component];
11608
- },
11609
- set: function set$$1(v) {
11610
- if (this.__state.space !== "RGB") {
11611
- Color$1.recalculateRGB(this, component, componentHexIndex);
11612
- this.__state.space = "RGB";
11613
- }
11614
- this.__state[component] = v;
11615
- }
11616
- });
11617
- }
11618
- function defineHSVComponent(target, component) {
11619
- Object.defineProperty(target, component, {
11620
- get: function get$$1() {
11621
- if (this.__state.space === "HSV") {
11622
- return this.__state[component];
11623
- }
11624
- Color$1.recalculateHSV(this);
11625
- return this.__state[component];
11626
- },
11627
- set: function set$$1(v) {
11628
- if (this.__state.space !== "HSV") {
11629
- Color$1.recalculateHSV(this);
11630
- this.__state.space = "HSV";
11631
- }
11632
- this.__state[component] = v;
11633
- }
11634
- });
11635
- }
11636
- Color$1.recalculateRGB = function(color, component, componentHexIndex) {
11637
- if (color.__state.space === "HEX") {
11638
- color.__state[component] = ColorMath.component_from_hex(color.__state.hex, componentHexIndex);
11639
- } else if (color.__state.space === "HSV") {
11640
- Common.extend(color.__state, ColorMath.hsv_to_rgb(color.__state.h, color.__state.s, color.__state.v));
11641
- } else {
11642
- throw new Error("Corrupted color state");
11643
- }
11644
- };
11645
- Color$1.recalculateHSV = function(color) {
11646
- var result2 = ColorMath.rgb_to_hsv(color.r, color.g, color.b);
11647
- Common.extend(color.__state, {
11648
- s: result2.s,
11649
- v: result2.v
11650
- });
11651
- if (!Common.isNaN(result2.h)) {
11652
- color.__state.h = result2.h;
11653
- } else if (Common.isUndefined(color.__state.h)) {
11654
- color.__state.h = 0;
11655
- }
11656
- };
11657
- Color$1.COMPONENTS = ["r", "g", "b", "h", "s", "v", "hex", "a"];
11658
- defineRGBComponent(Color$1.prototype, "r", 2);
11659
- defineRGBComponent(Color$1.prototype, "g", 1);
11660
- defineRGBComponent(Color$1.prototype, "b", 0);
11661
- defineHSVComponent(Color$1.prototype, "h");
11662
- defineHSVComponent(Color$1.prototype, "s");
11663
- defineHSVComponent(Color$1.prototype, "v");
11664
- Object.defineProperty(Color$1.prototype, "a", {
11665
- get: function get$$1() {
11666
- return this.__state.a;
11667
- },
11668
- set: function set$$1(v) {
11669
- this.__state.a = v;
11670
- }
11671
- });
11672
- Object.defineProperty(Color$1.prototype, "hex", {
11673
- get: function get$$1() {
11674
- if (this.__state.space !== "HEX") {
11675
- this.__state.hex = ColorMath.rgb_to_hex(this.r, this.g, this.b);
11676
- this.__state.space = "HEX";
11677
- }
11678
- return this.__state.hex;
11679
- },
11680
- set: function set$$1(v) {
11681
- this.__state.space = "HEX";
11682
- this.__state.hex = v;
11683
- }
11684
- });
11685
- var Controller = function() {
11686
- function Controller2(object, property) {
11687
- classCallCheck(this, Controller2);
11688
- this.initialValue = object[property];
11689
- this.domElement = document.createElement("div");
11690
- this.object = object;
11691
- this.property = property;
11692
- this.__onChange = void 0;
11693
- this.__onFinishChange = void 0;
11694
- }
11695
- createClass(Controller2, [{
11696
- key: "onChange",
11697
- value: function onChange(fnc) {
11698
- this.__onChange = fnc;
11699
- return this;
11700
- }
11701
- }, {
11702
- key: "onFinishChange",
11703
- value: function onFinishChange(fnc) {
11704
- this.__onFinishChange = fnc;
11705
- return this;
11706
- }
11707
- }, {
11708
- key: "setValue",
11709
- value: function setValue(newValue) {
11710
- this.object[this.property] = newValue;
11711
- if (this.__onChange) {
11712
- this.__onChange.call(this, newValue);
11713
- }
11714
- this.updateDisplay();
11715
- return this;
11716
- }
11717
- }, {
11718
- key: "getValue",
11719
- value: function getValue() {
11720
- return this.object[this.property];
11721
- }
11722
- }, {
11723
- key: "updateDisplay",
11724
- value: function updateDisplay() {
11725
- return this;
11726
- }
11727
- }, {
11728
- key: "isModified",
11729
- value: function isModified() {
11730
- return this.initialValue !== this.getValue();
11731
- }
11732
- }]);
11733
- return Controller2;
11734
- }();
11735
- var EVENT_MAP = {
11736
- HTMLEvents: ["change"],
11737
- MouseEvents: ["click", "mousemove", "mousedown", "mouseup", "mouseover"],
11738
- KeyboardEvents: ["keydown"]
11739
- };
11740
- var EVENT_MAP_INV = {};
11741
- Common.each(EVENT_MAP, function(v, k) {
11742
- Common.each(v, function(e) {
11743
- EVENT_MAP_INV[e] = k;
11744
- });
11745
- });
11746
- var CSS_VALUE_PIXELS = /(\d+(\.\d+)?)px/;
11747
- function cssValueToPixels(val) {
11748
- if (val === "0" || Common.isUndefined(val)) {
11749
- return 0;
11750
- }
11751
- var match = val.match(CSS_VALUE_PIXELS);
11752
- if (!Common.isNull(match)) {
11753
- return parseFloat(match[1]);
11754
- }
11755
- return 0;
11756
- }
11757
- var dom = {
11758
- makeSelectable: function makeSelectable(elem, selectable) {
11759
- if (elem === void 0 || elem.style === void 0)
11760
- return;
11761
- elem.onselectstart = selectable ? function() {
11762
- return false;
11763
- } : function() {
11764
- };
11765
- elem.style.MozUserSelect = selectable ? "auto" : "none";
11766
- elem.style.KhtmlUserSelect = selectable ? "auto" : "none";
11767
- elem.unselectable = selectable ? "on" : "off";
11768
- },
11769
- makeFullscreen: function makeFullscreen(elem, hor, vert) {
11770
- var vertical = vert;
11771
- var horizontal = hor;
11772
- if (Common.isUndefined(horizontal)) {
11773
- horizontal = true;
11774
- }
11775
- if (Common.isUndefined(vertical)) {
11776
- vertical = true;
11777
- }
11778
- elem.style.position = "absolute";
11779
- if (horizontal) {
11780
- elem.style.left = 0;
11781
- elem.style.right = 0;
11782
- }
11783
- if (vertical) {
11784
- elem.style.top = 0;
11785
- elem.style.bottom = 0;
11786
- }
11787
- },
11788
- fakeEvent: function fakeEvent(elem, eventType, pars, aux) {
11789
- var params = pars || {};
11790
- var className = EVENT_MAP_INV[eventType];
11791
- if (!className) {
11792
- throw new Error("Event type " + eventType + " not supported.");
11793
- }
11794
- var evt = document.createEvent(className);
11795
- switch (className) {
11796
- case "MouseEvents": {
11797
- var clientX = params.x || params.clientX || 0;
11798
- var clientY = params.y || params.clientY || 0;
11799
- evt.initMouseEvent(
11800
- eventType,
11801
- params.bubbles || false,
11802
- params.cancelable || true,
11803
- window,
11804
- params.clickCount || 1,
11805
- 0,
11806
- 0,
11807
- clientX,
11808
- clientY,
11809
- false,
11810
- false,
11811
- false,
11812
- false,
11813
- 0,
11814
- null
11815
- );
11816
- break;
11817
- }
11818
- case "KeyboardEvents": {
11819
- var init = evt.initKeyboardEvent || evt.initKeyEvent;
11820
- Common.defaults(params, {
11821
- cancelable: true,
11822
- ctrlKey: false,
11823
- altKey: false,
11824
- shiftKey: false,
11825
- metaKey: false,
11826
- keyCode: void 0,
11827
- charCode: void 0
11828
- });
11829
- init(eventType, params.bubbles || false, params.cancelable, window, params.ctrlKey, params.altKey, params.shiftKey, params.metaKey, params.keyCode, params.charCode);
11830
- break;
11831
- }
11832
- default: {
11833
- evt.initEvent(eventType, params.bubbles || false, params.cancelable || true);
11834
- break;
11835
- }
11836
- }
11837
- Common.defaults(evt, aux);
11838
- elem.dispatchEvent(evt);
11839
- },
11840
- bind: function bind(elem, event, func, newBool) {
11841
- var bool = newBool || false;
11842
- if (elem.addEventListener) {
11843
- elem.addEventListener(event, func, bool);
11844
- } else if (elem.attachEvent) {
11845
- elem.attachEvent("on" + event, func);
11846
- }
11847
- return dom;
11848
- },
11849
- unbind: function unbind(elem, event, func, newBool) {
11850
- var bool = newBool || false;
11851
- if (elem.removeEventListener) {
11852
- elem.removeEventListener(event, func, bool);
11853
- } else if (elem.detachEvent) {
11854
- elem.detachEvent("on" + event, func);
11855
- }
11856
- return dom;
11857
- },
11858
- addClass: function addClass(elem, className) {
11859
- if (elem.className === void 0) {
11860
- elem.className = className;
11861
- } else if (elem.className !== className) {
11862
- var classes = elem.className.split(/ +/);
11863
- if (classes.indexOf(className) === -1) {
11864
- classes.push(className);
11865
- elem.className = classes.join(" ").replace(/^\s+/, "").replace(/\s+$/, "");
11866
- }
11867
- }
11868
- return dom;
11869
- },
11870
- removeClass: function removeClass(elem, className) {
11871
- if (className) {
11872
- if (elem.className === className) {
11873
- elem.removeAttribute("class");
11874
- } else {
11875
- var classes = elem.className.split(/ +/);
11876
- var index = classes.indexOf(className);
11877
- if (index !== -1) {
11878
- classes.splice(index, 1);
11879
- elem.className = classes.join(" ");
11880
- }
11881
- }
11882
- } else {
11883
- elem.className = void 0;
11884
- }
11885
- return dom;
11886
- },
11887
- hasClass: function hasClass(elem, className) {
11888
- return new RegExp("(?:^|\\s+)" + className + "(?:\\s+|$)").test(elem.className) || false;
11889
- },
11890
- getWidth: function getWidth(elem) {
11891
- var style = getComputedStyle(elem);
11892
- return cssValueToPixels(style["border-left-width"]) + cssValueToPixels(style["border-right-width"]) + cssValueToPixels(style["padding-left"]) + cssValueToPixels(style["padding-right"]) + cssValueToPixels(style.width);
11893
- },
11894
- getHeight: function getHeight(elem) {
11895
- var style = getComputedStyle(elem);
11896
- return cssValueToPixels(style["border-top-width"]) + cssValueToPixels(style["border-bottom-width"]) + cssValueToPixels(style["padding-top"]) + cssValueToPixels(style["padding-bottom"]) + cssValueToPixels(style.height);
11897
- },
11898
- getOffset: function getOffset(el) {
11899
- var elem = el;
11900
- var offset = { left: 0, top: 0 };
11901
- if (elem.offsetParent) {
11902
- do {
11903
- offset.left += elem.offsetLeft;
11904
- offset.top += elem.offsetTop;
11905
- elem = elem.offsetParent;
11906
- } while (elem);
11907
- }
11908
- return offset;
11909
- },
11910
- isActive: function isActive(elem) {
11911
- return elem === document.activeElement && (elem.type || elem.href);
11912
- }
11913
- };
11914
- var BooleanController = function(_Controller) {
11915
- inherits(BooleanController2, _Controller);
11916
- function BooleanController2(object, property) {
11917
- classCallCheck(this, BooleanController2);
11918
- var _this2 = possibleConstructorReturn(this, (BooleanController2.__proto__ || Object.getPrototypeOf(BooleanController2)).call(this, object, property));
11919
- var _this = _this2;
11920
- _this2.__prev = _this2.getValue();
11921
- _this2.__checkbox = document.createElement("input");
11922
- _this2.__checkbox.setAttribute("type", "checkbox");
11923
- function onChange() {
11924
- _this.setValue(!_this.__prev);
11925
- }
11926
- dom.bind(_this2.__checkbox, "change", onChange, false);
11927
- _this2.domElement.appendChild(_this2.__checkbox);
11928
- _this2.updateDisplay();
11929
- return _this2;
11930
- }
11931
- createClass(BooleanController2, [{
11932
- key: "setValue",
11933
- value: function setValue(v) {
11934
- var toReturn2 = get(BooleanController2.prototype.__proto__ || Object.getPrototypeOf(BooleanController2.prototype), "setValue", this).call(this, v);
11935
- if (this.__onFinishChange) {
11936
- this.__onFinishChange.call(this, this.getValue());
11937
- }
11938
- this.__prev = this.getValue();
11939
- return toReturn2;
11940
- }
11941
- }, {
11942
- key: "updateDisplay",
11943
- value: function updateDisplay() {
11944
- if (this.getValue() === true) {
11945
- this.__checkbox.setAttribute("checked", "checked");
11946
- this.__checkbox.checked = true;
11947
- this.__prev = true;
11948
- } else {
11949
- this.__checkbox.checked = false;
11950
- this.__prev = false;
11951
- }
11952
- return get(BooleanController2.prototype.__proto__ || Object.getPrototypeOf(BooleanController2.prototype), "updateDisplay", this).call(this);
11953
- }
11954
- }]);
11955
- return BooleanController2;
11956
- }(Controller);
11957
- var OptionController = function(_Controller) {
11958
- inherits(OptionController2, _Controller);
11959
- function OptionController2(object, property, opts) {
11960
- classCallCheck(this, OptionController2);
11961
- var _this2 = possibleConstructorReturn(this, (OptionController2.__proto__ || Object.getPrototypeOf(OptionController2)).call(this, object, property));
11962
- var options = opts;
11963
- var _this = _this2;
11964
- _this2.__select = document.createElement("select");
11965
- if (Common.isArray(options)) {
11966
- var map2 = {};
11967
- Common.each(options, function(element) {
11968
- map2[element] = element;
11969
- });
11970
- options = map2;
11971
- }
11972
- Common.each(options, function(value, key) {
11973
- var opt = document.createElement("option");
11974
- opt.innerHTML = key;
11975
- opt.setAttribute("value", value);
11976
- _this.__select.appendChild(opt);
11977
- });
11978
- _this2.updateDisplay();
11979
- dom.bind(_this2.__select, "change", function() {
11980
- var desiredValue = this.options[this.selectedIndex].value;
11981
- _this.setValue(desiredValue);
11982
- });
11983
- _this2.domElement.appendChild(_this2.__select);
11984
- return _this2;
11985
- }
11986
- createClass(OptionController2, [{
11987
- key: "setValue",
11988
- value: function setValue(v) {
11989
- var toReturn2 = get(OptionController2.prototype.__proto__ || Object.getPrototypeOf(OptionController2.prototype), "setValue", this).call(this, v);
11990
- if (this.__onFinishChange) {
11991
- this.__onFinishChange.call(this, this.getValue());
11992
- }
11993
- return toReturn2;
11994
- }
11995
- }, {
11996
- key: "updateDisplay",
11997
- value: function updateDisplay() {
11998
- if (dom.isActive(this.__select))
11999
- return this;
12000
- this.__select.value = this.getValue();
12001
- return get(OptionController2.prototype.__proto__ || Object.getPrototypeOf(OptionController2.prototype), "updateDisplay", this).call(this);
12002
- }
12003
- }]);
12004
- return OptionController2;
12005
- }(Controller);
12006
- var StringController = function(_Controller) {
12007
- inherits(StringController2, _Controller);
12008
- function StringController2(object, property) {
12009
- classCallCheck(this, StringController2);
12010
- var _this2 = possibleConstructorReturn(this, (StringController2.__proto__ || Object.getPrototypeOf(StringController2)).call(this, object, property));
12011
- var _this = _this2;
12012
- function onChange() {
12013
- _this.setValue(_this.__input.value);
12014
- }
12015
- function onBlur() {
12016
- if (_this.__onFinishChange) {
12017
- _this.__onFinishChange.call(_this, _this.getValue());
12018
- }
12019
- }
12020
- _this2.__input = document.createElement("input");
12021
- _this2.__input.setAttribute("type", "text");
12022
- dom.bind(_this2.__input, "keyup", onChange);
12023
- dom.bind(_this2.__input, "change", onChange);
12024
- dom.bind(_this2.__input, "blur", onBlur);
12025
- dom.bind(_this2.__input, "keydown", function(e) {
12026
- if (e.keyCode === 13) {
12027
- this.blur();
12028
- }
12029
- });
12030
- _this2.updateDisplay();
12031
- _this2.domElement.appendChild(_this2.__input);
12032
- return _this2;
12033
- }
12034
- createClass(StringController2, [{
12035
- key: "updateDisplay",
12036
- value: function updateDisplay() {
12037
- if (!dom.isActive(this.__input)) {
12038
- this.__input.value = this.getValue();
12039
- }
12040
- return get(StringController2.prototype.__proto__ || Object.getPrototypeOf(StringController2.prototype), "updateDisplay", this).call(this);
12041
- }
12042
- }]);
12043
- return StringController2;
12044
- }(Controller);
12045
- function numDecimals(x2) {
12046
- var _x2 = x2.toString();
12047
- if (_x2.indexOf(".") > -1) {
12048
- return _x2.length - _x2.indexOf(".") - 1;
12049
- }
12050
- return 0;
12051
- }
12052
- var NumberController = function(_Controller) {
12053
- inherits(NumberController2, _Controller);
12054
- function NumberController2(object, property, params) {
12055
- classCallCheck(this, NumberController2);
12056
- var _this = possibleConstructorReturn(this, (NumberController2.__proto__ || Object.getPrototypeOf(NumberController2)).call(this, object, property));
12057
- var _params = params || {};
12058
- _this.__min = _params.min;
12059
- _this.__max = _params.max;
12060
- _this.__step = _params.step;
12061
- if (Common.isUndefined(_this.__step)) {
12062
- if (_this.initialValue === 0) {
12063
- _this.__impliedStep = 1;
12064
- } else {
12065
- _this.__impliedStep = Math.pow(10, Math.floor(Math.log(Math.abs(_this.initialValue)) / Math.LN10)) / 10;
12066
- }
12067
- } else {
12068
- _this.__impliedStep = _this.__step;
12069
- }
12070
- _this.__precision = numDecimals(_this.__impliedStep);
12071
- return _this;
12072
- }
12073
- createClass(NumberController2, [{
12074
- key: "setValue",
12075
- value: function setValue(v) {
12076
- var _v = v;
12077
- if (this.__min !== void 0 && _v < this.__min) {
12078
- _v = this.__min;
12079
- } else if (this.__max !== void 0 && _v > this.__max) {
12080
- _v = this.__max;
12081
- }
12082
- if (this.__step !== void 0 && _v % this.__step !== 0) {
12083
- _v = Math.round(_v / this.__step) * this.__step;
12084
- }
12085
- return get(NumberController2.prototype.__proto__ || Object.getPrototypeOf(NumberController2.prototype), "setValue", this).call(this, _v);
12086
- }
12087
- }, {
12088
- key: "min",
12089
- value: function min(minValue) {
12090
- this.__min = minValue;
12091
- return this;
12092
- }
12093
- }, {
12094
- key: "max",
12095
- value: function max(maxValue) {
12096
- this.__max = maxValue;
12097
- return this;
12098
- }
12099
- }, {
12100
- key: "step",
12101
- value: function step(stepValue) {
12102
- this.__step = stepValue;
12103
- this.__impliedStep = stepValue;
12104
- this.__precision = numDecimals(stepValue);
12105
- return this;
12106
- }
12107
- }]);
12108
- return NumberController2;
12109
- }(Controller);
12110
- function roundToDecimal(value, decimals) {
12111
- var tenTo = Math.pow(10, decimals);
12112
- return Math.round(value * tenTo) / tenTo;
12113
- }
12114
- var NumberControllerBox = function(_NumberController) {
12115
- inherits(NumberControllerBox2, _NumberController);
12116
- function NumberControllerBox2(object, property, params) {
12117
- classCallCheck(this, NumberControllerBox2);
12118
- var _this2 = possibleConstructorReturn(this, (NumberControllerBox2.__proto__ || Object.getPrototypeOf(NumberControllerBox2)).call(this, object, property, params));
12119
- _this2.__truncationSuspended = false;
12120
- var _this = _this2;
12121
- var prevY = void 0;
12122
- function onChange() {
12123
- var attempted = parseFloat(_this.__input.value);
12124
- if (!Common.isNaN(attempted)) {
12125
- _this.setValue(attempted);
12126
- }
12127
- }
12128
- function onFinish() {
12129
- if (_this.__onFinishChange) {
12130
- _this.__onFinishChange.call(_this, _this.getValue());
12131
- }
12132
- }
12133
- function onBlur() {
12134
- onFinish();
12135
- }
12136
- function onMouseDrag(e) {
12137
- var diff = prevY - e.clientY;
12138
- _this.setValue(_this.getValue() + diff * _this.__impliedStep);
12139
- prevY = e.clientY;
12140
- }
12141
- function onMouseUp() {
12142
- dom.unbind(window, "mousemove", onMouseDrag);
12143
- dom.unbind(window, "mouseup", onMouseUp);
12144
- onFinish();
12145
- }
12146
- function onMouseDown(e) {
12147
- dom.bind(window, "mousemove", onMouseDrag);
12148
- dom.bind(window, "mouseup", onMouseUp);
12149
- prevY = e.clientY;
12150
- }
12151
- _this2.__input = document.createElement("input");
12152
- _this2.__input.setAttribute("type", "text");
12153
- dom.bind(_this2.__input, "change", onChange);
12154
- dom.bind(_this2.__input, "blur", onBlur);
12155
- dom.bind(_this2.__input, "mousedown", onMouseDown);
12156
- dom.bind(_this2.__input, "keydown", function(e) {
12157
- if (e.keyCode === 13) {
12158
- _this.__truncationSuspended = true;
12159
- this.blur();
12160
- _this.__truncationSuspended = false;
12161
- onFinish();
12162
- }
12163
- });
12164
- _this2.updateDisplay();
12165
- _this2.domElement.appendChild(_this2.__input);
12166
- return _this2;
12167
- }
12168
- createClass(NumberControllerBox2, [{
12169
- key: "updateDisplay",
12170
- value: function updateDisplay() {
12171
- this.__input.value = this.__truncationSuspended ? this.getValue() : roundToDecimal(this.getValue(), this.__precision);
12172
- return get(NumberControllerBox2.prototype.__proto__ || Object.getPrototypeOf(NumberControllerBox2.prototype), "updateDisplay", this).call(this);
12173
- }
12174
- }]);
12175
- return NumberControllerBox2;
12176
- }(NumberController);
12177
- function map(v, i1, i2, o1, o2) {
12178
- return o1 + (o2 - o1) * ((v - i1) / (i2 - i1));
12179
- }
12180
- var NumberControllerSlider = function(_NumberController) {
12181
- inherits(NumberControllerSlider2, _NumberController);
12182
- function NumberControllerSlider2(object, property, min, max, step) {
12183
- classCallCheck(this, NumberControllerSlider2);
12184
- var _this2 = possibleConstructorReturn(this, (NumberControllerSlider2.__proto__ || Object.getPrototypeOf(NumberControllerSlider2)).call(this, object, property, { min, max, step }));
12185
- var _this = _this2;
12186
- _this2.__background = document.createElement("div");
12187
- _this2.__foreground = document.createElement("div");
12188
- dom.bind(_this2.__background, "mousedown", onMouseDown);
12189
- dom.bind(_this2.__background, "touchstart", onTouchStart);
12190
- dom.addClass(_this2.__background, "slider");
12191
- dom.addClass(_this2.__foreground, "slider-fg");
12192
- function onMouseDown(e) {
12193
- document.activeElement.blur();
12194
- dom.bind(window, "mousemove", onMouseDrag);
12195
- dom.bind(window, "mouseup", onMouseUp);
12196
- onMouseDrag(e);
12197
- }
12198
- function onMouseDrag(e) {
12199
- e.preventDefault();
12200
- var bgRect = _this.__background.getBoundingClientRect();
12201
- _this.setValue(map(e.clientX, bgRect.left, bgRect.right, _this.__min, _this.__max));
12202
- return false;
12203
- }
12204
- function onMouseUp() {
12205
- dom.unbind(window, "mousemove", onMouseDrag);
12206
- dom.unbind(window, "mouseup", onMouseUp);
12207
- if (_this.__onFinishChange) {
12208
- _this.__onFinishChange.call(_this, _this.getValue());
12209
- }
12210
- }
12211
- function onTouchStart(e) {
12212
- if (e.touches.length !== 1) {
12213
- return;
12214
- }
12215
- dom.bind(window, "touchmove", onTouchMove);
12216
- dom.bind(window, "touchend", onTouchEnd);
12217
- onTouchMove(e);
12218
- }
12219
- function onTouchMove(e) {
12220
- var clientX = e.touches[0].clientX;
12221
- var bgRect = _this.__background.getBoundingClientRect();
12222
- _this.setValue(map(clientX, bgRect.left, bgRect.right, _this.__min, _this.__max));
12223
- }
12224
- function onTouchEnd() {
12225
- dom.unbind(window, "touchmove", onTouchMove);
12226
- dom.unbind(window, "touchend", onTouchEnd);
12227
- if (_this.__onFinishChange) {
12228
- _this.__onFinishChange.call(_this, _this.getValue());
12229
- }
12230
- }
12231
- _this2.updateDisplay();
12232
- _this2.__background.appendChild(_this2.__foreground);
12233
- _this2.domElement.appendChild(_this2.__background);
12234
- return _this2;
12235
- }
12236
- createClass(NumberControllerSlider2, [{
12237
- key: "updateDisplay",
12238
- value: function updateDisplay() {
12239
- var pct = (this.getValue() - this.__min) / (this.__max - this.__min);
12240
- this.__foreground.style.width = pct * 100 + "%";
12241
- return get(NumberControllerSlider2.prototype.__proto__ || Object.getPrototypeOf(NumberControllerSlider2.prototype), "updateDisplay", this).call(this);
12242
- }
12243
- }]);
12244
- return NumberControllerSlider2;
12245
- }(NumberController);
12246
- var FunctionController = function(_Controller) {
12247
- inherits(FunctionController2, _Controller);
12248
- function FunctionController2(object, property, text) {
12249
- classCallCheck(this, FunctionController2);
12250
- var _this2 = possibleConstructorReturn(this, (FunctionController2.__proto__ || Object.getPrototypeOf(FunctionController2)).call(this, object, property));
12251
- var _this = _this2;
12252
- _this2.__button = document.createElement("div");
12253
- _this2.__button.innerHTML = text === void 0 ? "Fire" : text;
12254
- dom.bind(_this2.__button, "click", function(e) {
12255
- e.preventDefault();
12256
- _this.fire();
12257
- return false;
12258
- });
12259
- dom.addClass(_this2.__button, "button");
12260
- _this2.domElement.appendChild(_this2.__button);
12261
- return _this2;
12262
- }
12263
- createClass(FunctionController2, [{
12264
- key: "fire",
12265
- value: function fire() {
12266
- if (this.__onChange) {
12267
- this.__onChange.call(this);
12268
- }
12269
- this.getValue().call(this.object);
12270
- if (this.__onFinishChange) {
12271
- this.__onFinishChange.call(this, this.getValue());
12272
- }
12273
- }
12274
- }]);
12275
- return FunctionController2;
12276
- }(Controller);
12277
- var ColorController = function(_Controller) {
12278
- inherits(ColorController2, _Controller);
12279
- function ColorController2(object, property) {
12280
- classCallCheck(this, ColorController2);
12281
- var _this2 = possibleConstructorReturn(this, (ColorController2.__proto__ || Object.getPrototypeOf(ColorController2)).call(this, object, property));
12282
- _this2.__color = new Color$1(_this2.getValue());
12283
- _this2.__temp = new Color$1(0);
12284
- var _this = _this2;
12285
- _this2.domElement = document.createElement("div");
12286
- dom.makeSelectable(_this2.domElement, false);
12287
- _this2.__selector = document.createElement("div");
12288
- _this2.__selector.className = "selector";
12289
- _this2.__saturation_field = document.createElement("div");
12290
- _this2.__saturation_field.className = "saturation-field";
12291
- _this2.__field_knob = document.createElement("div");
12292
- _this2.__field_knob.className = "field-knob";
12293
- _this2.__field_knob_border = "2px solid ";
12294
- _this2.__hue_knob = document.createElement("div");
12295
- _this2.__hue_knob.className = "hue-knob";
12296
- _this2.__hue_field = document.createElement("div");
12297
- _this2.__hue_field.className = "hue-field";
12298
- _this2.__input = document.createElement("input");
12299
- _this2.__input.type = "text";
12300
- _this2.__input_textShadow = "0 1px 1px ";
12301
- dom.bind(_this2.__input, "keydown", function(e) {
12302
- if (e.keyCode === 13) {
12303
- onBlur.call(this);
12304
- }
12305
- });
12306
- dom.bind(_this2.__input, "blur", onBlur);
12307
- dom.bind(_this2.__selector, "mousedown", function() {
12308
- dom.addClass(this, "drag").bind(window, "mouseup", function() {
12309
- dom.removeClass(_this.__selector, "drag");
12310
- });
12311
- });
12312
- dom.bind(_this2.__selector, "touchstart", function() {
12313
- dom.addClass(this, "drag").bind(window, "touchend", function() {
12314
- dom.removeClass(_this.__selector, "drag");
12315
- });
12316
- });
12317
- var valueField = document.createElement("div");
12318
- Common.extend(_this2.__selector.style, {
12319
- width: "122px",
12320
- height: "102px",
12321
- padding: "3px",
12322
- backgroundColor: "#222",
12323
- boxShadow: "0px 1px 3px rgba(0,0,0,0.3)"
12324
- });
12325
- Common.extend(_this2.__field_knob.style, {
12326
- position: "absolute",
12327
- width: "12px",
12328
- height: "12px",
12329
- border: _this2.__field_knob_border + (_this2.__color.v < 0.5 ? "#fff" : "#000"),
12330
- boxShadow: "0px 1px 3px rgba(0,0,0,0.5)",
12331
- borderRadius: "12px",
12332
- zIndex: 1
12333
- });
12334
- Common.extend(_this2.__hue_knob.style, {
12335
- position: "absolute",
12336
- width: "15px",
12337
- height: "2px",
12338
- borderRight: "4px solid #fff",
12339
- zIndex: 1
12340
- });
12341
- Common.extend(_this2.__saturation_field.style, {
12342
- width: "100px",
12343
- height: "100px",
12344
- border: "1px solid #555",
12345
- marginRight: "3px",
12346
- display: "inline-block",
12347
- cursor: "pointer"
12348
- });
12349
- Common.extend(valueField.style, {
12350
- width: "100%",
12351
- height: "100%",
12352
- background: "none"
12353
- });
12354
- linearGradient(valueField, "top", "rgba(0,0,0,0)", "#000");
12355
- Common.extend(_this2.__hue_field.style, {
12356
- width: "15px",
12357
- height: "100px",
12358
- border: "1px solid #555",
12359
- cursor: "ns-resize",
12360
- position: "absolute",
12361
- top: "3px",
12362
- right: "3px"
12363
- });
12364
- hueGradient(_this2.__hue_field);
12365
- Common.extend(_this2.__input.style, {
12366
- outline: "none",
12367
- textAlign: "center",
12368
- color: "#fff",
12369
- border: 0,
12370
- fontWeight: "bold",
12371
- textShadow: _this2.__input_textShadow + "rgba(0,0,0,0.7)"
12372
- });
12373
- dom.bind(_this2.__saturation_field, "mousedown", fieldDown);
12374
- dom.bind(_this2.__saturation_field, "touchstart", fieldDown);
12375
- dom.bind(_this2.__field_knob, "mousedown", fieldDown);
12376
- dom.bind(_this2.__field_knob, "touchstart", fieldDown);
12377
- dom.bind(_this2.__hue_field, "mousedown", fieldDownH);
12378
- dom.bind(_this2.__hue_field, "touchstart", fieldDownH);
12379
- function fieldDown(e) {
12380
- setSV(e);
12381
- dom.bind(window, "mousemove", setSV);
12382
- dom.bind(window, "touchmove", setSV);
12383
- dom.bind(window, "mouseup", fieldUpSV);
12384
- dom.bind(window, "touchend", fieldUpSV);
12385
- }
12386
- function fieldDownH(e) {
12387
- setH(e);
12388
- dom.bind(window, "mousemove", setH);
12389
- dom.bind(window, "touchmove", setH);
12390
- dom.bind(window, "mouseup", fieldUpH);
12391
- dom.bind(window, "touchend", fieldUpH);
12392
- }
12393
- function fieldUpSV() {
12394
- dom.unbind(window, "mousemove", setSV);
12395
- dom.unbind(window, "touchmove", setSV);
12396
- dom.unbind(window, "mouseup", fieldUpSV);
12397
- dom.unbind(window, "touchend", fieldUpSV);
12398
- onFinish();
12399
- }
12400
- function fieldUpH() {
12401
- dom.unbind(window, "mousemove", setH);
12402
- dom.unbind(window, "touchmove", setH);
12403
- dom.unbind(window, "mouseup", fieldUpH);
12404
- dom.unbind(window, "touchend", fieldUpH);
12405
- onFinish();
12406
- }
12407
- function onBlur() {
12408
- var i = interpret(this.value);
12409
- if (i !== false) {
12410
- _this.__color.__state = i;
12411
- _this.setValue(_this.__color.toOriginal());
12412
- } else {
12413
- this.value = _this.__color.toString();
12414
- }
12415
- }
12416
- function onFinish() {
12417
- if (_this.__onFinishChange) {
12418
- _this.__onFinishChange.call(_this, _this.__color.toOriginal());
12419
- }
12420
- }
12421
- _this2.__saturation_field.appendChild(valueField);
12422
- _this2.__selector.appendChild(_this2.__field_knob);
12423
- _this2.__selector.appendChild(_this2.__saturation_field);
12424
- _this2.__selector.appendChild(_this2.__hue_field);
12425
- _this2.__hue_field.appendChild(_this2.__hue_knob);
12426
- _this2.domElement.appendChild(_this2.__input);
12427
- _this2.domElement.appendChild(_this2.__selector);
12428
- _this2.updateDisplay();
12429
- function setSV(e) {
12430
- if (e.type.indexOf("touch") === -1) {
12431
- e.preventDefault();
12432
- }
12433
- var fieldRect = _this.__saturation_field.getBoundingClientRect();
12434
- var _ref = e.touches && e.touches[0] || e, clientX = _ref.clientX, clientY = _ref.clientY;
12435
- var s2 = (clientX - fieldRect.left) / (fieldRect.right - fieldRect.left);
12436
- var v = 1 - (clientY - fieldRect.top) / (fieldRect.bottom - fieldRect.top);
12437
- if (v > 1) {
12438
- v = 1;
12439
- } else if (v < 0) {
12440
- v = 0;
12441
- }
12442
- if (s2 > 1) {
12443
- s2 = 1;
12444
- } else if (s2 < 0) {
12445
- s2 = 0;
12446
- }
12447
- _this.__color.v = v;
12448
- _this.__color.s = s2;
12449
- _this.setValue(_this.__color.toOriginal());
12450
- return false;
12451
- }
12452
- function setH(e) {
12453
- if (e.type.indexOf("touch") === -1) {
12454
- e.preventDefault();
12455
- }
12456
- var fieldRect = _this.__hue_field.getBoundingClientRect();
12457
- var _ref2 = e.touches && e.touches[0] || e, clientY = _ref2.clientY;
12458
- var h = 1 - (clientY - fieldRect.top) / (fieldRect.bottom - fieldRect.top);
12459
- if (h > 1) {
12460
- h = 1;
12461
- } else if (h < 0) {
12462
- h = 0;
12463
- }
12464
- _this.__color.h = h * 360;
12465
- _this.setValue(_this.__color.toOriginal());
12466
- return false;
12467
- }
12468
- return _this2;
12469
- }
12470
- createClass(ColorController2, [{
12471
- key: "updateDisplay",
12472
- value: function updateDisplay() {
12473
- var i = interpret(this.getValue());
12474
- if (i !== false) {
12475
- var mismatch = false;
12476
- Common.each(Color$1.COMPONENTS, function(component) {
12477
- if (!Common.isUndefined(i[component]) && !Common.isUndefined(this.__color.__state[component]) && i[component] !== this.__color.__state[component]) {
12478
- mismatch = true;
12479
- return {};
12480
- }
12481
- }, this);
12482
- if (mismatch) {
12483
- Common.extend(this.__color.__state, i);
12484
- }
12485
- }
12486
- Common.extend(this.__temp.__state, this.__color.__state);
12487
- this.__temp.a = 1;
12488
- var flip = this.__color.v < 0.5 || this.__color.s > 0.5 ? 255 : 0;
12489
- var _flip = 255 - flip;
12490
- Common.extend(this.__field_knob.style, {
12491
- marginLeft: 100 * this.__color.s - 7 + "px",
12492
- marginTop: 100 * (1 - this.__color.v) - 7 + "px",
12493
- backgroundColor: this.__temp.toHexString(),
12494
- border: this.__field_knob_border + "rgb(" + flip + "," + flip + "," + flip + ")"
12495
- });
12496
- this.__hue_knob.style.marginTop = (1 - this.__color.h / 360) * 100 + "px";
12497
- this.__temp.s = 1;
12498
- this.__temp.v = 1;
12499
- linearGradient(this.__saturation_field, "left", "#fff", this.__temp.toHexString());
12500
- this.__input.value = this.__color.toString();
12501
- Common.extend(this.__input.style, {
12502
- backgroundColor: this.__color.toHexString(),
12503
- color: "rgb(" + flip + "," + flip + "," + flip + ")",
12504
- textShadow: this.__input_textShadow + "rgba(" + _flip + "," + _flip + "," + _flip + ",.7)"
12505
- });
12506
- }
12507
- }]);
12508
- return ColorController2;
12509
- }(Controller);
12510
- var vendors = ["-moz-", "-o-", "-webkit-", "-ms-", ""];
12511
- function linearGradient(elem, x2, a, b) {
12512
- elem.style.background = "";
12513
- Common.each(vendors, function(vendor) {
12514
- elem.style.cssText += "background: " + vendor + "linear-gradient(" + x2 + ", " + a + " 0%, " + b + " 100%); ";
12515
- });
12516
- }
12517
- function hueGradient(elem) {
12518
- elem.style.background = "";
12519
- elem.style.cssText += "background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);";
12520
- elem.style.cssText += "background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);";
12521
- elem.style.cssText += "background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);";
12522
- elem.style.cssText += "background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);";
12523
- elem.style.cssText += "background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);";
12524
- }
12525
- var css = {
12526
- load: function load(url, indoc) {
12527
- var doc = indoc || document;
12528
- var link = doc.createElement("link");
12529
- link.type = "text/css";
12530
- link.rel = "stylesheet";
12531
- link.href = url;
12532
- doc.getElementsByTagName("head")[0].appendChild(link);
12533
- },
12534
- inject: function inject(cssContent, indoc) {
12535
- var doc = indoc || document;
12536
- var injected = document.createElement("style");
12537
- injected.type = "text/css";
12538
- injected.innerHTML = cssContent;
12539
- var head = doc.getElementsByTagName("head")[0];
12540
- try {
12541
- head.appendChild(injected);
12542
- } catch (e) {
12543
- }
12544
- }
12545
- };
12546
- var saveDialogContents = `<div id="dg-save" class="dg dialogue">
12547
-
12548
- Here's the new load parameter for your <code>GUI</code>'s constructor:
12549
-
12550
- <textarea id="dg-new-constructor"></textarea>
12551
-
12552
- <div id="dg-save-locally">
12553
-
12554
- <input id="dg-local-storage" type="checkbox"/> Automatically save
12555
- values to <code>localStorage</code> on exit.
12556
-
12557
- <div id="dg-local-explain">The values saved to <code>localStorage</code> will
12558
- override those passed to <code>dat.GUI</code>'s constructor. This makes it
12559
- easier to work incrementally, but <code>localStorage</code> is fragile,
12560
- and your friends may not see the same values you do.
12561
-
12562
- </div>
12563
-
12564
- </div>
12565
-
12566
- </div>`;
12567
- var ControllerFactory = function ControllerFactory2(object, property) {
12568
- var initialValue = object[property];
12569
- if (Common.isArray(arguments[2]) || Common.isObject(arguments[2])) {
12570
- return new OptionController(object, property, arguments[2]);
12571
- }
12572
- if (Common.isNumber(initialValue)) {
12573
- if (Common.isNumber(arguments[2]) && Common.isNumber(arguments[3])) {
12574
- if (Common.isNumber(arguments[4])) {
12575
- return new NumberControllerSlider(object, property, arguments[2], arguments[3], arguments[4]);
12576
- }
12577
- return new NumberControllerSlider(object, property, arguments[2], arguments[3]);
12578
- }
12579
- if (Common.isNumber(arguments[4])) {
12580
- return new NumberControllerBox(object, property, { min: arguments[2], max: arguments[3], step: arguments[4] });
12581
- }
12582
- return new NumberControllerBox(object, property, { min: arguments[2], max: arguments[3] });
12583
- }
12584
- if (Common.isString(initialValue)) {
12585
- return new StringController(object, property);
12586
- }
12587
- if (Common.isFunction(initialValue)) {
12588
- return new FunctionController(object, property, "");
12589
- }
12590
- if (Common.isBoolean(initialValue)) {
12591
- return new BooleanController(object, property);
12592
- }
12593
- return null;
12594
- };
12595
- function requestAnimationFrame$1(callback) {
12596
- setTimeout(callback, 1e3 / 60);
12597
- }
12598
- var requestAnimationFrame$1$1 = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || requestAnimationFrame$1;
12599
- var CenteredDiv = function() {
12600
- function CenteredDiv2() {
12601
- classCallCheck(this, CenteredDiv2);
12602
- this.backgroundElement = document.createElement("div");
12603
- Common.extend(this.backgroundElement.style, {
12604
- backgroundColor: "rgba(0,0,0,0.8)",
12605
- top: 0,
12606
- left: 0,
12607
- display: "none",
12608
- zIndex: "1000",
12609
- opacity: 0,
12610
- WebkitTransition: "opacity 0.2s linear",
12611
- transition: "opacity 0.2s linear"
12612
- });
12613
- dom.makeFullscreen(this.backgroundElement);
12614
- this.backgroundElement.style.position = "fixed";
12615
- this.domElement = document.createElement("div");
12616
- Common.extend(this.domElement.style, {
12617
- position: "fixed",
12618
- display: "none",
12619
- zIndex: "1001",
12620
- opacity: 0,
12621
- WebkitTransition: "-webkit-transform 0.2s ease-out, opacity 0.2s linear",
12622
- transition: "transform 0.2s ease-out, opacity 0.2s linear"
12623
- });
12624
- document.body.appendChild(this.backgroundElement);
12625
- document.body.appendChild(this.domElement);
12626
- var _this = this;
12627
- dom.bind(this.backgroundElement, "click", function() {
12628
- _this.hide();
12629
- });
12630
- }
12631
- createClass(CenteredDiv2, [{
12632
- key: "show",
12633
- value: function show() {
12634
- var _this = this;
12635
- this.backgroundElement.style.display = "block";
12636
- this.domElement.style.display = "block";
12637
- this.domElement.style.opacity = 0;
12638
- this.domElement.style.webkitTransform = "scale(1.1)";
12639
- this.layout();
12640
- Common.defer(function() {
12641
- _this.backgroundElement.style.opacity = 1;
12642
- _this.domElement.style.opacity = 1;
12643
- _this.domElement.style.webkitTransform = "scale(1)";
12644
- });
12645
- }
12646
- }, {
12647
- key: "hide",
12648
- value: function hide2() {
12649
- var _this = this;
12650
- var hide3 = function hide4() {
12651
- _this.domElement.style.display = "none";
12652
- _this.backgroundElement.style.display = "none";
12653
- dom.unbind(_this.domElement, "webkitTransitionEnd", hide4);
12654
- dom.unbind(_this.domElement, "transitionend", hide4);
12655
- dom.unbind(_this.domElement, "oTransitionEnd", hide4);
12656
- };
12657
- dom.bind(this.domElement, "webkitTransitionEnd", hide3);
12658
- dom.bind(this.domElement, "transitionend", hide3);
12659
- dom.bind(this.domElement, "oTransitionEnd", hide3);
12660
- this.backgroundElement.style.opacity = 0;
12661
- this.domElement.style.opacity = 0;
12662
- this.domElement.style.webkitTransform = "scale(1.1)";
12663
- }
12664
- }, {
12665
- key: "layout",
12666
- value: function layout() {
12667
- this.domElement.style.left = window.innerWidth / 2 - dom.getWidth(this.domElement) / 2 + "px";
12668
- this.domElement.style.top = window.innerHeight / 2 - dom.getHeight(this.domElement) / 2 + "px";
12669
- }
12670
- }]);
12671
- return CenteredDiv2;
12672
- }();
12673
- var styleSheet = ___$insertStyle(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .cr.function .property-name{width:100%}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n");
12674
- css.inject(styleSheet);
12675
- var CSS_NAMESPACE = "dg";
12676
- var HIDE_KEY_CODE = 72;
12677
- var CLOSE_BUTTON_HEIGHT = 20;
12678
- var DEFAULT_DEFAULT_PRESET_NAME = "Default";
12679
- var SUPPORTS_LOCAL_STORAGE = function() {
12680
- try {
12681
- return !!window.localStorage;
12682
- } catch (e) {
12683
- return false;
12684
- }
12685
- }();
12686
- var SAVE_DIALOGUE = void 0;
12687
- var autoPlaceVirgin = true;
12688
- var autoPlaceContainer = void 0;
12689
- var hide = false;
12690
- var hideableGuis = [];
12691
- var GUI = function GUI2(pars) {
12692
- var _this = this;
12693
- var params = pars || {};
12694
- this.domElement = document.createElement("div");
12695
- this.__ul = document.createElement("ul");
12696
- this.domElement.appendChild(this.__ul);
12697
- dom.addClass(this.domElement, CSS_NAMESPACE);
12698
- this.__folders = {};
12699
- this.__controllers = [];
12700
- this.__rememberedObjects = [];
12701
- this.__rememberedObjectIndecesToControllers = [];
12702
- this.__listening = [];
12703
- params = Common.defaults(params, {
12704
- closeOnTop: false,
12705
- autoPlace: true,
12706
- width: GUI2.DEFAULT_WIDTH
12707
- });
12708
- params = Common.defaults(params, {
12709
- resizable: params.autoPlace,
12710
- hideable: params.autoPlace
12711
- });
12712
- if (!Common.isUndefined(params.load)) {
12713
- if (params.preset) {
12714
- params.load.preset = params.preset;
12715
- }
12716
- } else {
12717
- params.load = { preset: DEFAULT_DEFAULT_PRESET_NAME };
12718
- }
12719
- if (Common.isUndefined(params.parent) && params.hideable) {
12720
- hideableGuis.push(this);
12721
- }
12722
- params.resizable = Common.isUndefined(params.parent) && params.resizable;
12723
- if (params.autoPlace && Common.isUndefined(params.scrollable)) {
12724
- params.scrollable = true;
12725
- }
12726
- var useLocalStorage = SUPPORTS_LOCAL_STORAGE && localStorage.getItem(getLocalStorageHash(this, "isLocal")) === "true";
12727
- var saveToLocalStorage = void 0;
12728
- var titleRow = void 0;
12729
- Object.defineProperties(
12730
- this,
12731
- {
12732
- parent: {
12733
- get: function get$$1() {
12734
- return params.parent;
12735
- }
12736
- },
12737
- scrollable: {
12738
- get: function get$$1() {
12739
- return params.scrollable;
12740
- }
12741
- },
12742
- autoPlace: {
12743
- get: function get$$1() {
12744
- return params.autoPlace;
12745
- }
12746
- },
12747
- closeOnTop: {
12748
- get: function get$$1() {
12749
- return params.closeOnTop;
12750
- }
12751
- },
12752
- preset: {
12753
- get: function get$$1() {
12754
- if (_this.parent) {
12755
- return _this.getRoot().preset;
12756
- }
12757
- return params.load.preset;
12758
- },
12759
- set: function set$$1(v) {
12760
- if (_this.parent) {
12761
- _this.getRoot().preset = v;
12762
- } else {
12763
- params.load.preset = v;
12764
- }
12765
- setPresetSelectIndex(this);
12766
- _this.revert();
12767
- }
12768
- },
12769
- width: {
12770
- get: function get$$1() {
12771
- return params.width;
12772
- },
12773
- set: function set$$1(v) {
12774
- params.width = v;
12775
- setWidth(_this, v);
12776
- }
12777
- },
12778
- name: {
12779
- get: function get$$1() {
12780
- return params.name;
12781
- },
12782
- set: function set$$1(v) {
12783
- params.name = v;
12784
- if (titleRow) {
12785
- titleRow.innerHTML = params.name;
12786
- }
12787
- }
12788
- },
12789
- closed: {
12790
- get: function get$$1() {
12791
- return params.closed;
12792
- },
12793
- set: function set$$1(v) {
12794
- params.closed = v;
12795
- if (params.closed) {
12796
- dom.addClass(_this.__ul, GUI2.CLASS_CLOSED);
12797
- } else {
12798
- dom.removeClass(_this.__ul, GUI2.CLASS_CLOSED);
12799
- }
12800
- this.onResize();
12801
- if (_this.__closeButton) {
12802
- _this.__closeButton.innerHTML = v ? GUI2.TEXT_OPEN : GUI2.TEXT_CLOSED;
12803
- }
12804
- }
12805
- },
12806
- load: {
12807
- get: function get$$1() {
12808
- return params.load;
12809
- }
12810
- },
12811
- useLocalStorage: {
12812
- get: function get$$1() {
12813
- return useLocalStorage;
12814
- },
12815
- set: function set$$1(bool) {
12816
- if (SUPPORTS_LOCAL_STORAGE) {
12817
- useLocalStorage = bool;
12818
- if (bool) {
12819
- dom.bind(window, "unload", saveToLocalStorage);
12820
- } else {
12821
- dom.unbind(window, "unload", saveToLocalStorage);
12822
- }
12823
- localStorage.setItem(getLocalStorageHash(_this, "isLocal"), bool);
12824
- }
12825
- }
12826
- }
12827
- }
12828
- );
12829
- if (Common.isUndefined(params.parent)) {
12830
- this.closed = params.closed || false;
12831
- dom.addClass(this.domElement, GUI2.CLASS_MAIN);
12832
- dom.makeSelectable(this.domElement, false);
12833
- if (SUPPORTS_LOCAL_STORAGE) {
12834
- if (useLocalStorage) {
12835
- _this.useLocalStorage = true;
12836
- var savedGui = localStorage.getItem(getLocalStorageHash(this, "gui"));
12837
- if (savedGui) {
12838
- params.load = JSON.parse(savedGui);
12839
- }
12840
- }
12841
- }
12842
- this.__closeButton = document.createElement("div");
12843
- this.__closeButton.innerHTML = GUI2.TEXT_CLOSED;
12844
- dom.addClass(this.__closeButton, GUI2.CLASS_CLOSE_BUTTON);
12845
- if (params.closeOnTop) {
12846
- dom.addClass(this.__closeButton, GUI2.CLASS_CLOSE_TOP);
12847
- this.domElement.insertBefore(this.__closeButton, this.domElement.childNodes[0]);
12848
- } else {
12849
- dom.addClass(this.__closeButton, GUI2.CLASS_CLOSE_BOTTOM);
12850
- this.domElement.appendChild(this.__closeButton);
12851
- }
12852
- dom.bind(this.__closeButton, "click", function() {
12853
- _this.closed = !_this.closed;
12854
- });
12855
- } else {
12856
- if (params.closed === void 0) {
12857
- params.closed = true;
12858
- }
12859
- var titleRowName = document.createTextNode(params.name);
12860
- dom.addClass(titleRowName, "controller-name");
12861
- titleRow = addRow(_this, titleRowName);
12862
- var onClickTitle = function onClickTitle2(e) {
12863
- e.preventDefault();
12864
- _this.closed = !_this.closed;
12865
- return false;
12866
- };
12867
- dom.addClass(this.__ul, GUI2.CLASS_CLOSED);
12868
- dom.addClass(titleRow, "title");
12869
- dom.bind(titleRow, "click", onClickTitle);
12870
- if (!params.closed) {
12871
- this.closed = false;
12872
- }
12873
- }
12874
- if (params.autoPlace) {
12875
- if (Common.isUndefined(params.parent)) {
12876
- if (autoPlaceVirgin) {
12877
- autoPlaceContainer = document.createElement("div");
12878
- dom.addClass(autoPlaceContainer, CSS_NAMESPACE);
12879
- dom.addClass(autoPlaceContainer, GUI2.CLASS_AUTO_PLACE_CONTAINER);
12880
- document.body.appendChild(autoPlaceContainer);
12881
- autoPlaceVirgin = false;
12882
- }
12883
- autoPlaceContainer.appendChild(this.domElement);
12884
- dom.addClass(this.domElement, GUI2.CLASS_AUTO_PLACE);
12885
- }
12886
- if (!this.parent) {
12887
- setWidth(_this, params.width);
12888
- }
12889
- }
12890
- this.__resizeHandler = function() {
12891
- _this.onResizeDebounced();
12892
- };
12893
- dom.bind(window, "resize", this.__resizeHandler);
12894
- dom.bind(this.__ul, "webkitTransitionEnd", this.__resizeHandler);
12895
- dom.bind(this.__ul, "transitionend", this.__resizeHandler);
12896
- dom.bind(this.__ul, "oTransitionEnd", this.__resizeHandler);
12897
- this.onResize();
12898
- if (params.resizable) {
12899
- addResizeHandle(this);
12900
- }
12901
- saveToLocalStorage = function saveToLocalStorage2() {
12902
- if (SUPPORTS_LOCAL_STORAGE && localStorage.getItem(getLocalStorageHash(_this, "isLocal")) === "true") {
12903
- localStorage.setItem(getLocalStorageHash(_this, "gui"), JSON.stringify(_this.getSaveObject()));
12904
- }
12905
- };
12906
- this.saveToLocalStorageIfPossible = saveToLocalStorage;
12907
- function resetWidth() {
12908
- var root = _this.getRoot();
12909
- root.width += 1;
12910
- Common.defer(function() {
12911
- root.width -= 1;
12912
- });
12913
- }
12914
- if (!params.parent) {
12915
- resetWidth();
12916
- }
12917
- };
12918
- GUI.toggleHide = function() {
12919
- hide = !hide;
12920
- Common.each(hideableGuis, function(gui2) {
12921
- gui2.domElement.style.display = hide ? "none" : "";
12922
- });
12923
- };
12924
- GUI.CLASS_AUTO_PLACE = "a";
12925
- GUI.CLASS_AUTO_PLACE_CONTAINER = "ac";
12926
- GUI.CLASS_MAIN = "main";
12927
- GUI.CLASS_CONTROLLER_ROW = "cr";
12928
- GUI.CLASS_TOO_TALL = "taller-than-window";
12929
- GUI.CLASS_CLOSED = "closed";
12930
- GUI.CLASS_CLOSE_BUTTON = "close-button";
12931
- GUI.CLASS_CLOSE_TOP = "close-top";
12932
- GUI.CLASS_CLOSE_BOTTOM = "close-bottom";
12933
- GUI.CLASS_DRAG = "drag";
12934
- GUI.DEFAULT_WIDTH = 245;
12935
- GUI.TEXT_CLOSED = "Close Controls";
12936
- GUI.TEXT_OPEN = "Open Controls";
12937
- GUI._keydownHandler = function(e) {
12938
- if (document.activeElement.type !== "text" && (e.which === HIDE_KEY_CODE || e.keyCode === HIDE_KEY_CODE)) {
12939
- GUI.toggleHide();
12940
- }
12941
- };
12942
- dom.bind(window, "keydown", GUI._keydownHandler, false);
12943
- Common.extend(
12944
- GUI.prototype,
12945
- {
12946
- add: function add(object, property) {
12947
- return _add(this, object, property, {
12948
- factoryArgs: Array.prototype.slice.call(arguments, 2)
12949
- });
12950
- },
12951
- addColor: function addColor(object, property) {
12952
- return _add(this, object, property, {
12953
- color: true
12954
- });
12955
- },
12956
- remove: function remove(controller) {
12957
- this.__ul.removeChild(controller.__li);
12958
- this.__controllers.splice(this.__controllers.indexOf(controller), 1);
12959
- var _this = this;
12960
- Common.defer(function() {
12961
- _this.onResize();
12962
- });
12963
- },
12964
- destroy: function destroy() {
12965
- if (this.parent) {
12966
- throw new Error("Only the root GUI should be removed with .destroy(). For subfolders, use gui.removeFolder(folder) instead.");
12967
- }
12968
- if (this.autoPlace) {
12969
- autoPlaceContainer.removeChild(this.domElement);
12970
- }
12971
- var _this = this;
12972
- Common.each(this.__folders, function(subfolder) {
12973
- _this.removeFolder(subfolder);
12974
- });
12975
- dom.unbind(window, "keydown", GUI._keydownHandler, false);
12976
- removeListeners(this);
12977
- },
12978
- addFolder: function addFolder(name) {
12979
- if (this.__folders[name] !== void 0) {
12980
- throw new Error('You already have a folder in this GUI by the name "' + name + '"');
12981
- }
12982
- var newGuiParams = { name, parent: this };
12983
- newGuiParams.autoPlace = this.autoPlace;
12984
- if (this.load && this.load.folders && this.load.folders[name]) {
12985
- newGuiParams.closed = this.load.folders[name].closed;
12986
- newGuiParams.load = this.load.folders[name];
12987
- }
12988
- var gui2 = new GUI(newGuiParams);
12989
- this.__folders[name] = gui2;
12990
- var li = addRow(this, gui2.domElement);
12991
- dom.addClass(li, "folder");
12992
- return gui2;
12993
- },
12994
- removeFolder: function removeFolder(folder) {
12995
- this.__ul.removeChild(folder.domElement.parentElement);
12996
- delete this.__folders[folder.name];
12997
- if (this.load && this.load.folders && this.load.folders[folder.name]) {
12998
- delete this.load.folders[folder.name];
12999
- }
13000
- removeListeners(folder);
13001
- var _this = this;
13002
- Common.each(folder.__folders, function(subfolder) {
13003
- folder.removeFolder(subfolder);
13004
- });
13005
- Common.defer(function() {
13006
- _this.onResize();
13007
- });
13008
- },
13009
- open: function open() {
13010
- this.closed = false;
13011
- },
13012
- close: function close() {
13013
- this.closed = true;
13014
- },
13015
- hide: function hide2() {
13016
- this.domElement.style.display = "none";
13017
- },
13018
- show: function show() {
13019
- this.domElement.style.display = "";
13020
- },
13021
- onResize: function onResize() {
13022
- var root = this.getRoot();
13023
- if (root.scrollable) {
13024
- var top = dom.getOffset(root.__ul).top;
13025
- var h = 0;
13026
- Common.each(root.__ul.childNodes, function(node) {
13027
- if (!(root.autoPlace && node === root.__save_row)) {
13028
- h += dom.getHeight(node);
13029
- }
13030
- });
13031
- if (window.innerHeight - top - CLOSE_BUTTON_HEIGHT < h) {
13032
- dom.addClass(root.domElement, GUI.CLASS_TOO_TALL);
13033
- root.__ul.style.height = window.innerHeight - top - CLOSE_BUTTON_HEIGHT + "px";
13034
- } else {
13035
- dom.removeClass(root.domElement, GUI.CLASS_TOO_TALL);
13036
- root.__ul.style.height = "auto";
13037
- }
13038
- }
13039
- if (root.__resize_handle) {
13040
- Common.defer(function() {
13041
- root.__resize_handle.style.height = root.__ul.offsetHeight + "px";
13042
- });
13043
- }
13044
- if (root.__closeButton) {
13045
- root.__closeButton.style.width = root.width + "px";
13046
- }
13047
- },
13048
- onResizeDebounced: Common.debounce(function() {
13049
- this.onResize();
13050
- }, 50),
13051
- remember: function remember() {
13052
- if (Common.isUndefined(SAVE_DIALOGUE)) {
13053
- SAVE_DIALOGUE = new CenteredDiv();
13054
- SAVE_DIALOGUE.domElement.innerHTML = saveDialogContents;
13055
- }
13056
- if (this.parent) {
13057
- throw new Error("You can only call remember on a top level GUI.");
13058
- }
13059
- var _this = this;
13060
- Common.each(Array.prototype.slice.call(arguments), function(object) {
13061
- if (_this.__rememberedObjects.length === 0) {
13062
- addSaveMenu(_this);
13063
- }
13064
- if (_this.__rememberedObjects.indexOf(object) === -1) {
13065
- _this.__rememberedObjects.push(object);
13066
- }
13067
- });
13068
- if (this.autoPlace) {
13069
- setWidth(this, this.width);
13070
- }
13071
- },
13072
- getRoot: function getRoot() {
13073
- var gui2 = this;
13074
- while (gui2.parent) {
13075
- gui2 = gui2.parent;
13076
- }
13077
- return gui2;
13078
- },
13079
- getSaveObject: function getSaveObject() {
13080
- var toReturn2 = this.load;
13081
- toReturn2.closed = this.closed;
13082
- if (this.__rememberedObjects.length > 0) {
13083
- toReturn2.preset = this.preset;
13084
- if (!toReturn2.remembered) {
13085
- toReturn2.remembered = {};
13086
- }
13087
- toReturn2.remembered[this.preset] = getCurrentPreset(this);
13088
- }
13089
- toReturn2.folders = {};
13090
- Common.each(this.__folders, function(element, key) {
13091
- toReturn2.folders[key] = element.getSaveObject();
13092
- });
13093
- return toReturn2;
13094
- },
13095
- save: function save() {
13096
- if (!this.load.remembered) {
13097
- this.load.remembered = {};
13098
- }
13099
- this.load.remembered[this.preset] = getCurrentPreset(this);
13100
- markPresetModified(this, false);
13101
- this.saveToLocalStorageIfPossible();
13102
- },
13103
- saveAs: function saveAs(presetName) {
13104
- if (!this.load.remembered) {
13105
- this.load.remembered = {};
13106
- this.load.remembered[DEFAULT_DEFAULT_PRESET_NAME] = getCurrentPreset(this, true);
13107
- }
13108
- this.load.remembered[presetName] = getCurrentPreset(this);
13109
- this.preset = presetName;
13110
- addPresetOption(this, presetName, true);
13111
- this.saveToLocalStorageIfPossible();
13112
- },
13113
- revert: function revert(gui2) {
13114
- Common.each(this.__controllers, function(controller) {
13115
- if (!this.getRoot().load.remembered) {
13116
- controller.setValue(controller.initialValue);
13117
- } else {
13118
- recallSavedValue(gui2 || this.getRoot(), controller);
13119
- }
13120
- if (controller.__onFinishChange) {
13121
- controller.__onFinishChange.call(controller, controller.getValue());
13122
- }
13123
- }, this);
13124
- Common.each(this.__folders, function(folder) {
13125
- folder.revert(folder);
13126
- });
13127
- if (!gui2) {
13128
- markPresetModified(this.getRoot(), false);
13129
- }
13130
- },
13131
- listen: function listen(controller) {
13132
- var init = this.__listening.length === 0;
13133
- this.__listening.push(controller);
13134
- if (init) {
13135
- updateDisplays(this.__listening);
13136
- }
13137
- },
13138
- updateDisplay: function updateDisplay() {
13139
- Common.each(this.__controllers, function(controller) {
13140
- controller.updateDisplay();
13141
- });
13142
- Common.each(this.__folders, function(folder) {
13143
- folder.updateDisplay();
13144
- });
13145
- }
13146
- }
13147
- );
13148
- function addRow(gui2, newDom, liBefore) {
13149
- var li = document.createElement("li");
13150
- if (newDom) {
13151
- li.appendChild(newDom);
13152
- }
13153
- if (liBefore) {
13154
- gui2.__ul.insertBefore(li, liBefore);
13155
- } else {
13156
- gui2.__ul.appendChild(li);
13157
- }
13158
- gui2.onResize();
13159
- return li;
13160
- }
13161
- function removeListeners(gui2) {
13162
- dom.unbind(window, "resize", gui2.__resizeHandler);
13163
- if (gui2.saveToLocalStorageIfPossible) {
13164
- dom.unbind(window, "unload", gui2.saveToLocalStorageIfPossible);
13165
- }
13166
- }
13167
- function markPresetModified(gui2, modified) {
13168
- var opt = gui2.__preset_select[gui2.__preset_select.selectedIndex];
13169
- if (modified) {
13170
- opt.innerHTML = opt.value + "*";
13171
- } else {
13172
- opt.innerHTML = opt.value;
13173
- }
13174
- }
13175
- function augmentController(gui2, li, controller) {
13176
- controller.__li = li;
13177
- controller.__gui = gui2;
13178
- Common.extend(controller, {
13179
- options: function options(_options) {
13180
- if (arguments.length > 1) {
13181
- var nextSibling = controller.__li.nextElementSibling;
13182
- controller.remove();
13183
- return _add(gui2, controller.object, controller.property, {
13184
- before: nextSibling,
13185
- factoryArgs: [Common.toArray(arguments)]
13186
- });
13187
- }
13188
- if (Common.isArray(_options) || Common.isObject(_options)) {
13189
- var _nextSibling = controller.__li.nextElementSibling;
13190
- controller.remove();
13191
- return _add(gui2, controller.object, controller.property, {
13192
- before: _nextSibling,
13193
- factoryArgs: [_options]
13194
- });
13195
- }
13196
- },
13197
- name: function name(_name) {
13198
- controller.__li.firstElementChild.firstElementChild.innerHTML = _name;
13199
- return controller;
13200
- },
13201
- listen: function listen() {
13202
- controller.__gui.listen(controller);
13203
- return controller;
13204
- },
13205
- remove: function remove() {
13206
- controller.__gui.remove(controller);
13207
- return controller;
13208
- }
13209
- });
13210
- if (controller instanceof NumberControllerSlider) {
13211
- var box = new NumberControllerBox(controller.object, controller.property, { min: controller.__min, max: controller.__max, step: controller.__step });
13212
- Common.each(["updateDisplay", "onChange", "onFinishChange", "step", "min", "max"], function(method) {
13213
- var pc = controller[method];
13214
- var pb = box[method];
13215
- controller[method] = box[method] = function() {
13216
- var args = Array.prototype.slice.call(arguments);
13217
- pb.apply(box, args);
13218
- return pc.apply(controller, args);
13219
- };
13220
- });
13221
- dom.addClass(li, "has-slider");
13222
- controller.domElement.insertBefore(box.domElement, controller.domElement.firstElementChild);
13223
- } else if (controller instanceof NumberControllerBox) {
13224
- var r = function r2(returned) {
13225
- if (Common.isNumber(controller.__min) && Common.isNumber(controller.__max)) {
13226
- var oldName = controller.__li.firstElementChild.firstElementChild.innerHTML;
13227
- var wasListening = controller.__gui.__listening.indexOf(controller) > -1;
13228
- controller.remove();
13229
- var newController = _add(gui2, controller.object, controller.property, {
13230
- before: controller.__li.nextElementSibling,
13231
- factoryArgs: [controller.__min, controller.__max, controller.__step]
13232
- });
13233
- newController.name(oldName);
13234
- if (wasListening)
13235
- newController.listen();
13236
- return newController;
13237
- }
13238
- return returned;
13239
- };
13240
- controller.min = Common.compose(r, controller.min);
13241
- controller.max = Common.compose(r, controller.max);
13242
- } else if (controller instanceof BooleanController) {
13243
- dom.bind(li, "click", function() {
13244
- dom.fakeEvent(controller.__checkbox, "click");
13245
- });
13246
- dom.bind(controller.__checkbox, "click", function(e) {
13247
- e.stopPropagation();
13248
- });
13249
- } else if (controller instanceof FunctionController) {
13250
- dom.bind(li, "click", function() {
13251
- dom.fakeEvent(controller.__button, "click");
13252
- });
13253
- dom.bind(li, "mouseover", function() {
13254
- dom.addClass(controller.__button, "hover");
13255
- });
13256
- dom.bind(li, "mouseout", function() {
13257
- dom.removeClass(controller.__button, "hover");
13258
- });
13259
- } else if (controller instanceof ColorController) {
13260
- dom.addClass(li, "color");
13261
- controller.updateDisplay = Common.compose(function(val) {
13262
- li.style.borderLeftColor = controller.__color.toString();
13263
- return val;
13264
- }, controller.updateDisplay);
13265
- controller.updateDisplay();
13266
- }
13267
- controller.setValue = Common.compose(function(val) {
13268
- if (gui2.getRoot().__preset_select && controller.isModified()) {
13269
- markPresetModified(gui2.getRoot(), true);
13270
- }
13271
- return val;
13272
- }, controller.setValue);
13273
- }
13274
- function recallSavedValue(gui2, controller) {
13275
- var root = gui2.getRoot();
13276
- var matchedIndex = root.__rememberedObjects.indexOf(controller.object);
13277
- if (matchedIndex !== -1) {
13278
- var controllerMap = root.__rememberedObjectIndecesToControllers[matchedIndex];
13279
- if (controllerMap === void 0) {
13280
- controllerMap = {};
13281
- root.__rememberedObjectIndecesToControllers[matchedIndex] = controllerMap;
13282
- }
13283
- controllerMap[controller.property] = controller;
13284
- if (root.load && root.load.remembered) {
13285
- var presetMap = root.load.remembered;
13286
- var preset = void 0;
13287
- if (presetMap[gui2.preset]) {
13288
- preset = presetMap[gui2.preset];
13289
- } else if (presetMap[DEFAULT_DEFAULT_PRESET_NAME]) {
13290
- preset = presetMap[DEFAULT_DEFAULT_PRESET_NAME];
13291
- } else {
13292
- return;
13293
- }
13294
- if (preset[matchedIndex] && preset[matchedIndex][controller.property] !== void 0) {
13295
- var value = preset[matchedIndex][controller.property];
13296
- controller.initialValue = value;
13297
- controller.setValue(value);
13298
- }
13299
- }
13300
- }
13301
- }
13302
- function _add(gui2, object, property, params) {
13303
- if (object[property] === void 0) {
13304
- throw new Error('Object "' + object + '" has no property "' + property + '"');
13305
- }
13306
- var controller = void 0;
13307
- if (params.color) {
13308
- controller = new ColorController(object, property);
13309
- } else {
13310
- var factoryArgs = [object, property].concat(params.factoryArgs);
13311
- controller = ControllerFactory.apply(gui2, factoryArgs);
13312
- }
13313
- if (params.before instanceof Controller) {
13314
- params.before = params.before.__li;
13315
- }
13316
- recallSavedValue(gui2, controller);
13317
- dom.addClass(controller.domElement, "c");
13318
- var name = document.createElement("span");
13319
- dom.addClass(name, "property-name");
13320
- name.innerHTML = controller.property;
13321
- var container = document.createElement("div");
13322
- container.appendChild(name);
13323
- container.appendChild(controller.domElement);
13324
- var li = addRow(gui2, container, params.before);
13325
- dom.addClass(li, GUI.CLASS_CONTROLLER_ROW);
13326
- if (controller instanceof ColorController) {
13327
- dom.addClass(li, "color");
13328
- } else {
13329
- dom.addClass(li, _typeof(controller.getValue()));
13330
- }
13331
- augmentController(gui2, li, controller);
13332
- gui2.__controllers.push(controller);
13333
- return controller;
13334
- }
13335
- function getLocalStorageHash(gui2, key) {
13336
- return document.location.href + "." + key;
13337
- }
13338
- function addPresetOption(gui2, name, setSelected) {
13339
- var opt = document.createElement("option");
13340
- opt.innerHTML = name;
13341
- opt.value = name;
13342
- gui2.__preset_select.appendChild(opt);
13343
- if (setSelected) {
13344
- gui2.__preset_select.selectedIndex = gui2.__preset_select.length - 1;
13345
- }
13346
- }
13347
- function showHideExplain(gui2, explain) {
13348
- explain.style.display = gui2.useLocalStorage ? "block" : "none";
13349
- }
13350
- function addSaveMenu(gui2) {
13351
- var div = gui2.__save_row = document.createElement("li");
13352
- dom.addClass(gui2.domElement, "has-save");
13353
- gui2.__ul.insertBefore(div, gui2.__ul.firstChild);
13354
- dom.addClass(div, "save-row");
13355
- var gears = document.createElement("span");
13356
- gears.innerHTML = "&nbsp;";
13357
- dom.addClass(gears, "button gears");
13358
- var button = document.createElement("span");
13359
- button.innerHTML = "Save";
13360
- dom.addClass(button, "button");
13361
- dom.addClass(button, "save");
13362
- var button2 = document.createElement("span");
13363
- button2.innerHTML = "New";
13364
- dom.addClass(button2, "button");
13365
- dom.addClass(button2, "save-as");
13366
- var button3 = document.createElement("span");
13367
- button3.innerHTML = "Revert";
13368
- dom.addClass(button3, "button");
13369
- dom.addClass(button3, "revert");
13370
- var select = gui2.__preset_select = document.createElement("select");
13371
- if (gui2.load && gui2.load.remembered) {
13372
- Common.each(gui2.load.remembered, function(value, key) {
13373
- addPresetOption(gui2, key, key === gui2.preset);
13374
- });
13375
- } else {
13376
- addPresetOption(gui2, DEFAULT_DEFAULT_PRESET_NAME, false);
13377
- }
13378
- dom.bind(select, "change", function() {
13379
- for (var index = 0; index < gui2.__preset_select.length; index++) {
13380
- gui2.__preset_select[index].innerHTML = gui2.__preset_select[index].value;
13381
- }
13382
- gui2.preset = this.value;
13383
- });
13384
- div.appendChild(select);
13385
- div.appendChild(gears);
13386
- div.appendChild(button);
13387
- div.appendChild(button2);
13388
- div.appendChild(button3);
13389
- if (SUPPORTS_LOCAL_STORAGE) {
13390
- var explain = document.getElementById("dg-local-explain");
13391
- var localStorageCheckBox = document.getElementById("dg-local-storage");
13392
- var saveLocally = document.getElementById("dg-save-locally");
13393
- saveLocally.style.display = "block";
13394
- if (localStorage.getItem(getLocalStorageHash(gui2, "isLocal")) === "true") {
13395
- localStorageCheckBox.setAttribute("checked", "checked");
13396
- }
13397
- showHideExplain(gui2, explain);
13398
- dom.bind(localStorageCheckBox, "change", function() {
13399
- gui2.useLocalStorage = !gui2.useLocalStorage;
13400
- showHideExplain(gui2, explain);
13401
- });
13402
- }
13403
- var newConstructorTextArea = document.getElementById("dg-new-constructor");
13404
- dom.bind(newConstructorTextArea, "keydown", function(e) {
13405
- if (e.metaKey && (e.which === 67 || e.keyCode === 67)) {
13406
- SAVE_DIALOGUE.hide();
13407
- }
13408
- });
13409
- dom.bind(gears, "click", function() {
13410
- newConstructorTextArea.innerHTML = JSON.stringify(gui2.getSaveObject(), void 0, 2);
13411
- SAVE_DIALOGUE.show();
13412
- newConstructorTextArea.focus();
13413
- newConstructorTextArea.select();
13414
- });
13415
- dom.bind(button, "click", function() {
13416
- gui2.save();
13417
- });
13418
- dom.bind(button2, "click", function() {
13419
- var presetName = prompt("Enter a new preset name.");
13420
- if (presetName) {
13421
- gui2.saveAs(presetName);
13422
- }
13423
- });
13424
- dom.bind(button3, "click", function() {
13425
- gui2.revert();
13426
- });
13427
- }
13428
- function addResizeHandle(gui2) {
13429
- var pmouseX = void 0;
13430
- gui2.__resize_handle = document.createElement("div");
13431
- Common.extend(gui2.__resize_handle.style, {
13432
- width: "6px",
13433
- marginLeft: "-3px",
13434
- height: "200px",
13435
- cursor: "ew-resize",
13436
- position: "absolute"
13437
- });
13438
- function drag(e) {
13439
- e.preventDefault();
13440
- gui2.width += pmouseX - e.clientX;
13441
- gui2.onResize();
13442
- pmouseX = e.clientX;
13443
- return false;
13444
- }
13445
- function dragStop() {
13446
- dom.removeClass(gui2.__closeButton, GUI.CLASS_DRAG);
13447
- dom.unbind(window, "mousemove", drag);
13448
- dom.unbind(window, "mouseup", dragStop);
13449
- }
13450
- function dragStart(e) {
13451
- e.preventDefault();
13452
- pmouseX = e.clientX;
13453
- dom.addClass(gui2.__closeButton, GUI.CLASS_DRAG);
13454
- dom.bind(window, "mousemove", drag);
13455
- dom.bind(window, "mouseup", dragStop);
13456
- return false;
13457
- }
13458
- dom.bind(gui2.__resize_handle, "mousedown", dragStart);
13459
- dom.bind(gui2.__closeButton, "mousedown", dragStart);
13460
- gui2.domElement.insertBefore(gui2.__resize_handle, gui2.domElement.firstElementChild);
13461
- }
13462
- function setWidth(gui2, w2) {
13463
- gui2.domElement.style.width = w2 + "px";
13464
- if (gui2.__save_row && gui2.autoPlace) {
13465
- gui2.__save_row.style.width = w2 + "px";
13466
- }
13467
- if (gui2.__closeButton) {
13468
- gui2.__closeButton.style.width = w2 + "px";
13469
- }
13470
- }
13471
- function getCurrentPreset(gui2, useInitialValues) {
13472
- var toReturn2 = {};
13473
- Common.each(gui2.__rememberedObjects, function(val, index) {
13474
- var savedValues = {};
13475
- var controllerMap = gui2.__rememberedObjectIndecesToControllers[index];
13476
- Common.each(controllerMap, function(controller, property) {
13477
- savedValues[property] = useInitialValues ? controller.initialValue : controller.getValue();
13478
- });
13479
- toReturn2[index] = savedValues;
13480
- });
13481
- return toReturn2;
13482
- }
13483
- function setPresetSelectIndex(gui2) {
13484
- for (var index = 0; index < gui2.__preset_select.length; index++) {
13485
- if (gui2.__preset_select[index].value === gui2.preset) {
13486
- gui2.__preset_select.selectedIndex = index;
13487
- }
13488
- }
13489
- }
13490
- function updateDisplays(controllerArray) {
13491
- if (controllerArray.length !== 0) {
13492
- requestAnimationFrame$1$1.call(window, function() {
13493
- updateDisplays(controllerArray);
13494
- });
13495
- }
13496
- Common.each(controllerArray, function(c2) {
13497
- c2.updateDisplay();
13498
- });
13499
- }
13500
- var GUI$1 = GUI;
13501
11045
  /**
13502
11046
  * @license
13503
11047
  * Copyright 2010-2023 Three.js Authors
@@ -18083,16 +15627,16 @@ var __publicField = (obj, key, value) => {
18083
15627
  return void 0;
18084
15628
  }
18085
15629
  getObjectsByProperty(name, value) {
18086
- let result2 = [];
15630
+ let result = [];
18087
15631
  if (this[name] === value)
18088
- result2.push(this);
15632
+ result.push(this);
18089
15633
  for (let i = 0, l = this.children.length; i < l; i++) {
18090
15634
  const childResult = this.children[i].getObjectsByProperty(name, value);
18091
15635
  if (childResult.length > 0) {
18092
- result2 = result2.concat(childResult);
15636
+ result = result.concat(childResult);
18093
15637
  }
18094
15638
  }
18095
- return result2;
15639
+ return result;
18096
15640
  }
18097
15641
  getWorldPosition(target) {
18098
15642
  this.updateWorldMatrix(true, false);
@@ -21599,7 +19143,7 @@ var __publicField = (obj, key, value) => {
21599
19143
  }
21600
19144
  attribute.onUploadCallback();
21601
19145
  }
21602
- function get2(attribute) {
19146
+ function get(attribute) {
21603
19147
  if (attribute.isInterleavedBufferAttribute)
21604
19148
  attribute = attribute.data;
21605
19149
  return buffers.get(attribute);
@@ -21637,7 +19181,7 @@ var __publicField = (obj, key, value) => {
21637
19181
  }
21638
19182
  }
21639
19183
  return {
21640
- get: get2,
19184
+ get,
21641
19185
  remove,
21642
19186
  update
21643
19187
  };
@@ -23104,7 +20648,7 @@ var __publicField = (obj, key, value) => {
23104
20648
  }
23105
20649
  return texture;
23106
20650
  }
23107
- function get2(texture) {
20651
+ function get(texture) {
23108
20652
  if (texture && texture.isTexture && texture.isRenderTargetTexture === false) {
23109
20653
  const mapping = texture.mapping;
23110
20654
  if (mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping) {
@@ -23140,7 +20684,7 @@ var __publicField = (obj, key, value) => {
23140
20684
  cubemaps = /* @__PURE__ */ new WeakMap();
23141
20685
  }
23142
20686
  return {
23143
- get: get2,
20687
+ get,
23144
20688
  dispose
23145
20689
  };
23146
20690
  }
@@ -23870,7 +21414,7 @@ var __publicField = (obj, key, value) => {
23870
21414
  function WebGLCubeUVMaps(renderer) {
23871
21415
  let cubeUVmaps = /* @__PURE__ */ new WeakMap();
23872
21416
  let pmremGenerator = null;
23873
- function get2(texture) {
21417
+ function get(texture) {
23874
21418
  if (texture && texture.isTexture) {
23875
21419
  const mapping = texture.mapping;
23876
21420
  const isEquirectMap = mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping;
@@ -23931,7 +21475,7 @@ var __publicField = (obj, key, value) => {
23931
21475
  }
23932
21476
  }
23933
21477
  return {
23934
- get: get2,
21478
+ get,
23935
21479
  dispose
23936
21480
  };
23937
21481
  }
@@ -24021,7 +21565,7 @@ var __publicField = (obj, key, value) => {
24021
21565
  }
24022
21566
  info.memory.geometries--;
24023
21567
  }
24024
- function get2(object, geometry) {
21568
+ function get(object, geometry) {
24025
21569
  if (geometries[geometry.id] === true)
24026
21570
  return geometry;
24027
21571
  geometry.addEventListener("dispose", onGeometryDispose);
@@ -24090,7 +21634,7 @@ var __publicField = (obj, key, value) => {
24090
21634
  return wireframeAttributes.get(geometry);
24091
21635
  }
24092
21636
  return {
24093
- get: get2,
21637
+ get,
24094
21638
  update,
24095
21639
  getWireframeAttribute
24096
21640
  };
@@ -24963,8 +22507,8 @@ var __publicField = (obj, key, value) => {
24963
22507
  addUniform(container, subscript === void 0 ? new SingleUniform(id, activeInfo, addr) : new PureArrayUniform(id, activeInfo, addr));
24964
22508
  break;
24965
22509
  } else {
24966
- const map2 = container.map;
24967
- let next = map2[id];
22510
+ const map = container.map;
22511
+ let next = map[id];
24968
22512
  if (next === void 0) {
24969
22513
  next = new StructuredUniform(id);
24970
22514
  addUniform(container, next);
@@ -26164,13 +23708,13 @@ var __publicField = (obj, key, value) => {
26164
23708
  }
26165
23709
  function WebGLProperties() {
26166
23710
  let properties = /* @__PURE__ */ new WeakMap();
26167
- function get2(object) {
26168
- let map2 = properties.get(object);
26169
- if (map2 === void 0) {
26170
- map2 = {};
26171
- properties.set(object, map2);
23711
+ function get(object) {
23712
+ let map = properties.get(object);
23713
+ if (map === void 0) {
23714
+ map = {};
23715
+ properties.set(object, map);
26172
23716
  }
26173
- return map2;
23717
+ return map;
26174
23718
  }
26175
23719
  function remove(object) {
26176
23720
  properties.delete(object);
@@ -26182,7 +23726,7 @@ var __publicField = (obj, key, value) => {
26182
23726
  properties = /* @__PURE__ */ new WeakMap();
26183
23727
  }
26184
23728
  return {
26185
- get: get2,
23729
+ get,
26186
23730
  remove,
26187
23731
  update,
26188
23732
  dispose
@@ -26304,7 +23848,7 @@ var __publicField = (obj, key, value) => {
26304
23848
  }
26305
23849
  function WebGLRenderLists() {
26306
23850
  let lists = /* @__PURE__ */ new WeakMap();
26307
- function get2(scene, renderCallDepth) {
23851
+ function get(scene, renderCallDepth) {
26308
23852
  const listArray = lists.get(scene);
26309
23853
  let list;
26310
23854
  if (listArray === void 0) {
@@ -26324,7 +23868,7 @@ var __publicField = (obj, key, value) => {
26324
23868
  lists = /* @__PURE__ */ new WeakMap();
26325
23869
  }
26326
23870
  return {
26327
- get: get2,
23871
+ get,
26328
23872
  dispose
26329
23873
  };
26330
23874
  }
@@ -26730,7 +24274,7 @@ var __publicField = (obj, key, value) => {
26730
24274
  }
26731
24275
  function WebGLRenderStates(extensions, capabilities) {
26732
24276
  let renderStates = /* @__PURE__ */ new WeakMap();
26733
- function get2(scene, renderCallDepth = 0) {
24277
+ function get(scene, renderCallDepth = 0) {
26734
24278
  const renderStateArray = renderStates.get(scene);
26735
24279
  let renderState;
26736
24280
  if (renderStateArray === void 0) {
@@ -26750,7 +24294,7 @@ var __publicField = (obj, key, value) => {
26750
24294
  renderStates = /* @__PURE__ */ new WeakMap();
26751
24295
  }
26752
24296
  return {
26753
- get: get2,
24297
+ get,
26754
24298
  dispose
26755
24299
  };
26756
24300
  }
@@ -26940,14 +24484,14 @@ var __publicField = (obj, key, value) => {
26940
24484
  _renderer.renderBufferDirect(camera, null, geometry, shadowMaterialHorizontal, fullScreenMesh, null);
26941
24485
  }
26942
24486
  function getDepthMaterial(object, material, light, type) {
26943
- let result2 = null;
24487
+ let result = null;
26944
24488
  const customMaterial = light.isPointLight === true ? object.customDistanceMaterial : object.customDepthMaterial;
26945
24489
  if (customMaterial !== void 0) {
26946
- result2 = customMaterial;
24490
+ result = customMaterial;
26947
24491
  } else {
26948
- result2 = light.isPointLight === true ? _distanceMaterial : _depthMaterial;
24492
+ result = light.isPointLight === true ? _distanceMaterial : _depthMaterial;
26949
24493
  if (_renderer.localClippingEnabled && material.clipShadows === true && Array.isArray(material.clippingPlanes) && material.clippingPlanes.length !== 0 || material.displacementMap && material.displacementScale !== 0 || material.alphaMap && material.alphaTest > 0 || material.map && material.alphaTest > 0) {
26950
- const keyA = result2.uuid, keyB = material.uuid;
24494
+ const keyA = result.uuid, keyB = material.uuid;
26951
24495
  let materialsForVariant = _materialCache[keyA];
26952
24496
  if (materialsForVariant === void 0) {
26953
24497
  materialsForVariant = {};
@@ -26955,35 +24499,35 @@ var __publicField = (obj, key, value) => {
26955
24499
  }
26956
24500
  let cachedMaterial = materialsForVariant[keyB];
26957
24501
  if (cachedMaterial === void 0) {
26958
- cachedMaterial = result2.clone();
24502
+ cachedMaterial = result.clone();
26959
24503
  materialsForVariant[keyB] = cachedMaterial;
26960
24504
  }
26961
- result2 = cachedMaterial;
24505
+ result = cachedMaterial;
26962
24506
  }
26963
24507
  }
26964
- result2.visible = material.visible;
26965
- result2.wireframe = material.wireframe;
24508
+ result.visible = material.visible;
24509
+ result.wireframe = material.wireframe;
26966
24510
  if (type === VSMShadowMap) {
26967
- result2.side = material.shadowSide !== null ? material.shadowSide : material.side;
24511
+ result.side = material.shadowSide !== null ? material.shadowSide : material.side;
26968
24512
  } else {
26969
- result2.side = material.shadowSide !== null ? material.shadowSide : shadowSide[material.side];
26970
- }
26971
- result2.alphaMap = material.alphaMap;
26972
- result2.alphaTest = material.alphaTest;
26973
- result2.map = material.map;
26974
- result2.clipShadows = material.clipShadows;
26975
- result2.clippingPlanes = material.clippingPlanes;
26976
- result2.clipIntersection = material.clipIntersection;
26977
- result2.displacementMap = material.displacementMap;
26978
- result2.displacementScale = material.displacementScale;
26979
- result2.displacementBias = material.displacementBias;
26980
- result2.wireframeLinewidth = material.wireframeLinewidth;
26981
- result2.linewidth = material.linewidth;
26982
- if (light.isPointLight === true && result2.isMeshDistanceMaterial === true) {
26983
- const materialProperties = _renderer.properties.get(result2);
24513
+ result.side = material.shadowSide !== null ? material.shadowSide : shadowSide[material.side];
24514
+ }
24515
+ result.alphaMap = material.alphaMap;
24516
+ result.alphaTest = material.alphaTest;
24517
+ result.map = material.map;
24518
+ result.clipShadows = material.clipShadows;
24519
+ result.clippingPlanes = material.clippingPlanes;
24520
+ result.clipIntersection = material.clipIntersection;
24521
+ result.displacementMap = material.displacementMap;
24522
+ result.displacementScale = material.displacementScale;
24523
+ result.displacementBias = material.displacementBias;
24524
+ result.wireframeLinewidth = material.wireframeLinewidth;
24525
+ result.linewidth = material.linewidth;
24526
+ if (light.isPointLight === true && result.isMeshDistanceMaterial === true) {
24527
+ const materialProperties = _renderer.properties.get(result);
26984
24528
  materialProperties.light = light;
26985
24529
  }
26986
- return result2;
24530
+ return result;
26987
24531
  }
26988
24532
  function renderObject(object, camera, shadowCamera, light, type) {
26989
24533
  if (object.visible === false)
@@ -29752,11 +27296,11 @@ var __publicField = (obj, key, value) => {
29752
27296
  }
29753
27297
  }
29754
27298
  function WebGLMaterials(renderer, properties) {
29755
- function refreshTransformUniform(map2, uniform) {
29756
- if (map2.matrixAutoUpdate === true) {
29757
- map2.updateMatrix();
27299
+ function refreshTransformUniform(map, uniform) {
27300
+ if (map.matrixAutoUpdate === true) {
27301
+ map.updateMatrix();
29758
27302
  }
29759
- uniform.value.copy(map2.matrix);
27303
+ uniform.value.copy(map.matrix);
29760
27304
  }
29761
27305
  function refreshFogUniforms(uniforms, fog) {
29762
27306
  fog.color.getRGB(uniforms.fogColor.value, getUnlitUniformColorSpace(renderer));
@@ -32913,22 +30457,22 @@ var __publicField = (obj, key, value) => {
32913
30457
  return times[i] - times[j];
32914
30458
  }
32915
30459
  const n2 = times.length;
32916
- const result2 = new Array(n2);
30460
+ const result = new Array(n2);
32917
30461
  for (let i = 0; i !== n2; ++i)
32918
- result2[i] = i;
32919
- result2.sort(compareTime);
32920
- return result2;
30462
+ result[i] = i;
30463
+ result.sort(compareTime);
30464
+ return result;
32921
30465
  }
32922
30466
  function sortedArray(values, stride, order) {
32923
30467
  const nValues = values.length;
32924
- const result2 = new values.constructor(nValues);
30468
+ const result = new values.constructor(nValues);
32925
30469
  for (let i = 0, dstOffset = 0; dstOffset !== nValues; ++i) {
32926
30470
  const srcOffset = order[i] * stride;
32927
30471
  for (let j = 0; j !== stride; ++j) {
32928
- result2[dstOffset++] = values[srcOffset + j];
30472
+ result[dstOffset++] = values[srcOffset + j];
32929
30473
  }
32930
30474
  }
32931
- return result2;
30475
+ return result;
32932
30476
  }
32933
30477
  function flattenJSON(jsonKeys, times, values, valuePropertyName) {
32934
30478
  let i = 1, key = jsonKeys[0];
@@ -33061,11 +30605,11 @@ var __publicField = (obj, key, value) => {
33061
30605
  return this.settings || this.DefaultSettings_;
33062
30606
  }
33063
30607
  copySampleValue_(index) {
33064
- const result2 = this.resultBuffer, values = this.sampleValues, stride = this.valueSize, offset = index * stride;
30608
+ const result = this.resultBuffer, values = this.sampleValues, stride = this.valueSize, offset = index * stride;
33065
30609
  for (let i = 0; i !== stride; ++i) {
33066
- result2[i] = values[offset + i];
30610
+ result[i] = values[offset + i];
33067
30611
  }
33068
- return result2;
30612
+ return result;
33069
30613
  }
33070
30614
  // Template methods for derived classes:
33071
30615
  interpolate_() {
@@ -33126,15 +30670,15 @@ var __publicField = (obj, key, value) => {
33126
30670
  this._offsetNext = iNext * stride;
33127
30671
  }
33128
30672
  interpolate_(i1, t0, t2, t1) {
33129
- const result2 = this.resultBuffer, values = this.sampleValues, stride = this.valueSize, o1 = i1 * stride, o0 = o1 - stride, oP = this._offsetPrev, oN = this._offsetNext, wP = this._weightPrev, wN = this._weightNext, p2 = (t2 - t0) / (t1 - t0), pp = p2 * p2, ppp = pp * p2;
30673
+ const result = this.resultBuffer, values = this.sampleValues, stride = this.valueSize, o1 = i1 * stride, o0 = o1 - stride, oP = this._offsetPrev, oN = this._offsetNext, wP = this._weightPrev, wN = this._weightNext, p2 = (t2 - t0) / (t1 - t0), pp = p2 * p2, ppp = pp * p2;
33130
30674
  const sP = -wP * ppp + 2 * wP * pp - wP * p2;
33131
30675
  const s0 = (1 + wP) * ppp + (-1.5 - 2 * wP) * pp + (-0.5 + wP) * p2 + 1;
33132
30676
  const s1 = (-1 - wN) * ppp + (1.5 + wN) * pp + 0.5 * p2;
33133
30677
  const sN = wN * ppp - wN * pp;
33134
30678
  for (let i = 0; i !== stride; ++i) {
33135
- result2[i] = sP * values[oP + i] + s0 * values[o0 + i] + s1 * values[o1 + i] + sN * values[oN + i];
30679
+ result[i] = sP * values[oP + i] + s0 * values[o0 + i] + s1 * values[o1 + i] + sN * values[oN + i];
33136
30680
  }
33137
- return result2;
30681
+ return result;
33138
30682
  }
33139
30683
  }
33140
30684
  class LinearInterpolant extends Interpolant {
@@ -33142,11 +30686,11 @@ var __publicField = (obj, key, value) => {
33142
30686
  super(parameterPositions, sampleValues, sampleSize, resultBuffer);
33143
30687
  }
33144
30688
  interpolate_(i1, t0, t2, t1) {
33145
- const result2 = this.resultBuffer, values = this.sampleValues, stride = this.valueSize, offset1 = i1 * stride, offset0 = offset1 - stride, weight1 = (t2 - t0) / (t1 - t0), weight0 = 1 - weight1;
30689
+ const result = this.resultBuffer, values = this.sampleValues, stride = this.valueSize, offset1 = i1 * stride, offset0 = offset1 - stride, weight1 = (t2 - t0) / (t1 - t0), weight0 = 1 - weight1;
33146
30690
  for (let i = 0; i !== stride; ++i) {
33147
- result2[i] = values[offset0 + i] * weight0 + values[offset1 + i] * weight1;
30691
+ result[i] = values[offset0 + i] * weight0 + values[offset1 + i] * weight1;
33148
30692
  }
33149
- return result2;
30693
+ return result;
33150
30694
  }
33151
30695
  }
33152
30696
  class DiscreteInterpolant extends Interpolant {
@@ -33189,14 +30733,14 @@ var __publicField = (obj, key, value) => {
33189
30733
  json.type = track.ValueTypeName;
33190
30734
  return json;
33191
30735
  }
33192
- InterpolantFactoryMethodDiscrete(result2) {
33193
- return new DiscreteInterpolant(this.times, this.values, this.getValueSize(), result2);
30736
+ InterpolantFactoryMethodDiscrete(result) {
30737
+ return new DiscreteInterpolant(this.times, this.values, this.getValueSize(), result);
33194
30738
  }
33195
- InterpolantFactoryMethodLinear(result2) {
33196
- return new LinearInterpolant(this.times, this.values, this.getValueSize(), result2);
30739
+ InterpolantFactoryMethodLinear(result) {
30740
+ return new LinearInterpolant(this.times, this.values, this.getValueSize(), result);
33197
30741
  }
33198
- InterpolantFactoryMethodSmooth(result2) {
33199
- return new CubicInterpolant(this.times, this.values, this.getValueSize(), result2);
30742
+ InterpolantFactoryMethodSmooth(result) {
30743
+ return new CubicInterpolant(this.times, this.values, this.getValueSize(), result);
33200
30744
  }
33201
30745
  setInterpolation(interpolation) {
33202
30746
  let factoryMethod;
@@ -33404,17 +30948,17 @@ var __publicField = (obj, key, value) => {
33404
30948
  super(parameterPositions, sampleValues, sampleSize, resultBuffer);
33405
30949
  }
33406
30950
  interpolate_(i1, t0, t2, t1) {
33407
- const result2 = this.resultBuffer, values = this.sampleValues, stride = this.valueSize, alpha = (t2 - t0) / (t1 - t0);
30951
+ const result = this.resultBuffer, values = this.sampleValues, stride = this.valueSize, alpha = (t2 - t0) / (t1 - t0);
33408
30952
  let offset = i1 * stride;
33409
30953
  for (let end = offset + stride; offset !== end; offset += 4) {
33410
- Quaternion.slerpFlat(result2, 0, values, offset - stride, values, offset, alpha);
30954
+ Quaternion.slerpFlat(result, 0, values, offset - stride, values, offset, alpha);
33411
30955
  }
33412
- return result2;
30956
+ return result;
33413
30957
  }
33414
30958
  }
33415
30959
  class QuaternionKeyframeTrack extends KeyframeTrack {
33416
- InterpolantFactoryMethodLinear(result2) {
33417
- return new QuaternionLinearInterpolant(this.times, this.values, this.getValueSize(), result2);
30960
+ InterpolantFactoryMethodLinear(result) {
30961
+ return new QuaternionLinearInterpolant(this.times, this.values, this.getValueSize(), result);
33418
30962
  }
33419
30963
  }
33420
30964
  QuaternionKeyframeTrack.prototype.ValueTypeName = "quaternion";
@@ -34625,9 +32169,9 @@ var __publicField = (obj, key, value) => {
34625
32169
  if (childNode.name === nodeName || childNode.uuid === nodeName) {
34626
32170
  return childNode;
34627
32171
  }
34628
- const result2 = searchNodeSubtree(childNode.children);
34629
- if (result2)
34630
- return result2;
32172
+ const result = searchNodeSubtree(childNode.children);
32173
+ if (result)
32174
+ return result;
34631
32175
  }
34632
32176
  return null;
34633
32177
  };
@@ -36517,9 +34061,9 @@ var __publicField = (obj, key, value) => {
36517
34061
  });
36518
34062
  } else {
36519
34063
  return decoder.ready.then(function() {
36520
- const result2 = new ArrayBuffer(count * stride);
36521
- decoder.decodeGltfBuffer(new Uint8Array(result2), count, stride, source, extensionDef.mode, extensionDef.filter);
36522
- return result2;
34064
+ const result = new ArrayBuffer(count * stride);
34065
+ decoder.decodeGltfBuffer(new Uint8Array(result), count, stride, source, extensionDef.mode, extensionDef.filter);
34066
+ return result;
36523
34067
  });
36524
34068
  }
36525
34069
  });
@@ -36726,14 +34270,14 @@ var __publicField = (obj, key, value) => {
36726
34270
  super(parameterPositions, sampleValues, sampleSize, resultBuffer);
36727
34271
  }
36728
34272
  copySampleValue_(index) {
36729
- const result2 = this.resultBuffer, values = this.sampleValues, valueSize = this.valueSize, offset = index * valueSize * 3 + valueSize;
34273
+ const result = this.resultBuffer, values = this.sampleValues, valueSize = this.valueSize, offset = index * valueSize * 3 + valueSize;
36730
34274
  for (let i = 0; i !== valueSize; i++) {
36731
- result2[i] = values[offset + i];
34275
+ result[i] = values[offset + i];
36732
34276
  }
36733
- return result2;
34277
+ return result;
36734
34278
  }
36735
34279
  interpolate_(i1, t0, t2, t1) {
36736
- const result2 = this.resultBuffer;
34280
+ const result = this.resultBuffer;
36737
34281
  const values = this.sampleValues;
36738
34282
  const stride = this.valueSize;
36739
34283
  const stride2 = stride * 2;
@@ -36753,17 +34297,17 @@ var __publicField = (obj, key, value) => {
36753
34297
  const m0 = values[offset0 + i + stride2] * td;
36754
34298
  const p1 = values[offset1 + i + stride];
36755
34299
  const m1 = values[offset1 + i] * td;
36756
- result2[i] = s0 * p0 + s1 * m0 + s2 * p1 + s3 * m1;
34300
+ result[i] = s0 * p0 + s1 * m0 + s2 * p1 + s3 * m1;
36757
34301
  }
36758
- return result2;
34302
+ return result;
36759
34303
  }
36760
34304
  }
36761
34305
  const _q = new Quaternion();
36762
34306
  class GLTFCubicSplineQuaternionInterpolant extends GLTFCubicSplineInterpolant {
36763
34307
  interpolate_(i1, t0, t2, t1) {
36764
- const result2 = super.interpolate_(i1, t0, t2, t1);
36765
- _q.fromArray(result2).normalize().toArray(result2);
36766
- return result2;
34308
+ const result = super.interpolate_(i1, t0, t2, t1);
34309
+ _q.fromArray(result).normalize().toArray(result);
34310
+ return result;
36767
34311
  }
36768
34312
  }
36769
34313
  const WEBGL_CONSTANTS = {
@@ -37056,7 +34600,7 @@ var __publicField = (obj, key, value) => {
37056
34600
  parser.getDependencies("camera")
37057
34601
  ]);
37058
34602
  }).then(function(dependencies) {
37059
- const result2 = {
34603
+ const result = {
37060
34604
  scene: dependencies[0][json.scene || 0],
37061
34605
  scenes: dependencies[0],
37062
34606
  animations: dependencies[1],
@@ -37065,12 +34609,12 @@ var __publicField = (obj, key, value) => {
37065
34609
  parser,
37066
34610
  userData: {}
37067
34611
  };
37068
- addUnknownExtensionsToUserData(extensions, result2, json);
37069
- assignExtrasToUserData(result2, json);
34612
+ addUnknownExtensionsToUserData(extensions, result, json);
34613
+ assignExtrasToUserData(result, json);
37070
34614
  return Promise.all(parser._invokeAll(function(ext) {
37071
- return ext.afterRoot && ext.afterRoot(result2);
34615
+ return ext.afterRoot && ext.afterRoot(result);
37072
34616
  })).then(function() {
37073
- onLoad(result2);
34617
+ onLoad(result);
37074
34618
  });
37075
34619
  }).catch(onError);
37076
34620
  }
@@ -37139,9 +34683,9 @@ var __publicField = (obj, key, value) => {
37139
34683
  const extensions = Object.values(this.plugins);
37140
34684
  extensions.push(this);
37141
34685
  for (let i = 0; i < extensions.length; i++) {
37142
- const result2 = func(extensions[i]);
37143
- if (result2)
37144
- return result2;
34686
+ const result = func(extensions[i]);
34687
+ if (result)
34688
+ return result;
37145
34689
  }
37146
34690
  return null;
37147
34691
  }
@@ -37150,9 +34694,9 @@ var __publicField = (obj, key, value) => {
37150
34694
  extensions.unshift(this);
37151
34695
  const pending = [];
37152
34696
  for (let i = 0; i < extensions.length; i++) {
37153
- const result2 = func(extensions[i]);
37154
- if (result2)
37155
- pending.push(result2);
34697
+ const result = func(extensions[i]);
34698
+ if (result)
34699
+ pending.push(result);
37156
34700
  }
37157
34701
  return pending;
37158
34702
  }
@@ -38128,9 +35672,9 @@ var __publicField = (obj, key, value) => {
38128
35672
  return outputArray;
38129
35673
  }
38130
35674
  _createCubicSplineTrackInterpolant(track) {
38131
- track.createInterpolant = function InterpolantFactoryMethodGLTFCubicSpline(result2) {
35675
+ track.createInterpolant = function InterpolantFactoryMethodGLTFCubicSpline(result) {
38132
35676
  const interpolantType = this instanceof QuaternionKeyframeTrack ? GLTFCubicSplineQuaternionInterpolant : GLTFCubicSplineInterpolant;
38133
- return new interpolantType(this.times, this.values, this.getValueSize() / 3, result2);
35677
+ return new interpolantType(this.times, this.values, this.getValueSize() / 3, result);
38134
35678
  };
38135
35679
  track.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = true;
38136
35680
  }
@@ -38760,14 +36304,14 @@ var __publicField = (obj, key, value) => {
38760
36304
  const array = arrays[i];
38761
36305
  totalByteLength += array.byteLength;
38762
36306
  }
38763
- const result2 = new Uint8Array(totalByteLength);
36307
+ const result = new Uint8Array(totalByteLength);
38764
36308
  let byteOffset = 0;
38765
36309
  for (let i = 0; i < arrays.length; i++) {
38766
36310
  const array = arrays[i];
38767
- result2.set(array, byteOffset);
36311
+ result.set(array, byteOffset);
38768
36312
  byteOffset += array.byteLength;
38769
36313
  }
38770
- return result2;
36314
+ return result;
38771
36315
  }
38772
36316
  };
38773
36317
  const UNCOMPRESSED_FORMATS = /* @__PURE__ */ new Set([RGBAFormat, RGFormat, RedFormat]);
@@ -39245,8 +36789,7 @@ var __publicField = (obj, key, value) => {
39245
36789
  positions: { value: positions },
39246
36790
  opacities: { value: opacities }
39247
36791
  };
39248
- let gui = new GUI$1({ autoPlace: false });
39249
- const guiContainer = document.getElementById("gui-container");
36792
+ document.getElementById("gui-container");
39250
36793
  class CustomRenderer {
39251
36794
  // lensMaterial:THREE.MeshPhysicalMaterial| any
39252
36795
  constructor(apiService) {
@@ -39304,15 +36847,36 @@ var __publicField = (obj, key, value) => {
39304
36847
  );
39305
36848
  }
39306
36849
  }
36850
+ getMinY(mesh) {
36851
+ let lowestY = Number.POSITIVE_INFINITY;
36852
+ if (mesh.geometry instanceof BufferGeometry) {
36853
+ const positionAttribute = mesh.geometry.getAttribute("position");
36854
+ if (positionAttribute) {
36855
+ const positions2 = positionAttribute.array;
36856
+ for (let i = 0; i < positions2.length; i += 3) {
36857
+ const vertex2 = new Vector3(
36858
+ positions2[i],
36859
+ positions2[i + 1],
36860
+ positions2[i + 2]
36861
+ );
36862
+ const worldPosition = mesh.localToWorld(vertex2.clone());
36863
+ lowestY = Math.min(lowestY, worldPosition.y);
36864
+ }
36865
+ }
36866
+ }
36867
+ return lowestY;
36868
+ }
39307
36869
  updateScene(gltf) {
39308
36870
  gltf.scene.scale.set(7, 7, 7);
39309
36871
  gltf.scene.position.y -= 0.08;
39310
36872
  }
39311
36873
  updateMaterials(gltf) {
39312
- gltf.scene.scale.set(7, 7, 7);
39313
- gltf.scene.position.y -= 0.08;
36874
+ this.updateScene(gltf);
36875
+ let bottom = Number.POSITIVE_INFINITY;
36876
+ let targetY = -0.313;
39314
36877
  gltf.scene.traverse((node) => {
39315
36878
  if (node.isMesh) {
36879
+ bottom = Math.min(bottom, this.getMinY(node));
39316
36880
  if (node.material && node.material.name == "Lenses") {
39317
36881
  let lowestY = Number.POSITIVE_INFINITY;
39318
36882
  let highestY = Number.NEGATIVE_INFINITY;
@@ -39419,6 +36983,10 @@ var __publicField = (obj, key, value) => {
39419
36983
  }
39420
36984
  }
39421
36985
  });
36986
+ let diff = targetY - bottom;
36987
+ gltf.scene.position.y += diff;
36988
+ gu.minY.value += diff;
36989
+ gu.maxY.value += diff;
39422
36990
  }
39423
36991
  async loadEyewearFromGLTF(loader, modelFileUrl, renderer, renderAsIs, decryptionKey) {
39424
36992
  const manager = new LoadingManager();
@@ -39428,11 +36996,11 @@ var __publicField = (obj, key, value) => {
39428
36996
  loader.setKTX2Loader(ktx2Loader.detectSupport(renderer));
39429
36997
  const password = decryptionKey;
39430
36998
  const isRawGlbFile = modelFileUrl.includes(".glb");
39431
- let result2;
36999
+ let result;
39432
37000
  if (isRawGlbFile) {
39433
- result2 = await loader.loadAsync(modelFileUrl);
37001
+ result = await loader.loadAsync(modelFileUrl);
39434
37002
  } else {
39435
- result2 = await this.LoadEncryptedGlb(loader, modelFileUrl, password).then((finalRes) => {
37003
+ result = await this.LoadEncryptedGlb(loader, modelFileUrl, password).then((finalRes) => {
39436
37004
  if (renderAsIs) {
39437
37005
  this.updateScene(finalRes.result);
39438
37006
  } else {
@@ -39441,7 +37009,7 @@ var __publicField = (obj, key, value) => {
39441
37009
  this.setupAndRenderScene(finalRes.result.scene);
39442
37010
  });
39443
37011
  }
39444
- return result2 == null ? void 0 : result2.scene;
37012
+ return result == null ? void 0 : result.scene;
39445
37013
  }
39446
37014
  async setupDropdownAndListeners(response) {
39447
37015
  const selectDropdown = document.getElementById("Framedropdown");
@@ -39631,7 +37199,6 @@ var __publicField = (obj, key, value) => {
39631
37199
  }
39632
37200
  setupLensMaterial(selectedLens) {
39633
37201
  if (lensMaterial) {
39634
- console.log(selectedLens);
39635
37202
  if (selectedLens.direction == "u") {
39636
37203
  lensMaterial.color = new Color(selectedLens.color);
39637
37204
  lensMaterial.opacity = selectedLens.opacity;
@@ -39661,106 +37228,124 @@ var __publicField = (obj, key, value) => {
39661
37228
  lensMaterial.metalness = selectedLens.metalness;
39662
37229
  }
39663
37230
  }
39664
- createGuiControls(selectedLens, name) {
39665
- guiContainer.innerHTML = "";
39666
- gui.destroy();
39667
- gui = new GUI$1({ autoPlace: false });
39668
- const datGuiContainer = document.createElement("div");
39669
- guiContainer.appendChild(datGuiContainer);
39670
- datGuiContainer.appendChild(gui.domElement);
39671
- const opacityControl = gui.add(selectedLens, "opacity", 0, 1).name("Opacity");
39672
- opacityControl.onChange((opacity) => {
39673
- if (lensMaterial) {
39674
- lensMaterial.opacity = opacity;
39675
- }
39676
- });
39677
- const colorControl = gui.addColor(selectedLens, "color").name(name);
39678
- colorControl.onChange((color) => {
39679
- if (lensMaterial) {
39680
- lensMaterial.color.set(color);
39681
- }
39682
- });
39683
- }
39684
- createGuiControlsGrad(selectedLens, name) {
39685
- guiContainer.innerHTML = "";
39686
- gui.destroy();
39687
- gui = new GUI$1({ autoPlace: false });
39688
- const datGuiContainer = document.createElement("div");
39689
- guiContainer.appendChild(datGuiContainer);
39690
- datGuiContainer.appendChild(gui.domElement);
39691
- const positionControl1 = gui.add(selectedLens[0], "position", 0, 1).name("position");
39692
- const positionControl2 = gui.add(selectedLens[1], "position", 0, 1).name("position");
39693
- const positionControl3 = gui.add(selectedLens[2], "position", 0, 1).name("position");
39694
- const positionControl4 = gui.add(selectedLens[3], "position", 0, 1).name("position");
39695
- positionControl1.onChange((position) => {
39696
- if (lensMaterial) {
39697
- gu.positions.value[0] = position;
39698
- }
39699
- });
39700
- positionControl2.onChange((position) => {
39701
- if (lensMaterial) {
39702
- gu.positions.value[1] = position;
39703
- }
39704
- });
39705
- positionControl3.onChange((position) => {
39706
- if (lensMaterial) {
39707
- gu.positions.value[2] = position;
39708
- }
39709
- });
39710
- positionControl4.onChange((position) => {
39711
- if (lensMaterial) {
39712
- gu.positions.value[3] = position;
39713
- }
39714
- });
39715
- const opacityControl1 = gui.add(selectedLens[0], "opacity", 0, 1).name("Opacity");
39716
- const opacityControl2 = gui.add(selectedLens[1], "opacity", 0, 1).name("Opacity");
39717
- const opacityControl3 = gui.add(selectedLens[2], "opacity", 0, 1).name("Opacity");
39718
- const opacityControl4 = gui.add(selectedLens[3], "opacity", 0, 1).name("Opacity");
39719
- opacityControl1.onChange((opacity) => {
39720
- if (lensMaterial) {
39721
- gu.opacities.value[0] = opacity;
39722
- }
39723
- });
39724
- opacityControl2.onChange((opacity) => {
39725
- if (lensMaterial) {
39726
- gu.opacities.value[1] = opacity;
39727
- }
39728
- });
39729
- opacityControl3.onChange((opacity) => {
39730
- if (lensMaterial) {
39731
- gu.opacities.value[2] = opacity;
39732
- }
39733
- });
39734
- opacityControl4.onChange((opacity) => {
39735
- if (lensMaterial) {
39736
- gu.opacities.value[3] = opacity;
39737
- }
39738
- });
39739
- const colorControl1 = gui.addColor(selectedLens[0], "color").name(name);
39740
- const colorControl2 = gui.addColor(selectedLens[1], "color").name(name);
39741
- const colorControl3 = gui.addColor(selectedLens[2], "color").name(name);
39742
- const colorControl4 = gui.addColor(selectedLens[3], "color").name(name);
39743
- colorControl1.onChange((color) => {
39744
- if (lensMaterial) {
39745
- gu.colors.value[0] = new Color(color);
39746
- }
39747
- });
39748
- colorControl2.onChange((color) => {
39749
- if (lensMaterial) {
39750
- gu.colors.value[1] = new Color(color);
39751
- }
39752
- });
39753
- colorControl3.onChange((color) => {
39754
- if (lensMaterial) {
39755
- gu.colors.value[2] = new Color(color);
39756
- }
39757
- });
39758
- colorControl4.onChange((color) => {
39759
- if (lensMaterial) {
39760
- gu.colors.value[3] = new Color(color);
39761
- }
39762
- });
39763
- }
37231
+ // createGuiControls(selectedLens: any, name: any) {
37232
+ // guiContainer!.innerHTML = '';
37233
+ // gui.destroy();
37234
+ // gui = new GUI({ autoPlace: false });
37235
+ // const datGuiContainer = document.createElement('div');
37236
+ // guiContainer!.appendChild(datGuiContainer);
37237
+ // datGuiContainer.appendChild(gui.domElement);
37238
+ // const opacityControl = gui
37239
+ // .add(selectedLens, 'opacity', 0, 1)
37240
+ // .name('Opacity');
37241
+ // opacityControl.onChange((opacity) => {
37242
+ // if (lensMaterial) {
37243
+ // lensMaterial.opacity = opacity;
37244
+ // }
37245
+ // });
37246
+ // const colorControl = gui.addColor(selectedLens, 'color').name(name);
37247
+ // colorControl.onChange((color) => {
37248
+ // if (lensMaterial) {
37249
+ // lensMaterial.color.set(color);
37250
+ // }
37251
+ // });
37252
+ // }
37253
+ // createGuiControlsGrad(selectedLens: any, name: any) {
37254
+ // guiContainer!.innerHTML = '';
37255
+ // gui.destroy();
37256
+ // gui = new GUI({ autoPlace: false });
37257
+ // const datGuiContainer = document.createElement('div');
37258
+ // guiContainer!.appendChild(datGuiContainer);
37259
+ // datGuiContainer.appendChild(gui.domElement);
37260
+ // const positionControl1 = gui
37261
+ // .add(selectedLens[0], 'position', 0, 1)
37262
+ // .name('position');
37263
+ // const positionControl2 = gui
37264
+ // .add(selectedLens[1], 'position', 0, 1)
37265
+ // .name('position');
37266
+ // const positionControl3 = gui
37267
+ // .add(selectedLens[2], 'position', 0, 1)
37268
+ // .name('position');
37269
+ // const positionControl4 = gui
37270
+ // .add(selectedLens[3], 'position', 0, 1)
37271
+ // .name('position');
37272
+ // positionControl1.onChange((position) => {
37273
+ // if (lensMaterial) {
37274
+ // gu.positions.value[0] = position;
37275
+ // }
37276
+ // });
37277
+ // positionControl2.onChange((position) => {
37278
+ // if (lensMaterial) {
37279
+ // gu.positions.value[1] = position;
37280
+ // }
37281
+ // });
37282
+ // positionControl3.onChange((position) => {
37283
+ // if (lensMaterial) {
37284
+ // gu.positions.value[2] = position;
37285
+ // }
37286
+ // });
37287
+ // positionControl4.onChange((position) => {
37288
+ // if (lensMaterial) {
37289
+ // gu.positions.value[3] = position;
37290
+ // }
37291
+ // });
37292
+ // const opacityControl1 = gui
37293
+ // .add(selectedLens[0], 'opacity', 0, 1)
37294
+ // .name('Opacity');
37295
+ // const opacityControl2 = gui
37296
+ // .add(selectedLens[1], 'opacity', 0, 1)
37297
+ // .name('Opacity');
37298
+ // const opacityControl3 = gui
37299
+ // .add(selectedLens[2], 'opacity', 0, 1)
37300
+ // .name('Opacity');
37301
+ // const opacityControl4 = gui
37302
+ // .add(selectedLens[3], 'opacity', 0, 1)
37303
+ // .name('Opacity');
37304
+ // opacityControl1.onChange((opacity) => {
37305
+ // if (lensMaterial) {
37306
+ // gu.opacities.value[0] = opacity;
37307
+ // }
37308
+ // });
37309
+ // opacityControl2.onChange((opacity) => {
37310
+ // if (lensMaterial) {
37311
+ // gu.opacities.value[1] = opacity;
37312
+ // }
37313
+ // });
37314
+ // opacityControl3.onChange((opacity) => {
37315
+ // if (lensMaterial) {
37316
+ // gu.opacities.value[2] = opacity;
37317
+ // }
37318
+ // });
37319
+ // opacityControl4.onChange((opacity) => {
37320
+ // if (lensMaterial) {
37321
+ // gu.opacities.value[3] = opacity;
37322
+ // }
37323
+ // });
37324
+ // const colorControl1 = gui.addColor(selectedLens[0], 'color').name(name);
37325
+ // const colorControl2 = gui.addColor(selectedLens[1], 'color').name(name);
37326
+ // const colorControl3 = gui.addColor(selectedLens[2], 'color').name(name);
37327
+ // const colorControl4 = gui.addColor(selectedLens[3], 'color').name(name);
37328
+ // colorControl1.onChange((color) => {
37329
+ // if (lensMaterial) {
37330
+ // gu.colors.value[0] = new THREE.Color(color);
37331
+ // }
37332
+ // });
37333
+ // colorControl2.onChange((color) => {
37334
+ // if (lensMaterial) {
37335
+ // gu.colors.value[1] = new THREE.Color(color);
37336
+ // }
37337
+ // });
37338
+ // colorControl3.onChange((color) => {
37339
+ // if (lensMaterial) {
37340
+ // gu.colors.value[2] = new THREE.Color(color);
37341
+ // }
37342
+ // });
37343
+ // colorControl4.onChange((color) => {
37344
+ // if (lensMaterial) {
37345
+ // gu.colors.value[3] = new THREE.Color(color);
37346
+ // }
37347
+ // });
37348
+ // }
39764
37349
  setupAndRenderScene(model) {
39765
37350
  this.scene.remove(this.scene.children[0], this.scene.children[2]);
39766
37351
  const Modelscene = model;
@@ -39784,28 +37369,28 @@ var __publicField = (obj, key, value) => {
39784
37369
  -0.2564218846390263
39785
37370
  );
39786
37371
  this.camera.position.set(
39787
- 4.1833384904942355,
39788
- 0.22167120846009788,
39789
- 3.1674384468981134
37372
+ 2.2,
37373
+ 2.2,
37374
+ 4
39790
37375
  );
39791
37376
  controls.minDistance = 3;
39792
37377
  controls.maxDistance = 9;
37378
+ controls.enableDamping = true;
39793
37379
  controls.dampingFactor = 0.2;
39794
37380
  controls.enablePan = true;
39795
37381
  controls.minPolarAngle = -Math.PI * 5 / 36;
39796
37382
  controls.maxPolarAngle = Math.PI * 3 / 5;
39797
37383
  controls.update();
39798
- controls.enableDamping = true;
39799
37384
  this.renderer.toneMapping = ACESFilmicToneMapping;
39800
37385
  this.renderer.toneMappingExposure = 1.2;
39801
- this.renderer.useLegacyLights = true;
37386
+ this.renderer.setClearColor(15724527);
39802
37387
  const PLANE_WIDTH = 2.5;
39803
37388
  const PLANE_HEIGHT = 2.5;
39804
37389
  const CAMERA_HEIGHT = 0.4;
39805
37390
  const state = {
39806
37391
  shadow: {
39807
- blur: 0.9,
39808
- darkness: 0.9,
37392
+ blur: 0.6,
37393
+ darkness: 1,
39809
37394
  opacity: 0.6
39810
37395
  },
39811
37396
  plane: {
@@ -39884,6 +37469,11 @@ var __publicField = (obj, key, value) => {
39884
37469
  renderer.render(blurPlane, shadowCamera);
39885
37470
  blurPlane.visible = false;
39886
37471
  }
37472
+ shadowCamera.far = 0.125;
37473
+ updateShadowCamera();
37474
+ function updateShadowCamera() {
37475
+ shadowCamera.updateProjectionMatrix();
37476
+ }
39887
37477
  const animate = () => {
39888
37478
  controls.update();
39889
37479
  const initialBackground = this.scene.background;
@@ -39897,7 +37487,6 @@ var __publicField = (obj, key, value) => {
39897
37487
  this.renderer.render(this.scene, shadowCamera);
39898
37488
  this.scene.overrideMaterial = null;
39899
37489
  blurShadow(state.shadow.blur, this.renderer);
39900
- blurShadow(state.shadow.blur * 0.4, this.renderer);
39901
37490
  this.renderer.setRenderTarget(null);
39902
37491
  this.renderer.setClearAlpha(initialClearAlpha);
39903
37492
  this.scene.background = initialBackground;
@@ -40864,6 +38453,7 @@ var __publicField = (obj, key, value) => {
40864
38453
  }
40865
38454
  let customRenderer = null;
40866
38455
  let currentFrame = null;
38456
+ let hasSpecialDefaultLens = false;
40867
38457
  async function changeCustomRenderer({
40868
38458
  orgId,
40869
38459
  apiService,
@@ -40878,11 +38468,12 @@ var __publicField = (obj, key, value) => {
40878
38468
  orgId,
40879
38469
  assetsId: frame._id
40880
38470
  });
40881
- const defaultLens = frame.customisation.length > 0 ? frame.customisation.find((x2) => x2.type == "Lens") : null;
40882
- customRenderer.renderModel(apiRes.asset.cloudfrontUrl, defaultLens == null, apiRes.decryptionKey).then(() => {
40883
- if (frame.customisation.length > 0 && defaultLens) {
38471
+ hasSpecialDefaultLens = frame.customisation.length == 0;
38472
+ const includedLens = hasSpecialDefaultLens ? null : frame.customisation.find((x2) => x2.type == "Lens");
38473
+ customRenderer.renderModel(apiRes.asset.cloudfrontUrl, hasSpecialDefaultLens, apiRes.decryptionKey).then(() => {
38474
+ if (includedLens) {
40884
38475
  customRenderer.setupLensMaterial(
40885
- defaultLens
38476
+ includedLens
40886
38477
  );
40887
38478
  }
40888
38479
  currentFrame = frame;
@@ -40902,6 +38493,9 @@ var __publicField = (obj, key, value) => {
40902
38493
  const [modelLoading, setModelLoading] = reactExports.useState(false);
40903
38494
  const orgId = apiService.fetcher.LoadConfig().ORGID;
40904
38495
  const changeFrame = (frame) => {
38496
+ if (selectedFrame == frame) {
38497
+ return;
38498
+ }
40905
38499
  if (customRenderer) {
40906
38500
  (async () => {
40907
38501
  if (selectedLens) {
@@ -40910,18 +38504,17 @@ var __publicField = (obj, key, value) => {
40910
38504
  orgId,
40911
38505
  assetsId: frame._id
40912
38506
  });
40913
- const defaultCustomisation = frame.customisation.length > 0 ? frame.customisation.find((x2) => x2.type == "Lens") : null;
40914
- const renderAsIs = defaultCustomisation == null && selectedLens.sku == "lens-default";
38507
+ hasSpecialDefaultLens = frame.customisation.length == 0;
38508
+ const includedLens = hasSpecialDefaultLens ? null : frame.customisation.find((x2) => x2.type == "Lens");
38509
+ const renderAsIs = hasSpecialDefaultLens && selectedLens.sku == "lens-default";
40915
38510
  customRenderer.renderModel(apiRes.asset.cloudfrontUrl, renderAsIs, apiRes.decryptionKey).then(async () => {
40916
- if (selectedLens && selectedLens.sku == "lens-default") {
40917
- if (defaultCustomisation) {
38511
+ if (selectedLens.sku == "lens-default") {
38512
+ if (includedLens) {
40918
38513
  customRenderer.setupLensMaterial(
40919
- defaultCustomisation
38514
+ includedLens
40920
38515
  );
40921
- } else {
40922
- console.log("Special lens detected.");
40923
38516
  }
40924
- } else if (selectedLens) {
38517
+ } else {
40925
38518
  customRenderer.setupLensMaterial(
40926
38519
  selectedLens
40927
38520
  );
@@ -40935,24 +38528,38 @@ var __publicField = (obj, key, value) => {
40935
38528
  setSelectedFrame(frame);
40936
38529
  };
40937
38530
  const changeLens = async (lens) => {
38531
+ if (selectedLens == lens) {
38532
+ return;
38533
+ }
40938
38534
  if (customRenderer && currentFrame && lens) {
40939
- const defaultCustomisation = currentFrame.customisation.length > 0 ? currentFrame.customisation.find((x2) => x2.type == "Lens") : null;
40940
- const renderAsIs = defaultCustomisation == null && lens.sku == "lens-default";
40941
- if (lens.sku == "lens-default") {
40942
- if (defaultCustomisation) {
40943
- customRenderer.setupLensMaterial(defaultCustomisation);
40944
- } else {
40945
- setModelLoading(true);
40946
- if (currentFrame) {
40947
- const apiRes = await apiService.DownloadMA({
40948
- orgId,
40949
- assetsId: currentFrame._id
40950
- });
40951
- customRenderer.renderModel(apiRes.asset.cloudfrontUrl, renderAsIs, apiRes.decryptionKey).then(() => {
40952
- setModelLoading(false);
40953
- });
40954
- }
38535
+ hasSpecialDefaultLens = currentFrame.customisation.length == 0;
38536
+ const includedLens = hasSpecialDefaultLens ? null : currentFrame.customisation.find((x2) => x2.type == "Lens");
38537
+ const renderAsIs = hasSpecialDefaultLens && lens.sku == "lens-default";
38538
+ if (renderAsIs) {
38539
+ setModelLoading(true);
38540
+ if (currentFrame) {
38541
+ const apiRes = await apiService.DownloadMA({
38542
+ orgId,
38543
+ assetsId: currentFrame._id
38544
+ });
38545
+ customRenderer.renderModel(apiRes.asset.cloudfrontUrl, renderAsIs, apiRes.decryptionKey).then(() => {
38546
+ setModelLoading(false);
38547
+ });
38548
+ }
38549
+ } else if (hasSpecialDefaultLens && lens.sku != "lens-default") {
38550
+ setModelLoading(true);
38551
+ if (currentFrame) {
38552
+ const apiRes = await apiService.DownloadMA({
38553
+ orgId,
38554
+ assetsId: currentFrame._id
38555
+ });
38556
+ customRenderer.renderModel(apiRes.asset.cloudfrontUrl, renderAsIs, apiRes.decryptionKey).then(() => {
38557
+ setModelLoading(false);
38558
+ customRenderer.setupLensMaterial(lens);
38559
+ });
40955
38560
  }
38561
+ } else if (!hasSpecialDefaultLens && lens.sku == "lens-default") {
38562
+ customRenderer.setupLensMaterial(includedLens);
40956
38563
  } else {
40957
38564
  customRenderer.setupLensMaterial(lens);
40958
38565
  }