fomantic-ui 2.9.1-beta.14 → 2.9.1-beta.16

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 (181) hide show
  1. package/dist/components/accordion.css +1 -1
  2. package/dist/components/accordion.js +14 -12
  3. package/dist/components/accordion.min.css +1 -1
  4. package/dist/components/accordion.min.js +2 -2
  5. package/dist/components/ad.css +1 -1
  6. package/dist/components/ad.min.css +1 -1
  7. package/dist/components/api.js +15 -12
  8. package/dist/components/api.min.js +2 -2
  9. package/dist/components/breadcrumb.css +1 -1
  10. package/dist/components/breadcrumb.min.css +1 -1
  11. package/dist/components/button.css +1 -1
  12. package/dist/components/button.min.css +1 -1
  13. package/dist/components/calendar.css +1 -1
  14. package/dist/components/calendar.js +21 -21
  15. package/dist/components/calendar.min.css +1 -1
  16. package/dist/components/calendar.min.js +2 -2
  17. package/dist/components/card.css +1 -1
  18. package/dist/components/card.min.css +1 -1
  19. package/dist/components/checkbox.css +1 -1
  20. package/dist/components/checkbox.js +7 -7
  21. package/dist/components/checkbox.min.css +1 -1
  22. package/dist/components/checkbox.min.js +2 -2
  23. package/dist/components/comment.css +1 -1
  24. package/dist/components/comment.min.css +1 -1
  25. package/dist/components/container.css +1 -1
  26. package/dist/components/container.min.css +1 -1
  27. package/dist/components/dimmer.css +1 -1
  28. package/dist/components/dimmer.js +8 -8
  29. package/dist/components/dimmer.min.css +1 -1
  30. package/dist/components/dimmer.min.js +2 -2
  31. package/dist/components/divider.css +1 -1
  32. package/dist/components/divider.min.css +1 -1
  33. package/dist/components/dropdown.css +1 -1
  34. package/dist/components/dropdown.js +23 -23
  35. package/dist/components/dropdown.min.css +1 -1
  36. package/dist/components/dropdown.min.js +2 -2
  37. package/dist/components/embed.css +1 -1
  38. package/dist/components/embed.js +4 -4
  39. package/dist/components/embed.min.css +1 -1
  40. package/dist/components/embed.min.js +2 -2
  41. package/dist/components/feed.css +1 -1
  42. package/dist/components/feed.min.css +1 -1
  43. package/dist/components/flag.css +1 -1
  44. package/dist/components/flag.min.css +1 -1
  45. package/dist/components/flyout.css +1 -1
  46. package/dist/components/flyout.js +26 -24
  47. package/dist/components/flyout.min.css +1 -1
  48. package/dist/components/flyout.min.js +2 -2
  49. package/dist/components/form.css +1 -1
  50. package/dist/components/form.js +15 -15
  51. package/dist/components/form.min.css +1 -1
  52. package/dist/components/form.min.js +2 -2
  53. package/dist/components/grid.css +1 -1
  54. package/dist/components/grid.min.css +1 -1
  55. package/dist/components/header.css +1 -1
  56. package/dist/components/header.min.css +1 -1
  57. package/dist/components/icon.css +1 -1
  58. package/dist/components/icon.min.css +1 -1
  59. package/dist/components/image.css +1 -1
  60. package/dist/components/image.min.css +1 -1
  61. package/dist/components/input.css +138 -8
  62. package/dist/components/input.min.css +2 -2
  63. package/dist/components/item.css +1 -1
  64. package/dist/components/item.min.css +1 -1
  65. package/dist/components/label.css +1 -1
  66. package/dist/components/label.min.css +1 -1
  67. package/dist/components/list.css +1 -1
  68. package/dist/components/list.min.css +1 -1
  69. package/dist/components/loader.css +1 -1
  70. package/dist/components/loader.min.css +1 -1
  71. package/dist/components/message.css +1 -1
  72. package/dist/components/message.min.css +1 -1
  73. package/dist/components/modal.css +1 -1
  74. package/dist/components/modal.js +30 -28
  75. package/dist/components/modal.min.css +1 -1
  76. package/dist/components/modal.min.js +2 -2
  77. package/dist/components/nag.css +1 -1
  78. package/dist/components/nag.js +6 -6
  79. package/dist/components/nag.min.css +1 -1
  80. package/dist/components/nag.min.js +2 -2
  81. package/dist/components/placeholder.css +1 -1
  82. package/dist/components/placeholder.min.css +1 -1
  83. package/dist/components/popup.css +1 -1
  84. package/dist/components/popup.js +9 -9
  85. package/dist/components/popup.min.css +1 -1
  86. package/dist/components/popup.min.js +2 -2
  87. package/dist/components/progress.css +1 -1
  88. package/dist/components/progress.js +8 -8
  89. package/dist/components/progress.min.css +1 -1
  90. package/dist/components/progress.min.js +2 -2
  91. package/dist/components/rail.css +1 -1
  92. package/dist/components/rail.min.css +1 -1
  93. package/dist/components/rating.css +1 -1
  94. package/dist/components/rating.js +4 -4
  95. package/dist/components/rating.min.css +1 -1
  96. package/dist/components/rating.min.js +2 -2
  97. package/dist/components/reset.css +1 -1
  98. package/dist/components/reset.min.css +1 -1
  99. package/dist/components/reveal.css +1 -1
  100. package/dist/components/reveal.min.css +1 -1
  101. package/dist/components/search.css +1 -1
  102. package/dist/components/search.js +12 -12
  103. package/dist/components/search.min.css +1 -1
  104. package/dist/components/search.min.js +2 -2
  105. package/dist/components/segment.css +1 -1
  106. package/dist/components/segment.min.css +1 -1
  107. package/dist/components/shape.css +1 -1
  108. package/dist/components/shape.js +5 -5
  109. package/dist/components/shape.min.css +1 -1
  110. package/dist/components/shape.min.js +2 -2
  111. package/dist/components/sidebar.css +1 -1
  112. package/dist/components/sidebar.js +9 -9
  113. package/dist/components/sidebar.min.css +1 -1
  114. package/dist/components/sidebar.min.js +2 -2
  115. package/dist/components/site.css +1 -1
  116. package/dist/components/site.js +10 -15
  117. package/dist/components/site.min.css +1 -1
  118. package/dist/components/site.min.js +2 -2
  119. package/dist/components/slider.js +18 -13
  120. package/dist/components/slider.min.js +2 -2
  121. package/dist/components/state.js +4 -4
  122. package/dist/components/state.min.js +2 -2
  123. package/dist/components/statistic.css +4 -1
  124. package/dist/components/statistic.min.css +2 -2
  125. package/dist/components/step.css +1 -1
  126. package/dist/components/step.min.css +1 -1
  127. package/dist/components/sticky.css +1 -1
  128. package/dist/components/sticky.js +10 -9
  129. package/dist/components/sticky.min.css +1 -1
  130. package/dist/components/sticky.min.js +2 -2
  131. package/dist/components/tab.css +1 -1
  132. package/dist/components/tab.js +11 -11
  133. package/dist/components/tab.min.css +1 -1
  134. package/dist/components/tab.min.js +2 -2
  135. package/dist/components/table.css +1 -1
  136. package/dist/components/table.min.css +1 -1
  137. package/dist/components/text.css +1 -1
  138. package/dist/components/text.min.css +1 -1
  139. package/dist/components/toast.css +1 -1
  140. package/dist/components/toast.js +28 -25
  141. package/dist/components/toast.min.css +1 -1
  142. package/dist/components/toast.min.js +2 -2
  143. package/dist/components/transition.css +1 -1
  144. package/dist/components/transition.js +4 -4
  145. package/dist/components/transition.min.css +1 -1
  146. package/dist/components/transition.min.js +2 -2
  147. package/dist/components/visibility.js +5 -5
  148. package/dist/components/visibility.min.js +2 -2
  149. package/dist/semantic.css +258 -57
  150. package/dist/semantic.js +307 -294
  151. package/dist/semantic.min.css +2 -2
  152. package/dist/semantic.min.js +2 -2
  153. package/package.json +2 -2
  154. package/src/definitions/behaviors/api.js +14 -11
  155. package/src/definitions/behaviors/form.js +14 -14
  156. package/src/definitions/behaviors/state.js +3 -3
  157. package/src/definitions/behaviors/visibility.js +4 -4
  158. package/src/definitions/elements/input.less +14 -5
  159. package/src/definitions/globals/site.js +9 -14
  160. package/src/definitions/modules/accordion.js +13 -11
  161. package/src/definitions/modules/calendar.js +20 -20
  162. package/src/definitions/modules/checkbox.js +6 -6
  163. package/src/definitions/modules/dimmer.js +7 -7
  164. package/src/definitions/modules/dropdown.js +22 -22
  165. package/src/definitions/modules/embed.js +3 -3
  166. package/src/definitions/modules/flyout.js +25 -23
  167. package/src/definitions/modules/modal.js +29 -27
  168. package/src/definitions/modules/nag.js +5 -5
  169. package/src/definitions/modules/popup.js +8 -8
  170. package/src/definitions/modules/progress.js +7 -7
  171. package/src/definitions/modules/rating.js +3 -3
  172. package/src/definitions/modules/search.js +11 -11
  173. package/src/definitions/modules/shape.js +4 -4
  174. package/src/definitions/modules/sidebar.js +8 -8
  175. package/src/definitions/modules/slider.js +17 -12
  176. package/src/definitions/modules/sticky.js +9 -8
  177. package/src/definitions/modules/tab.js +10 -10
  178. package/src/definitions/modules/toast.js +27 -24
  179. package/src/definitions/modules/transition.js +3 -3
  180. package/src/definitions/views/statistic.less +5 -0
  181. package/src/themes/default/globals/variation.variables +1 -0
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * # Fomantic-UI 2.9.1-beta.14+1a3de4b - Feed
2
+ * # Fomantic-UI 2.9.1-beta.16+7071e59 - Feed
3
3
  * https://github.com/fomantic/Fomantic-UI/
4
4
  *
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * # Fomantic-UI 2.9.1-beta.14+1a3de4b - Feed
2
+ * # Fomantic-UI 2.9.1-beta.16+7071e59 - Feed
3
3
  * https://github.com/fomantic/Fomantic-UI/
4
4
  *
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * # Fomantic-UI 2.9.1-beta.14+1a3de4b - Flag
2
+ * # Fomantic-UI 2.9.1-beta.16+7071e59 - Flag
3
3
  * https://github.com/fomantic/Fomantic-UI/
4
4
  *
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * # Fomantic-UI 2.9.1-beta.14+1a3de4b - Flag
2
+ * # Fomantic-UI 2.9.1-beta.16+7071e59 - Flag
3
3
  * https://github.com/fomantic/Fomantic-UI/
4
4
  *
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * # Fomantic-UI 2.9.1-beta.14+1a3de4b - Flyout
2
+ * # Fomantic-UI 2.9.1-beta.16+7071e59 - Flyout
3
3
  * https://github.com/fomantic/Fomantic-UI/
4
4
  *
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * # Fomantic-UI 2.9.1-beta.14+1a3de4b - Flyout
2
+ * # Fomantic-UI 2.9.1-beta.16+7071e59 - Flyout
3
3
  * https://github.com/fomantic/Fomantic-UI/
4
4
  *
5
5
  *
@@ -12,9 +12,9 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- $.isFunction = $.isFunction || function(obj) {
15
+ function isFunction(obj) {
16
16
  return typeof obj === "function" && typeof obj.nodeType !== "number";
17
- };
17
+ }
18
18
 
19
19
  window = (typeof window != 'undefined' && window.Math == Math)
20
20
  ? window
