@ms-atlas-module/datastudio-datafactory 0.1.36

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.

Potentially problematic release.


This version of @ms-atlas-module/datastudio-datafactory might be problematic. Click here for more details.

Files changed (111) hide show
  1. package/_generated/ClientResources.js +1549 -0
  2. package/_generated/Framework.js +97 -0
  3. package/_generated/Svg.js +201 -0
  4. package/bootstrapper/BreadcrumbsKnockoutBinding.js +25 -0
  5. package/bootstrapper/CSS/Callout.css +43 -0
  6. package/bootstrapper/CSS/Common.css +22 -0
  7. package/bootstrapper/CSS/FormFields.css +133 -0
  8. package/bootstrapper/CSS/InlineBlock.css +34 -0
  9. package/bootstrapper/CSS/ParameterGroups.css +77 -0
  10. package/bootstrapper/CSS/Pivot.css +25 -0
  11. package/bootstrapper/CSS/Wizard.css +197 -0
  12. package/bootstrapper/CalloutBinding.js +52 -0
  13. package/bootstrapper/CollapsibleKnockoutBinding.js +70 -0
  14. package/bootstrapper/CopyBinding.js +150 -0
  15. package/bootstrapper/FilterFlyoutKnockoutBinding.js +114 -0
  16. package/bootstrapper/FormFields.js +397 -0
  17. package/bootstrapper/InlineBlockBinding.js +69 -0
  18. package/bootstrapper/JQueryUIBindings.js +152 -0
  19. package/bootstrapper/KnockoutBindings.js +635 -0
  20. package/bootstrapper/LoadingBinding.js +54 -0
  21. package/bootstrapper/MonacoEditorKnockoutBinding.js +67 -0
  22. package/bootstrapper/ParameterGroupsBinding.js +289 -0
  23. package/bootstrapper/PivotKnockoutBinding.js +61 -0
  24. package/bootstrapper/StatusCalendarFlyoutKnockoutBinding.js +398 -0
  25. package/bootstrapper/StatusCalendarKnockoutBinding.js +107 -0
  26. package/bootstrapper/TelemetryKnockoutBinding.js +68 -0
  27. package/bootstrapper/WinJSButtonKnockoutBinding.js +72 -0
  28. package/bootstrapper/WinJSKnockoutBindings.js +49 -0
  29. package/bootstrapper/WizardBinding.js +611 -0
  30. package/bootstrapper/startup.js +29 -0
  31. package/libs/VivaGraphControl/Content/CSS/Graph.css +157 -0
  32. package/libs/VivaGraphControl/Content/CSS/LightTheme.css +699 -0
  33. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Base/Base.TriggerableLifetimeManager.js +190 -0
  34. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Base/Base.js +647 -0
  35. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Base/Image.js +113 -0
  36. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Base/KnockoutExtensions.js +1064 -0
  37. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/DockedBalloon.js +18 -0
  38. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/Animation.js +192 -0
  39. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/Commands/MoveNodes.js +83 -0
  40. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/Geometry.js +167 -0
  41. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/GraphEntityViewModel.js +260 -0
  42. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/GraphViewModel.js +338 -0
  43. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/GraphWidget.Constants.js +178 -0
  44. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/GraphWidget.js +5190 -0
  45. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/MouseCapture.js +148 -0
  46. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Controls/Visualization/Graph/SvgUtils.js +164 -0
  47. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Util/Detection.js +658 -0
  48. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Util/Resize.js +241 -0
  49. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Util/Util.Private.js +236 -0
  50. package/libs/VivaGraphControl/Content/Scripts/Viva.Controls/Util/Util.js +905 -0
  51. package/libs/WinJS/WinJs.min.js +61909 -0
  52. package/libs/WinJS/ui-light.css +8500 -0
  53. package/package.json +15 -0
  54. package/scripts/AppContext.js +262 -0
  55. package/scripts/ExposureControl.js +11 -0
  56. package/scripts/Framework/Model/ActivityWindowCache.js +390 -0
  57. package/scripts/Framework/Model/ArmDataFactoryCache.js +77 -0
  58. package/scripts/Framework/Model/Contracts/Activity.js +83 -0
  59. package/scripts/Framework/Model/Contracts/ActivityWindow.js +185 -0
  60. package/scripts/Framework/Model/Contracts/BaseEncodable.js +106 -0
  61. package/scripts/Framework/Model/Contracts/Common.js +19 -0
  62. package/scripts/Framework/Model/Contracts/DataArtifact.js +100 -0
  63. package/scripts/Framework/Model/Contracts/Diagram.js +9 -0
  64. package/scripts/Framework/Model/Contracts/Encodable.js +113 -0
  65. package/scripts/Framework/Model/Contracts/Gateway.js +98 -0
  66. package/scripts/Framework/Model/Contracts/LinkedService.js +200 -0
  67. package/scripts/Framework/Model/Contracts/Pipeline.js +197 -0
  68. package/scripts/Framework/Model/DataCache.js +105 -0
  69. package/scripts/Framework/Model/DataFactoryCache.js +24 -0
  70. package/scripts/Framework/Model/Filter.js +186 -0
  71. package/scripts/Framework/Model/Helpers/ActivityWindowHelper.js +185 -0
  72. package/scripts/Framework/Model/MonitoringView.js +40 -0
  73. package/scripts/Framework/Shared/Constants.js +27 -0
  74. package/scripts/Framework/Shared/DataConstants.js +61 -0
  75. package/scripts/Framework/Shared/Disposable.js +53 -0
  76. package/scripts/Framework/Shared/IconResources.js +59 -0
  77. package/scripts/Framework/Shared/Resources/IbizaSvgs.js +241 -0
  78. package/scripts/Framework/Shared/TypeDeclarations.js +4 -0
  79. package/scripts/Framework/Telemetry/Telemetry.js +78 -0
  80. package/scripts/Framework/UI/Breadcrumbs.js +84 -0
  81. package/scripts/Framework/UI/Command.js +231 -0
  82. package/scripts/Framework/UI/ContextMenu.js +80 -0
  83. package/scripts/Framework/UI/Loader.js +11 -0
  84. package/scripts/Framework/UI/Menu.js +65 -0
  85. package/scripts/Framework/UI/PanelMessage.js +25 -0
  86. package/scripts/Framework/UI/Refresh.js +70 -0
  87. package/scripts/Framework/UI/Spinner.js +61 -0
  88. package/scripts/Framework/UI/StatusCalendar.js +1070 -0
  89. package/scripts/Framework/UI/Toolbar.js +84 -0
  90. package/scripts/Framework/Util/Datetime.js +258 -0
  91. package/scripts/Framework/Util/Log.js +10 -0
  92. package/scripts/Framework/Util/ResourceIdUtil.js +56 -0
  93. package/scripts/Framework/Util/Security.js +73 -0
  94. package/scripts/Framework/Util/Util.js +332 -0
  95. package/scripts/Framework/Views/HoverFlyout.js +92 -0
  96. package/scripts/Handlers/ErrorHandler.js +176 -0
  97. package/scripts/Handlers/MessageHandler.js +115 -0
  98. package/scripts/Handlers/MonitoringViewHandler.js +199 -0
  99. package/scripts/Handlers/RoutingHandler.js +364 -0
  100. package/scripts/Handlers/WinJSHandlers.js +265 -0
  101. package/scripts/MonitoringViewContext.js +75 -0
  102. package/scripts/Services/AzureInsightsService.js +162 -0
  103. package/scripts/Services/AzureResourceManagerService.js +869 -0
  104. package/scripts/Services/BaseService.js +232 -0
  105. package/scripts/Services/DataFactoryService.js +204 -0
  106. package/scripts/Services/HDInsightArmService.js +59 -0
  107. package/scripts/ViewContext.js +9 -0
  108. package/stylesheets/main.css +1042 -0
  109. package/views/Edit/DateTimeFilterViewModel.js +211 -0
  110. package/views/Edit/FilterViewModel.js +131 -0
  111. package/views/Shared/ProvisioningState.js +11 -0
