AE86 3 gadi atpakaļ
vecāks
revīzija
077bb5abff

+ 9 - 0
dbsyncer-biz/src/main/java/org/dbsyncer/biz/checker/impl/connector/PostgreSQLConfigChecker.java

@@ -1,5 +1,6 @@
 package org.dbsyncer.biz.checker.impl.connector;
 
+import org.dbsyncer.common.util.StringUtil;
 import org.dbsyncer.connector.config.DatabaseConfig;
 import org.springframework.stereotype.Component;
 
@@ -16,5 +17,13 @@ public class PostgreSQLConfigChecker extends AbstractDataBaseConfigChecker {
     public void modify(DatabaseConfig connectorConfig, Map<String, String> params) {
         super.modify(connectorConfig, params);
         super.modifySchema(connectorConfig, params);
+
+        String dropSlotOnClose = params.get("dropSlotOnClose");
+        connectorConfig.getProperties().put("dropSlotOnClose", StringUtil.equals("on", dropSlotOnClose) ? "true" : "false");
+
+        String pluginName = params.get("pluginName");
+        if (StringUtil.isNotBlank(pluginName)) {
+            connectorConfig.getProperties().put("pluginName", pluginName);
+        }
     }
 }

+ 5 - 9
dbsyncer-listener/src/main/java/org/dbsyncer/listener/postgresql/decoder/TestDecodingMessageDecoder.java

@@ -11,8 +11,6 @@ import org.dbsyncer.listener.postgresql.enums.MessageDecoderEnum;
 import org.dbsyncer.listener.postgresql.enums.MessageTypeEnum;
 import org.postgresql.replication.LogSequenceNumber;
 import org.postgresql.replication.fluent.logical.ChainedLogicalStreamBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