@@ -105,7 +105,7 @@ $.flyout = $.fn.flyout = function(parameters) {
105
105
  module.create.id();
106
106
  if(!isFlyoutComponent) {
107
107
  module.create.flyout();
108
- if(!$.isFunction(settings.onHidden)) {
108
+ if(!isFunction(settings.onHidden)) {
109
109
  settings.onHidden = function () {
110
110
  module.destroy();
111
111
  $module.remove();
@@ -134,17 +134,19 @@ $.flyout = $.fn.flyout = function(parameters) {
134
134
  icon = el[fields.icon] ? '<i '+(el[fields.text] ? 'aria-hidden="true"' : '')+' class="' + module.helpers.deQuote(el[fields.icon]) + ' icon"></i>' : '',
135
135
  text = module.helpers.escape(el[fields.text] || '', settings.preserveHTML),
136
136
  cls = module.helpers.deQuote(el[fields.class] || ''),
137
- click = el[fields.click] && $.isFunction(el[fields.click]) ? el[fields.click] : function () {}
137
+ click = el[fields.click] && isFunction(el[fields.click]) ? el[fields.click] : function () {}
138
138
  ;
139
139
  $actions.append($('<button/>', {
140
140
  html: icon + text,
141
141
  'aria-label': (el[fields.text] || el[fields.icon] || '').replace(/<[^>]+(>|$)/g,''),
142
142
  class: className.button + ' ' + cls,
143
- click: function () {
144
- if (click.call(element, $module) === false) {
145
- return;
143
+ on: {
144
+ click: function () {
145
+ if (click.call(element, $module) === false) {
146
+ return;
147
+ }
148
+ module.hide();
146
149
  }
147
- module.hide();
148
150
  }
149
151
  }));
150
152
  });
@@ -290,7 +292,7 @@ $.flyout = $.fn.flyout = function(parameters) {
290
292
  keyCode = event.which
291
293
  ;
292
294
  if (keyCode === settings.keys.tab && event.shiftKey) {
293
- $inputs.last().focus();
295
+ $inputs.last().trigger('focus');
294
296
  event.preventDefault();
295
297
  }
296
298
  },
@@ -299,7 +301,7 @@ $.flyout = $.fn.flyout = function(parameters) {
299
301
  keyCode = event.which
300
302
  ;
301
303
  if (keyCode === settings.keys.tab && !event.shiftKey) {
302
- $inputs.first().focus();
304
+ $inputs.first().trigger('focus');
303
305
  event.preventDefault();
304
306
  }
305
307
  }
@@ -579,7 +581,7 @@ $.flyout = $.fn.flyout = function(parameters) {
579
581
  var
580
582
  $toggle = $(selector)
581
583
  ;
582
- event = $.isFunction(module[event])
584
+ event = isFunction(module[event])
583
585
  ? module[event]
584
586
  : module.toggle
585
587
  ;
@@ -595,7 +597,7 @@ $.flyout = $.fn.flyout = function(parameters) {
595
597
  },
596
598
 
597
599
  show: function(callback) {
598
- callback = $.isFunction(callback)
600
+ callback = isFunction(callback)
599
601
  ? callback
600
602
  : function(){}
601
603
  ;
@@ -634,7 +636,7 @@ $.flyout = $.fn.flyout = function(parameters) {
634
636
  },
635
637
 
636
638
  hide: function(callback) {
637
- callback = $.isFunction(callback)
639
+ callback = isFunction(callback)
638
640
  ? callback
639
641
  : function(){}
640
642
  ;
@@ -648,7 +650,7 @@ $.flyout = $.fn.flyout = function(parameters) {
648
650
  module.refreshFlyouts();
649
651
  module.pullPage(function() {
650
652
  callback.call(element);
651
- if($.isFunction(settings.onHidden)) {
653
+ if(isFunction(settings.onHidden)) {
652
654
  settings.onHidden.call(element);
653
655
  }
654
656
  module.restore.focus();
@@ -700,7 +702,7 @@ $.flyout = $.fn.flyout = function(parameters) {
700
702
  dim,
701
703
  transitionEnd
702
704
  ;
703
- callback = $.isFunction(callback)
705
+ callback = isFunction(callback)
704
706
  ? callback
705
707
  : function(){}
706
708
  ;
@@ -738,7 +740,7 @@ $.flyout = $.fn.flyout = function(parameters) {
738
740
  animate,
739
741
  transitionEnd
740
742
  ;
741
- callback = $.isFunction(callback)
743
+ callback = isFunction(callback)
742
744
  ? callback
743
745
  : function(){}
744
746
  ;
@@ -809,7 +811,7 @@ $.flyout = $.fn.flyout = function(parameters) {
809
811
  : ($inputs.length > 1 ? $inputs.filter(':not(i.close)') : $inputs).first()
810
812
  ;
811
813
  if($input.length > 0) {
812
- $input.focus();
814
+ $input.trigger('focus');
813
815
  }
814
816
  },
815
817
  dimmerStyles: function() {
@@ -978,7 +980,7 @@ $.flyout = $.fn.flyout = function(parameters) {
978
980
  inCurrentFlyout = $activeElement.closest($module).length > 0
979
981
  ;
980
982
  if(!inCurrentFlyout) {
981
- $focusedElement = $(document.activeElement).blur();
983
+ $focusedElement = $(document.activeElement).trigger('blur');
982
984
  }
983
985
  },
984
986
  bodyMargin: function() {
@@ -1078,7 +1080,7 @@ $.flyout = $.fn.flyout = function(parameters) {
1078
1080
  restore: {
1079
1081
  focus: function() {
1080
1082
  if($focusedElement && $focusedElement.length > 0 && settings.restoreFocus) {
1081
- $focusedElement.focus();
1083
+ $focusedElement.trigger('focus');
1082
1084
  }
1083
1085
  },
1084
1086
  bodyMargin: function() {
@@ -1267,7 +1269,7 @@ $.flyout = $.fn.flyout = function(parameters) {
1267
1269
  }
1268
1270
  });
1269
1271
  }
1270
- if ( $.isFunction( found ) ) {
1272
+ if ( isFunction( found ) ) {
1271
1273
  response = found.apply(context, passedArguments);
1272
1274
  }
1273
1275
  else if(found !== undefined) {
@@ -1289,7 +1291,7 @@ $.flyout = $.fn.flyout = function(parameters) {
1289
1291
 
1290
1292
  if(methodInvoked) {
1291
1293
  if(instance === undefined) {
1292
- if ($.isFunction(settings.templates[query])) {
1294
+ if (isFunction(settings.templates[query])) {
1293
1295
  settings.autoShow = true;
1294
1296
  settings.className.flyout = settings.className.template;
1295
1297
  settings = $.extend(true, {}, settings, settings.templates[query].apply(module ,queryArguments));
@@ -1302,7 +1304,7 @@ $.flyout = $.fn.flyout = function(parameters) {
1302
1304
  }
1303
1305
  module.initialize();
1304
1306
  }
1305
- if (!$.isFunction(settings.templates[query])) {
1307
+ if (!isFunction(settings.templates[query])) {
1306
1308
  module.invoke(query);
1307
1309
  }
1308
1310
  }
@@ -1452,7 +1454,7 @@ $.fn.flyout.settings.templates = {
1452
1454
  title: ''
1453
1455
  }, queryArguments[0]);
1454
1456
  } else {
1455
- if(!$.isFunction(queryArguments[queryArguments.length-1])) {
1457
+ if(!isFunction(queryArguments[queryArguments.length-1])) {
1456
1458
  queryArguments.push(function() {});
1457
1459
  }
1458
1460
  return {
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * # Fomantic-UI 2.9.1-beta.14+1a3de4b - Flyout
2
+ * # Fomantic-UI 2.9.1-beta.16+7071e59 - Flyout
3
3
  * https://github.com/fomantic/Fomantic-UI/
4
4
  *
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /*
2
- * # Fomantic UI - 2.9.1-beta.14+1a3de4b
2
+ * # Fomantic UI - 2.9.1-beta.16+7071e59
3
3
  * https://github.com/fomantic/Fomantic-UI
4
4
  * https://fomantic-ui.com/
5
5
  *
@@ -8,4 +8,4 @@
8
8
  * https://opensource.org/licenses/MIT
9
9
  *
10
10
  */
11
- !function(Q,U,X,_){"use strict";Q.isFunction=Q.isFunction||function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},U=void 0!==U&&U.Math==Math?U:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),Q.flyout=Q.fn.flyout=function(O){var P,e=Q(this),D=Q(U),L=Q(X),z=Q("html"),B=Q("head"),N=Q("body"),R=e.selector||"",I=(new Date).getTime(),j=[],K=O,V="string"==typeof K,W=[].slice.call(arguments,1),q=U.requestAnimationFrame||U.mozRequestAnimationFrame||U.webkitRequestAnimationFrame||U.msRequestAnimationFrame||function(e){setTimeout(e,0)};return e.each(function(){var t,e,o,s,n,i,r,c,l=Q.isPlainObject(O)?Q.extend(!0,{},Q.fn.flyout.settings,O):Q.extend({},Q.fn.flyout.settings),a=l.selector,u=l.className,d=l.namespace,f=l.fields,h=l.regExp,g=l.error,p="."+d,m="module-"+d,b=Q(this),v=[U,X].indexOf(l.context)<0?L.find(l.context):N,y=b.find(a.close),k=b.children(a.flyout),x=v.children(a.pusher),w=b.hasClass("flyout"),S=this,C=w?b.data(m):_,A=!1,T=v[0]===N[0],F="",E="",H=!1,M={initialize:function(){var s;M.debug("Initializing flyout",O),M.create.id(),w||(M.create.flyout(),Q.isFunction(l.onHidden)||(l.onHidden=function(){M.destroy(),b.remove()}),l.autoShow||(l.autoShow=!0)),b.addClass(l.class),""!==l.title&&b.find(a.header).html(M.helpers.escape(l.title,l.preserveHTML)).addClass(l.classTitle),""!==l.content&&b.find(a.content).html(M.helpers.escape(l.content,l.preserveHTML)).addClass(l.classContent),M.has.configActions()&&(0===(s=b.find(a.actions).addClass(l.classActions)).length?s=Q("<div/>",{class:u.actions+" "+(l.classActions||"")}).appendTo(b):s.empty(),l.actions.forEach(function(e){var t=e[f.icon]?"<i "+(e[f.text]?'aria-hidden="true"':"")+' class="'+M.helpers.deQuote(e[f.icon])+' icon"></i>':"",n=M.helpers.escape(e[f.text]||"",l.preserveHTML),i=M.helpers.deQuote(e[f.class]||""),o=e[f.click]&&Q.isFunction(e[f.click])?e[f.click]:function(){};s.append(Q("<button/>",{html:t+n,"aria-label":(e[f.text]||e[f.icon]||"").replace(/<[^>]+(>|$)/g,""),class:u.button+" "+i,click:function(){!1!==o.call(S,b)&&M.hide()}}))})),c=M.get.transitionEvent(),l.delaySetup?q(M.setup.layout):M.setup.layout(),q(function(){M.setup.cache()}),"left"!=M.get.direction()&&"right"!=M.get.direction()||(M.setup.heights(),M.bind.resize()),M.bind.events(),M.observeChanges(),M.instantiate(),l.autoShow&&M.show()},instantiate:function(){M.verbose("Storing instance of module",M),C=M,b.data(m,C)},create:{flyout:function(){var e;M.verbose("Programmaticaly create flyout",v),b=Q("<div/>",{class:u.flyout,role:"dialog","aria-modal":l.dimPage}),l.closeIcon&&(y=Q("<i/>",{class:u.close,role:"button",tabindex:0,"aria-label":l.text.close}),b.append(y)),""!==l.title&&(e="_"+M.get.id()+"title",b.attr("aria-labelledby",e),Q("<div/>",{class:u.header,id:e}).appendTo(b)),""!==l.content&&(e="_"+M.get.id()+"desc",b.attr("aria-describedby",e),Q("<div/>",{class:u.content,id:e}).appendTo(b)),M.has.configActions()&&Q("<div/>",{class:u.actions}).appendTo(b),b.prependTo(v),S=b[0]},id:function(){n=(Math.random().toString(16)+"000000000").slice(2,10),s="."+n,M.verbose("Creating unique id for element",n)}},destroy:function(){i&&i.disconnect(),M.verbose("Destroying previous module for",b),b.off(p).removeData(m),M.is.ios()&&M.remove.ios(),y.off(s),t&&t.off(s),v.off(s),D.off(s),L.off(s)},event:{keyboard:function(e){e.which===l.keys.escape&&(l.closable?(M.debug("Escape key pressed hiding flyout"),M.hide()):M.debug("Escape key pressed, but closable is set to false"),e.preventDefault())},resize:function(){M.setup.heights()},clickaway:function(e){var t;l.closable&&(t=0<x.find(e.target).length||x.is(e.target),e=v.is(e.target),t&&(M.verbose("User clicked on dimmed page"),M.hide()),e&&(M.verbose("User clicked on dimmable context (scaled out page)"),M.hide()))},close:function(e){M.hide()},closeKeyUp:function(e){e=e.which;e!==l.keys.enter&&e!==l.keys.space||M.hide()},inputKeyDown:{first:function(e){e.which===l.keys.tab&&e.shiftKey&&(t.last().focus(),e.preventDefault())},last:function(e){e.which!==l.keys.tab||e.shiftKey||(t.first().focus(),e.preventDefault())}},approve:function(e){A||!1===l.onApprove.call(M.element,Q(this))?M.verbose("Approve callback returned false cancelling close"):(A=!0,M.hide(function(){A=!1}))},deny:function(e){A||!1===l.onDeny.call(M.element,Q(this))?M.verbose("Deny callback returned false cancelling close"):(A=!0,M.hide(function(){A=!1}))},touch:function(e){},containScroll:function(e){S.scrollTop<=0&&(S.scrollTop=1),S.scrollTop+S.offsetHeight>=S.scrollHeight&&(S.scrollTop=S.scrollHeight-S.offsetHeight-1)},scroll:function(e){0===Q(e.target).closest(a.flyout).length&&e.preventDefault()}},bind:{resize:function(){M.verbose("Adding resize event to window",D),D.on("resize"+s,M.event.resize)},events:function(){M.verbose("Attaching events"),b.on("click"+p,a.close,M.event.close).on("click"+p,a.approve,M.event.approve).on("click"+p,a.deny,M.event.deny),y.on("keyup"+s,M.event.closeKeyUp)},clickaway:function(){M.verbose("Adding clickaway events to context",v),v.on("click"+s,M.event.clickaway).on("touchend"+s,M.event.clickaway)},scrollLock:function(){l.scrollLock&&(M.debug("Disabling page scroll"),(H=M.has.scrollbar())&&(M.save.bodyMargin(),M.set.bodyMargin()),v.addClass(u.locked)),M.verbose("Adding events to contain flyout scroll"),L.on("touchmove"+s,M.event.touch),b.on("scroll"+p,M.event.containScroll)}},unbind:{clickaway:function(){M.verbose("Removing clickaway events from context",v),v.off(s)},scrollLock:function(){M.verbose("Removing scroll lock from page"),H&&M.restore.bodyMargin(),v.removeClass(u.locked),L.off(s),b.off("scroll"+p)}},add:{inlineCSS:function(){var e=M.cache.width||b.outerWidth(),t=M.cache.height||b.outerHeight(),n=M.is.rtl(),i=M.get.direction(),t={left:e,right:-e,top:t,bottom:-t};n&&(M.verbose("RTL detected, flipping widths"),t.left=-e,t.right=e),n="<style>","left"===i||"right"===i?(M.debug("Adding CSS rules for animation distance",e),n+=" .ui.visible."+i+".flyout ~ .fixed, .ui.visible."+i+".flyout ~ .pusher { -webkit-transform: translate3d("+t[i]+"px, 0, 0); transform: translate3d("+t[i]+"px, 0, 0); }"):"top"!==i&&"bottom"!=i||(n+=" .ui.visible."+i+".flyout ~ .fixed, .ui.visible."+i+".flyout ~ .pusher { -webkit-transform: translate3d(0, "+t[i]+"px, 0); transform: translate3d(0, "+t[i]+"px, 0); }"),M.is.ie()&&("left"===i||"right"===i?(M.debug("Adding CSS rules for animation distance",e),n+=" body.pushable > .ui.visible."+i+".flyout ~ .pusher::after { -webkit-transform: translate3d("+t[i]+"px, 0, 0); transform: translate3d("+t[i]+"px, 0, 0); }"):"top"!==i&&"bottom"!=i||(n+=" body.pushable > .ui.visible."+i+".flyout ~ .pusher::after { -webkit-transform: translate3d(0, "+t[i]+"px, 0); transform: translate3d(0, "+t[i]+"px, 0); }"),n+=" body.pushable > .ui.visible.left.flyout ~ .ui.visible.right.flyout ~ .pusher::after, body.pushable > .ui.visible.right.flyout ~ .ui.visible.left.flyout ~ .pusher::after { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); }"),o=Q(n+="</style>").appendTo(B),M.debug("Adding sizing css to head",o)},keyboardShortcuts:function(){M.verbose("Adding keyboard shortcuts"),L.on("keydown"+p,M.event.keyboard)}},observeChanges:function(){"MutationObserver"in U&&((i=new MutationObserver(function(e){M.refreshInputs()})).observe(S,{childList:!0,subtree:!0}),M.debug("Setting up mutation observer",i))},refresh:function(){M.verbose("Refreshing selector cache"),v=[U,X].indexOf(l.context)<0?L.find(l.context):N,M.refreshFlyouts(),x=v.children(a.pusher),M.clear.cache()},refreshFlyouts:function(){M.verbose("Refreshing other flyouts"),k=v.children(a.flyout)},refreshInputs:function(){t&&t.off("keydown"+s),l.dimPage&&((t=b.find("[tabindex], :input").filter(":visible").filter(function(){return 0===Q(this).closest(".disabled").length})).first().on("keydown"+s,M.event.inputKeyDown.first),t.last().on("keydown"+s,M.event.inputKeyDown.last))},setup:{cache:function(){M.cache={width:b.outerWidth(),height:b.outerHeight()}},layout:function(){0===v.children(a.pusher).length&&(M.debug("Adding wrapper element for flyout"),M.error(g.pusher),x=Q('<div class="pusher" />'),v.children().not(a.omitted).not(k).wrapAll(x),M.refresh()),0!==b.nextAll(a.pusher).length&&b.nextAll(a.pusher)[0]===x[0]||(M.debug("Moved flyout to correct parent element"),M.error(g.movedFlyout,S),b.detach().prependTo(v),M.refresh()),M.is.mobile()&&b.addClass(u.fullscreen),M.clear.cache(),M.set.pushable(),M.set.direction()},heights:function(){M.debug("Setting up heights",b);var e=b.children(a.header),t=b.children(a.content),n=b.children(a.actions);t.css("min-height",v.height()-e.outerHeight()-n.outerHeight()+"px")}},attachEvents:function(e,t){var n=Q(e);t=Q.isFunction(M[t])?M[t]:M.toggle,0<n.length?(M.debug("Attaching flyout events to element",e,t),n.on("click"+p,t)):M.error(g.notFound,e)},show:function(e){e=Q.isFunction(e)?e:function(){},M.is.hidden()?!1===l.onShow.call(S)?M.verbose("Show callback returned false cancelling show"):(M.refresh(),M.othersActive()&&(M.debug("Other flyouts currently visible"),l.exclusive?M.hideOthers():A=!1),M.set.dimmerStyles(),M.pushPage(function(){e.call(S),l.onVisible.call(S),l.keyboardShortcuts&&M.add.keyboardShortcuts(),M.save.focus(),M.refreshInputs(),l.autofocus&&M.set.autofocus()}),l.onChange.call(S)):M.debug("Flyout is already visible")},hide:function(e){if(e=Q.isFunction(e)?e:function(){},!1===l.onHide.call(S,Q(this)))return M.verbose("Hide callback returned false cancelling hide"),A=!1;(M.is.visible()||M.is.animating())&&(M.debug("Hiding flyout",e),M.refreshFlyouts(),M.pullPage(function(){e.call(S),Q.isFunction(l.onHidden)&&l.onHidden.call(S),M.restore.focus()}),l.onChange.call(S))},othersAnimating:function(){return 0<k.not(b).filter("."+u.animating).length},othersVisible:function(){return 0<k.not(b).filter("."+u.visible).length},othersActive:function(){return M.othersVisible()||M.othersAnimating()},hideOthers:function(e){var t=k.not(b).filter("."+u.visible),n=t.length,i=0;e=e||function(){},t.flyout("hide",function(){++i==n&&e()})},toggle:function(){M.verbose("Determining toggled direction"),M.is.hidden()?M.show():M.hide()},pushPage:function(t){var e,n,i;t=Q.isFunction(t)?t:function(){},M.set.overlay(),l.returnScroll&&(r=(T?D:v).scrollTop()),M.bind.scrollLock(),e=function(){M.bind.clickaway(),M.add.inlineCSS(),M.set.animating(),M.set.visible()},n=function(){M.set.dimmed()},i=function(e){e.target==b[0]&&(b.off(c+s,i),M.remove.animating(),t.call(S))},b.off(c+s),b.on(c+s,i),q(e),l.dimPage&&!M.othersVisible()&&q(n)},pullPage:function(t){var e,n;t=Q.isFunction(t)?t:function(){},M.verbose("Removing context push state",M.get.direction()),M.unbind.clickaway(),M.othersActive()||(M.unbind.scrollLock(),l.keyboardShortcuts&&M.remove.keyboardShortcuts()),e=function(){M.set.overlay(),M.set.animating(),l.dimPage&&!M.othersVisible()&&M.set.closing(),M.remove.visible()},n=function(e){e.target==b[0]&&(b.off(c+s,n),M.remove.animating(),M.remove.closing(),M.remove.overlay(),M.remove.inlineCSS(),l.returnScroll&&M.scrollBack(),l.dimPage&&!M.othersVisible()&&x.removeClass(u.dimmed),t.call(S))},b.off(c+s),b.on(c+s,n),q(e)},scrollToTop:function(){M.verbose("Scrolling to top of page to avoid animation issues"),b.scrollTop(0),(T?D:v)[0].scrollTo(0,0)},scrollBack:function(){M.verbose("Scrolling back to original page position"),(T?D:v)[0].scrollTo(0,r)},clear:{cache:function(){M.verbose("Clearing cached dimensions"),M.cache={}}},set:{autofocus:function(){var e=t.filter("[autofocus]"),e=(0<e.length?e:1<t.length?t.filter(":not(i.close)"):t).first();0<e.length&&e.focus()},dimmerStyles:function(){l.blurring?x.addClass(u.blurring):x.removeClass(u.blurring)},bodyMargin:function(){var n=M.can.leftBodyScrollbar()?"left":"right";v.css((T?"margin-":"padding-")+n,E+"px"),v.find(a.bodyFixed.replace("right",n)).each(function(){var e=Q(this),t="fixed"===e.css("position")?"padding-"+n:n;e.css(t,"calc("+e.css(t)+" + "+E+"px)")})},ios:function(){z.addClass(u.ios)},pushed:function(){v.addClass(u.pushed)},pushable:function(){v.addClass(u.pushable)},dimmed:function(){x.addClass(u.dimmed)},active:function(){b.addClass(u.active)},animating:function(){b.addClass(u.animating)},closing:function(){x.addClass(u.closing)},direction:function(e){e=e||M.get.direction(),b.addClass(u[e])},visible:function(){b.addClass(u.visible)},overlay:function(){b.addClass(u.overlay)}},remove:{inlineCSS:function(){M.debug("Removing inline css styles",o),o&&0<o.length&&o.remove()},keyboardShortcuts:function(){M.verbose("Removing keyboard shortcuts"),L.off("keydown"+p)},ios:function(){z.removeClass(u.ios)},pushed:function(){v.removeClass(u.pushed)},pushable:function(){v.removeClass(u.pushable)},active:function(){b.removeClass(u.active)},animating:function(){b.removeClass(u.animating)},closing:function(){x.removeClass(u.closing)},direction:function(e){e=e||M.get.direction(),b.removeClass(u[e])},visible:function(){b.removeClass(u.visible)},overlay:function(){b.removeClass(u.overlay)}},get:{direction:function(){return b.hasClass(u.top)?u.top:b.hasClass(u.right)?u.right:b.hasClass(u.bottom)?u.bottom:u.left},transitionEvent:function(){var e,t=X.createElement("element"),n={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(e in n)if(t.style[e]!==_)return n[e]},id:function(){return n},element:function(){return b},settings:function(){return l}},can:{leftBodyScrollbar:function(){return M.cache.leftBodyScrollbar===_&&(M.cache.leftBodyScrollbar=M.is.rtl()&&(M.is.iframe&&!M.is.firefox()||M.is.safari()||M.is.edge()||M.is.ie())),M.cache.leftBodyScrollbar}},save:{focus:function(){0<Q(X.activeElement).closest(b).length||(e=Q(X.activeElement).blur())},bodyMargin:function(){F=v.css((T?"margin-":"padding-")+(M.can.leftBodyScrollbar()?"left":"right"));var e=parseInt(F.replace(/[^\d.]/g,"")),t=T?U.innerWidth-X.documentElement.clientWidth:v[0].offsetWidth-v[0].clientWidth;E=e+t}},is:{safari:function(){return M.cache.isSafari===_&&(M.cache.isSafari=/constructor/i.test(U.HTMLElement)||!!U.ApplePaySession),M.cache.isSafari},edge:function(){return M.cache.isEdge===_&&(M.cache.isEdge=!!U.setImmediate&&!M.is.ie()),M.cache.isEdge},firefox:function(){return M.cache.isFirefox===_&&(M.cache.isFirefox=!!U.InstallTrigger),M.cache.isFirefox},iframe:function(){return!(self===top)},ie:function(){var e,t;return M.cache.isIE===_&&(e=!U.ActiveXObject&&"ActiveXObject"in U,t="ActiveXObject"in U,M.cache.isIE=e||t),M.cache.isIE},ios:function(){var e=navigator.userAgent,t=e.match(h.ios),n=e.match(h.mobileChrome);return!(!t||n)&&(M.verbose("Browser was found to be iOS",e),!0)},mobile:function(){var e=navigator.userAgent;return e.match(h.mobile)?(M.verbose("Browser was found to be mobile",e),!0):(M.verbose("Browser is not mobile, using regular transition",e),!1)},hidden:function(){return!M.is.visible()},visible:function(){return b.hasClass(u.visible)},animating:function(){return v.hasClass(u.animating)},rtl:function(){return M.cache.isRTL===_&&(M.cache.isRTL="rtl"===b.attr("dir")||"rtl"===b.css("direction")||"rtl"===N.attr("dir")||"rtl"===N.css("direction")||"rtl"===v.attr("dir")||"rtl"===v.css("direction")),M.cache.isRTL}},has:{configActions:function(){return Array.isArray(l.actions)&&0<l.actions.length},scrollbar:function(){return T||"hidden"!==v.css("overflow-y")}},restore:{focus:function(){e&&0<e.length&&l.restoreFocus&&e.focus()},bodyMargin:function(){var n=M.can.leftBodyScrollbar()?"left":"right";v.css((T?"margin-":"padding-")+n,F),v.find(a.bodyFixed.replace("right",n)).each(function(){var e=Q(this),t="fixed"===e.css("position")?"padding-"+n:n;e.css(t,"")})}},helpers:{deQuote:function(e){return String(e).replace(/"/g,"")},escape:function(e,t){if(t)return e;var n={"<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};return/[&<>"'`]/.test(e)?(e=e.replace(/&(?![a-z0-9#]{1,12};)/gi,"&amp;")).replace(/[<>"'`]/g,function(e){return n[e]}):e}},setting:function(e,t){if(M.debug("Changing setting",e,t),Q.isPlainObject(e))Q.extend(!0,l,e);else{if(t===_)return l[e];Q.isPlainObject(l[e])?Q.extend(!0,l[e],t):l[e]=t}},internal:function(e,t){if(Q.isPlainObject(e))Q.extend(!0,M,e);else{if(t===_)return M[e];M[e]=t}},debug:function(){!l.silent&&l.debug&&(l.performance?M.performance.log(arguments):(M.debug=Function.prototype.bind.call(console.info,console,l.name+":"),M.debug.apply(console,arguments)))},verbose:function(){!l.silent&&l.verbose&&l.debug&&(l.performance?M.performance.log(arguments):(M.verbose=Function.prototype.bind.call(console.info,console,l.name+":"),M.verbose.apply(console,arguments)))},error:function(){l.silent||(M.error=Function.prototype.bind.call(console.error,console,l.name+":"),M.error.apply(console,arguments))},performance:{log:function(e){var t,n;l.performance&&(n=(t=(new Date).getTime())-(I||t),I=t,j.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:S,"Execution Time":n})),clearTimeout(M.performance.timer),M.performance.timer=setTimeout(M.performance.display,500)},display:function(){var e=l.name+":",n=0;I=!1,clearTimeout(M.performance.timer),Q.each(j,function(e,t){n+=t["Execution Time"]}),e+=" "+n+"ms",R&&(e+=" '"+R+"'"),(console.group!==_||console.table!==_)&&0<j.length&&(console.groupCollapsed(e),console.table?console.table(j):Q.each(j,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),j=[]}},invoke:function(i,e,t){var o,s,n,r=C;return e=e||W,t=S||t,"string"==typeof i&&r!==_&&(i=i.split(/[\. ]/),o=i.length-1,Q.each(i,function(e,t){var n=e!=o?t+i[e+1].charAt(0).toUpperCase()+i[e+1].slice(1):i;if(Q.isPlainObject(r[n])&&e!=o)r=r[n];else{if(r[n]!==_)return s=r[n],!1;{if(!Q.isPlainObject(r[t])||e==o)return r[t]!==_?s=r[t]:M.error(g.method,i),!1;r=r[t]}}})),Q.isFunction(s)?n=s.apply(t,e):s!==_&&(n=s),Array.isArray(P)?P.push(n):P!==_?P=[P,n]:n!==_&&(P=n),s}};V?(C===_&&(Q.isFunction(l.templates[K])&&(l.autoShow=!0,l.className.flyout=l.className.template,l=Q.extend(!0,{},l,l.templates[K].apply(M,W)),u=l.className,l.namespace,f=l.fields,g=l.error),M.initialize()),Q.isFunction(l.templates[K])||M.invoke(K)):(C!==_&&C.invoke("destroy"),M.initialize(),P=b)}),P!==_?P:this},Q.fn.flyout.settings={name:"Flyout",namespace:"flyout",silent:!1,debug:!1,verbose:!1,performance:!0,context:"body",exclusive:!1,closable:!0,autofocus:!0,restoreFocus:!0,dimPage:!0,scrollLock:!1,returnScroll:!1,delaySetup:!1,autoShow:!1,keyboardShortcuts:!0,title:"",content:"",class:"",classTitle:"",classContent:"",classActions:"",closeIcon:!1,actions:!1,preserveHTML:!0,fields:{class:"class",text:"text",icon:"icon",click:"click"},onChange:function(){},onShow:function(){},onHide:function(){return!0},onHidden:!1,onVisible:function(){},onApprove:function(){},onDeny:function(){},keys:{space:32,enter:13,escape:27,tab:9},className:{flyout:"ui flyout",close:"close icon",header:"ui header",content:"content",actions:"actions",active:"active",animating:"animating",blurring:"blurring",closing:"closing",dimmed:"dimmed",ios:"ios",locked:"locked",pushable:"pushable",pushed:"pushed",right:"right",top:"top",left:"left",bottom:"bottom",visible:"visible",overlay:"overlay",fullscreen:"fullscreen",template:"ui flyout",button:"ui button",ok:"positive",cancel:"negative",prompt:"ui fluid input"},selector:{bodyFixed:"> .ui.fixed.menu, > .ui.right.toast-container, > .ui.right.sidebar, > .ui.right.flyout, > .ui.fixed.nag, > .ui.fixed.nag > .close",fixed:".fixed",omitted:"script, link, style, .ui.modal, .ui.dimmer, .ui.nag, .ui.fixed",pusher:".pusher",flyout:".ui.flyout",header:".ui.header",content:".content",actions:".actions",close:".close",approve:".actions .positive, .actions .approve, .actions .ok",deny:".actions .negative, .actions .deny, .actions .cancel"},regExp:{ios:/(iPad|iPhone|iPod)/g,mobileChrome:/(CriOS)/g,mobile:/Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/g},error:{method:"The method you called is not defined.",pusher:"Had to add pusher element. For optimal performance make sure body content is inside a pusher element",movedFlyout:"Had to move flyout. For optimal performance make sure flyout and pusher are direct children of your body tag",notFound:"There were no elements that matched the specified selector"},text:{ok:"Ok",cancel:"Cancel",close:"Close"}},Q.fn.flyout.settings.templates={getArguments:function(e){e=[].slice.call(e);return Q.isPlainObject(e[0])?Q.extend({handler:function(){},content:"",title:""},e[0]):(Q.isFunction(e[e.length-1])||e.push(function(){}),{handler:e.pop(),content:e.pop()||"",title:e.pop()||""})},alert:function(){var e=this.get.settings(),t=e.templates.getArguments(arguments);return{title:t.title,content:t.content,actions:[{text:e.text.ok,class:e.className.ok,click:t.handler}]}},confirm:function(){var e=this.get.settings(),t=e.templates.getArguments(arguments);return{title:t.title,content:t.content,actions:[{text:e.text.ok,class:e.className.ok,click:function(){t.handler(!0)}},{text:e.text.cancel,class:e.className.cancel,click:function(){t.handler(!1)}}]}},prompt:function(){var t=this,e=this.get.settings(),n=e.templates.getArguments(arguments);return 0===Q(Q.parseHTML(n.content)).filter(".ui.input").length&&(n.content+='<p><div class="'+e.className.prompt+'"><input placeholder="'+this.helpers.deQuote(n.placeholder||"")+'" type="text" value="'+this.helpers.deQuote(n.defaultValue||"")+'"></div></p>'),{title:n.title,content:n.content,actions:[{text:e.text.ok,class:e.className.ok,click:function(){var e=t.get.settings(),e=t.get.element().find(e.selector.prompt)[0];n.handler(Q(e).val())}},{text:e.text.cancel,class:e.className.cancel,click:function(){n.handler(null)}}]}}}}(jQuery,window,document);
11
+ !function(Q,U,X,_){"use strict";function Z(e){return"function"==typeof e&&"number"!=typeof e.nodeType}U=void 0!==U&&U.Math==Math?U:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),Q.flyout=Q.fn.flyout=function(O){var P,e=Q(this),D=Q(U),L=Q(X),z=Q("html"),B=Q("head"),N=Q("body"),R=e.selector||"",I=(new Date).getTime(),j=[],K=O,V="string"==typeof K,W=[].slice.call(arguments,1),q=U.requestAnimationFrame||U.mozRequestAnimationFrame||U.webkitRequestAnimationFrame||U.msRequestAnimationFrame||function(e){setTimeout(e,0)};return e.each(function(){var t,e,o,s,n,i,r,c,l=Q.isPlainObject(O)?Q.extend(!0,{},Q.fn.flyout.settings,O):Q.extend({},Q.fn.flyout.settings),a=l.selector,u=l.className,d=l.namespace,f=l.fields,h=l.regExp,g=l.error,p="."+d,m="module-"+d,b=Q(this),v=[U,X].indexOf(l.context)<0?L.find(l.context):N,y=b.find(a.close),k=b.children(a.flyout),x=v.children(a.pusher),w=b.hasClass("flyout"),S=this,C=w?b.data(m):_,A=!1,T=v[0]===N[0],F="",E="",H=!1,M={initialize:function(){var s;M.debug("Initializing flyout",O),M.create.id(),w||(M.create.flyout(),Z(l.onHidden)||(l.onHidden=function(){M.destroy(),b.remove()}),l.autoShow||(l.autoShow=!0)),b.addClass(l.class),""!==l.title&&b.find(a.header).html(M.helpers.escape(l.title,l.preserveHTML)).addClass(l.classTitle),""!==l.content&&b.find(a.content).html(M.helpers.escape(l.content,l.preserveHTML)).addClass(l.classContent),M.has.configActions()&&(0===(s=b.find(a.actions).addClass(l.classActions)).length?s=Q("<div/>",{class:u.actions+" "+(l.classActions||"")}).appendTo(b):s.empty(),l.actions.forEach(function(e){var t=e[f.icon]?"<i "+(e[f.text]?'aria-hidden="true"':"")+' class="'+M.helpers.deQuote(e[f.icon])+' icon"></i>':"",n=M.helpers.escape(e[f.text]||"",l.preserveHTML),i=M.helpers.deQuote(e[f.class]||""),o=e[f.click]&&Z(e[f.click])?e[f.click]:function(){};s.append(Q("<button/>",{html:t+n,"aria-label":(e[f.text]||e[f.icon]||"").replace(/<[^>]+(>|$)/g,""),class:u.button+" "+i,on:{click:function(){!1!==o.call(S,b)&&M.hide()}}}))})),c=M.get.transitionEvent(),l.delaySetup?q(M.setup.layout):M.setup.layout(),q(function(){M.setup.cache()}),"left"!=M.get.direction()&&"right"!=M.get.direction()||(M.setup.heights(),M.bind.resize()),M.bind.events(),M.observeChanges(),M.instantiate(),l.autoShow&&M.show()},instantiate:function(){M.verbose("Storing instance of module",M),C=M,b.data(m,C)},create:{flyout:function(){var e;M.verbose("Programmaticaly create flyout",v),b=Q("<div/>",{class:u.flyout,role:"dialog","aria-modal":l.dimPage}),l.closeIcon&&(y=Q("<i/>",{class:u.close,role:"button",tabindex:0,"aria-label":l.text.close}),b.append(y)),""!==l.title&&(e="_"+M.get.id()+"title",b.attr("aria-labelledby",e),Q("<div/>",{class:u.header,id:e}).appendTo(b)),""!==l.content&&(e="_"+M.get.id()+"desc",b.attr("aria-describedby",e),Q("<div/>",{class:u.content,id:e}).appendTo(b)),M.has.configActions()&&Q("<div/>",{class:u.actions}).appendTo(b),b.prependTo(v),S=b[0]},id:function(){n=(Math.random().toString(16)+"000000000").slice(2,10),s="."+n,M.verbose("Creating unique id for element",n)}},destroy:function(){i&&i.disconnect(),M.verbose("Destroying previous module for",b),b.off(p).removeData(m),M.is.ios()&&M.remove.ios(),y.off(s),t&&t.off(s),v.off(s),D.off(s),L.off(s)},event:{keyboard:function(e){e.which===l.keys.escape&&(l.closable?(M.debug("Escape key pressed hiding flyout"),M.hide()):M.debug("Escape key pressed, but closable is set to false"),e.preventDefault())},resize:function(){M.setup.heights()},clickaway:function(e){var t;l.closable&&(t=0<x.find(e.target).length||x.is(e.target),e=v.is(e.target),t&&(M.verbose("User clicked on dimmed page"),M.hide()),e&&(M.verbose("User clicked on dimmable context (scaled out page)"),M.hide()))},close:function(e){M.hide()},closeKeyUp:function(e){e=e.which;e!==l.keys.enter&&e!==l.keys.space||M.hide()},inputKeyDown:{first:function(e){e.which===l.keys.tab&&e.shiftKey&&(t.last().trigger("focus"),e.preventDefault())},last:function(e){e.which!==l.keys.tab||e.shiftKey||(t.first().trigger("focus"),e.preventDefault())}},approve:function(e){A||!1===l.onApprove.call(M.element,Q(this))?M.verbose("Approve callback returned false cancelling close"):(A=!0,M.hide(function(){A=!1}))},deny:function(e){A||!1===l.onDeny.call(M.element,Q(this))?M.verbose("Deny callback returned false cancelling close"):(A=!0,M.hide(function(){A=!1}))},touch:function(e){},containScroll:function(e){S.scrollTop<=0&&(S.scrollTop=1),S.scrollTop+S.offsetHeight>=S.scrollHeight&&(S.scrollTop=S.scrollHeight-S.offsetHeight-1)},scroll:function(e){0===Q(e.target).closest(a.flyout).length&&e.preventDefault()}},bind:{resize:function(){M.verbose("Adding resize event to window",D),D.on("resize"+s,M.event.resize)},events:function(){M.verbose("Attaching events"),b.on("click"+p,a.close,M.event.close).on("click"+p,a.approve,M.event.approve).on("click"+p,a.deny,M.event.deny),y.on("keyup"+s,M.event.closeKeyUp)},clickaway:function(){M.verbose("Adding clickaway events to context",v),v.on("click"+s,M.event.clickaway).on("touchend"+s,M.event.clickaway)},scrollLock:function(){l.scrollLock&&(M.debug("Disabling page scroll"),(H=M.has.scrollbar())&&(M.save.bodyMargin(),M.set.bodyMargin()),v.addClass(u.locked)),M.verbose("Adding events to contain flyout scroll"),L.on("touchmove"+s,M.event.touch),b.on("scroll"+p,M.event.containScroll)}},unbind:{clickaway:function(){M.verbose("Removing clickaway events from context",v),v.off(s)},scrollLock:function(){M.verbose("Removing scroll lock from page"),H&&M.restore.bodyMargin(),v.removeClass(u.locked),L.off(s),b.off("scroll"+p)}},add:{inlineCSS:function(){var e=M.cache.width||b.outerWidth(),t=M.cache.height||b.outerHeight(),n=M.is.rtl(),i=M.get.direction(),t={left:e,right:-e,top:t,bottom:-t};n&&(M.verbose("RTL detected, flipping widths"),t.left=-e,t.right=e),n="<style>","left"===i||"right"===i?(M.debug("Adding CSS rules for animation distance",e),n+=" .ui.visible."+i+".flyout ~ .fixed, .ui.visible."+i+".flyout ~ .pusher { -webkit-transform: translate3d("+t[i]+"px, 0, 0); transform: translate3d("+t[i]+"px, 0, 0); }"):"top"!==i&&"bottom"!=i||(n+=" .ui.visible."+i+".flyout ~ .fixed, .ui.visible."+i+".flyout ~ .pusher { -webkit-transform: translate3d(0, "+t[i]+"px, 0); transform: translate3d(0, "+t[i]+"px, 0); }"),M.is.ie()&&("left"===i||"right"===i?(M.debug("Adding CSS rules for animation distance",e),n+=" body.pushable > .ui.visible."+i+".flyout ~ .pusher::after { -webkit-transform: translate3d("+t[i]+"px, 0, 0); transform: translate3d("+t[i]+"px, 0, 0); }"):"top"!==i&&"bottom"!=i||(n+=" body.pushable > .ui.visible."+i+".flyout ~ .pusher::after { -webkit-transform: translate3d(0, "+t[i]+"px, 0); transform: translate3d(0, "+t[i]+"px, 0); }"),n+=" body.pushable > .ui.visible.left.flyout ~ .ui.visible.right.flyout ~ .pusher::after, body.pushable > .ui.visible.right.flyout ~ .ui.visible.left.flyout ~ .pusher::after { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); }"),o=Q(n+="</style>").appendTo(B),M.debug("Adding sizing css to head",o)},keyboardShortcuts:function(){M.verbose("Adding keyboard shortcuts"),L.on("keydown"+p,M.event.keyboard)}},observeChanges:function(){"MutationObserver"in U&&((i=new MutationObserver(function(e){M.refreshInputs()})).observe(S,{childList:!0,subtree:!0}),M.debug("Setting up mutation observer",i))},refresh:function(){M.verbose("Refreshing selector cache"),v=[U,X].indexOf(l.context)<0?L.find(l.context):N,M.refreshFlyouts(),x=v.children(a.pusher),M.clear.cache()},refreshFlyouts:function(){M.verbose("Refreshing other flyouts"),k=v.children(a.flyout)},refreshInputs:function(){t&&t.off("keydown"+s),l.dimPage&&((t=b.find("[tabindex], :input").filter(":visible").filter(function(){return 0===Q(this).closest(".disabled").length})).first().on("keydown"+s,M.event.inputKeyDown.first),t.last().on("keydown"+s,M.event.inputKeyDown.last))},setup:{cache:function(){M.cache={width:b.outerWidth(),height:b.outerHeight()}},layout:function(){0===v.children(a.pusher).length&&(M.debug("Adding wrapper element for flyout"),M.error(g.pusher),x=Q('<div class="pusher" />'),v.children().not(a.omitted).not(k).wrapAll(x),M.refresh()),0!==b.nextAll(a.pusher).length&&b.nextAll(a.pusher)[0]===x[0]||(M.debug("Moved flyout to correct parent element"),M.error(g.movedFlyout,S),b.detach().prependTo(v),M.refresh()),M.is.mobile()&&b.addClass(u.fullscreen),M.clear.cache(),M.set.pushable(),M.set.direction()},heights:function(){M.debug("Setting up heights",b);var e=b.children(a.header),t=b.children(a.content),n=b.children(a.actions);t.css("min-height",v.height()-e.outerHeight()-n.outerHeight()+"px")}},attachEvents:function(e,t){var n=Q(e);t=Z(M[t])?M[t]:M.toggle,0<n.length?(M.debug("Attaching flyout events to element",e,t),n.on("click"+p,t)):M.error(g.notFound,e)},show:function(e){e=Z(e)?e:function(){},M.is.hidden()?!1===l.onShow.call(S)?M.verbose("Show callback returned false cancelling show"):(M.refresh(),M.othersActive()&&(M.debug("Other flyouts currently visible"),l.exclusive?M.hideOthers():A=!1),M.set.dimmerStyles(),M.pushPage(function(){e.call(S),l.onVisible.call(S),l.keyboardShortcuts&&M.add.keyboardShortcuts(),M.save.focus(),M.refreshInputs(),l.autofocus&&M.set.autofocus()}),l.onChange.call(S)):M.debug("Flyout is already visible")},hide:function(e){if(e=Z(e)?e:function(){},!1===l.onHide.call(S,Q(this)))return M.verbose("Hide callback returned false cancelling hide"),A=!1;(M.is.visible()||M.is.animating())&&(M.debug("Hiding flyout",e),M.refreshFlyouts(),M.pullPage(function(){e.call(S),Z(l.onHidden)&&l.onHidden.call(S),M.restore.focus()}),l.onChange.call(S))},othersAnimating:function(){return 0<k.not(b).filter("."+u.animating).length},othersVisible:function(){return 0<k.not(b).filter("."+u.visible).length},othersActive:function(){return M.othersVisible()||M.othersAnimating()},hideOthers:function(e){var t=k.not(b).filter("."+u.visible),n=t.length,i=0;e=e||function(){},t.flyout("hide",function(){++i==n&&e()})},toggle:function(){M.verbose("Determining toggled direction"),M.is.hidden()?M.show():M.hide()},pushPage:function(t){var e,n,i;t=Z(t)?t:function(){},M.set.overlay(),l.returnScroll&&(r=(T?D:v).scrollTop()),M.bind.scrollLock(),e=function(){M.bind.clickaway(),M.add.inlineCSS(),M.set.animating(),M.set.visible()},n=function(){M.set.dimmed()},i=function(e){e.target==b[0]&&(b.off(c+s,i),M.remove.animating(),t.call(S))},b.off(c+s),b.on(c+s,i),q(e),l.dimPage&&!M.othersVisible()&&q(n)},pullPage:function(t){var e,n;t=Z(t)?t:function(){},M.verbose("Removing context push state",M.get.direction()),M.unbind.clickaway(),M.othersActive()||(M.unbind.scrollLock(),l.keyboardShortcuts&&M.remove.keyboardShortcuts()),e=function(){M.set.overlay(),M.set.animating(),l.dimPage&&!M.othersVisible()&&M.set.closing(),M.remove.visible()},n=function(e){e.target==b[0]&&(b.off(c+s,n),M.remove.animating(),M.remove.closing(),M.remove.overlay(),M.remove.inlineCSS(),l.returnScroll&&M.scrollBack(),l.dimPage&&!M.othersVisible()&&x.removeClass(u.dimmed),t.call(S))},b.off(c+s),b.on(c+s,n),q(e)},scrollToTop:function(){M.verbose("Scrolling to top of page to avoid animation issues"),b.scrollTop(0),(T?D:v)[0].scrollTo(0,0)},scrollBack:function(){M.verbose("Scrolling back to original page position"),(T?D:v)[0].scrollTo(0,r)},clear:{cache:function(){M.verbose("Clearing cached dimensions"),M.cache={}}},set:{autofocus:function(){var e=t.filter("[autofocus]"),e=(0<e.length?e:1<t.length?t.filter(":not(i.close)"):t).first();0<e.length&&e.trigger("focus")},dimmerStyles:function(){l.blurring?x.addClass(u.blurring):x.removeClass(u.blurring)},bodyMargin:function(){var n=M.can.leftBodyScrollbar()?"left":"right";v.css((T?"margin-":"padding-")+n,E+"px"),v.find(a.bodyFixed.replace("right",n)).each(function(){var e=Q(this),t="fixed"===e.css("position")?"padding-"+n:n;e.css(t,"calc("+e.css(t)+" + "+E+"px)")})},ios:function(){z.addClass(u.ios)},pushed:function(){v.addClass(u.pushed)},pushable:function(){v.addClass(u.pushable)},dimmed:function(){x.addClass(u.dimmed)},active:function(){b.addClass(u.active)},animating:function(){b.addClass(u.animating)},closing:function(){x.addClass(u.closing)},direction:function(e){e=e||M.get.direction(),b.addClass(u[e])},visible:function(){b.addClass(u.visible)},overlay:function(){b.addClass(u.overlay)}},remove:{inlineCSS:function(){M.debug("Removing inline css styles",o),o&&0<o.length&&o.remove()},keyboardShortcuts:function(){M.verbose("Removing keyboard shortcuts"),L.off("keydown"+p)},ios:function(){z.removeClass(u.ios)},pushed:function(){v.removeClass(u.pushed)},pushable:function(){v.removeClass(u.pushable)},active:function(){b.removeClass(u.active)},animating:function(){b.removeClass(u.animating)},closing:function(){x.removeClass(u.closing)},direction:function(e){e=e||M.get.direction(),b.removeClass(u[e])},visible:function(){b.removeClass(u.visible)},overlay:function(){b.removeClass(u.overlay)}},get:{direction:function(){return b.hasClass(u.top)?u.top:b.hasClass(u.right)?u.right:b.hasClass(u.bottom)?u.bottom:u.left},transitionEvent:function(){var e,t=X.createElement("element"),n={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(e in n)if(t.style[e]!==_)return n[e]},id:function(){return n},element:function(){return b},settings:function(){return l}},can:{leftBodyScrollbar:function(){return M.cache.leftBodyScrollbar===_&&(M.cache.leftBodyScrollbar=M.is.rtl()&&(M.is.iframe&&!M.is.firefox()||M.is.safari()||M.is.edge()||M.is.ie())),M.cache.leftBodyScrollbar}},save:{focus:function(){0<Q(X.activeElement).closest(b).length||(e=Q(X.activeElement).trigger("blur"))},bodyMargin:function(){F=v.css((T?"margin-":"padding-")+(M.can.leftBodyScrollbar()?"left":"right"));var e=parseInt(F.replace(/[^\d.]/g,"")),t=T?U.innerWidth-X.documentElement.clientWidth:v[0].offsetWidth-v[0].clientWidth;E=e+t}},is:{safari:function(){return M.cache.isSafari===_&&(M.cache.isSafari=/constructor/i.test(U.HTMLElement)||!!U.ApplePaySession),M.cache.isSafari},edge:function(){return M.cache.isEdge===_&&(M.cache.isEdge=!!U.setImmediate&&!M.is.ie()),M.cache.isEdge},firefox:function(){return M.cache.isFirefox===_&&(M.cache.isFirefox=!!U.InstallTrigger),M.cache.isFirefox},iframe:function(){return!(self===top)},ie:function(){var e,t;return M.cache.isIE===_&&(e=!U.ActiveXObject&&"ActiveXObject"in U,t="ActiveXObject"in U,M.cache.isIE=e||t),M.cache.isIE},ios:function(){var e=navigator.userAgent,t=e.match(h.ios),n=e.match(h.mobileChrome);return!(!t||n)&&(M.verbose("Browser was found to be iOS",e),!0)},mobile:function(){var e=navigator.userAgent;return e.match(h.mobile)?(M.verbose("Browser was found to be mobile",e),!0):(M.verbose("Browser is not mobile, using regular transition",e),!1)},hidden:function(){return!M.is.visible()},visible:function(){return b.hasClass(u.visible)},animating:function(){return v.hasClass(u.animating)},rtl:function(){return M.cache.isRTL===_&&(M.cache.isRTL="rtl"===b.attr("dir")||"rtl"===b.css("direction")||"rtl"===N.attr("dir")||"rtl"===N.css("direction")||"rtl"===v.attr("dir")||"rtl"===v.css("direction")),M.cache.isRTL}},has:{configActions:function(){return Array.isArray(l.actions)&&0<l.actions.length},scrollbar:function(){return T||"hidden"!==v.css("overflow-y")}},restore:{focus:function(){e&&0<e.length&&l.restoreFocus&&e.trigger("focus")},bodyMargin:function(){var n=M.can.leftBodyScrollbar()?"left":"right";v.css((T?"margin-":"padding-")+n,F),v.find(a.bodyFixed.replace("right",n)).each(function(){var e=Q(this),t="fixed"===e.css("position")?"padding-"+n:n;e.css(t,"")})}},helpers:{deQuote:function(e){return String(e).replace(/"/g,"")},escape:function(e,t){if(t)return e;var n={"<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};return/[&<>"'`]/.test(e)?(e=e.replace(/&(?![a-z0-9#]{1,12};)/gi,"&amp;")).replace(/[<>"'`]/g,function(e){return n[e]}):e}},setting:function(e,t){if(M.debug("Changing setting",e,t),Q.isPlainObject(e))Q.extend(!0,l,e);else{if(t===_)return l[e];Q.isPlainObject(l[e])?Q.extend(!0,l[e],t):l[e]=t}},internal:function(e,t){if(Q.isPlainObject(e))Q.extend(!0,M,e);else{if(t===_)return M[e];M[e]=t}},debug:function(){!l.silent&&l.debug&&(l.performance?M.performance.log(arguments):(M.debug=Function.prototype.bind.call(console.info,console,l.name+":"),M.debug.apply(console,arguments)))},verbose:function(){!l.silent&&l.verbose&&l.debug&&(l.performance?M.performance.log(arguments):(M.verbose=Function.prototype.bind.call(console.info,console,l.name+":"),M.verbose.apply(console,arguments)))},error:function(){l.silent||(M.error=Function.prototype.bind.call(console.error,console,l.name+":"),M.error.apply(console,arguments))},performance:{log:function(e){var t,n;l.performance&&(n=(t=(new Date).getTime())-(I||t),I=t,j.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:S,"Execution Time":n})),clearTimeout(M.performance.timer),M.performance.timer=setTimeout(M.performance.display,500)},display:function(){var e=l.name+":",n=0;I=!1,clearTimeout(M.performance.timer),Q.each(j,function(e,t){n+=t["Execution Time"]}),e+=" "+n+"ms",R&&(e+=" '"+R+"'"),(console.group!==_||console.table!==_)&&0<j.length&&(console.groupCollapsed(e),console.table?console.table(j):Q.each(j,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),j=[]}},invoke:function(i,e,t){var o,s,n,r=C;return e=e||W,t=S||t,"string"==typeof i&&r!==_&&(i=i.split(/[\. ]/),o=i.length-1,Q.each(i,function(e,t){var n=e!=o?t+i[e+1].charAt(0).toUpperCase()+i[e+1].slice(1):i;if(Q.isPlainObject(r[n])&&e!=o)r=r[n];else{if(r[n]!==_)return s=r[n],!1;{if(!Q.isPlainObject(r[t])||e==o)return r[t]!==_?s=r[t]:M.error(g.method,i),!1;r=r[t]}}})),Z(s)?n=s.apply(t,e):s!==_&&(n=s),Array.isArray(P)?P.push(n):P!==_?P=[P,n]:n!==_&&(P=n),s}};V?(C===_&&(Z(l.templates[K])&&(l.autoShow=!0,l.className.flyout=l.className.template,l=Q.extend(!0,{},l,l.templates[K].apply(M,W)),u=l.className,l.namespace,f=l.fields,g=l.error),M.initialize()),Z(l.templates[K])||M.invoke(K)):(C!==_&&C.invoke("destroy"),M.initialize(),P=b)}),P!==_?P:this},Q.fn.flyout.settings={name:"Flyout",namespace:"flyout",silent:!1,debug:!1,verbose:!1,performance:!0,context:"body",exclusive:!1,closable:!0,autofocus:!0,restoreFocus:!0,dimPage:!0,scrollLock:!1,returnScroll:!1,delaySetup:!1,autoShow:!1,keyboardShortcuts:!0,title:"",content:"",class:"",classTitle:"",classContent:"",classActions:"",closeIcon:!1,actions:!1,preserveHTML:!0,fields:{class:"class",text:"text",icon:"icon",click:"click"},onChange:function(){},onShow:function(){},onHide:function(){return!0},onHidden:!1,onVisible:function(){},onApprove:function(){},onDeny:function(){},keys:{space:32,enter:13,escape:27,tab:9},className:{flyout:"ui flyout",close:"close icon",header:"ui header",content:"content",actions:"actions",active:"active",animating:"animating",blurring:"blurring",closing:"closing",dimmed:"dimmed",ios:"ios",locked:"locked",pushable:"pushable",pushed:"pushed",right:"right",top:"top",left:"left",bottom:"bottom",visible:"visible",overlay:"overlay",fullscreen:"fullscreen",template:"ui flyout",button:"ui button",ok:"positive",cancel:"negative",prompt:"ui fluid input"},selector:{bodyFixed:"> .ui.fixed.menu, > .ui.right.toast-container, > .ui.right.sidebar, > .ui.right.flyout, > .ui.fixed.nag, > .ui.fixed.nag > .close",fixed:".fixed",omitted:"script, link, style, .ui.modal, .ui.dimmer, .ui.nag, .ui.fixed",pusher:".pusher",flyout:".ui.flyout",header:".ui.header",content:".content",actions:".actions",close:".close",approve:".actions .positive, .actions .approve, .actions .ok",deny:".actions .negative, .actions .deny, .actions .cancel"},regExp:{ios:/(iPad|iPhone|iPod)/g,mobileChrome:/(CriOS)/g,mobile:/Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/g},error:{method:"The method you called is not defined.",pusher:"Had to add pusher element. For optimal performance make sure body content is inside a pusher element",movedFlyout:"Had to move flyout. For optimal performance make sure flyout and pusher are direct children of your body tag",notFound:"There were no elements that matched the specified selector"},text:{ok:"Ok",cancel:"Cancel",close:"Close"}},Q.fn.flyout.settings.templates={getArguments:function(e){e=[].slice.call(e);return Q.isPlainObject(e[0])?Q.extend({handler:function(){},content:"",title:""},e[0]):(Z(e[e.length-1])||e.push(function(){}),{handler:e.pop(),content:e.pop()||"",title:e.pop()||""})},alert:function(){var e=this.get.settings(),t=e.templates.getArguments(arguments);return{title:t.title,content:t.content,actions:[{text:e.text.ok,class:e.className.ok,click:t.handler}]}},confirm:function(){var e=this.get.settings(),t=e.templates.getArguments(arguments);return{title:t.title,content:t.content,actions:[{text:e.text.ok,class:e.className.ok,click:function(){t.handler(!0)}},{text:e.text.cancel,class:e.className.cancel,click:function(){t.handler(!1)}}]}},prompt:function(){var t=this,e=this.get.settings(),n=e.templates.getArguments(arguments);return 0===Q(Q.parseHTML(n.content)).filter(".ui.input").length&&(n.content+='<p><div class="'+e.className.prompt+'"><input placeholder="'+this.helpers.deQuote(n.placeholder||"")+'" type="text" value="'+this.helpers.deQuote(n.defaultValue||"")+'"></div></p>'),{title:n.title,content:n.content,actions:[{text:e.text.ok,class:e.className.ok,click:function(){var e=t.get.settings(),e=t.get.element().find(e.selector.prompt)[0];n.handler(Q(e).val())}},{text:e.text.cancel,class:e.className.cancel,click:function(){n.handler(null)}}]}}}}(jQuery,window,document);
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * # Fomantic-UI 2.9.1-beta.14+1a3de4b - Form
2
+ * # Fomantic-UI 2.9.1-beta.16+7071e59 - Form
3
3
  * https://github.com/fomantic/Fomantic-UI/
4
4
  *
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * # Fomantic-UI 2.9.1-beta.14+1a3de4b - Form Validation
2
+ * # Fomantic-UI 2.9.1-beta.16+7071e59 - Form Validation
3
3
  * https://github.com/fomantic/Fomantic-UI/
4
4
  *
5
5
  *
@@ -12,9 +12,9 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- $.isFunction = $.isFunction || function(obj) {
15
+ function isFunction(obj) {
16
16
  return typeof obj === "function" && typeof obj.nodeType !== "number";
17
- };
17
+ }
18
18
 
19
19
  window = (typeof window != 'undefined' && window.Math == Math)
20
20
  ? window
@@ -139,7 +139,7 @@ $.fn.form = function(parameters) {
139
139
  submit: function() {
140
140
  module.verbose('Submitting form', $module);
141
141
  submitting = true;
142
- $module.submit();
142
+ $module.trigger('submit');
143
143
  },
144
144
 
145
145
  attachEvents: function(selector, action) {
@@ -538,7 +538,7 @@ $.fn.form = function(parameters) {
538
538
  ancillary = module.get.ancillaryValue(rule),
539
539
  $field = module.get.field(field.identifier),
540
540
  value = $field.val(),
541
- prompt = $.isFunction(rule.prompt)
541
+ prompt = isFunction(rule.prompt)
542
542
  ? rule.prompt(value)
543
543
  : rule.prompt || settings.prompt[ruleName] || settings.text.unspecifiedRule,
544
544
  requiresValue = (prompt.search('{value}') !== -1),
@@ -1146,7 +1146,7 @@ $.fn.form = function(parameters) {
1146
1146
  $field.each(function (_index, el) {
1147
1147
  var
1148
1148
  $el = $(el),
1149
- $elGroup = $(el).closest($group),
1149
+ $elGroup = $el.closest($group),
1150
1150
  isCheckbox = ($el.filter(selector.checkbox).length > 0),
1151
1151
  isRequired = $el.prop('required') || $elGroup.hasClass(className.required) || $elGroup.parent().hasClass(className.required),
1152
1152
  isDisabled = $el.is(':disabled') || $elGroup.hasClass(className.disabled) || $elGroup.parent().hasClass(className.disabled),
@@ -1211,21 +1211,21 @@ $.fn.form = function(parameters) {
1211
1211
  event.stopImmediatePropagation();
1212
1212
  }
1213
1213
  if(settings.errorFocus && ignoreCallbacks !== true) {
1214
- var focusElement, hasTabIndex = true;
1214
+ var $focusElement, hasTabIndex = true;
1215
1215
  if (typeof settings.errorFocus === 'string') {
1216
- focusElement = $(document).find(settings.errorFocus);
1217
- hasTabIndex = focusElement.is('[tabindex]');
1216
+ $focusElement = $(document).find(settings.errorFocus);
1217
+ hasTabIndex = $focusElement.is('[tabindex]');
1218
1218
  // to be able to focus/scroll into non input elements we need a tabindex
1219
1219
  if (!hasTabIndex) {
1220
- focusElement.attr('tabindex',-1);
1220
+ $focusElement.attr('tabindex',-1);
1221
1221
  }
1222
1222
  } else {
1223
- focusElement = $group.filter('.' + className.error).first().find(selector.field);
1223
+ $focusElement = $group.filter('.' + className.error).first().find(selector.field);
1224
1224
  }
1225
- focusElement.focus();
1225
+ $focusElement.trigger('focus');
1226
1226
  // only remove tabindex if it was dynamically created above
1227
1227
  if (!hasTabIndex){
1228
- focusElement.removeAttr('tabindex');
1228
+ $focusElement.removeAttr('tabindex');
1229
1229
  }
1230
1230
  }
1231
1231
  if(ignoreCallbacks !== true) {
@@ -1322,7 +1322,7 @@ $.fn.form = function(parameters) {
1322
1322
  return ruleFunction.call(field, value, ancillary, $module);
1323
1323
  }
1324
1324
  ;
1325
- if( !$.isFunction(ruleFunction) ) {
1325
+ if( !isFunction(ruleFunction) ) {
1326
1326
  module.error(error.noRule, ruleName);
1327
1327
  return;
1328
1328
  }
@@ -1481,7 +1481,7 @@ $.fn.form = function(parameters) {
1481
1481
  }
1482
1482
  });
1483
1483
  }
1484
- if( $.isFunction( found ) ) {
1484
+ if( isFunction( found ) ) {
1485
1485
  response = found.apply(context, passedArguments);
1486
1486
  }
1487
1487
  else if(found !== undefined) {
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * # Fomantic-UI 2.9.1-beta.14+1a3de4b - Form
2
+ * # Fomantic-UI 2.9.1-beta.16+7071e59 - Form
3
3
  * https://github.com/fomantic/Fomantic-UI/
4
4
  *
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /*
2
- * # Fomantic UI - 2.9.1-beta.14+1a3de4b
2
+ * # Fomantic UI - 2.9.1-beta.16+7071e59
3
3
  * https://github.com/fomantic/Fomantic-UI
4
4
  * https://fomantic-ui.com/
5
5
  *
@@ -8,4 +8,4 @@
8
8
  * https://opensource.org/licenses/MIT
9
9
  *
10
10
  */
11
- !function(O,$,I,L){"use strict";O.isFunction=O.isFunction||function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},$=void 0!==$&&$.Math==Math?$:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),O.fn.form=function(C){var w,V=O(this),A=V.selector||"",D=(new Date).getTime(),F=[],R=C,S=arguments[1],T="string"==typeof R,j=[].slice.call(arguments,1);return V.each(function(){var n,d,t,e,f,s,m,p,g,r,u,i,a,l,c,h=O(this),v=this,b=[],y=!1,o=!1,x=!1,k=["clean","clean"],E={initialize:function(){E.get.settings(),T?(c===L&&E.instantiate(),E.invoke(R)):(c!==L&&(c.invoke("destroy"),E.refresh()),E.verbose("Initializing form validation",h,f),E.bindEvents(),E.set.defaults(),f.autoCheckRequired&&E.set.autoCheck(),E.instantiate())},instantiate:function(){E.verbose("Storing instance of module",E),c=E,h.data(a,E)},destroy:function(){E.verbose("Destroying previous module",c),E.removeEvents(),h.removeData(a)},refresh:function(){E.verbose("Refreshing selector cache"),n=h.find(p.field),d=h.find(p.group),t=h.find(p.message),h.find(p.prompt),e=h.find(p.submit),h.find(p.clear),h.find(p.reset)},refreshEvents:function(){E.removeEvents(),E.bindEvents()},submit:function(){E.verbose("Submitting form",h),o=!0,h.submit()},attachEvents:function(e,t){t=t||"submit",O(e).on("click"+l,function(e){E[t](),e.preventDefault()})},bindEvents:function(){E.verbose("Attaching form events"),h.on("submit"+l,E.validate.form).on("blur"+l,p.field,E.event.field.blur).on("click"+l,p.submit,E.submit).on("click"+l,p.reset,E.reset).on("click"+l,p.clear,E.clear),f.keyboardShortcuts&&h.on("keydown"+l,p.field,E.event.field.keydown),n.each(function(e,t){var t=O(t),n=t.prop("type"),n=E.get.changeEvent(n,t);t.on(n+l,E.event.field.change)}),f.preventLeaving&&O($).on("beforeunload"+l,E.event.beforeUnload),n.on("change click keyup keydown blur",function(e){E.determine.isDirty()}),h.on("dirty"+l,function(e){f.onDirty.call()}),h.on("clean"+l,function(e){f.onClean.call()})},clear:function(){n.each(function(e,t){var t=O(t),n=t.parent(),r=t.closest(d),i=r.find(p.prompt),a=t.closest(p.uiCalendar),o=t.data(m.defaultValue)||"",l=n.is(p.uiCheckbox),s=n.is(p.uiDropdown)&&E.can.useElement("dropdown"),u=0<a.length&&E.can.useElement("calendar");r.hasClass(g.error)&&(E.verbose("Resetting error on field",r),r.removeClass(g.error),i.remove()),s?(E.verbose("Resetting dropdown value",n,o),n.dropdown("clear",!0)):l?t.prop("checked",!1):u?a.calendar("clear"):(E.verbose("Resetting field value",t,o),t.val(""))}),E.remove.states()},reset:function(){n.each(function(e,t){var t=O(t),n=t.parent(),r=t.closest(d),i=t.closest(p.uiCalendar),a=r.find(p.prompt),o=t.data(m.defaultValue),l=n.is(p.uiCheckbox),s=n.is(p.uiDropdown)&&E.can.useElement("dropdown"),u=0<i.length&&E.can.useElement("calendar"),c=r.hasClass(g.error);o!==L&&(c&&(E.verbose("Resetting error on field",r),r.removeClass(g.error),a.remove()),s?(E.verbose("Resetting dropdown value",n,o),n.dropdown("restore defaults",!0)):l?(E.verbose("Resetting checkbox value",n,o),t.prop("checked",o)):u?i.calendar("set date",o):(E.verbose("Resetting field value",t,o),t.val(o)))}),E.remove.states()},determine:{isValid:function(){var n=!0;return O.each(s,function(e,t){E.validate.field(t,e,!0)||(n=!1)}),n},isDirty:function(e){var r=!1;n.each(function(e,t){var t=O(t),n=0<t.filter(p.checkbox).length?E.is.checkboxDirty(t):E.is.fieldDirty(t);t.data(f.metadata.isDirty,n),r|=n}),r?E.set.dirty():E.set.clean()}},is:{bracketedRule:function(e){return e.type&&e.type.match(f.regExp.bracket)},shorthandRules:function(e){return"string"==typeof e||Array.isArray(e)},empty:function(e){return!e||0===e.length||(e.is(p.checkbox)?!e.is(":checked"):E.is.blank(e))},blank:function(e){return""===String(e.val()).trim()},valid:function(e,n){var r=!0;return e?(E.verbose("Checking if field is valid",e),E.validate.field(s[e],e,!!n)):(E.verbose("Checking if form is valid"),O.each(s,function(e,t){E.is.valid(e,n)||(r=!1)}),r)},dirty:function(){return x},clean:function(){return!x},fieldDirty:function(e){var t=e.data(m.defaultValue),e=(null==t?t="":Array.isArray(t)&&(t=t.toString()),e.val()),n=(null==e?e="":Array.isArray(e)&&(e=e.toString()),/^(true|false)$/i);return n.test(t)&&n.test(e)?!new RegExp("^"+t+"$","i").test(e):e!==t},checkboxDirty:function(e){return e.data(m.defaultValue)!==e.is(":checked")},justDirty:function(){return"dirty"===k[0]},justClean:function(){return"clean"===k[0]}},removeEvents:function(){h.off(l),n.off(l),e.off(l)},event:{field:{keydown:function(e){var t=O(this),n=e.which,r=t.is(p.input),i=t.is(p.checkbox),a=0<t.closest(p.uiDropdown).length,o=13;n==27&&(E.verbose("Escape key pressed blurring field"),t[0].blur()),e.ctrlKey||n!=o||!r||a||i||(y||(t.one("keyup"+l,E.event.field.keyup),E.submit(),E.debug("Enter pressed on input submitting form"),e.preventDefault()),y=!0)},keyup:function(){y=!1},blur:function(e){var t=O(this),n=t.closest(d),r=E.get.validation(t);r&&("blur"==f.on||n.hasClass(g.error)&&f.revalidate)&&(E.debug("Revalidating field",t,r),E.validate.field(r),f.inline||E.validate.form(!1,!0))},change:function(e){var t=O(this),n=t.closest(d),r=E.get.validation(t);r&&("change"==f.on||n.hasClass(g.error)&&f.revalidate)&&(clearTimeout(E.timer),E.timer=setTimeout(function(){E.debug("Revalidating field",t,r),E.validate.field(r),f.inline||E.validate.form(!1,!0)},f.delay))}},beforeUnload:function(e){if(E.is.dirty()&&!o)return(e=e||$.event)&&(e.returnValue=f.text.leavingMessage),f.text.leavingMessage}},get:{ancillaryValue:function(e){return!(!e.type||!e.value&&!E.is.bracketedRule(e))&&(e.value!==L?e.value:e.type.match(f.regExp.bracket)[1]+"")},ruleName:function(e){return E.is.bracketedRule(e)?e.type.replace(e.type.match(f.regExp.bracket)[0],""):e.type},changeEvent:function(e,t){return"checkbox"==e||"radio"==e||"hidden"==e||t.is("select")?"change":E.get.inputEvent()},inputEvent:function(){return I.createElement("input").oninput!==L?"input":I.createElement("input").onpropertychange!==L?"propertychange":"keyup"},fieldsFromShorthand:function(e){var r={};return O.each(e,function(n,e){Array.isArray(e)||"object"!=typeof e?("string"==typeof e&&(e=[e]),r[n]={rules:[]},O.each(e,function(e,t){r[n].rules.push({type:t})})):r[n]=e}),r},prompt:function(e,t){var n,r=E.get.ruleName(e),i=E.get.ancillaryValue(e),a=E.get.field(t.identifier),o=a.val(),o=O.isFunction(e.prompt)?e.prompt(o):e.prompt||f.prompt[r]||f.text.unspecifiedRule,l=-1!==o.search("{value}"),s=-1!==o.search("{name}");return i&&0<=["integer","decimal","number"].indexOf(r)&&0<=i.indexOf("..")&&(n=i.split("..",2),e.prompt||(o+=(""===n[0]?f.prompt.maxValue.replace(/\{ruleValue\}/g,"{max}"):""===n[1]?f.prompt.minValue.replace(/\{ruleValue\}/g,"{min}"):f.prompt.range).replace(/\{name\}/g," "+f.text.and)),o=(o=o.replace(/\{min\}/g,n[0])).replace(/\{max\}/g,n[1])),l&&(o=o.replace(/\{value\}/g,a.val())),s&&(l=1==(n=a.closest(p.group).find("label").eq(0)).length?n.text():a.prop("placeholder")||f.text.unspecifiedField,o=o.replace(/\{name\}/g,l)),o=(o=o.replace(/\{identifier\}/g,t.identifier)).replace(/\{ruleValue\}/g,i),e.prompt||E.verbose("Using default validation prompt for type",o,r),o},settings:function(){var e;O.isPlainObject(C)?0<(e=Object.keys(C)).length&&(C[e[0]].identifier!==L&&C[e[0]].rules!==L)?(f=O.extend(!0,{},O.fn.form.settings,S),s=O.extend(!0,{},O.fn.form.settings.defaults,C),E.error(f.error.oldSyntax,v),E.verbose("Extending settings from legacy parameters",s,f)):(C.fields&&(C.fields=E.get.fieldsFromShorthand(C.fields)),f=O.extend(!0,{},O.fn.form.settings,C),s=O.extend(!0,{},O.fn.form.settings.defaults,f.fields),E.verbose("Extending settings",s,f)):(f=O.extend(!0,{},O.fn.form.settings),s=O.extend(!0,{},O.fn.form.settings.defaults),E.verbose("Using default form validation",s,f)),i=f.namespace,m=f.metadata,p=f.selector,g=f.className,r=f.regExp,u=f.error,a="module-"+i,l="."+i,((c=h.data(a))||E).refresh()},field:function(e){var t;return E.verbose("Finding field with identifier",e),e=E.escape.string(e),0<(t=n.filter("#"+e)).length||0<(t=n.filter('[name="'+e+'"]')).length||0<(t=n.filter('[name="'+e+'[]"]')).length||0<(t=n.filter("[data-"+m.validate+'="'+e+'"]')).length?t:(E.error(u.noField.replace("{identifier}",e)),O("<input/>"))},fields:function(e){var n=O();return O.each(e,function(e,t){n=n.add(E.get.field(t))}),n},validation:function(r){var i,a;return!!s&&(O.each(s,function(e,n){a=n.identifier||e,O.each(E.get.field(a),function(e,t){if(t==r[0])return n.identifier=a,i=n,!1})}),i||!1)},value:function(e){var t=[];return t.push(e),E.get.values.call(v,t)[e]},values:function(e){var e=Array.isArray(e)?E.get.fields(e):n,d={};return e.each(function(e,t){var t=O(t),n=t.closest(p.uiCalendar),r=t.prop("name"),i=t.val(),a=t.is(p.checkbox),o=t.is(p.radio),l=-1!==r.indexOf("[]"),s=0<n.length&&E.can.useElement("calendar"),t=!!a&&t.is(":checked");if(r)if(l)r=r.replace("[]",""),d[r]||(d[r]=[]),a?t?d[r].push(i||!0):d[r].push(!1):d[r].push(i);else if(o)d[r]!==L&&!1!==d[r]||(d[r]=!!t&&(i||!0));else if(a)d[r]=!!t&&(i||!0);else if(s){var u=n.calendar("get date");if(null!==u){if("date"==f.dateHandling)d[r]=u;else if("input"==f.dateHandling)d[r]=n.calendar("get input date");else if("formatter"==f.dateHandling){var c=n.calendar("setting","type");switch(c){case"date":d[r]=f.formatter.date(u);break;case"datetime":d[r]=f.formatter.datetime(u);break;case"time":d[r]=f.formatter.time(u);break;case"month":d[r]=f.formatter.month(u);break;case"year":d[r]=f.formatter.year(u);break;default:E.debug("Wrong calendar mode",n,c),d[r]=""}}}else d[r]=""}else d[r]=i}),d},dirtyFields:function(){return n.filter(function(e,t){return O(t).data(m.isDirty)})}},has:{field:function(e){return E.verbose("Checking for existence of a field with identifier",e),"string"!=typeof(e=E.escape.string(e))&&E.error(u.identifier,e),0<n.filter("#"+e).length||0<n.filter('[name="'+e+'"]').length||0<n.filter("[data-"+m.validate+'="'+e+'"]').length}},can:{useElement:function(e){return O.fn[e]!==L||(E.error(u.noElement.replace("{element}",e)),!1)}},escape:{string:function(e){return(e=String(e)).replace(r.escape,"\\$&")}},add:{rule:function(e,t){E.add.field(e,t)},field:function(n,e){s[n]!==L&&s[n].rules!==L||(s[n]={rules:[]});var r={rules:[]};E.is.shorthandRules(e)?(e=Array.isArray(e)?e:[e],O.each(e,function(e,t){r.rules.push({type:t})})):r.rules=e.rules,O.each(r.rules,function(e,t){0==O.grep(s[n].rules,function(e){return e.type==t.type}).length&&s[n].rules.push(t)}),E.debug("Adding rules",r.rules,s),E.refreshEvents()},fields:function(e){s=O.extend(!0,{},s,E.get.fieldsFromShorthand(e)),E.refreshEvents()},prompt:function(e,t,n){var r=E.get.field(e).closest(d),i=r.children(p.prompt),a=0!==i.length;t="string"==typeof t?[t]:t,E.verbose("Adding field error state",e),n||r.addClass(g.error),f.inline&&(a||(i=O("<div/>").addClass(g.label)).appendTo(r),i.html(f.templates.prompt(t)),a?E.verbose("Inline errors are disabled, no inline error added",e):f.transition&&E.can.useElement("transition")&&h.transition("is supported")?(E.verbose("Displaying error with css transition",f.transition),i.transition(f.transition+" in",f.duration)):(E.verbose("Displaying error with fallback javascript animation"),i.fadeIn(f.duration)))},errors:function(e){E.debug("Adding form error messages",e),E.set.error(),t.html(f.templates.error(e))}},remove:{errors:function(){E.debug("Removing form error messages"),t.empty()},states:function(){h.removeClass(g.error).removeClass(g.success),f.inline||E.remove.errors(),E.determine.isDirty()},rule:function(n,e){var r=Array.isArray(e)?e:[e];if(s[n]!==L&&Array.isArray(s[n].rules))return e===L?(E.debug("Removed all rules"),void(s[n].rules=[])):void O.each(s[n].rules,function(e,t){t&&-1!==r.indexOf(t.type)&&(E.debug("Removed rule",t.type),s[n].rules.splice(e,1))})},field:function(e){e=Array.isArray(e)?e:[e];O.each(e,function(e,t){E.remove.rule(t)}),E.refreshEvents()},rules:function(e,n){Array.isArray(e)?O.each(e,function(e,t){E.remove.rule(t,n)}):E.remove.rule(e,n)},fields:function(e){E.remove.field(e)},prompt:function(e){var t=E.get.field(e).closest(d),n=t.children(p.prompt);t.removeClass(g.error),f.inline&&n.is(":visible")&&(E.verbose("Removing prompt for field",e),f.transition&&E.can.useElement("transition")&&h.transition("is supported")?n.transition(f.transition+" out",f.duration,function(){n.remove()}):n.fadeOut(f.duration,function(){n.remove()}))}},set:{success:function(){h.removeClass(g.error).addClass(g.success)},defaults:function(){n.each(function(e,t){var t=O(t),n=t.parent(),r=0<t.filter(p.checkbox).length,i=n.is(p.uiDropdown)&&E.can.useElement("dropdown"),a=t.closest(p.uiCalendar),o=0<a.length&&E.can.useElement("calendar"),r=r?t.is(":checked"):t.val();i?n.dropdown("save defaults"):o&&a.calendar("refresh"),t.data(m.defaultValue,r),t.data(m.isDirty,!1)})},error:function(){h.removeClass(g.success).addClass(g.error)},value:function(e,t){var n={};return n[e]=t,E.set.values.call(v,n)},values:function(e){O.isEmptyObject(e)||O.each(e,function(e,t){var n,r=E.get.field(e),i=r.parent(),e=r.closest(p.uiCalendar),a=Array.isArray(t),o=i.is(p.uiCheckbox)&&E.can.useElement("checkbox"),l=i.is(p.uiDropdown)&&E.can.useElement("dropdown"),s=r.is(p.radio)&&o,u=0<e.length&&E.can.useElement("calendar");0<r.length&&(a&&o?(E.verbose("Selecting multiple",t,r),i.checkbox("uncheck"),O.each(t,function(e,t){n=r.filter('[value="'+t+'"]'),i=n.parent(),0<n.length&&i.checkbox("check")})):s?(E.verbose("Selecting radio value",t,r),r.filter('[value="'+t+'"]').parent(p.uiCheckbox).checkbox("check")):o?(E.verbose("Setting checkbox value",t,i),!0===t||1===t||"on"===t?i.checkbox("check"):i.checkbox("uncheck"),"string"==typeof t&&r.val(t)):l?(E.verbose("Setting dropdown value",t,i),i.dropdown("set selected",t)):u?e.calendar("set date",t):(E.verbose("Setting field value",t,r),r.val(t)))})},dirty:function(){E.verbose("Setting state dirty"),x=!0,k[0]=k[1],k[1]="dirty",E.is.justClean()&&h.trigger("dirty")},clean:function(){E.verbose("Setting state clean"),x=!1,k[0]=k[1],k[1]="clean",E.is.justDirty()&&h.trigger("clean")},asClean:function(){E.set.defaults(),E.set.clean()},asDirty:function(){E.set.defaults(),E.set.dirty()},autoCheck:function(){E.debug("Enabling auto check on required fields"),n.each(function(e,t){var n=O(t),t=O(t).closest(d),r=0<n.filter(p.checkbox).length,i=n.prop("required")||t.hasClass(g.required)||t.parent().hasClass(g.required),t=n.is(":disabled")||t.hasClass(g.disabled)||t.parent().hasClass(g.disabled),a=E.get.validation(n),o=!!a&&0!==O.grep(a.rules,function(e){return"empty"==e.type}),a=a.identifier||n.attr("id")||n.attr("name")||n.data(m.validate);!i||t||o||a===L||(r?(E.verbose("Adding 'checked' rule on field",a),E.add.rule(a,"checked")):(E.verbose("Adding 'empty' rule on field",a),E.add.rule(a,"empty")))})},optional:function(n,r){r=!1!==r,O.each(s,function(e,t){n!=e&&n!=t.identifier||(t.optional=r)})}},validate:{form:function(e,t){var n,r=E.get.values();if(y)return!1;if(b=[],E.determine.isValid()){if(E.debug("Form has no validation errors, submitting"),E.set.success(),f.inline||E.remove.errors(),!0!==t)return f.onSuccess.call(v,e,r)}else if(E.debug("Form has errors"),o=!1,E.set.error(),f.inline||E.add.errors(b),e&&h.data("moduleApi")!==L&&e.stopImmediatePropagation(),f.errorFocus&&!0!==t&&(e=!0,"string"==typeof f.errorFocus?(e=(n=O(I).find(f.errorFocus)).is("[tabindex]"))||n.attr("tabindex",-1):n=d.filter("."+g.error).first().find(p.field),n.focus(),e||n.removeAttr("tabindex")),!0!==t)return f.onFailure.call(v,b,r)},field:function(r,e,i){i=i===L||i,"string"==typeof r&&(E.verbose("Validating field",r),r=s[e=r]);var a=r.identifier||e,e=E.get.field(a),t=!!r.depends&&E.get.field(r.depends),o=!0,l=[];return r.identifier||(E.debug("Using field name as identifier",a),r.identifier=a),!e.filter(":not(:disabled)").length?E.debug("Field is disabled. Skipping",a):r.optional&&E.is.blank(e)?E.debug("Field is optional and blank. Skipping",a):r.depends&&E.is.empty(t)?E.debug("Field depends on another value that is not present or empty. Skipping",t):r.rules!==L&&(i&&e.closest(d).removeClass(g.error),O.each(r.rules,function(e,t){var n;E.has.field(a)&&0<(n=E.validate.rule(r,t,!0)||[]).length&&(E.debug("Field is invalid",a,t.type),l.push(E.get.prompt(t,r)),o=!1,i&&O(n).closest(d).addClass(g.error))})),o?(i&&(E.remove.prompt(a,l),f.onValid.call(e)),!0):(i&&(b=b.concat(l),E.add.prompt(a,l,!0),f.onInvalid.call(e,l)),!1)},rule:function(e,n,t){function r(e){var t=(t=(s?O(e).filter(":checked"):O(e)).val())===L||""===t||null===t?"":f.shouldTrim&&!1!==n.shouldTrim||n.shouldTrim?String(t+"").trim():String(t+"");return o.call(e,t,i,h)}var e=E.get.field(e.identifier),i=E.get.ancillaryValue(n),a=E.get.ruleName(n),o=f.rules[a],l=[],s=e.is(p.checkbox);if(O.isFunction(o))return s?r(e)||(l=e):O.each(e,function(e,t){r(t)||l.push(t)}),t?l:!(0<l.length);E.error(u.noRule,a)}},setting:function(e,t){if(O.isPlainObject(e))O.extend(!0,f,e);else{if(t===L)return f[e];f[e]=t}},internal:function(e,t){if(O.isPlainObject(e))O.extend(!0,E,e);else{if(t===L)return E[e];E[e]=t}},debug:function(){!f.silent&&f.debug&&(f.performance?E.performance.log(arguments):(E.debug=Function.prototype.bind.call(console.info,console,f.name+":"),E.debug.apply(console,arguments)))},verbose:function(){!f.silent&&f.verbose&&f.debug&&(f.performance?E.performance.log(arguments):(E.verbose=Function.prototype.bind.call(console.info,console,f.name+":"),E.verbose.apply(console,arguments)))},error:function(){f.silent||(E.error=Function.prototype.bind.call(console.error,console,f.name+":"),E.error.apply(console,arguments))},performance:{log:function(e){var t,n;f.performance&&(n=(t=(new Date).getTime())-(D||t),D=t,F.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:v,"Execution Time":n})),clearTimeout(E.performance.timer),E.performance.timer=setTimeout(E.performance.display,500)},display:function(){var e=f.name+":",n=0;D=!1,clearTimeout(E.performance.timer),O.each(F,function(e,t){n+=t["Execution Time"]}),e+=" "+n+"ms",A&&(e+=" '"+A+"'"),1<V.length&&(e+=" ("+V.length+")"),(console.group!==L||console.table!==L)&&0<F.length&&(console.groupCollapsed(e),console.table?console.table(F):O.each(F,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),F=[]}},invoke:function(r,e,t){var i,a,n,o=c;return e=e||j,t=t||v,"string"==typeof r&&o!==L&&(r=r.split(/[\. ]/),i=r.length-1,O.each(r,function(e,t){var n=e!=i?t+r[e+1].charAt(0).toUpperCase()+r[e+1].slice(1):r;if(O.isPlainObject(o[n])&&e!=i)o=o[n];else{if(o[n]!==L)return a=o[n],!1;{if(!O.isPlainObject(o[t])||e==i)return o[t]!==L&&(a=o[t]),!1;o=o[t]}}})),O.isFunction(a)?n=a.apply(t,e):a!==L&&(n=a),Array.isArray(w)?w.push(n):w!==L?w=[w,n]:n!==L&&(w=n),a}};E.initialize()}),w!==L?w:this},O.fn.form.settings={name:"Form",namespace:"form",debug:!1,verbose:!1,performance:!0,fields:!1,keyboardShortcuts:!0,on:"submit",inline:!1,delay:200,revalidate:!0,shouldTrim:!0,transition:"scale",duration:200,autoCheckRequired:!1,preventLeaving:!1,errorFocus:!0,dateHandling:"date",onValid:function(){},onInvalid:function(){},onSuccess:function(){return!0},onFailure:function(){return!1},onDirty:function(){},onClean:function(){},metadata:{defaultValue:"default",validate:"validate",isDirty:"isDirty"},regExp:{htmlID:/^[a-zA-Z][\w:.-]*$/g,bracket:/\[(.*)\]/i,decimal:/^\d+\.?\d*$/,email:/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i,escape:/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|:,=@]/g,flags:/^\/(.*)\/(.*)?/,integer:/^\-?\d+$/,number:/^\-?\d*(\.\d+)?$/,url:/(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/i},text:{and:"and",unspecifiedRule:"Please enter a valid value",unspecifiedField:"This field",leavingMessage:"There are unsaved changes on this page which will be discarded if you continue."},prompt:{range:"{name} must be in a range from {min} to {max}",maxValue:"{name} must have a maximum value of {ruleValue}",minValue:"{name} must have a minimum value of {ruleValue}",empty:"{name} must have a value",checked:"{name} must be checked",email:"{name} must be a valid e-mail",url:"{name} must be a valid url",regExp:"{name} is not formatted correctly",integer:"{name} must be an integer",decimal:"{name} must be a decimal number",number:"{name} must be set to a number",is:'{name} must be "{ruleValue}"',isExactly:'{name} must be exactly "{ruleValue}"',not:'{name} cannot be set to "{ruleValue}"',notExactly:'{name} cannot be set to exactly "{ruleValue}"',contain:'{name} must contain "{ruleValue}"',containExactly:'{name} must contain exactly "{ruleValue}"',doesntContain:'{name} cannot contain "{ruleValue}"',doesntContainExactly:'{name} cannot contain exactly "{ruleValue}"',minLength:"{name} must be at least {ruleValue} characters",exactLength:"{name} must be exactly {ruleValue} characters",maxLength:"{name} cannot be longer than {ruleValue} characters",match:"{name} must match {ruleValue} field",different:"{name} must have a different value than {ruleValue} field",creditCard:"{name} must be a valid credit card number",minCount:"{name} must have at least {ruleValue} choices",exactCount:"{name} must have exactly {ruleValue} choices",maxCount:"{name} must have {ruleValue} or less choices"},selector:{checkbox:'input[type="checkbox"], input[type="radio"]',clear:".clear",field:'input:not(.search):not([type="file"]):not([type="reset"]):not([type="button"]):not([type="submit"]), textarea, select',group:".field",input:'input:not([type="file"])',message:".error.message",prompt:".prompt.label",radio:'input[type="radio"]',reset:'.reset:not([type="reset"])',submit:'.submit:not([type="submit"])',uiCheckbox:".ui.checkbox",uiDropdown:".ui.dropdown",uiCalendar:".ui.calendar"},className:{error:"error",label:"ui basic red pointing prompt label",pressed:"down",success:"success",required:"required",disabled:"disabled"},error:{identifier:"You must specify a string identifier for each field",method:"The method you called is not defined.",noRule:"There is no rule matching the one you specified",oldSyntax:"Starting in 2.0 forms now only take a single settings object. Validation settings converted to new syntax automatically.",noField:"Field identifier {identifier} not found",noElement:"This module requires ui {element}"},templates:{error:function(e){var n='<ul class="list">';return O.each(e,function(e,t){n+="<li>"+t+"</li>"}),n+="</ul>"},prompt:function(e){if(1===e.length)return e[0];var n='<ul class="ui list">';return O.each(e,function(e,t){n+="<li>"+t+"</li>"}),n+="</ul>"}},formatter:{date:function(e){return Intl.DateTimeFormat("en-GB").format(e)},datetime:function(e){return Intl.DateTimeFormat("en-GB",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(e)},time:function(e){return Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(e)},month:function(e){return Intl.DateTimeFormat("en-GB",{month:"2-digit",year:"numeric"}).format(e)},year:function(e){return Intl.DateTimeFormat("en-GB",{year:"numeric"}).format(e)}},rules:{empty:function(e){return!(e===L||""===e||Array.isArray(e)&&0===e.length)},checked:function(){return 0<O(this).filter(":checked").length},email:function(e){return O.fn.form.settings.regExp.email.test(e)},url:function(e){return O.fn.form.settings.regExp.url.test(e)},regExp:function(e,t){if(t instanceof RegExp)return e.match(t);var n,r=t.match(O.fn.form.settings.regExp.flags);return r&&(t=2<=r.length?r[1]:t,n=3<=r.length?r[2]:""),e.match(new RegExp(t,n))},minValue:function(e,t){return O.fn.form.settings.rules.range(e,t+"..","number")},maxValue:function(e,t){return O.fn.form.settings.rules.range(e,".."+t,"number")},integer:function(e,t){return O.fn.form.settings.rules.range(e,t,"integer")},range:function(e,t,n){var r,i;return(n="string"==typeof n?O.fn.form.settings.regExp[n]:n)instanceof RegExp||(n=O.fn.form.settings.regExp.integer),t&&-1===["",".."].indexOf(t)&&(-1==t.indexOf("..")?n.test(t)&&(r=i=+t):(t=t.split("..",2),n.test(t[0])&&(r=+t[0]),n.test(t[1])&&(i=+t[1]))),n.test(e)&&(r===L||r<=e)&&(i===L||e<=i)},decimal:function(e,t){return O.fn.form.settings.rules.range(e,t,"decimal")},number:function(e,t){return O.fn.form.settings.rules.range(e,t,"number")},is:function(e,t){return t="string"==typeof t?t.toLowerCase():t,(e="string"==typeof e?e.toLowerCase():e)==t},isExactly:function(e,t){return e==t},not:function(e,t){return(e="string"==typeof e?e.toLowerCase():e)!=(t="string"==typeof t?t.toLowerCase():t)},notExactly:function(e,t){return e!=t},contains:function(e,t){return t=t.replace(O.fn.form.settings.regExp.escape,"\\$&"),-1!==e.search(new RegExp(t,"i"))},containsExactly:function(e,t){return t=t.replace(O.fn.form.settings.regExp.escape,"\\$&"),-1!==e.search(new RegExp(t))},doesntContain:function(e,t){return t=t.replace(O.fn.form.settings.regExp.escape,"\\$&"),-1===e.search(new RegExp(t,"i"))},doesntContainExactly:function(e,t){return t=t.replace(O.fn.form.settings.regExp.escape,"\\$&"),-1===e.search(new RegExp(t))},minLength:function(e,t){return e!==L&&e.length>=t},exactLength:function(e,t){return e!==L&&e.length==t},maxLength:function(e,t){return e!==L&&e.length<=t},match:function(e,t,n){var r,i;return 0<(i=n.find('[data-validate="'+t+'"]')).length||0<(i=n.find("#"+t)).length||0<(i=n.find('[name="'+t+'"]')).length?r=i.val():0<(i=n.find('[name="'+t+'[]"]')).length&&(r=i),r!==L&&e.toString()==r.toString()},different:function(e,t,n){var r,i;return 0<(i=n.find('[data-validate="'+t+'"]')).length||0<(i=n.find("#"+t)).length||0<(i=n.find('[name="'+t+'"]')).length?r=i.val():0<(i=n.find('[name="'+t+'[]"]')).length&&(r=i),r!==L&&e.toString()!==r.toString()},creditCard:function(n,e){var r,i={visa:{pattern:/^4/,length:[16]},amex:{pattern:/^3[47]/,length:[15]},mastercard:{pattern:/^5[1-5]/,length:[16]},discover:{pattern:/^(6011|622(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[0-1][0-9]|92[0-5]|64[4-9])|65)/,length:[16]},unionPay:{pattern:/^(62|88)/,length:[16,17,18,19]},jcb:{pattern:/^35(2[89]|[3-8][0-9])/,length:[16]},maestro:{pattern:/^(5018|5020|5038|6304|6759|676[1-3])/,length:[12,13,14,15,16,17,18,19]},dinersClub:{pattern:/^(30[0-5]|^36)/,length:[14]},laser:{pattern:/^(6304|670[69]|6771)/,length:[16,17,18,19]},visaElectron:{pattern:/^(4026|417500|4508|4844|491(3|7))/,length:[16]}},a=!1,e="string"==typeof e&&e.split(",");if("string"==typeof n&&0!==n.length){if(n=n.replace(/[\s\-]/g,""),e&&(O.each(e,function(e,t){(r=i[t])&&(r={length:-1!==O.inArray(n.length,r.length),pattern:-1!==n.search(r.pattern)}).length&&r.pattern&&(a=!0)}),!a))return!1;if((e={number:-1!==O.inArray(n.length,i.unionPay.length),pattern:-1!==n.search(i.unionPay.pattern)}).number&&e.pattern)return!0;for(var t=n.length,o=0,l=[[0,1,2,3,4,5,6,7,8,9],[0,2,4,6,8,1,3,5,7,9]],s=0;t--;)s+=l[o][parseInt(n.charAt(t),10)],o^=1;return s%10==0&&0<s}},minCount:function(e,t){return 0==t||(1==t?""!==e:e.split(",").length>=t)},exactCount:function(e,t){return 0==t?""===e:1==t?""!==e&&-1===e.search(","):e.split(",").length==t},maxCount:function(e,t){return 0!=t&&(1==t?-1===e.search(","):e.split(",").length<=t)}}}}(jQuery,window,document);
11
+ !function(O,$,I,L){"use strict";function z(e){return"function"==typeof e&&"number"!=typeof e.nodeType}$=void 0!==$&&$.Math==Math?$:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),O.fn.form=function(C){var w,V=O(this),A=V.selector||"",D=(new Date).getTime(),R=[],F=C,S=arguments[1],T="string"==typeof F,j=[].slice.call(arguments,1);return V.each(function(){var n,d,t,e,f,s,m,p,g,r,u,i,a,l,c,h=O(this),v=this,b=[],y=!1,o=!1,x=!1,k=["clean","clean"],E={initialize:function(){E.get.settings(),T?(c===L&&E.instantiate(),E.invoke(F)):(c!==L&&(c.invoke("destroy"),E.refresh()),E.verbose("Initializing form validation",h,f),E.bindEvents(),E.set.defaults(),f.autoCheckRequired&&E.set.autoCheck(),E.instantiate())},instantiate:function(){E.verbose("Storing instance of module",E),c=E,h.data(a,E)},destroy:function(){E.verbose("Destroying previous module",c),E.removeEvents(),h.removeData(a)},refresh:function(){E.verbose("Refreshing selector cache"),n=h.find(p.field),d=h.find(p.group),t=h.find(p.message),h.find(p.prompt),e=h.find(p.submit),h.find(p.clear),h.find(p.reset)},refreshEvents:function(){E.removeEvents(),E.bindEvents()},submit:function(){E.verbose("Submitting form",h),o=!0,h.trigger("submit")},attachEvents:function(e,t){t=t||"submit",O(e).on("click"+l,function(e){E[t](),e.preventDefault()})},bindEvents:function(){E.verbose("Attaching form events"),h.on("submit"+l,E.validate.form).on("blur"+l,p.field,E.event.field.blur).on("click"+l,p.submit,E.submit).on("click"+l,p.reset,E.reset).on("click"+l,p.clear,E.clear),f.keyboardShortcuts&&h.on("keydown"+l,p.field,E.event.field.keydown),n.each(function(e,t){var t=O(t),n=t.prop("type"),n=E.get.changeEvent(n,t);t.on(n+l,E.event.field.change)}),f.preventLeaving&&O($).on("beforeunload"+l,E.event.beforeUnload),n.on("change click keyup keydown blur",function(e){E.determine.isDirty()}),h.on("dirty"+l,function(e){f.onDirty.call()}),h.on("clean"+l,function(e){f.onClean.call()})},clear:function(){n.each(function(e,t){var t=O(t),n=t.parent(),r=t.closest(d),i=r.find(p.prompt),a=t.closest(p.uiCalendar),o=t.data(m.defaultValue)||"",l=n.is(p.uiCheckbox),s=n.is(p.uiDropdown)&&E.can.useElement("dropdown"),u=0<a.length&&E.can.useElement("calendar");r.hasClass(g.error)&&(E.verbose("Resetting error on field",r),r.removeClass(g.error),i.remove()),s?(E.verbose("Resetting dropdown value",n,o),n.dropdown("clear",!0)):l?t.prop("checked",!1):u?a.calendar("clear"):(E.verbose("Resetting field value",t,o),t.val(""))}),E.remove.states()},reset:function(){n.each(function(e,t){var t=O(t),n=t.parent(),r=t.closest(d),i=t.closest(p.uiCalendar),a=r.find(p.prompt),o=t.data(m.defaultValue),l=n.is(p.uiCheckbox),s=n.is(p.uiDropdown)&&E.can.useElement("dropdown"),u=0<i.length&&E.can.useElement("calendar"),c=r.hasClass(g.error);o!==L&&(c&&(E.verbose("Resetting error on field",r),r.removeClass(g.error),a.remove()),s?(E.verbose("Resetting dropdown value",n,o),n.dropdown("restore defaults",!0)):l?(E.verbose("Resetting checkbox value",n,o),t.prop("checked",o)):u?i.calendar("set date",o):(E.verbose("Resetting field value",t,o),t.val(o)))}),E.remove.states()},determine:{isValid:function(){var n=!0;return O.each(s,function(e,t){E.validate.field(t,e,!0)||(n=!1)}),n},isDirty:function(e){var r=!1;n.each(function(e,t){var t=O(t),n=0<t.filter(p.checkbox).length?E.is.checkboxDirty(t):E.is.fieldDirty(t);t.data(f.metadata.isDirty,n),r|=n}),r?E.set.dirty():E.set.clean()}},is:{bracketedRule:function(e){return e.type&&e.type.match(f.regExp.bracket)},shorthandRules:function(e){return"string"==typeof e||Array.isArray(e)},empty:function(e){return!e||0===e.length||(e.is(p.checkbox)?!e.is(":checked"):E.is.blank(e))},blank:function(e){return""===String(e.val()).trim()},valid:function(e,n){var r=!0;return e?(E.verbose("Checking if field is valid",e),E.validate.field(s[e],e,!!n)):(E.verbose("Checking if form is valid"),O.each(s,function(e,t){E.is.valid(e,n)||(r=!1)}),r)},dirty:function(){return x},clean:function(){return!x},fieldDirty:function(e){var t=e.data(m.defaultValue),e=(null==t?t="":Array.isArray(t)&&(t=t.toString()),e.val()),n=(null==e?e="":Array.isArray(e)&&(e=e.toString()),/^(true|false)$/i);return n.test(t)&&n.test(e)?!new RegExp("^"+t+"$","i").test(e):e!==t},checkboxDirty:function(e){return e.data(m.defaultValue)!==e.is(":checked")},justDirty:function(){return"dirty"===k[0]},justClean:function(){return"clean"===k[0]}},removeEvents:function(){h.off(l),n.off(l),e.off(l)},event:{field:{keydown:function(e){var t=O(this),n=e.which,r=t.is(p.input),i=t.is(p.checkbox),a=0<t.closest(p.uiDropdown).length,o=13;n==27&&(E.verbose("Escape key pressed blurring field"),t[0].blur()),e.ctrlKey||n!=o||!r||a||i||(y||(t.one("keyup"+l,E.event.field.keyup),E.submit(),E.debug("Enter pressed on input submitting form"),e.preventDefault()),y=!0)},keyup:function(){y=!1},blur:function(e){var t=O(this),n=t.closest(d),r=E.get.validation(t);r&&("blur"==f.on||n.hasClass(g.error)&&f.revalidate)&&(E.debug("Revalidating field",t,r),E.validate.field(r),f.inline||E.validate.form(!1,!0))},change:function(e){var t=O(this),n=t.closest(d),r=E.get.validation(t);r&&("change"==f.on||n.hasClass(g.error)&&f.revalidate)&&(clearTimeout(E.timer),E.timer=setTimeout(function(){E.debug("Revalidating field",t,r),E.validate.field(r),f.inline||E.validate.form(!1,!0)},f.delay))}},beforeUnload:function(e){if(E.is.dirty()&&!o)return(e=e||$.event)&&(e.returnValue=f.text.leavingMessage),f.text.leavingMessage}},get:{ancillaryValue:function(e){return!(!e.type||!e.value&&!E.is.bracketedRule(e))&&(e.value!==L?e.value:e.type.match(f.regExp.bracket)[1]+"")},ruleName:function(e){return E.is.bracketedRule(e)?e.type.replace(e.type.match(f.regExp.bracket)[0],""):e.type},changeEvent:function(e,t){return"checkbox"==e||"radio"==e||"hidden"==e||t.is("select")?"change":E.get.inputEvent()},inputEvent:function(){return I.createElement("input").oninput!==L?"input":I.createElement("input").onpropertychange!==L?"propertychange":"keyup"},fieldsFromShorthand:function(e){var r={};return O.each(e,function(n,e){Array.isArray(e)||"object"!=typeof e?("string"==typeof e&&(e=[e]),r[n]={rules:[]},O.each(e,function(e,t){r[n].rules.push({type:t})})):r[n]=e}),r},prompt:function(e,t){var n,r=E.get.ruleName(e),i=E.get.ancillaryValue(e),a=E.get.field(t.identifier),o=a.val(),o=z(e.prompt)?e.prompt(o):e.prompt||f.prompt[r]||f.text.unspecifiedRule,l=-1!==o.search("{value}"),s=-1!==o.search("{name}");return i&&0<=["integer","decimal","number"].indexOf(r)&&0<=i.indexOf("..")&&(n=i.split("..",2),e.prompt||(o+=(""===n[0]?f.prompt.maxValue.replace(/\{ruleValue\}/g,"{max}"):""===n[1]?f.prompt.minValue.replace(/\{ruleValue\}/g,"{min}"):f.prompt.range).replace(/\{name\}/g," "+f.text.and)),o=(o=o.replace(/\{min\}/g,n[0])).replace(/\{max\}/g,n[1])),l&&(o=o.replace(/\{value\}/g,a.val())),s&&(l=1==(n=a.closest(p.group).find("label").eq(0)).length?n.text():a.prop("placeholder")||f.text.unspecifiedField,o=o.replace(/\{name\}/g,l)),o=(o=o.replace(/\{identifier\}/g,t.identifier)).replace(/\{ruleValue\}/g,i),e.prompt||E.verbose("Using default validation prompt for type",o,r),o},settings:function(){var e;O.isPlainObject(C)?0<(e=Object.keys(C)).length&&(C[e[0]].identifier!==L&&C[e[0]].rules!==L)?(f=O.extend(!0,{},O.fn.form.settings,S),s=O.extend(!0,{},O.fn.form.settings.defaults,C),E.error(f.error.oldSyntax,v),E.verbose("Extending settings from legacy parameters",s,f)):(C.fields&&(C.fields=E.get.fieldsFromShorthand(C.fields)),f=O.extend(!0,{},O.fn.form.settings,C),s=O.extend(!0,{},O.fn.form.settings.defaults,f.fields),E.verbose("Extending settings",s,f)):(f=O.extend(!0,{},O.fn.form.settings),s=O.extend(!0,{},O.fn.form.settings.defaults),E.verbose("Using default form validation",s,f)),i=f.namespace,m=f.metadata,p=f.selector,g=f.className,r=f.regExp,u=f.error,a="module-"+i,l="."+i,((c=h.data(a))||E).refresh()},field:function(e){var t;return E.verbose("Finding field with identifier",e),e=E.escape.string(e),0<(t=n.filter("#"+e)).length||0<(t=n.filter('[name="'+e+'"]')).length||0<(t=n.filter('[name="'+e+'[]"]')).length||0<(t=n.filter("[data-"+m.validate+'="'+e+'"]')).length?t:(E.error(u.noField.replace("{identifier}",e)),O("<input/>"))},fields:function(e){var n=O();return O.each(e,function(e,t){n=n.add(E.get.field(t))}),n},validation:function(r){var i,a;return!!s&&(O.each(s,function(e,n){a=n.identifier||e,O.each(E.get.field(a),function(e,t){if(t==r[0])return n.identifier=a,i=n,!1})}),i||!1)},value:function(e){var t=[];return t.push(e),E.get.values.call(v,t)[e]},values:function(e){var e=Array.isArray(e)?E.get.fields(e):n,d={};return e.each(function(e,t){var t=O(t),n=t.closest(p.uiCalendar),r=t.prop("name"),i=t.val(),a=t.is(p.checkbox),o=t.is(p.radio),l=-1!==r.indexOf("[]"),s=0<n.length&&E.can.useElement("calendar"),t=!!a&&t.is(":checked");if(r)if(l)r=r.replace("[]",""),d[r]||(d[r]=[]),a?t?d[r].push(i||!0):d[r].push(!1):d[r].push(i);else if(o)d[r]!==L&&!1!==d[r]||(d[r]=!!t&&(i||!0));else if(a)d[r]=!!t&&(i||!0);else if(s){var u=n.calendar("get date");if(null!==u){if("date"==f.dateHandling)d[r]=u;else if("input"==f.dateHandling)d[r]=n.calendar("get input date");else if("formatter"==f.dateHandling){var c=n.calendar("setting","type");switch(c){case"date":d[r]=f.formatter.date(u);break;case"datetime":d[r]=f.formatter.datetime(u);break;case"time":d[r]=f.formatter.time(u);break;case"month":d[r]=f.formatter.month(u);break;case"year":d[r]=f.formatter.year(u);break;default:E.debug("Wrong calendar mode",n,c),d[r]=""}}}else d[r]=""}else d[r]=i}),d},dirtyFields:function(){return n.filter(function(e,t){return O(t).data(m.isDirty)})}},has:{field:function(e){return E.verbose("Checking for existence of a field with identifier",e),"string"!=typeof(e=E.escape.string(e))&&E.error(u.identifier,e),0<n.filter("#"+e).length||0<n.filter('[name="'+e+'"]').length||0<n.filter("[data-"+m.validate+'="'+e+'"]').length}},can:{useElement:function(e){return O.fn[e]!==L||(E.error(u.noElement.replace("{element}",e)),!1)}},escape:{string:function(e){return(e=String(e)).replace(r.escape,"\\$&")}},add:{rule:function(e,t){E.add.field(e,t)},field:function(n,e){s[n]!==L&&s[n].rules!==L||(s[n]={rules:[]});var r={rules:[]};E.is.shorthandRules(e)?(e=Array.isArray(e)?e:[e],O.each(e,function(e,t){r.rules.push({type:t})})):r.rules=e.rules,O.each(r.rules,function(e,t){0==O.grep(s[n].rules,function(e){return e.type==t.type}).length&&s[n].rules.push(t)}),E.debug("Adding rules",r.rules,s),E.refreshEvents()},fields:function(e){s=O.extend(!0,{},s,E.get.fieldsFromShorthand(e)),E.refreshEvents()},prompt:function(e,t,n){var r=E.get.field(e).closest(d),i=r.children(p.prompt),a=0!==i.length;t="string"==typeof t?[t]:t,E.verbose("Adding field error state",e),n||r.addClass(g.error),f.inline&&(a||(i=O("<div/>").addClass(g.label)).appendTo(r),i.html(f.templates.prompt(t)),a?E.verbose("Inline errors are disabled, no inline error added",e):f.transition&&E.can.useElement("transition")&&h.transition("is supported")?(E.verbose("Displaying error with css transition",f.transition),i.transition(f.transition+" in",f.duration)):(E.verbose("Displaying error with fallback javascript animation"),i.fadeIn(f.duration)))},errors:function(e){E.debug("Adding form error messages",e),E.set.error(),t.html(f.templates.error(e))}},remove:{errors:function(){E.debug("Removing form error messages"),t.empty()},states:function(){h.removeClass(g.error).removeClass(g.success),f.inline||E.remove.errors(),E.determine.isDirty()},rule:function(n,e){var r=Array.isArray(e)?e:[e];if(s[n]!==L&&Array.isArray(s[n].rules))return e===L?(E.debug("Removed all rules"),void(s[n].rules=[])):void O.each(s[n].rules,function(e,t){t&&-1!==r.indexOf(t.type)&&(E.debug("Removed rule",t.type),s[n].rules.splice(e,1))})},field:function(e){e=Array.isArray(e)?e:[e];O.each(e,function(e,t){E.remove.rule(t)}),E.refreshEvents()},rules:function(e,n){Array.isArray(e)?O.each(e,function(e,t){E.remove.rule(t,n)}):E.remove.rule(e,n)},fields:function(e){E.remove.field(e)},prompt:function(e){var t=E.get.field(e).closest(d),n=t.children(p.prompt);t.removeClass(g.error),f.inline&&n.is(":visible")&&(E.verbose("Removing prompt for field",e),f.transition&&E.can.useElement("transition")&&h.transition("is supported")?n.transition(f.transition+" out",f.duration,function(){n.remove()}):n.fadeOut(f.duration,function(){n.remove()}))}},set:{success:function(){h.removeClass(g.error).addClass(g.success)},defaults:function(){n.each(function(e,t){var t=O(t),n=t.parent(),r=0<t.filter(p.checkbox).length,i=n.is(p.uiDropdown)&&E.can.useElement("dropdown"),a=t.closest(p.uiCalendar),o=0<a.length&&E.can.useElement("calendar"),r=r?t.is(":checked"):t.val();i?n.dropdown("save defaults"):o&&a.calendar("refresh"),t.data(m.defaultValue,r),t.data(m.isDirty,!1)})},error:function(){h.removeClass(g.success).addClass(g.error)},value:function(e,t){var n={};return n[e]=t,E.set.values.call(v,n)},values:function(e){O.isEmptyObject(e)||O.each(e,function(e,t){var n,r=E.get.field(e),i=r.parent(),e=r.closest(p.uiCalendar),a=Array.isArray(t),o=i.is(p.uiCheckbox)&&E.can.useElement("checkbox"),l=i.is(p.uiDropdown)&&E.can.useElement("dropdown"),s=r.is(p.radio)&&o,u=0<e.length&&E.can.useElement("calendar");0<r.length&&(a&&o?(E.verbose("Selecting multiple",t,r),i.checkbox("uncheck"),O.each(t,function(e,t){n=r.filter('[value="'+t+'"]'),i=n.parent(),0<n.length&&i.checkbox("check")})):s?(E.verbose("Selecting radio value",t,r),r.filter('[value="'+t+'"]').parent(p.uiCheckbox).checkbox("check")):o?(E.verbose("Setting checkbox value",t,i),!0===t||1===t||"on"===t?i.checkbox("check"):i.checkbox("uncheck"),"string"==typeof t&&r.val(t)):l?(E.verbose("Setting dropdown value",t,i),i.dropdown("set selected",t)):u?e.calendar("set date",t):(E.verbose("Setting field value",t,r),r.val(t)))})},dirty:function(){E.verbose("Setting state dirty"),x=!0,k[0]=k[1],k[1]="dirty",E.is.justClean()&&h.trigger("dirty")},clean:function(){E.verbose("Setting state clean"),x=!1,k[0]=k[1],k[1]="clean",E.is.justDirty()&&h.trigger("clean")},asClean:function(){E.set.defaults(),E.set.clean()},asDirty:function(){E.set.defaults(),E.set.dirty()},autoCheck:function(){E.debug("Enabling auto check on required fields"),n.each(function(e,t){var t=O(t),n=t.closest(d),r=0<t.filter(p.checkbox).length,i=t.prop("required")||n.hasClass(g.required)||n.parent().hasClass(g.required),n=t.is(":disabled")||n.hasClass(g.disabled)||n.parent().hasClass(g.disabled),a=E.get.validation(t),o=!!a&&0!==O.grep(a.rules,function(e){return"empty"==e.type}),a=a.identifier||t.attr("id")||t.attr("name")||t.data(m.validate);!i||n||o||a===L||(r?(E.verbose("Adding 'checked' rule on field",a),E.add.rule(a,"checked")):(E.verbose("Adding 'empty' rule on field",a),E.add.rule(a,"empty")))})},optional:function(n,r){r=!1!==r,O.each(s,function(e,t){n!=e&&n!=t.identifier||(t.optional=r)})}},validate:{form:function(e,t){var n,r=E.get.values();if(y)return!1;if(b=[],E.determine.isValid()){if(E.debug("Form has no validation errors, submitting"),E.set.success(),f.inline||E.remove.errors(),!0!==t)return f.onSuccess.call(v,e,r)}else if(E.debug("Form has errors"),o=!1,E.set.error(),f.inline||E.add.errors(b),e&&h.data("moduleApi")!==L&&e.stopImmediatePropagation(),f.errorFocus&&!0!==t&&(e=!0,"string"==typeof f.errorFocus?(e=(n=O(I).find(f.errorFocus)).is("[tabindex]"))||n.attr("tabindex",-1):n=d.filter("."+g.error).first().find(p.field),n.trigger("focus"),e||n.removeAttr("tabindex")),!0!==t)return f.onFailure.call(v,b,r)},field:function(r,e,i){i=i===L||i,"string"==typeof r&&(E.verbose("Validating field",r),r=s[e=r]);var a=r.identifier||e,e=E.get.field(a),t=!!r.depends&&E.get.field(r.depends),o=!0,l=[];return r.identifier||(E.debug("Using field name as identifier",a),r.identifier=a),!e.filter(":not(:disabled)").length?E.debug("Field is disabled. Skipping",a):r.optional&&E.is.blank(e)?E.debug("Field is optional and blank. Skipping",a):r.depends&&E.is.empty(t)?E.debug("Field depends on another value that is not present or empty. Skipping",t):r.rules!==L&&(i&&e.closest(d).removeClass(g.error),O.each(r.rules,function(e,t){var n;E.has.field(a)&&0<(n=E.validate.rule(r,t,!0)||[]).length&&(E.debug("Field is invalid",a,t.type),l.push(E.get.prompt(t,r)),o=!1,i&&O(n).closest(d).addClass(g.error))})),o?(i&&(E.remove.prompt(a,l),f.onValid.call(e)),!0):(i&&(b=b.concat(l),E.add.prompt(a,l,!0),f.onInvalid.call(e,l)),!1)},rule:function(e,n,t){function r(e){var t=(t=(s?O(e).filter(":checked"):O(e)).val())===L||""===t||null===t?"":f.shouldTrim&&!1!==n.shouldTrim||n.shouldTrim?String(t+"").trim():String(t+"");return o.call(e,t,i,h)}var e=E.get.field(e.identifier),i=E.get.ancillaryValue(n),a=E.get.ruleName(n),o=f.rules[a],l=[],s=e.is(p.checkbox);if(z(o))return s?r(e)||(l=e):O.each(e,function(e,t){r(t)||l.push(t)}),t?l:!(0<l.length);E.error(u.noRule,a)}},setting:function(e,t){if(O.isPlainObject(e))O.extend(!0,f,e);else{if(t===L)return f[e];f[e]=t}},internal:function(e,t){if(O.isPlainObject(e))O.extend(!0,E,e);else{if(t===L)return E[e];E[e]=t}},debug:function(){!f.silent&&f.debug&&(f.performance?E.performance.log(arguments):(E.debug=Function.prototype.bind.call(console.info,console,f.name+":"),E.debug.apply(console,arguments)))},verbose:function(){!f.silent&&f.verbose&&f.debug&&(f.performance?E.performance.log(arguments):(E.verbose=Function.prototype.bind.call(console.info,console,f.name+":"),E.verbose.apply(console,arguments)))},error:function(){f.silent||(E.error=Function.prototype.bind.call(console.error,console,f.name+":"),E.error.apply(console,arguments))},performance:{log:function(e){var t,n;f.performance&&(n=(t=(new Date).getTime())-(D||t),D=t,R.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:v,"Execution Time":n})),clearTimeout(E.performance.timer),E.performance.timer=setTimeout(E.performance.display,500)},display:function(){var e=f.name+":",n=0;D=!1,clearTimeout(E.performance.timer),O.each(R,function(e,t){n+=t["Execution Time"]}),e+=" "+n+"ms",A&&(e+=" '"+A+"'"),1<V.length&&(e+=" ("+V.length+")"),(console.group!==L||console.table!==L)&&0<R.length&&(console.groupCollapsed(e),console.table?console.table(R):O.each(R,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),R=[]}},invoke:function(r,e,t){var i,a,n,o=c;return e=e||j,t=t||v,"string"==typeof r&&o!==L&&(r=r.split(/[\. ]/),i=r.length-1,O.each(r,function(e,t){var n=e!=i?t+r[e+1].charAt(0).toUpperCase()+r[e+1].slice(1):r;if(O.isPlainObject(o[n])&&e!=i)o=o[n];else{if(o[n]!==L)return a=o[n],!1;{if(!O.isPlainObject(o[t])||e==i)return o[t]!==L&&(a=o[t]),!1;o=o[t]}}})),z(a)?n=a.apply(t,e):a!==L&&(n=a),Array.isArray(w)?w.push(n):w!==L?w=[w,n]:n!==L&&(w=n),a}};E.initialize()}),w!==L?w:this},O.fn.form.settings={name:"Form",namespace:"form",debug:!1,verbose:!1,performance:!0,fields:!1,keyboardShortcuts:!0,on:"submit",inline:!1,delay:200,revalidate:!0,shouldTrim:!0,transition:"scale",duration:200,autoCheckRequired:!1,preventLeaving:!1,errorFocus:!0,dateHandling:"date",onValid:function(){},onInvalid:function(){},onSuccess:function(){return!0},onFailure:function(){return!1},onDirty:function(){},onClean:function(){},metadata:{defaultValue:"default",validate:"validate",isDirty:"isDirty"},regExp:{htmlID:/^[a-zA-Z][\w:.-]*$/g,bracket:/\[(.*)\]/i,decimal:/^\d+\.?\d*$/,email:/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i,escape:/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|:,=@]/g,flags:/^\/(.*)\/(.*)?/,integer:/^\-?\d+$/,number:/^\-?\d*(\.\d+)?$/,url:/(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/i},text:{and:"and",unspecifiedRule:"Please enter a valid value",unspecifiedField:"This field",leavingMessage:"There are unsaved changes on this page which will be discarded if you continue."},prompt:{range:"{name} must be in a range from {min} to {max}",maxValue:"{name} must have a maximum value of {ruleValue}",minValue:"{name} must have a minimum value of {ruleValue}",empty:"{name} must have a value",checked:"{name} must be checked",email:"{name} must be a valid e-mail",url:"{name} must be a valid url",regExp:"{name} is not formatted correctly",integer:"{name} must be an integer",decimal:"{name} must be a decimal number",number:"{name} must be set to a number",is:'{name} must be "{ruleValue}"',isExactly:'{name} must be exactly "{ruleValue}"',not:'{name} cannot be set to "{ruleValue}"',notExactly:'{name} cannot be set to exactly "{ruleValue}"',contain:'{name} must contain "{ruleValue}"',containExactly:'{name} must contain exactly "{ruleValue}"',doesntContain:'{name} cannot contain "{ruleValue}"',doesntContainExactly:'{name} cannot contain exactly "{ruleValue}"',minLength:"{name} must be at least {ruleValue} characters",exactLength:"{name} must be exactly {ruleValue} characters",maxLength:"{name} cannot be longer than {ruleValue} characters",match:"{name} must match {ruleValue} field",different:"{name} must have a different value than {ruleValue} field",creditCard:"{name} must be a valid credit card number",minCount:"{name} must have at least {ruleValue} choices",exactCount:"{name} must have exactly {ruleValue} choices",maxCount:"{name} must have {ruleValue} or less choices"},selector:{checkbox:'input[type="checkbox"], input[type="radio"]',clear:".clear",field:'input:not(.search):not([type="file"]):not([type="reset"]):not([type="button"]):not([type="submit"]), textarea, select',group:".field",input:'input:not([type="file"])',message:".error.message",prompt:".prompt.label",radio:'input[type="radio"]',reset:'.reset:not([type="reset"])',submit:'.submit:not([type="submit"])',uiCheckbox:".ui.checkbox",uiDropdown:".ui.dropdown",uiCalendar:".ui.calendar"},className:{error:"error",label:"ui basic red pointing prompt label",pressed:"down",success:"success",required:"required",disabled:"disabled"},error:{identifier:"You must specify a string identifier for each field",method:"The method you called is not defined.",noRule:"There is no rule matching the one you specified",oldSyntax:"Starting in 2.0 forms now only take a single settings object. Validation settings converted to new syntax automatically.",noField:"Field identifier {identifier} not found",noElement:"This module requires ui {element}"},templates:{error:function(e){var n='<ul class="list">';return O.each(e,function(e,t){n+="<li>"+t+"</li>"}),n+="</ul>"},prompt:function(e){if(1===e.length)return e[0];var n='<ul class="ui list">';return O.each(e,function(e,t){n+="<li>"+t+"</li>"}),n+="</ul>"}},formatter:{date:function(e){return Intl.DateTimeFormat("en-GB").format(e)},datetime:function(e){return Intl.DateTimeFormat("en-GB",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(e)},time:function(e){return Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(e)},month:function(e){return Intl.DateTimeFormat("en-GB",{month:"2-digit",year:"numeric"}).format(e)},year:function(e){return Intl.DateTimeFormat("en-GB",{year:"numeric"}).format(e)}},rules:{empty:function(e){return!(e===L||""===e||Array.isArray(e)&&0===e.length)},checked:function(){return 0<O(this).filter(":checked").length},email:function(e){return O.fn.form.settings.regExp.email.test(e)},url:function(e){return O.fn.form.settings.regExp.url.test(e)},regExp:function(e,t){if(t instanceof RegExp)return e.match(t);var n,r=t.match(O.fn.form.settings.regExp.flags);return r&&(t=2<=r.length?r[1]:t,n=3<=r.length?r[2]:""),e.match(new RegExp(t,n))},minValue:function(e,t){return O.fn.form.settings.rules.range(e,t+"..","number")},maxValue:function(e,t){return O.fn.form.settings.rules.range(e,".."+t,"number")},integer:function(e,t){return O.fn.form.settings.rules.range(e,t,"integer")},range:function(e,t,n){var r,i;return(n="string"==typeof n?O.fn.form.settings.regExp[n]:n)instanceof RegExp||(n=O.fn.form.settings.regExp.integer),t&&-1===["",".."].indexOf(t)&&(-1==t.indexOf("..")?n.test(t)&&(r=i=+t):(t=t.split("..",2),n.test(t[0])&&(r=+t[0]),n.test(t[1])&&(i=+t[1]))),n.test(e)&&(r===L||r<=e)&&(i===L||e<=i)},decimal:function(e,t){return O.fn.form.settings.rules.range(e,t,"decimal")},number:function(e,t){return O.fn.form.settings.rules.range(e,t,"number")},is:function(e,t){return t="string"==typeof t?t.toLowerCase():t,(e="string"==typeof e?e.toLowerCase():e)==t},isExactly:function(e,t){return e==t},not:function(e,t){return(e="string"==typeof e?e.toLowerCase():e)!=(t="string"==typeof t?t.toLowerCase():t)},notExactly:function(e,t){return e!=t},contains:function(e,t){return t=t.replace(O.fn.form.settings.regExp.escape,"\\$&"),-1!==e.search(new RegExp(t,"i"))},containsExactly:function(e,t){return t=t.replace(O.fn.form.settings.regExp.escape,"\\$&"),-1!==e.search(new RegExp(t))},doesntContain:function(e,t){return t=t.replace(O.fn.form.settings.regExp.escape,"\\$&"),-1===e.search(new RegExp(t,"i"))},doesntContainExactly:function(e,t){return t=t.replace(O.fn.form.settings.regExp.escape,"\\$&"),-1===e.search(new RegExp(t))},minLength:function(e,t){return e!==L&&e.length>=t},exactLength:function(e,t){return e!==L&&e.length==t},maxLength:function(e,t){return e!==L&&e.length<=t},match:function(e,t,n){var r,i;return 0<(i=n.find('[data-validate="'+t+'"]')).length||0<(i=n.find("#"+t)).length||0<(i=n.find('[name="'+t+'"]')).length?r=i.val():0<(i=n.find('[name="'+t+'[]"]')).length&&(r=i),r!==L&&e.toString()==r.toString()},different:function(e,t,n){var r,i;return 0<(i=n.find('[data-validate="'+t+'"]')).length||0<(i=n.find("#"+t)).length||0<(i=n.find('[name="'+t+'"]')).length?r=i.val():0<(i=n.find('[name="'+t+'[]"]')).length&&(r=i),r!==L&&e.toString()!==r.toString()},creditCard:function(n,e){var r,i={visa:{pattern:/^4/,length:[16]},amex:{pattern:/^3[47]/,length:[15]},mastercard:{pattern:/^5[1-5]/,length:[16]},discover:{pattern:/^(6011|622(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[0-1][0-9]|92[0-5]|64[4-9])|65)/,length:[16]},unionPay:{pattern:/^(62|88)/,length:[16,17,18,19]},jcb:{pattern:/^35(2[89]|[3-8][0-9])/,length:[16]},maestro:{pattern:/^(5018|5020|5038|6304|6759|676[1-3])/,length:[12,13,14,15,16,17,18,19]},dinersClub:{pattern:/^(30[0-5]|^36)/,length:[14]},laser:{pattern:/^(6304|670[69]|6771)/,length:[16,17,18,19]},visaElectron:{pattern:/^(4026|417500|4508|4844|491(3|7))/,length:[16]}},a=!1,e="string"==typeof e&&e.split(",");if("string"==typeof n&&0!==n.length){if(n=n.replace(/[\s\-]/g,""),e&&(O.each(e,function(e,t){(r=i[t])&&(r={length:-1!==O.inArray(n.length,r.length),pattern:-1!==n.search(r.pattern)}).length&&r.pattern&&(a=!0)}),!a))return!1;if((e={number:-1!==O.inArray(n.length,i.unionPay.length),pattern:-1!==n.search(i.unionPay.pattern)}).number&&e.pattern)return!0;for(var t=n.length,o=0,l=[[0,1,2,3,4,5,6,7,8,9],[0,2,4,6,8,1,3,5,7,9]],s=0;t--;)s+=l[o][parseInt(n.charAt(t),10)],o^=1;return s%10==0&&0<s}},minCount:function(e,t){return 0==t||(1==t?""!==e:e.split(",").length>=t)},exactCount:function(e,t){return 0==t?""===e:1==t?""!==e&&-1===e.search(","):e.split(",").length==t},maxCount:function(e,t){return 0!=t&&(1==t?-1===e.search(","):e.split(",").length<=t)}}}}(jQuery,window,document);