@@ -0,0 +1,658 @@
1
+ /// <reference path="../../Definitions/jquery.d.ts" />
2
+ /// <reference path="../../Definitions/Q.d.ts" />
3
+ define(["require", "exports"], function (require, exports) {
4
+ var Main;
5
+ (function (Main) {
6
+ "use strict";
7
+ var global = window,
8
+ $ = jQuery;
9
+ /**
10
+ * Detection of browsers and features.
11
+ */
12
+ var Detection = (function () {
13
+ function Detection() {}
14
+ Object.defineProperty(Detection, "Features", {
15
+ /**
16
+ * Feature detection.
17
+ *
18
+ * @return The feature detection.
19
+ */
20
+ get: function () {
21
+ if (!this._features) {
22
+ this._features = new FeatureDetection();
23
+ }
24
+ return this._features;
25
+ },
26
+ enumerable: true,
27
+ configurable: true,
28
+ });
29
+ Object.defineProperty(Detection, "Browsers", {
30
+ /**
31
+ * Browser detection.
32
+ * (only unit tests and feature detection should use this)
33
+ *
34
+ * @return The browser detection.
35
+ */
36
+ get: function () {
37
+ if (!this._browsers) {
38
+ this._browsers = new BrowserDetection();
39
+ }
40
+ return this._browsers;
41
+ },
42
+ enumerable: true,
43
+ configurable: true,
44
+ });
45
+ return Detection;
46
+ })();
47
+ Main.Detection = Detection;
48
+ /**
49
+ * Browser detection.
50
+ * (only unit tests and feature detection should use this class)
51
+ */
52
+ var BrowserDetection = (function () {
53
+ function BrowserDetection() {}
54
+ Object.defineProperty(BrowserDetection.prototype, "firefox", {
55
+ /**
56
+ * Detects if the browser is Firefox
57
+ * (only unit tests and feature detection should use this method)
58
+ *
59
+ * @return Indicates if the browser is Firefox.
60
+ */
61
+ get: function () {
62
+ if (this._firefox === undefined) {
63
+ this._firefox = /Firefox\//i.test(global.navigator.userAgent);
64
+ }
65
+ return this._firefox;
66
+ },
67
+ enumerable: true,
68
+ configurable: true,
69
+ });
70
+ Object.defineProperty(BrowserDetection.prototype, "chrome", {
71
+ /**
72
+ * Detects if the browser is Chrome
73
+ * (only unit tests and feature detection should use this method)
74
+ *
75
+ * @return Indicates if the browser is Chrome.
76
+ */
77
+ get: function () {
78
+ if (this._chrome === undefined) {
79
+ this._chrome = /Chrome[ \/]/i.test(global.navigator.userAgent);
80
+ }
81
+ return this._chrome;
82
+ },
83
+ enumerable: true,
84
+ configurable: true,
85
+ });
86
+ Object.defineProperty(BrowserDetection.prototype, "ie", {
87
+ /**
88
+ * Detects if the browser is IE
89
+ * (only unit tests and feature detection should use this method)
90
+ *
91
+ * @return Indicates if the browser is IE.
92
+ */
93
+ get: function () {
94
+ if (this._ie === undefined) {
95
+ this._ie =
96
+ /MSIE /i.test(global.navigator.userAgent) ||
97
+ /Trident[\/]/i.test(global.navigator.userAgent) ||
98
+ /Edge[\/]/i.test(global.navigator.userAgent);
99
+ }
100
+ return this._ie;
101
+ },
102
+ enumerable: true,
103
+ configurable: true,
104
+ });
105
+ Object.defineProperty(BrowserDetection.prototype, "ie11", {
106
+ /**
107
+ * Detects if the browser is IE11
108
+ * (only unit tests and feature detection should use this method)
109
+ *
110
+ * @return Indicates if the browser is IE11.
111
+ */
112
+ get: function () {
113
+ if (this._ie11 === undefined) {
114
+ this._ie11 =
115
+ !/MSIE /i.test(global.navigator.userAgent) &&
116
+ (/Trident[\/]/i.test(global.navigator.userAgent) ||
117
+ /Edge[\/]/i.test(global.navigator.userAgent));
118
+ }
119
+ return this._ie11;
120
+ },
121
+ enumerable: true,
122
+ configurable: true,
123
+ });
124
+ return BrowserDetection;
125
+ })();
126
+ Main.BrowserDetection = BrowserDetection;
127
+ /**
128
+ * Detects events that are supported in the current environment.
129
+ */
130
+ var EventDetection = (function () {
131
+ /**
132
+ * Constructs and initializes event detection.
133
+ */
134
+ function EventDetection() {
135
+ this._div = document.createElement("div");
136
+ // Initiate async detections
137
+ this._detectionComplete = Q.allSettled([
138
+ this._detectObjResize(),
139
+ this._detectOverflow(),
140
+ this._detectUnderflow(),
141
+ this._detectDivResize(),
142
+ this._detectSvgResize(),
143
+ ]);
144
+ }
145
+ /**
146
+ * Creates a promise that completes when all the async detections are done.
147
+ *
148
+ * @return The completion promise.
149
+ */
150
+ EventDetection.prototype.complete = function () {
151
+ return this._detectionComplete;
152
+ };
153
+ Object.defineProperty(EventDetection.prototype, "divResize", {
154
+ /**
155
+ * Indicates if resize is supported on a div.
156
+ *
157
+ * @return True if supported.
158
+ */
159
+ get: function () {
160
+ return this._divResize;
161
+ },
162
+ enumerable: true,
163
+ configurable: true,
164
+ });
165
+ Object.defineProperty(EventDetection.prototype, "svgResize", {
166
+ /**
167
+ * Indicates if resize is supported on an svg.
168
+ *
169
+ * @return True if supported.
170
+ */
171
+ get: function () {
172
+ return this._svgResize;
173
+ },
174
+ enumerable: true,
175
+ configurable: true,
176
+ });
177
+ Object.defineProperty(EventDetection.prototype, "objResize", {
178
+ /**
179
+ * Indicates if resize is supported on an object.
180
+ *
181
+ * @return True if supported.
182
+ */
183
+ get: function () {
184
+ return this._objResize;
185
+ },
186
+ enumerable: true,
187
+ configurable: true,
188
+ });
189
+ Object.defineProperty(EventDetection.prototype, "overflowchanged", {
190
+ /**
191
+ * Indicates if overflowchanged method is supported.
192
+ *
193
+ * @return True if supported.
194
+ */
195
+ get: function () {
196
+ if (this._overflowchanged === undefined) {
197
+ this._overflowchanged = global.OverflowEvent !== undefined;
198
+ }
199
+ return this._overflowchanged;
200
+ },
201
+ enumerable: true,
202
+ configurable: true,
203
+ });
204
+ Object.defineProperty(EventDetection.prototype, "overflow", {
205
+ /**
206
+ * Indicates if overflow event is supported.
207
+ *
208
+ * @return True if supported.
209
+ */
210
+ get: function () {
211
+ return this._overflow;
212
+ },
213
+ enumerable: true,
214
+ configurable: true,
215
+ });
216
+ Object.defineProperty(EventDetection.prototype, "underflow", {
217
+ /**
218
+ * Indicates if underflow event is supported.
219
+ *
220
+ * @return True if supported.
221
+ */
222
+ get: function () {
223
+ return this._underflow;
224
+ },
225
+ enumerable: true,
226
+ configurable: true,
227
+ });
228
+ /**
229
+ * Determines if an element supports an event.
230
+ * Works for most but not all events.
231
+ *
232
+ * @param event The name of the event to check.
233
+ * @param element The element to check (div if not specified).
234
+ * @return Indicates if the event is supported.
235
+ */
236
+ EventDetection.prototype.supported = function (event, element) {
237
+ var supported = false;
238
+ if (!element) {
239
+ element = this._div;
240
+ }
241
+ event = "on" + event;
242
+ if (event in element) {
243
+ supported = true;
244
+ } else {
245
+ element.setAttribute(event, "");
246
+ // <any> type seems more appropriate than StringMap<Function> since this is a DOM element
247
+ var untypedElement = element;
248
+ if (typeof untypedElement[event] === "function") {
249
+ supported = true;
250
+ untypedElement[event] = undefined;
251
+ }
252
+ element.removeAttribute(event);
253
+ }
254
+ return supported;
255
+ };
256
+ /**
257
+ * Detects if overflow event is supported.
258
+ */
259
+ EventDetection.prototype._detectOverflow = function () {
260
+ var _this = this;
261
+ this._overflowDeferred = Q.defer();
262
+ this._overflow = Detection.Browsers.firefox;
263
+ $(function () {
264
+ var body, element, content;
265
+ body = $("body");
266
+ element = $(
267
+ "<div class='azc-eventdetection-overflow' style='position:fixed; top:-1000px; width:10px; height:10px; overflow:hidden'></div>"
268
+ ).appendTo(body);
269
+ content = $("<div style ='width:8px; height:8px'></div>").appendTo(
270
+ element
271
+ );
272
+ setTimeout(function () {
273
+ _this
274
+ ._eventPromise(_this._overflowDeferred, element, "overflow", 200)
275
+ .then(
276
+ function () {
277
+ _this._overflow = true;
278
+ },
279
+ function () {
280
+ _this._overflow = false;
281
+ }
282
+ )
283
+ .finally(function () {
284
+ element.remove();
285
+ });
286
+ // overflow the div
287
+ content.height(12);
288
+ }, 40);
289
+ });
290
+ return this._overflowDeferred.promise;
291
+ };
292
+ /**
293
+ * Detects if underflow event is supported.
294
+ */
295
+ EventDetection.prototype._detectUnderflow = function () {
296
+ var _this = this;
297
+ this._underflowDeferred = Q.defer();
298
+ this._underflow = Detection.Browsers.firefox;
299
+ $(function () {
300
+ var body, element, content;
301
+ body = $("body");
302
+ element = $(
303
+ "<div class='azc-eventdetection-underflow' style='position:fixed; top:-1000px; width:10px; height:10px; overflow:hidden'></div>"
304
+ ).appendTo(body);
305
+ content = $("<div style ='width:12px; height:12px'></div>").appendTo(
306
+ element
307
+ );
308
+ setTimeout(function () {
309
+ _this
310
+ ._eventPromise(
311
+ _this._underflowDeferred,
312
+ element,
313
+ "underflow",
314
+ 200
315
+ )
316
+ .then(
317
+ function () {
318
+ _this._underflow = true;
319
+ },
320
+ function () {
321
+ _this._underflow = false;
322
+ }
323
+ )
324
+ .finally(function () {
325
+ element.remove();
326
+ });
327
+ // underflow the div
328
+ content.height(8);
329
+ }, 40);
330
+ });
331
+ return this._underflowDeferred.promise;
332
+ };
333
+ /**
334
+ * Detects if div element supports resize event.
335
+ */
336
+ EventDetection.prototype._detectDivResize = function () {
337
+ var _this = this;
338
+ this._divResizeDeferred = Q.defer();
339
+ this._divResize = Detection.Browsers.ie;
340
+ // Not supported without attachEvent and detachEvent
341
+ var target = this._div;
342
+ if (!target.attachEvent || !target.detachEvent) {
343
+ this._divResize = false;
344
+ this._divResizeDeferred.resolve();
345
+ return;
346
+ }
347
+ $(function () {
348
+ var body, element;
349
+ body = $("body");
350
+ element = $(
351
+ "<div class='azc-eventdetection-divresize' style='position:fixed; top:-1000px; width:10px; height:10px;'></div>"
352
+ ).appendTo(body);
353
+ setTimeout(function () {
354
+ _this
355
+ ._attacheventPromise(
356
+ _this._divResizeDeferred,
357
+ element[0],
358
+ "resize",
359
+ 200
360
+ )
361
+ .then(
362
+ function () {
363
+ _this._divResize = true;
364
+ },
365
+ function () {
366
+ _this._divResize = false;
367
+ }
368
+ )
369
+ .finally(function () {
370
+ element.remove();
371
+ });
372
+ // resize the div
373
+ element.height(12);
374
+ }, 40);
375
+ });
376
+ return this._divResizeDeferred.promise;
377
+ };
378
+ /**
379
+ * Detects if svg element supports resize event.
380
+ */
381
+ EventDetection.prototype._detectSvgResize = function () {
382
+ var _this = this;
383
+ this._svgResizeDeferred = Q.defer();
384
+ this._svgResize = Detection.Browsers.ie11;
385
+ $(function () {
386
+ var body, element, content;
387
+ body = $("body");
388
+ element = $(
389
+ "<div class='azc-eventdetection-svgresize' style='position:fixed; top:-1000px; width:10px; height:10px;'></div>"
390
+ ).appendTo(body);
391
+ content = $(
392
+ "<svg onresize='' style='width:100%; height:100%; z-index:-1'></svg>"
393
+ ).appendTo(element);
394
+ setTimeout(function () {
395
+ _this
396
+ ._oneventPromise(
397
+ _this._svgResizeDeferred,
398
+ content[0],
399
+ "resize",
400
+ 200
401
+ )
402
+ .then(
403
+ function () {
404
+ _this._svgResize = true;
405
+ },
406
+ function () {
407
+ _this._svgResize = false;
408
+ }
409
+ )
410
+ .finally(function () {
411
+ element.remove();
412
+ });
413
+ // resize the div
414
+ element.height(12);
415
+ }, 40);
416
+ });
417
+ return this._svgResizeDeferred.promise;
418
+ };
419
+ /**
420
+ * Detects if svg element supports resize event.
421
+ */
422
+ EventDetection.prototype._detectObjResize = function () {
423
+ var _this = this;
424
+ this._objResizeDeferred = Q.defer();
425
+ this._objResize =
426
+ Detection.Browsers.ie ||
427
+ Detection.Browsers.chrome ||
428
+ Detection.Browsers.firefox;
429
+ $(function () {
430
+ var body = $("body");
431
+ var element = $(
432
+ "<div class='azc-eventdetection-objresize' style='position:fixed; top:-1000px; width:10px; height:10px;'></div>"
433
+ ).appendTo(body);
434
+ var content = $(
435
+ "<object type='text/html' style='width:100%; height:100%; z-index:-1'></object>"
436
+ ).appendTo(element);
437
+ var obj = content[0];
438
+ // Wait for the object to load
439
+ obj.addEventListener("load", function () {
440
+ // Wait for a resize event
441
+ _this
442
+ ._windowEventPromise(
443
+ _this._objResizeDeferred,
444
+ obj.contentDocument.defaultView,
445
+ "resize",
446
+ 300
447
+ )
448
+ .then(
449
+ function () {
450
+ _this._objResize = true;
451
+ },
452
+ function () {
453
+ _this._objResize = false;
454
+ }
455
+ )
456
+ .finally(function () {
457
+ element.remove();
458
+ });
459
+ // Resize the div
460
+ element.height(12);
461
+ });
462
+ // Load the object
463
+ obj.data = "about:blank";
464
+ });
465
+ return this._objResizeDeferred.promise;
466
+ };
467
+ /**
468
+ * Handles an event using a promise.
469
+ *
470
+ * @param deferred The deferred object to use.
471
+ * @param window The window to listen on.
472
+ * @param event The event name to listen for.
473
+ * @param timeout The max time to wait for the event callback.
474
+ * @return The promise.
475
+ */
476
+ EventDetection.prototype._windowEventPromise = function (
477
+ deferred,
478
+ window,
479
+ event,
480
+ timeout
481
+ ) {
482
+ var handler, timeoutId;
483
+ handler = function () {
484
+ if (timeoutId) {
485
+ clearTimeout(timeoutId);
486
+ }
487
+ deferred.resolve();
488
+ };
489
+ window.addEventListener(event, handler);
490
+ timeoutId = setTimeout(function () {
491
+ timeoutId = null;
492
+ deferred.reject();
493
+ }, timeout);
494
+ return deferred.promise.finally(function () {
495
+ window.removeEventListener(event, handler);
496
+ });
497
+ };
498
+ /**
499
+ * Handles an event using a promise.
500
+ *
501
+ * @param deferred The deferred object to use.
502
+ * @param element The element to listen on.
503
+ * @param event The event name to listen for.
504
+ * @param timeout The max time to wait for the event callback.
505
+ * @return The promise.
506
+ */
507
+ EventDetection.prototype._eventPromise = function (
508
+ deferred,
509
+ element,
510
+ event,
511
+ timeout
512
+ ) {
513
+ var handler, timeoutId;
514
+ handler = function (evt) {
515
+ if (timeoutId) {
516
+ clearTimeout(timeoutId);
517
+ }
518
+ deferred.resolve();
519
+ };
520
+ element.on(event, handler);
521
+ timeoutId = setTimeout(function () {
522
+ timeoutId = null;
523
+ deferred.reject();
524
+ }, timeout);
525
+ return deferred.promise.finally(function () {
526
+ element.off(event, handler);
527
+ });
528
+ };
529
+ /**
530
+ * Handles an on event using a promise.
531
+ *
532
+ * @param deferred The deferred object to use.
533
+ * @param element The element to listen on.
534
+ * @param event The event name to listen for.
535
+ * @param timeout The max time to wait for the event callback.
536
+ * @return The promise.
537
+ */
538
+ EventDetection.prototype._oneventPromise = function (
539
+ deferred,
540
+ element,
541
+ event,
542
+ timeout
543
+ ) {
544
+ var handler, timeoutId;
545
+ handler = function () {
546
+ if (timeoutId) {
547
+ clearTimeout(timeoutId);
548
+ }
549
+ deferred.resolve();
550
+ };
551
+ var untypedElement = element;
552
+ untypedElement["on" + event] = handler;
553
+ timeoutId = setTimeout(function () {
554
+ timeoutId = null;
555
+ deferred.reject();
556
+ }, timeout);
557
+ return deferred.promise.finally(function () {
558
+ untypedElement["on" + event] = null;
559
+ });
560
+ };
561
+ /**
562
+ * Handles an attach event using a promise.
563
+ *
564
+ * @param deferred The deferred object to use.
565
+ * @param element The element to listen on.
566
+ * @param event The event name to listen for.
567
+ * @param timeout The max time to wait for the event callback.
568
+ * @return The promise.
569
+ */
570
+ EventDetection.prototype._attacheventPromise = function (
571
+ deferred,
572
+ element,
573
+ event,
574
+ timeout
575
+ ) {
576
+ var handler, timeoutId;
577
+ handler = function () {
578
+ if (timeoutId) {
579
+ clearTimeout(timeoutId);
580
+ }
581
+ deferred.resolve();
582
+ };
583
+ element.attachEvent("on" + event, handler);
584
+ timeoutId = setTimeout(function () {
585
+ timeoutId = null;
586
+ deferred.reject();
587
+ }, timeout);
588
+ return deferred.promise.finally(function () {
589
+ element.detachEvent("on" + event, handler);
590
+ });
591
+ };
592
+ return EventDetection;
593
+ })();
594
+ Main.EventDetection = EventDetection;
595
+ /**
596
+ * Detects features that are supported in the current environment.
597
+ */
598
+ var FeatureDetection = (function () {
599
+ /**
600
+ * Constructs the feature detection.
601
+ */
602
+ function FeatureDetection() {
603
+ this._events = new EventDetection();
604
+ }
605
+ Object.defineProperty(FeatureDetection.prototype, "Events", {
606
+ /**
607
+ * Detected event support.
608
+ */
609
+ get: function () {
610
+ return this._events;
611
+ },
612
+ enumerable: true,
613
+ configurable: true,
614
+ });
615
+ Object.defineProperty(FeatureDetection.prototype, "maxElementHeight", {
616
+ /**
617
+ * The maximum element height for the browser.
618
+ *
619
+ * @return Height in pixels.
620
+ */
621
+ get: function () {
622
+ if (!this._maxElementHeight) {
623
+ var body = $("body"),
624
+ element = $(
625
+ "<div class='azc-featuredetection-maxheight' style='position: fixed; right: -1000px; bottom: -1000px; height: 10000px; width: 100px'></div>"
626
+ ).appendTo(body),
627
+ high = 10000,
628
+ low,
629
+ mid,
630
+ dif;
631
+ while (high === element.height()) {
632
+ low = high;
633
+ high = 10 * low;
634
+ element.height(high);
635
+ }
636
+ while ((dif = high - low) > 10) {
637
+ mid = Math.floor(low + dif / 2);
638
+ element.height(mid);
639
+ if (mid === element.height()) {
640
+ low = mid;
641
+ } else {
642
+ high = mid - 1;
643
+ }
644
+ }
645
+ this._maxElementHeight = low;
646
+ element.remove();
647
+ }
648
+ return this._maxElementHeight;
649
+ },
650
+ enumerable: true,
651
+ configurable: true,
652
+ });
653
+ return FeatureDetection;
654
+ })();
655
+ Main.FeatureDetection = FeatureDetection;
656
+ })(Main || (Main = {}));
657
+ return Main;
658
+ });