@@ -26,8 +24,6 @@ import java.util.List;
  */
 public class TestDecodingMessageDecoder extends AbstractMessageDecoder {
 
-    private final Logger logger = LoggerFactory.getLogger(getClass());
-
     private static final ColumnValueResolver resolver = new ColumnValueResolver();
 
     @Override
@@ -45,10 +41,13 @@ public class TestDecodingMessageDecoder extends AbstractMessageDecoder {
                 case TRUNCATE:
                 case TYPE:
                 case ORIGIN:
+                case INSERT:
+                case UPDATE:
+                case DELETE:
                 case NONE:
                     return true;
                 default:
-                    // TABLE|INSERT|UPDATE|DELETE
+                    // TABLE
                     return false;
             }
         } finally {
@@ -82,7 +81,6 @@ public class TestDecodingMessageDecoder extends AbstractMessageDecoder {
     }
 
     private RowChangedEvent parseMessage(String message) {
-        logger.info(message);
         Lexer lexer = new Lexer(message);
 
         // table
@@ -122,9 +120,7 @@ public class TestDecodingMessageDecoder extends AbstractMessageDecoder {
         if (StringUtil.equals(ConnectorConstant.OPERTION_DELETE, eventType)) {
             event = new RowChangedEvent(table, ConnectorConstant.OPERTION_DELETE, data, Collections.EMPTY_LIST);
         }
-        logger.info(event.toString());
-
-        return null;
+        return event;
     }
 
     private String parseName(Lexer lexer) {

+ 30 - 0
dbsyncer-web/src/main/resources/public/connector/addDqlPostgreSQL.html

@@ -50,6 +50,24 @@
         </div>
         <div class="col-sm-6"></div>
     </div>
+    <div class="form-group">
+        <label class="col-sm-2 control-label">删除Slot</label>
+        <div class="col-sm-4">
+            <input id="dropSlotOnCloseSwitch" name="dropSlotOnClose"
+                   th:checked="${#maps.isEmpty(connector?.config?.properties) or connector?.config?.properties?.dropSlotOnClose eq 'true'}"
+                   type="checkbox">
+        </div>
+        <label class="col-sm-2 control-label">插件</label>
+        <div class="col-sm-4"
+             th:if="${#maps.isEmpty(connector?.config?.properties) or not #maps.containsKey(connector?.config?.properties, 'pluginName')}">
+            <input class="form-control" maxlength="32" name="pluginName" type="text"/>
+        </div>
+        <div class="col-sm-4"
+             th:if="${not #maps.isEmpty(connector?.config?.properties) and #maps.containsKey(connector?.config?.properties, 'pluginName')}">
+            <input class="form-control" maxlength="32" name="pluginName"
+                   th:value="${connector?.config?.properties?.pluginName}" type="text"/>
+        </div>
+    </div>
     <div class="form-group">
         <label class="col-sm-2 control-label">驱动 </label>
         <div class="col-sm-10">
@@ -57,6 +75,18 @@
                    th:value="${connector?.config?.driverClassName} ?: 'org.postgresql.Driver'" type="text"/>
         </div>
     </div>
+
+    <script type="text/javascript">
+        $(function () {
+            $('#dropSlotOnCloseSwitch').bootstrapSwitch({
+                onText: "Yes",
+                offText: "No",
+                onColor: "success",
+                offColor: "info",
+                size: "normal"
+            });
+        })
+    </script>
 </div>
 
 </html>

+ 25 - 2
dbsyncer-web/src/main/resources/public/connector/addPostgreSQL.html

@@ -31,6 +31,24 @@
         </div>
         <div class="col-sm-6"></div>
     </div>
+    <div class="form-group">
+        <label class="col-sm-2 control-label">删除Slot</label>
+        <div class="col-sm-4">
+            <input id="dropSlotOnCloseSwitch" name="dropSlotOnClose"
+                   th:checked="${#maps.isEmpty(connector?.config?.properties) or connector?.config?.properties?.dropSlotOnClose eq 'true'}"
+                   type="checkbox">
+        </div>
+        <label class="col-sm-2 control-label">插件</label>
+        <div class="col-sm-4"
+             th:if="${#maps.isEmpty(connector?.config?.properties) or not #maps.containsKey(connector?.config?.properties, 'pluginName')}">
+            <input class="form-control" maxlength="32" name="pluginName" type="text"/>
+        </div>
+        <div class="col-sm-4"
+             th:if="${not #maps.isEmpty(connector?.config?.properties) and #maps.containsKey(connector?.config?.properties, 'pluginName')}">
+            <input class="form-control" maxlength="32" name="pluginName"
+                   th:value="${connector?.config?.properties?.pluginName}" type="text"/>
+        </div>
+    </div>
     <div class="form-group">
         <label class="col-sm-2 control-label">驱动 </label>
         <div class="col-sm-10">
@@ -41,8 +59,13 @@
 
     <script type="text/javascript">
         $(function () {
-            // 初始化select插件
-            initSelectIndex($(".select-control"), 1);
+            $('#dropSlotOnCloseSwitch').bootstrapSwitch({
+                onText: "Yes",
+                offText: "No",
+                onColor: "success",
+                offColor: "info",
+                size: "normal"
+            });
         })
     </script>
 </div>

+ 2 - 0
dbsyncer-web/src/main/resources/public/index.html

@@ -18,6 +18,7 @@
     <link type="text/css" rel="stylesheet" th:href="@{/plugins/css/bootstrap-dialog/bootstrap-dialog.min.css}"/>
     <link type="text/css" rel="stylesheet" th:href="@{/plugins/css/bootstrap-fileinput/fileinput.min.css}"/>
     <link type="text/css" rel="stylesheet" th:href="@{/plugins/css/bootstrap-select/bootstrap-select.min.css}"/>
+    <link rel="stylesheet" th:href="@{/plugins/css/bootstrap-switch/bootstrap-switch.min.css}" type="text/css"/>
     <link type="text/css" rel="stylesheet" th:href="@{/plugins/css/icheck/all.css}"/>
     <link type="text/css" rel="stylesheet" th:href="@{/plugins/css/loading-plus/loading-plus.css}"/>
     <link type="text/css" rel="stylesheet" th:href="@{/css/common.css}">
@@ -46,6 +47,7 @@
 <script th:src="@{/plugins/js/bootstrap-fileinput/theme.min.js}"></script>
 <script th:src="@{/plugins/js/bootstrap-fileinput/zh.js}"></script>
 <script th:src="@{/plugins/js/bootstrap-select/bootstrap-select.min.js}"></script>
+<script th:src="@{/plugins/js/bootstrap-switch/bootstrap-switch.min.js}"></script>
 <script th:src="@{/plugins/js/icheck/icheck.min.js}"></script>
 <script th:src="@{/plugins/js/loading-plus/loading-plus.js}"></script>
 <script th:src="@{/plugins/js/placeholder/jquery.placeholder.js}"></script>

BIN
dbsyncer-web/src/main/resources/static/plugins/css/bootstrap-icheck/flat/blue.png


BIN
dbsyncer-web/src/main/resources/static/plugins/css/bootstrap-icheck/flat/blue@2x.png


BIN
dbsyncer-web/src/main/resources/static/plugins/css/bootstrap-icheck/flat/flat.png


+ 0 - 530
dbsyncer-web/src/main/resources/static/plugins/css/bootstrap-icheck/flat/icheck-allSkins.css

@@ -1,530 +0,0 @@
-/* iCheck plugin Flat skin
------------------------------------ */
-.icheckbox_flat,
-.iradio_flat {
-    display: inline-block;
-    *display: inline;
-    vertical-align: middle;
-    margin: 0;
-    padding: 0;
-    width: 20px;
-    height: 20px;
-    background: url(flat.png) no-repeat;
-    border: none;
-    cursor: pointer;
-}
-
-.icheckbox_flat {
-    background-position: 0 0;
-}
-    .icheckbox_flat.checked {
-        background-position: -22px 0;
-    }
-    .icheckbox_flat.disabled {
-        background-position: -44px 0;
-        cursor: default;
-    }
-    .icheckbox_flat.checked.disabled {
-        background-position: -66px 0;
-    }
-
-.iradio_flat {
-    background-position: -88px 0;
-}
-    .iradio_flat.checked {
-        background-position: -110px 0;
-    }
-    .iradio_flat.disabled {
-        background-position: -132px 0;
-        cursor: default;
-    }
-    .iradio_flat.checked.disabled {
-        background-position: -154px 0;
-    }
-
-/* HiDPI support */
-@media (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) {
-    .icheckbox_flat,
-    .iradio_flat {
-        background-image: url(flat@2x.png);
-        -webkit-background-size: 176px 22px;
-        background-size: 176px 22px;
-    }
-}
-
-/* red */
-.icheckbox_flat-red,
-.iradio_flat-red {
-    display: inline-block;
-    *display: inline;
-    vertical-align: middle;
-    margin: 0;
-    padding: 0;
-    width: 20px;
-    height: 20px;
-    background: url(red.png) no-repeat;
-    border: none;
-    cursor: pointer;
-}
-
-.icheckbox_flat-red {
-    background-position: 0 0;
-}
-    .icheckbox_flat-red.checked {
-        background-position: -22px 0;
-    }
-    .icheckbox_flat-red.disabled {
-        background-position: -44px 0;
-        cursor: default;
-    }
-    .icheckbox_flat-red.checked.disabled {
-        background-position: -66px 0;
-    }
-
-.iradio_flat-red {
-    background-position: -88px 0;
-}
-    .iradio_flat-red.checked {
-        background-position: -110px 0;
-    }
-    .iradio_flat-red.disabled {
-        background-position: -132px 0;
-        cursor: default;
-    }
-    .iradio_flat-red.checked.disabled {
-        background-position: -154px 0;
-    }
-
-/* HiDPI support */
-@media (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) {
-    .icheckbox_flat-red,
-    .iradio_flat-red {
-        background-image: url(red@2x.png);
-        -webkit-background-size: 176px 22px;
-        background-size: 176px 22px;
-    }
-}
-
-/* green */
-.icheckbox_flat-green,
-.iradio_flat-green {
-    display: inline-block;
-    *display: inline;
-    vertical-align: middle;
-    margin: 0;
-    padding: 0;
-    width: 20px;
-    height: 20px;
-    background: url(green.png) no-repeat;
-    border: none;
-    cursor: pointer;
-}
-
-.icheckbox_flat-green {
-    background-position: 0 0;
-}
-    .icheckbox_flat-green.checked {
-        background-position: -22px 0;
-    }
-    .icheckbox_flat-green.disabled {
-        background-position: -44px 0;
-        cursor: default;
-    }
-    .icheckbox_flat-green.checked.disabled {
-        background-position: -66px 0;
-    }
-
-.iradio_flat-green {
-    background-position: -88px 0;
-}
-    .iradio_flat-green.checked {
-        background-position: -110px 0;
-    }
-    .iradio_flat-green.disabled {
-        background-position: -132px 0;
-        cursor: default;
-    }
-    .iradio_flat-green.checked.disabled {
-        background-position: -154px 0;
-    }
-
-/* HiDPI support */
-@media (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) {
-    .icheckbox_flat-green,
-    .iradio_flat-green {
-        background-image: url(green@2x.png);
-        -webkit-background-size: 176px 22px;
-        background-size: 176px 22px;
-    }
-}
-
-/* blue */
-.icheckbox_flat-blue,
-.iradio_flat-blue {
-    display: inline-block;
-    *display: inline;
-    vertical-align: middle;
-    margin: 0;
-    padding: 0;
-    width: 20px;
-    height: 20px;
-    background: url(blue.png) no-repeat;
-    border: none;
-    cursor: pointer;
-}
-
-.icheckbox_flat-blue {
-    background-position: 0 0;
-}
-    .icheckbox_flat-blue.checked {
-        background-position: -22px 0;
-    }
-    .icheckbox_flat-blue.disabled {
-        background-position: -44px 0;
-        cursor: default;
-    }
-    .icheckbox_flat-blue.checked.disabled {
-        background-position: -66px 0;
-    }
-
-.iradio_flat-blue {
-    background-position: -88px 0;
-}
-    .iradio_flat-blue.checked {
-        background-position: -110px 0;
-    }
-    .iradio_flat-blue.disabled {
-        background-position: -132px 0;
-        cursor: default;
-    }
-    .iradio_flat-blue.checked.disabled {
-        background-position: -154px 0;
-    }
-
-/* HiDPI support */
-@media (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) {
-    .icheckbox_flat-blue,
-    .iradio_flat-blue {
-        background-image: url(blue@2x.png);
-        -webkit-background-size: 176px 22px;
-        background-size: 176px 22px;
-    }
-}
-
-/* aero */
-.icheckbox_flat-aero,
-.iradio_flat-aero {
-    display: inline-block;
-    *display: inline;
-    vertical-align: middle;
-    margin: 0;
-    padding: 0;
-    width: 20px;
-    height: 20px;
-    background: url(aero.png) no-repeat;
-    border: none;
-    cursor: pointer;
-}
-
-.icheckbox_flat-aero {
-    background-position: 0 0;
-}
-    .icheckbox_flat-aero.checked {
-        background-position: -22px 0;
-    }
-    .icheckbox_flat-aero.disabled {
-        background-position: -44px 0;
-        cursor: default;
-    }
-    .icheckbox_flat-aero.checked.disabled {
-        background-position: -66px 0;
-    }
-
-.iradio_flat-aero {
-    background-position: -88px 0;
-}
-    .iradio_flat-aero.checked {
-        background-position: -110px 0;
-    }
-    .iradio_flat-aero.disabled {
-        background-position: -132px 0;
-        cursor: default;
-    }
-    .iradio_flat-aero.checked.disabled {
-        background-position: -154px 0;
-    }
-
-/* HiDPI support */
-@media (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) {
-    .icheckbox_flat-aero,
-    .iradio_flat-aero {
-        background-image: url(aero@2x.png);
-        -webkit-background-size: 176px 22px;
-        background-size: 176px 22px;
-    }
-}
-
-/* grey */
-.icheckbox_flat-grey,
-.iradio_flat-grey {
-    display: inline-block;
-    *display: inline;
-    vertical-align: middle;
-    margin: 0;
-    padding: 0;
-    width: 20px;
-    height: 20px;
-    background: url(grey.png) no-repeat;
-    border: none;
-    cursor: pointer;
-}
-
-.icheckbox_flat-grey {
-    background-position: 0 0;
-}
-    .icheckbox_flat-grey.checked {
-        background-position: -22px 0;
-    }
-    .icheckbox_flat-grey.disabled {
-        background-position: -44px 0;
-        cursor: default;
-    }
-    .icheckbox_flat-grey.checked.disabled {
-        background-position: -66px 0;
-    }
-
-.iradio_flat-grey {
-    background-position: -88px 0;
-}
-    .iradio_flat-grey.checked {
-        background-position: -110px 0;
-    }
-    .iradio_flat-grey.disabled {
-        background-position: -132px 0;
-        cursor: default;
-    }
-    .iradio_flat-grey.checked.disabled {
-        background-position: -154px 0;
-    }
-
-/* HiDPI support */
-@media (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) {
-    .icheckbox_flat-grey,
-    .iradio_flat-grey {
-        background-image: url(grey@2x.png);
-        -webkit-background-size: 176px 22px;
-        background-size: 176px 22px;
-    }
-}
-
-/* orange */
-.icheckbox_flat-orange,
-.iradio_flat-orange {
-    display: inline-block;
-    *display: inline;
-    vertical-align: middle;
-    margin: 0;
-    padding: 0;
-    width: 20px;
-    height: 20px;
-    background: url(orange.png) no-repeat;
-    border: none;
-    cursor: pointer;
-}
-
-.icheckbox_flat-orange {
-    background-position: 0 0;
-}
-    .icheckbox_flat-orange.checked {
-        background-position: -22px 0;
-    }
-    .icheckbox_flat-orange.disabled {
-        background-position: -44px 0;
-        cursor: default;
-    }
-    .icheckbox_flat-orange.checked.disabled {
-        background-position: -66px 0;
-    }
-
-.iradio_flat-orange {
-    background-position: -88px 0;
-}
-    .iradio_flat-orange.checked {
-        background-position: -110px 0;
-    }
-    .iradio_flat-orange.disabled {
-        background-position: -132px 0;
-        cursor: default;
-    }
-    .iradio_flat-orange.checked.disabled {
-        background-position: -154px 0;
-    }
-
-/* HiDPI support */
-@media (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) {
-    .icheckbox_flat-orange,
-    .iradio_flat-orange {
-        background-image: url(orange@2x.png);
-        -webkit-background-size: 176px 22px;
-        background-size: 176px 22px;
-    }
-}
-
-/* yellow */
-.icheckbox_flat-yellow,
-.iradio_flat-yellow {
-    display: inline-block;
-    *display: inline;
-    vertical-align: middle;
-    margin: 0;
-    padding: 0;
-    width: 20px;
-    height: 20px;
-    background: url(yellow.png) no-repeat;
-    border: none;
-    cursor: pointer;
-}
-
-.icheckbox_flat-yellow {
-    background-position: 0 0;
-}
-    .icheckbox_flat-yellow.checked {
-        background-position: -22px 0;
-    }
-    .icheckbox_flat-yellow.disabled {
-        background-position: -44px 0;
-        cursor: default;
-    }
-    .icheckbox_flat-yellow.checked.disabled {
-        background-position: -66px 0;
-    }
-
-.iradio_flat-yellow {
-    background-position: -88px 0;
-}
-    .iradio_flat-yellow.checked {
-        background-position: -110px 0;
-    }
-    .iradio_flat-yellow.disabled {
-        background-position: -132px 0;
-        cursor: default;
-    }
-    .iradio_flat-yellow.checked.disabled {
-        background-position: -154px 0;
-    }
-
-/* HiDPI support */
-@media (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) {
-    .icheckbox_flat-yellow,
-    .iradio_flat-yellow {
-        background-image: url(yellow@2x.png);
-        -webkit-background-size: 176px 22px;
-        background-size: 176px 22px;
-    }
-}
-
-/* pink */
-.icheckbox_flat-pink,
-.iradio_flat-pink {
-    display: inline-block;
-    *display: inline;
-    vertical-align: middle;
-    margin: 0;
-    padding: 0;
-    width: 20px;
-    height: 20px;
-    background: url(pink.png) no-repeat;
-    border: none;
-    cursor: pointer;
-}
-
-.icheckbox_flat-pink {
-    background-position: 0 0;
-}
-    .icheckbox_flat-pink.checked {
-        background-position: -22px 0;
-    }
-    .icheckbox_flat-pink.disabled {
-        background-position: -44px 0;
-        cursor: default;
-    }
-    .icheckbox_flat-pink.checked.disabled {
-        background-position: -66px 0;
-    }
-
-.iradio_flat-pink {
-    background-position: -88px 0;
-}
-    .iradio_flat-pink.checked {
-        background-position: -110px 0;
-    }
-    .iradio_flat-pink.disabled {
-        background-position: -132px 0;
-        cursor: default;
-    }
-    .iradio_flat-pink.checked.disabled {
-        background-position: -154px 0;
-    }
-
-/* HiDPI support */
-@media (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) {
-    .icheckbox_flat-pink,
-    .iradio_flat-pink {
-        background-image: url(pink@2x.png);
-        -webkit-background-size: 176px 22px;
-        background-size: 176px 22px;
-    }
-}
-
-/* purple */
-.icheckbox_flat-purple,
-.iradio_flat-purple {
-    display: inline-block;
-    *display: inline;
-    vertical-align: middle;
-    margin: 0;
-    padding: 0;
-    width: 20px;
-    height: 20px;
-    background: url(purple.png) no-repeat;
-    border: none;
-    cursor: pointer;
-}
-
-.icheckbox_flat-purple {
-    background-position: 0 0;
-}
-    .icheckbox_flat-purple.checked {
-        background-position: -22px 0;
-    }
-    .icheckbox_flat-purple.disabled {
-        background-position: -44px 0;
-        cursor: default;
-    }
-    .icheckbox_flat-purple.checked.disabled {
-        background-position: -66px 0;
-    }
-
-.iradio_flat-purple {
-    background-position: -88px 0;
-}
-    .iradio_flat-purple.checked {
-        background-position: -110px 0;
-    }
-    .iradio_flat-purple.disabled {
-        background-position: -132px 0;
-        cursor: default;
-    }
-    .iradio_flat-purple.checked.disabled {
-        background-position: -154px 0;
-    }
-
-/* HiDPI support */
-@media (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) {
-    .icheckbox_flat-purple,
-    .iradio_flat-purple {
-        background-image: url(purple@2x.png);
-        -webkit-background-size: 176px 22px;
-        background-size: 176px 22px;
-    }
-}

+ 0 - 11
dbsyncer-web/src/main/resources/static/plugins/js/bootstrap-icheck/bootstrap-icheck.min.js

@@ -1,11 +0,0 @@
-/*! iCheck v1.0.2 by Damir Sultanov, http://git.io/arlzeA, MIT Licensed */
-(function(f){function A(a,b,d){var c=a[0],g=/er/.test(d)?_indeterminate:/bl/.test(d)?n:k,e=d==_update?{checked:c[k],disabled:c[n],indeterminate:"true"==a.attr(_indeterminate)||"false"==a.attr(_determinate)}:c[g];if(/^(ch|di|in)/.test(d)&&!e)x(a,g);else if(/^(un|en|de)/.test(d)&&e)q(a,g);else if(d==_update)for(var f in e)e[f]?x(a,f,!0):q(a,f,!0);else if(!b||"toggle"==d){if(!b)a[_callback]("ifClicked");e?c[_type]!==r&&q(a,g):x(a,g)}}function x(a,b,d){var c=a[0],g=a.parent(),e=b==k,u=b==_indeterminate,
-v=b==n,s=u?_determinate:e?y:"enabled",F=l(a,s+t(c[_type])),B=l(a,b+t(c[_type]));if(!0!==c[b]){if(!d&&b==k&&c[_type]==r&&c.name){var w=a.closest("form"),p='input[name="'+c.name+'"]',p=w.length?w.find(p):f(p);p.each(function(){this!==c&&f(this).data(m)&&q(f(this),b)})}u?(c[b]=!0,c[k]&&q(a,k,"force")):(d||(c[b]=!0),e&&c[_indeterminate]&&q(a,_indeterminate,!1));D(a,e,b,d)}c[n]&&l(a,_cursor,!0)&&g.find("."+C).css(_cursor,"default");g[_add](B||l(a,b)||"");g.attr("role")&&!u&&g.attr("aria-"+(v?n:k),"true");
-g[_remove](F||l(a,s)||"")}function q(a,b,d){var c=a[0],g=a.parent(),e=b==k,f=b==_indeterminate,m=b==n,s=f?_determinate:e?y:"enabled",q=l(a,s+t(c[_type])),r=l(a,b+t(c[_type]));if(!1!==c[b]){if(f||!d||"force"==d)c[b]=!1;D(a,e,s,d)}!c[n]&&l(a,_cursor,!0)&&g.find("."+C).css(_cursor,"pointer");g[_remove](r||l(a,b)||"");g.attr("role")&&!f&&g.attr("aria-"+(m?n:k),"false");g[_add](q||l(a,s)||"")}function E(a,b){if(a.data(m)){a.parent().html(a.attr("style",a.data(m).s||""));if(b)a[_callback](b);a.off(".i").unwrap();
-f(_label+'[for="'+a[0].id+'"]').add(a.closest(_label)).off(".i")}}function l(a,b,f){if(a.data(m))return a.data(m).o[b+(f?"":"Class")]}function t(a){return a.charAt(0).toUpperCase()+a.slice(1)}function D(a,b,f,c){if(!c){if(b)a[_callback]("ifToggled");a[_callback]("ifChanged")[_callback]("if"+t(f))}}var m="iCheck",C=m+"-helper",r="radio",k="checked",y="un"+k,n="disabled";_determinate="determinate";_indeterminate="in"+_determinate;_update="update";_type="type";_click="click";_touch="touchbegin.i touchend.i";
-_add="addClass";_remove="removeClass";_callback="trigger";_label="label";_cursor="cursor";_mobile=/ipad|iphone|ipod|android|blackberry|windows phone|opera mini|silk/i.test(navigator.userAgent);f.fn[m]=function(a,b){var d='input[type="checkbox"], input[type="'+r+'"]',c=f(),g=function(a){a.each(function(){var a=f(this);c=a.is(d)?c.add(a):c.add(a.find(d))})};if(/^(check|uncheck|toggle|indeterminate|determinate|disable|enable|update|destroy)$/i.test(a))return a=a.toLowerCase(),g(this),c.each(function(){var c=
-f(this);"destroy"==a?E(c,"ifDestroyed"):A(c,!0,a);f.isFunction(b)&&b()});if("object"!=typeof a&&a)return this;var e=f.extend({checkedClass:k,disabledClass:n,indeterminateClass:_indeterminate,labelHover:!0},a),l=e.handle,v=e.hoverClass||"hover",s=e.focusClass||"focus",t=e.activeClass||"active",B=!!e.labelHover,w=e.labelHoverClass||"hover",p=(""+e.increaseArea).replace("%","")|0;if("checkbox"==l||l==r)d='input[type="'+l+'"]';-50>p&&(p=-50);g(this);return c.each(function(){var a=f(this);E(a);var c=this,
-b=c.id,g=-p+"%",d=100+2*p+"%",d={position:"absolute",top:g,left:g,display:"block",width:d,height:d,margin:0,padding:0,background:"#fff",border:0,opacity:0},g=_mobile?{position:"absolute",visibility:"hidden"}:p?d:{position:"absolute",opacity:0},l="checkbox"==c[_type]?e.checkboxClass||"icheckbox":e.radioClass||"i"+r,z=f(_label+'[for="'+b+'"]').add(a.closest(_label)),u=!!e.aria,y=m+"-"+Math.random().toString(36).substr(2,6),h='<div class="'+l+'" '+(u?'role="'+c[_type]+'" ':"");u&&z.each(function(){h+=
-'aria-labelledby="';this.id?h+=this.id:(this.id=y,h+=y);h+='"'});h=a.wrap(h+"/>")[_callback]("ifCreated").parent().append(e.insert);d=f('<ins class="'+C+'"/>').css(d).appendTo(h);a.data(m,{o:e,s:a.attr("style")}).css(g);e.inheritClass&&h[_add](c.className||"");e.inheritID&&b&&h.attr("id",m+"-"+b);"static"==h.css("position")&&h.css("position","relative");A(a,!0,_update);if(z.length)z.on(_click+".i mouseover.i mouseout.i "+_touch,function(b){var d=b[_type],e=f(this);if(!c[n]){if(d==_click){if(f(b.target).is("a"))return;
-A(a,!1,!0)}else B&&(/ut|nd/.test(d)?(h[_remove](v),e[_remove](w)):(h[_add](v),e[_add](w)));if(_mobile)b.stopPropagation();else return!1}});a.on(_click+".i focus.i blur.i keyup.i keydown.i keypress.i",function(b){var d=b[_type];b=b.keyCode;if(d==_click)return!1;if("keydown"==d&&32==b)return c[_type]==r&&c[k]||(c[k]?q(a,k):x(a,k)),!1;if("keyup"==d&&c[_type]==r)!c[k]&&x(a,k);else if(/us|ur/.test(d))h["blur"==d?_remove:_add](s)});d.on(_click+" mousedown mouseup mouseover mouseout "+_touch,function(b){var d=
-b[_type],e=/wn|up/.test(d)?t:v;if(!c[n]){if(d==_click)A(a,!1,!0);else{if(/wn|er|in/.test(d))h[_add](e);else h[_remove](e+" "+t);if(z.length&&B&&e==v)z[/ut|nd/.test(d)?_remove:_add](w)}if(_mobile)b.stopPropagation();else return!1}})})}})(window.jQuery||window.Zepto);