Nimble Page Builder - Version 2.1.30

Version Description

December 23rd, 2020 = * fixed : [dynamic CSS] insufficient specificity when setting section style options * fixed : [file import] bug when trying to assign sections to missing locations if current page uses a local header/footer * fixed : [text editor module] line break not preserved when re-opening a text module UI

Download this release

Release Info

Developer nikeo
Plugin Icon 128x128 Nimble Page Builder
Version 2.1.30
Comparing to
See all releases

Code changes from version 2.1.28 to 2.1.30

assets/czr/sek/css/sek-control.css CHANGED
@@ -1759,7 +1759,7 @@ body.sek-save-section-ui-visible #nimble-top-section-save-ui {
1759
  }
1760
  */
1761
  /* TEMPLATE GALLERY */
1762
- #nimble-tmpl-gallery {
1763
  -webkit-transition: top 0.3s ease-in-out;
1764
  -moz-transition: top, 0.3s ease-in-out;
1765
  -ms-transition: top, 0.3s ease-in-out;
@@ -1785,6 +1785,28 @@ body.sek-save-section-ui-visible #nimble-top-section-save-ui {
1785
  top: 36px;
1786
  }
1787
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1788
  #nimble-tmpl-gallery .sek-tmpl-gallery-inner {
1789
  display: -webkit-box;
1790
  display: -ms-flexbox;
1759
  }
1760
  */
1761
  /* TEMPLATE GALLERY */
1762
+ #nimble-tmpl-gallery, #nimble-tmpl-gallery .sek-tmpl-gal-import-dialog {
1763
  -webkit-transition: top 0.3s ease-in-out;
1764
  -moz-transition: top, 0.3s ease-in-out;
1765
  -ms-transition: top, 0.3s ease-in-out;
1785
  top: 36px;
1786
  }
1787
 
1788
+
1789
+ /* IMPORT DIALOG BOX */
1790
+ #nimble-tmpl-gallery .sek-tmpl-gal-import-dialog {
1791
+ background: rgba(240, 240, 240, 0.89)!important;
1792
+ border-bottom: 1px solid #aaa!important;
1793
+ color: #222!important;
1794
+ font-size: 12px!important;
1795
+ position: absolute;
1796
+ top: -100vh;
1797
+ right: 0;
1798
+ left: 0;
1799
+ height: calc(100vh - 36px);
1800
+ overflow: auto;
1801
+ padding: 15px;
1802
+ z-index: 1001;
1803
+ }
1804
+ .sek-tmpl-dialog-expanded #nimble-tmpl-gallery .sek-tmpl-gal-import-dialog {
1805
+ top: 36px;
1806
+ }
1807
+
1808
+
1809
+
1810
  #nimble-tmpl-gallery .sek-tmpl-gallery-inner {
1811
  display: -webkit-box;
1812
  display: -ms-flexbox;
assets/czr/sek/css/sek-control.min.css CHANGED
@@ -1 +1 @@
1
- @font-face{font-family:'Material Icons';font-style:normal;font-weight:400;src:url(../fonts/material-icons/MaterialIcons-Regular.eot);src:local('Material Icons'),local('MaterialIcons-Regular'),url(../fonts/material-icons/MaterialIcons-Regular.woff2) format('woff2'),url(../fonts/material-icons/MaterialIcons-Regular.woff) format('woff'),url(../fonts/material-icons/MaterialIcons-Regular.ttf) format('truetype')}.material-icons{font-family:'Material Icons';font-weight:400;font-style:normal;font-size:24px;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;-webkit-font-feature-settings:'liga';font-feature-settings:'liga'}#customize-preview iframe,#nimble-level-tree{-webkit-transition:top .3s ease-in-out;-moz-transition:top,.3s ease-in-out;-ms-transition:top,.3s ease-in-out;-o-transition:top,.3s ease-in-out;transition:top .3s ease-in-out}#customize-preview iframe{z-index:1}ul[id*=sub-accordion-section-__nimble__]{background:#f2f2f2!important}#customize-theme-controls .customize-pane-child[id*="__nimble__"]{-webkit-transition:unset;-o-transition:unset;transition:unset}li[id*="__nimble__"].customize-control{margin:8px 0;padding:2px;width:calc(100% - 4px);border:1px solid rgba(221,221,221,.43);box-shadow:1px 1px 2px 0 rgba(75,75,85,.2);-webkit-box-shadow:1px 1px 2px 0 rgba(75,75,85,.2);background-color:#fff}li[id*="__nimble__"].customize-control span.customize-control-title:first-child{margin-left:21px}#customize-theme-controls ul[id*=sub-accordion-section-__nimble__].open{top:0!important}.sek-float-right{float:right}.sek-float-left{float:left}.sek-flex-vertical-center{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}li[id^=accordion-section-__nimble__]{margin-top:16px}li[id^=accordion-section-__nimble__]>h3{border-top:1px solid #ddd}[data-sek-content-type]{float:left;padding:0;margin:1.8%;text-align:center;cursor:move;-webkit-transition:-webkit-box-shadow .2s ease;transition:-webkit-box-shadow .2s ease;-o-transition:box-shadow .2s ease;transition:box-shadow .2s ease;transition:box-shadow .2s ease,-webkit-box-shadow .2s ease;-webkit-box-shadow:0 2px 5px rgba(0,0,0,.25);box-shadow:0 2px 5px rgba(0,0,0,.25);border-radius:4px}[data-sek-content-type=module]{width:29%;height:130px;position:relative}.sek-is-pro{position:absolute;top:0;z-index:10;right:2px;height:20px;width:28px}li[id*=sek_draggable_modules] [data-sek-content-type=preset_section]{width:29%;height:130px}.sek-content-type-wrapper [data-sek-content-type=preset_section]{width:95%;height:165px;position:relative;overflow:hidden}.sek-demo-link{position:absolute;bottom:-22px;z-index:20;height:18px;width:100%;padding:2px 0;background:#000;background-color:rgba(0,0,0,.5);color:#fff;font-size:13px;cursor:pointer;-webkit-transition:bottom .2s ease-in-out;-moz-transition:bottom,.2s ease-in-out;-ms-transition:bottom,.2s ease-in-out;-o-transition:bottom,.2s ease-in-out;transition:bottom .2s ease-in-out}.sek-demo-link a,.sek-demo-link a:focus,.sek-demo-link a:visited,.sek-demo-link i{color:#fff}.sek-demo-link a{text-decoration:none;text-transform:uppercase;font-size:12px}.sek-demo-link a:hover{color:#fff;text-decoration:underline}[data-sek-content-type=preset_section]:hover .sek-demo-link{bottom:0}[data-sek-content-type=preset_section] .sek-overlay{display:block;position:absolute;top:0;left:0;right:0;bottom:0;background-color:#000;opacity:0;-webkit-transition:opacity .35s ease;transition:opacity .35s ease;-o-transition:opacity .35s ease}[data-sek-content-type=preset_section]:hover .sek-overlay{opacity:.15}[data-sek-content-type][draggable=true]:hover{-webkit-box-shadow:0 12px 20px rgba(0,0,0,.2);box-shadow:0 12px 20px rgba(0,0,0,.2)}[data-sek-content-type][draggable=false]{background:#eee;opacity:.8}.sek-user-section-wrapper{margin-bottom:15px;float:left;width:100%}.sek-user-section-wrapper [data-sek-content-type=preset_section] .sek-overlay{opacity:.4}.sek-user-section-wrapper [data-sek-content-type=preset_section]:hover .sek-overlay{opacity:.5}.sek-user-section-wrapper [data-sek-is-user-section=true]{height:165px;margin:0;width:97%}.sek-user-section-wrapper .sek-sec-thumb{position:absolute;opacity:.5;z-index:0;top:0;bottom:0;height:100%;width:100%}.sek-user-section-wrapper .sek-sec-info{position:relative;color:#fff;padding:2%;overflow:hidden;height:100%;max-height:138px;padding:10px}.sek-sec-info .sec-title{color:#fff;margin:0;line-height:20px;max-height:20px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.sek-sec-info .sec-date,.sek-sec-info .sec-desc{margin:0;margin-top:5px;font-size:12px}.sek-sec-info .sec-date{font-size:italic}.sek-sec-info>.remove-user-sec{cursor:pointer;font-size:16px;width:30px;height:30px;color:#535353;background:rgba(255,255,255,.7);border-radius:30px;opacity:0;-webkit-box-shadow:0 2px 6px rgba(0,0,0,.2);box-shadow:0 2px 6px rgba(0,0,0,.2);-webkit-transition:all .2s ease;-o-transition:all .2s ease;transition:all .2s ease;-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;position:absolute;bottom:0;right:5px}.sek-sec-info:hover>.remove-user-sec{opacity:.7}.sek-sec-info>.remove-user-sec:hover{opacity:.95;color:red}.sek-dragging [data-sek-content-type]{-webkit-box-shadow:0 2px 5px rgba(0,0,0,.25)!important;box-shadow:0 2px 5px rgba(0,0,0,.25)!important}.sek-dragged{background:#33b3db3d;background:rgba(51,179,219,.24)}[data-sek-content-type] .sek-module-icon{display:block;padding:0}[data-sek-content-type] .sek-module-icon .nimble-module-icons{font-size:3rem;max-width:100%;color:#878787;max-height:86px}[data-sek-content-type] .sek-module-icon.is-font-icon{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-flex:0;-ms-flex:0 0 100%;flex:0 0 100%;max-width:100%;min-height:70%}[data-sek-content-type] .sek-module-icon.is-font-icon i{font-size:35px}[data-sek-content-type] .sek-module-title{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:0 6px 0;font-size:.75rem;height:45px;justify-content:center;position:relative;top:-18px}.sek-centered-module-title{overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.sek-new-label{background:#ff0;border:1px solid #ff0;padding:3px 4px;line-height:12px;border-radius:8px;font-size:12px}.sek-accord-title{color:#4b4a4a;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:120px;height:23px;line-height:22px;font-size:13px;float:left;padding-left:10px}.sek-pad-marg-inner{font-size:12px;display:-webkit-box;display:-ms-flexbox;display:flex;margin:10px auto 10px auto;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;padding:0;background-color:#e6e6e6;border:1px solid #c5c5c5;height:192px;width:232px;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-transition:background-color .2s ease;-o-transition:background-color .2s ease;transition:background-color .2s ease}.sek-pm-top-bottom-wrap{height:46px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.sek-flex-center-stretch{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch}.sek-pm-input{width:35px;height:15px;padding:0;text-align:center;font-family:Source Sans Pro;padding:5px;border-radius:3px;text-align:left;font-size:13px;outline:0;-webkit-box-shadow:inset 1px 1px 3px rgba(0,0,0,.15);box-shadow:inset 1px 1px 3px rgba(0,0,0,.15);border:1px solid #ced6d9}.sek-pm-input-parent .sek-pm-input{-webkit-box-flex:1;-ms-flex:1 1 auto;flex:1 1 auto;display:block;margin:auto 3px;-webkit-box-sizing:border-box;box-sizing:border-box;padding:1px 3px;font-size:12px;font-weight:300;min-width:34px;min-height:20px;color:#313131}.sek-pm-middle-wrap{display:-webkit-box;display:-ms-flexbox;display:flex;height:100px;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.sek-pm-margin-left,.sek-pm-margin-right{width:46px}.sek-pm-padding-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;background-color:#fff;border:1px solid #ced6d9;height:100px;width:140px;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;padding:5px;-webkit-transition:background-color .2s ease;-o-transition:background-color .2s ease;transition:background-color .2s ease;-webkit-box-sizing:border-box;box-sizing:border-box;margin:auto}.sek-flex-justify-center{min-height:0;min-width:0;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.sek-flex-space-between{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.sek-pm-input-parent{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex}.sek-pm-input-parent .sek-pm-input{min-height:25px;min-width:40px;background-color:#fff}.sek-pm-input-parent .sek-pm-input{-webkit-box-flex:1;-ms-flex:1 1 auto;flex:1 1 auto;display:block;margin:auto 3px!important;-webkit-box-sizing:border-box;box-sizing:border-box;padding:1px 3px;font-size:12px;font-weight:300;min-width:34px;min-height:20px;color:#313131;width:40px!important;text-align:center}.sek-pm-padding-wrapper label{margin:0}.sek-pad-marg-inner label{-webkit-box-flex:0;-ms-flex:0;flex:0}.reset-spacing-wrap{padding:10px 0 0;font-size:.8em;text-decoration:underline;cursor:pointer;text-align:center}.reset-spacing-wrap:hover{color:#006799}.sek-bg-pos-wrapper{padding:10px;text-align:center;display:inline-block;width:90px;height:90px}.sek-bg-pos-wrapper{display:inline-block;width:90px;height:90px}.sek-bg-pos-wrapper .sek-bg-pos{cursor:pointer;width:24px;height:24px;margin:3px;float:left}.sek-bg-pos-wrapper input[type=radio]{display:none}.sek-bg-pos-wrapper .sek-bg-pos span{display:inline-block;width:100%;height:100%;border-radius:6px;background:#e6e6e6 no-repeat center;-webkit-transition:background-color .2s ease;-o-transition:background-color .2s ease;transition:background-color .2s ease}.sek-bg-pos-wrapper .sek-bg-pos span:hover{background-color:#33b3db}.sek-bg-pos-wrapper .sek-bg-pos span:hover svg{visibility:visible}.sek-bg-pos-wrapper .sek-bg-pos input[type=radio]:checked+span{background-color:#33b3db}.sek-bg-pos-wrapper .sek-bg-pos input[type=radio]:checked+span svg{visibility:visible}.sek-bg-pos-wrapper .sek-bg-pos span svg{visibility:hidden;shape-rendering:crispEdges}.sek-bg-pos-wrapper .sek-svg-bg-pos{fill:#fff}div[data-sek-align]{margin:0 5px;padding:4px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end;position:relative;text-align:center;width:23px;height:24px;top:-4px;border-radius:4px;cursor:pointer}div[data-input-type=horizTextAlignmentWithDeviceSwitcher] .czr-input{text-align:center}div[data-input-type=horizTextAlignmentWithDeviceSwitcher] .sek-h-align-wrapper{display:inline-block}div[data-input-type=horizAlignmentWithDeviceSwitcher] .czr-input{text-align:center}div[data-input-type=horizAlignmentWithDeviceSwitcher] .sek-h-align-wrapper{display:inline-block}.sek-h-align-wrapper .sek-align-icons{float:right}div[data-sek-align]:hover{-webkit-box-shadow:inset 0 0 0 1px #555d66,inset 0 0 0 2px #fff;box-shadow:inset 0 0 0 1px #555d66,inset 0 0 0 2px #fff}div[data-sek-align].selected{outline:0;color:#fff;-webkit-box-shadow:none;box-shadow:none;background:#555d66}div[data-sek-grid-layout]{margin:0 5px;padding:1px 3px 1px 1px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end;position:relative;text-align:center;border-radius:4px;cursor:pointer}div[data-sek-grid-layout] i{font-size:50px}div[data-input-type=grid_layout] .czr-input{text-align:center}div[data-input-type=grid_layout] .sek-grid-layout-wrapper{display:inline-block}.sek-grid-layout-wrapper .sek-grid-icons{float:right}div[data-sek-grid-layout]:hover{-webkit-box-shadow:inset 0 0 0 1px #555d66,inset 0 0 0 2px #fff;box-shadow:inset 0 0 0 1px #555d66,inset 0 0 0 2px #fff}div[data-sek-grid-layout].selected{outline:0;color:#fff;-webkit-box-shadow:none;box-shadow:none;background:#33b3db}.customize-control select[data-czrtype=categories]{height:28px}.sek-input-device-switcher .sek-switcher:before,.sek-mobile-device-icons .sek-switcher:before{display:inline-block;-webkit-font-smoothing:antialiased;font:normal 20px/30px dashicons;vertical-align:top;color:#656a6f;position:relative;top:-5px}.sek-input-device-switcher .sek-switcher{cursor:pointer}.sek-input-device-switcher .sek-switcher,.sek-mobile-device-icons .sek-switcher{background:0 0;border:none;padding:0 1px;margin:0 0 0 -2px;box-shadow:none;border-top:1px solid transparent;border-bottom:4px solid transparent;-webkit-transition:.15s color ease-in-out,.15s background-color ease-in-out,.15s border-color ease-in-out;-o-transition:.15s color ease-in-out,.15s background-color ease-in-out,.15s border-color ease-in-out;transition:.15s color ease-in-out,.15s background-color ease-in-out,.15s border-color ease-in-out}.sek-input-device-switcher .sek-switcher:focus,.sek-input-device-switcher .sek-switcher:hover{background-color:#fff}.sek-input-device-switcher .sek-switcher.active:before{color:#191e23}.sek-input-device-switcher .sek-switcher:focus:before,.sek-input-device-switcher .sek-switcher:hover:before{color:#0073aa}.sek-input-device-switcher .preview-desktop:before,.sek-mobile-device-icons .preview-desktop:before{content:"\f472"}.sek-input-device-switcher .preview-tablet:before,.sek-mobile-device-icons .preview-tablet:before{content:"\f471"}.sek-input-device-switcher .preview-mobile:before,.sek-mobile-device-icons .preview-mobile:before{content:"\f470"}.sek-borders{width:100%;float:left;margin-bottom:8px}.sek-borders>div{float:left;width:100%}.sek-borders .sek-range-unit-wrapper>div{float:left}.sek-borders .sek-border-type-wrapper{margin-bottom:5px}.sek-borders .sek-range-unit-wrapper{margin-bottom:5px}.sek-borders .sek-range-unit-wrapper .sek-unit-wrapper{float:right}.sek-borders .sek-color-wrapper{width:100%}.sek-borders .sek-color-wrapper .sek-color-picker{width:50%;float:left}.sek-borders .sek-color-wrapper .sek-reset-button{width:50%;float:right}[data-sek-radius-type=top_right]>i.material-icons{-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}[data-sek-radius-type=bottom_right]>i.material-icons{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}[data-sek-radius-type=bottom_left]>i.material-icons{-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.sek-range-with-unit-picker-wrapper{width:100%;float:left;margin-bottom:8px}.sek-range-with-unit-picker-wrapper .sek-unit-wrapper{float:right}.sek-range-with-unit-picker-wrapper>div{float:left}.sek-range-wrapper{width:44%;margin-right:4px}.sek-no-unit-picker .sek-range-wrapper{width:70%}.sek-number-wrapper,.sek-simple-number-wrapper{width:60px;margin-right:5px}.sek-simple-number-wrapper{text-align:right}.sek-range-input{flex:1;width:100%;padding:0;-webkit-appearance:none;background:0 0;height:26px}.sek-range-input::-webkit-slider-thumb{-webkit-appearance:none;height:20px;width:20px;border-radius:50%;cursor:pointer;background:#555d66;border:4px solid transparent;background-clip:padding-box;box-sizing:border-box;margin-top:-8px}.sek-range-input::-moz-range-thumb{height:20px;width:20px;border-radius:50%;cursor:pointer;background:#555d66;border:4px solid transparent;background-clip:padding-box;box-sizing:border-box;margin-top:-7px}.sek-range-input::-ms-thumb{height:20px;width:20px;border-radius:50%;cursor:pointer;background:#555d66;border:4px solid transparent;background-clip:padding-box;box-sizing:border-box;margin-top:-8px}.sek-range-input:focus{outline:0}.sek-range-input::-webkit-slider-runnable-track{height:3px;cursor:pointer;background:#e2e4e7;border-radius:1.5px;margin-top:-4px}.sek-range-input::-moz-range-track{height:3px;cursor:pointer;background:#e2e4e7;border-radius:1.5px}.sek-range-input::-ms-track{margin-top:-4px;background:0 0;border-color:transparent;color:transparent;height:3px;cursor:pointer;background:#e2e4e7;border-radius:1.5px}.sek-import-btn-wrap{padding:20px 0}.sek-import-btn-wrap input.sek-import-file{margin-bottom:10px}.sek-export-btn-wrap{padding-bottom:20px;border-bottom:1px solid #ddd}.sek-import-file{background:#eee;width:100%;margin:10px 0;padding:10px;font-size:12px}.sek-uploading{background:#eee;display:none;margin:10px 0;padding:10px;font-size:12px}.czr-import-dialog{display:none;padding:11px}.czr-import-message{padding-bottom:10px}.sek-import-btn-wrap .czr-import-dialog .czr-import-message{font-size:12px!important}.sek-import-btn-wrap .czr-import-dialog .button{margin:4px 0;font-size:12px!important}.sek-slide-thumb{width:32px;height:32px;overflow:hidden;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;float:left}.sek-slide-title{color:#4b4a4a;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:120px;height:32px;line-height:32px;font-size:13px;float:left;padding-left:10px}.sek-pro-notice{position:relative;padding-left:36px;font-size:13px}.sek-pro-notice a,.sek-pro-notice a:focus,.sek-pro-notice a:hover{color:#f07829;font-weight:700;text-decoration:none}.sek-pro-notice a:hover{text-decoration:underline}.sek-pro-icon{position:absolute;width:32px;left:0;top:-2px}.sek-pro-notice .sek-pro-notice-icon-bef-text{display:inline-block;width:23px;height:15px;position:relative}.sek-pro-notice .sek-pro-notice-icon-bef-text img{position:absolute;top:0}.sek-unit-wrapper{text-align:center}.sek-ui-button-group{display:inline-block}.sek-ui-button-group .sek-ui-button:first-child{border-radius:3px 0 0 3px}.sek-ui-button-group .sek-ui-button+.sek-ui-button{margin-left:-1px}.sek-ui-button-group .sek-ui-button:last-child{border-radius:0 3px 3px 0}.sek-ui-button{height:28px;padding:0 10px 2px;border-radius:3px;white-space:nowrap;border-width:1px;border-style:solid;display:inline-flex;text-decoration:none;font-size:12px;line-height:25px;font-weight:400;margin:0;cursor:pointer;-webkit-appearance:none;background:0 0;color:#555;border-color:#ccc;background:#f7f7f7;box-shadow:inset 0 -1px 0 #ccc;vertical-align:top;-webkit-transition:opacity .2s ease-in-out;-moz-transition:opacity .2s ease-in-out;-ms-transition:opacity .2s ease-in-out;-o-transition:opacity .2s ease-in-out;transition:opacity .2s ease-in-out}.sek-ui-button:hover{background:#fafafa;border-color:#999;box-shadow:inset 0 -1px 0 #999;color:#23282d;opacity:1!important}.sek-ui-button:active:not(:disabled){background:#eee;border-color:#999;box-shadow:inset 0 1px 0 #999}.sek-ui-button:focus:not(:disabled){background:#fafafa;color:#23282d;border-color:#999;box-shadow:inset 0 -1px 0 #999,0 0 0 2px #fbfbfb;outline:0}.sek-ui-button[aria-pressed=true]{background:#555d66;border-color:#555d66;box-shadow:inset 0 -1px 0 #555d66;color:#fff;text-decoration:none}.sek-ui-button[aria-pressed=true]:focus:not(:disabled),.sek-ui-button[aria-pressed=true]:hover{background:#555d66;border-color:#4f4f4f;color:#fff}.sek-ui-button[aria-pressed=true]:focus:not(:disabled){box-shadow:inset 0 -1px 0 #4f4f4f}.sek-ui-button[aria-pressed=true]:focus:not(:disabled){outline:0}.sek-content-type-wrapper,.sek-save-section-action,.sek-save-section-mode-switcher,.sek-save-tmpl-action,.sek-save-tmpl-mode-switcher{margin-bottom:8px;width:100%;float:left}#nimble-tmpl-gallery .sek-ui-button-group,.sek-content-type-wrapper .sek-ui-button-group,.sek-save-section-action .sek-ui-button-group,.sek-save-section-mode-switcher .sek-ui-button-group,.sek-save-tmpl-action .sek-ui-button-group,.sek-save-tmpl-mode-switcher .sek-ui-button-group{display:block}#nimble-tmpl-gallery .sek-ui-button,.sek-content-type-wrapper .sek-ui-button,.sek-save-section-action .sek-ui-button,.sek-save-section-mode-switcher .sek-ui-button,.sek-save-tmpl-action .sek-ui-button,.sek-save-tmpl-mode-switcher .sek-ui-button{text-align:center;display:inline-block;padding:3px 10px;height:auto;text-transform:uppercase}.sek-content-type-wrapper .sek-ui-button{width:49%}.sek-save-section-mode-switcher .sek-ui-button,.sek-save-tmpl-mode-switcher .sek-ui-button{width:32%}.sek-content-type-wrapper [data-sek-content-type=template]{width:98%;margin-top:5px}[data-input-type=module_option_switcher] .sek-content-type-wrapper{margin-bottom:0}[data-input-type=module_option_switcher] [aria-pressed=false]{opacity:.7}[data-input-type=module_option_switcher] [data-sek-option-type]{position:relative}.sek-wrap-opt-switch-btn{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;flex:0 0 100%;max-width:100%;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}[data-input-type=module_option_switcher] [data-sek-option-type] .sek-wrap-opt-switch-btn>i{font-size:21px;line-height:24px}[data-input-type=module_option_switcher] [data-sek-option-type] .sek-wrap-opt-switch-btn>span{position:relative;padding-left:10px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:center}.wp-core-ui .button.sek-reset-button{font-size:11px;padding:0 5px 1px;line-height:18px;height:25px;min-height:25px;color:#555;border-color:#ccc}.sek-animated-arrow{position:absolute;left:-20px;margin-left:6px;top:3px;font-size:10px;color:#617379;-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);-webkit-transition:-webkit-transform .2s ease-in-out;transition:-webkit-transform .2s ease-in-out;-o-transition:transform .2s ease-in-out;transition:transform .2s ease-in-out;transition:transform .2s ease-in-out,-webkit-transform .2s ease-in-out;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;height:100%;-webkit-box-align:center;-ms-flex-align:center;align-items:center}[data-sek-expanded=true] label>.customize-control-title .sek-animated-arrow{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}[data-sek-expanded=true] label>.customize-control-title .sek-ctrl-accordion-title,[data-sek-expanded] label>.customize-control-title .sek-ctrl-accordion-title:hover{text-decoration:underline;text-underline-position:under}.customize-control-title .sek-ctrl-accordion-title>i{font-size:1.2em;position:relative;top:4px;padding-right:4px}.sek-level-option-icon{padding-right:5px;min-width:22px;text-align:center}.sek-input-title-icon{position:relative;top:6px}.sek-pro-icon-next-title{padding:5px;min-width:22px}[data-sek-expanded=false]>.czr-open-pre-add-new{display:none}[data-sek-expanded=false]>.czr-items-wrapper{display:none}.sek-side-nimble-logo-wrapper{padding:4px 25px 0 2px!important;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;flex:0 0 100%;max-width:100%}.sek-side-nimble-logo-wrapper .sek-nimble-logo{height:45px}.sek-side-nimble-logo-wrapper .sek-pro-pastil{height:30px}[data-input-type=code_editor] .czr-input{width:100%;float:left}#customize-preview iframe{top:36px}#nimble-top-bar{max-height:36px;position:absolute;text-align:center;right:0;left:0;z-index:20;color:#fff;display:block;-webkit-transition:all .3s ease-in-out;-moz-transition:all,.3s ease-in-out;-ms-transition:all,.3s ease-in-out;-o-transition:all,.3s ease-in-out;transition:all .3s ease-in-out;opacity:.3;top:0;background:rgba(0,0,0,.5);padding:2px;z-index:99999;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;flex:0 0 100%;max-width:100%}.outer-section-open #nimble-top-bar,.themes-panel-expanded #nimble-top-bar{display:none}body.nimble-top-bar-visible #nimble-top-bar{opacity:1}#nimble-top-bar:hover{background:rgba(0,0,0,.7)}#nimble-top-bar .nimble-top-bar-content{display:inline-block;line-height:20px;width:80%}#nimble-top-bar .sek-do-undo .icon:before{display:inline-block;-webkit-font-smoothing:antialiased;font:normal 20px/30px dashicons;vertical-align:top;color:#fff}#nimble-top-bar .sek-settings,#nimble-top-bar .sek-tmpl-saving{font-size:18px;padding:0 5px}#nimble-top-bar button{background:0 0;border:none;color:#fff;cursor:pointer}#nimble-top-bar button[data-nimble-state=disabled]{cursor:inherit;opacity:.4!important;cursor:not-allowed}#nimble-top-bar .sek-do-undo button:hover{opacity:1}#nimble-top-bar .sek-do-undo button:focus{outline:0}#nimble-top-bar .sek-do-undo .icon:before{position:relative}#nimble-top-bar .sek-do-undo .icon.undo:before{content:"\f171";-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg)}#nimble-top-bar .sek-do-undo .icon.do:before{content:"\f172";-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}#nimble-top-bar .sek-add-content button{padding-top:3px}#nimble-top-bar .sek-nimble-doc{position:absolute;right:10px;cursor:pointer;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;flex:0 0 100%;max-width:100%}.rtl #nimble-top-bar .sek-nimble-doc{left:10px;right:auto}#nimble-top-bar .sek-nimble-doc img{width:30px;height:30px;position:relative;top:2px;-webkit-filter:grayscale(100%);filter:grayscale(100%);-webkit-filter:gray;filter:gray}#nimble-top-bar .sek-nimble-doc:hover img{-webkit-filter:none;filter:none}#nimble-top-bar .sek-notifications{max-width:410px;overflow:hidden}#nimble-top-bar .sek-notifications .debug-mode-notif{color:red;line-height:1.5em;padding:3px;background:#fff;display:inline-block;overflow:hidden}#nimble-top-section-save-ui,#nimble-top-tmpl-save-ui{height:auto;min-height:300px;padding:20px;position:absolute;top:-300px;right:0;left:0;z-index:20;color:#fff;display:block;-webkit-transition:all .3s ease-in-out;-moz-transition:all,.3s ease-in-out;-ms-transition:all,.3s ease-in-out;-o-transition:all,.3s ease-in-out;transition:all .3s ease-in-out;opacity:.3;background:rgba(0,0,0,.7);z-index:99999;max-width:100%;font-size:16px;line-height:1.5em}#nimble-top-section-save-ui .nb-section-save-inner,#nimble-top-tmpl-save-ui .nb-tmpl-save-inner{max-width:800px;margin:auto}body.sek-save-section-ui-visible #nimble-top-section-save-ui,body.sek-save-tmpl-ui-visible #nimble-top-tmpl-save-ui{opacity:1;top:36px}#nimble-top-section-save-ui .sek-close-dialog,#nimble-top-tmpl-save-ui .sek-close-dialog{position:absolute;bottom:10px;right:10px;border-radius:3px!important}#nimble-top-section-save-ui #sek-saved-section-title.error,#nimble-top-tmpl-save-ui #sek-saved-tmpl-title.error{border:1px solid red}.sek-section-description,.sek-section-title,.sek-tmpl-description,.sek-tmpl-title,select.sek-saved-section-picker,select.sek-saved-tmpl-picker{margin-top:10px;float:left;clear:both;width:100%}.sek-section-description textarea,.sek-tmpl-description textarea,input#sek-saved-section-title,input#sek-saved-tmpl-title,select.sek-saved-section-picker,select.sek-saved-tmpl-picker{width:97%;max-width:none;margin-bottom:10px}.sek-section-description textarea,.sek-tmpl-description textarea{min-height:100px}.sek-save-section-action .sek-do-save-section,.sek-save-section-action .sek-do-update-section,.sek-save-section-action .sek-open-remove-confirmation,.sek-save-tmpl-action .sek-do-save-tmpl,.sek-save-tmpl-action .sek-do-update-tmpl,.sek-save-tmpl-action .sek-open-remove-confirmation,.sek-saved-section-picker,.sek-saved-tmpl-picker,.sek-section-description,.sek-section-title,.sek-tmpl-description,.sek-tmpl-title{display:none}.section-collection-populated .sek-saved-section-picker,.tmpl-collection-populated .sek-saved-tmpl-picker{display:block}.sek-section-remove-dialog,.sek-tmpl-remove-dialog{display:none;color:red;background:#fff;padding:5px;text-transform:uppercase;float:left;width:96%}.sek-section-remove-dialog .sek-do-remove-section,.sek-tmpl-remove-dialog .sek-do-remove-tmpl{color:red}[data-sek-tmpl-dialog-mode=save] .sek-saved-tmpl-picker{display:none}[data-sek-tmpl-dialog-mode=save] .sek-tmpl-title{display:block}[data-sek-tmpl-dialog-mode=save] .sek-tmpl-description{display:block}[data-sek-tmpl-dialog-mode=save] .sek-do-save-tmpl{display:block;border-color:#ff0;background:#f9f9b6f7;border-radius:3px!important}[data-sek-tmpl-dialog-mode=update].sek-tmpl-update-selected .sek-tmpl-title{display:block}[data-sek-tmpl-dialog-mode=update].sek-tmpl-update-selected .sek-tmpl-description{display:block}[data-sek-tmpl-dialog-mode=update].sek-tmpl-update-selected .sek-do-update-tmpl{display:block}[data-sek-tmpl-dialog-mode=remove].sek-tmpl-remove-selected .sek-open-remove-confirmation{display:block}[data-sek-tmpl-dialog-mode=remove].sek-removal-confirmation-opened .sek-open-remove-confirmation{display:none!important}[data-sek-tmpl-dialog-mode=remove].sek-removal-confirmation-opened .sek-tmpl-remove-dialog{display:block}[data-sek-section-dialog-mode=save] .sek-saved-section-picker{display:none}[data-sek-section-dialog-mode=save] .sek-section-title{display:block}[data-sek-section-dialog-mode=save] .sek-section-description{display:block}[data-sek-section-dialog-mode=save] .sek-do-save-section{display:block;border-color:#ff0;background:#f9f9b6f7;border-radius:3px!important}[data-sek-section-dialog-mode=update].sek-section-update-selected .sek-section-title{display:block}[data-sek-section-dialog-mode=update].sek-section-update-selected .sek-section-description{display:block}[data-sek-section-dialog-mode=update].sek-section-update-selected .sek-do-update-section{display:block}[data-sek-section-dialog-mode=remove].sek-section-remove-selected .sek-open-remove-confirmation{display:block}[data-sek-section-dialog-mode=remove].sek-removal-confirmation-opened .sek-open-remove-confirmation{display:none!important}[data-sek-section-dialog-mode=remove].sek-removal-confirmation-opened .sek-section-remove-dialog{display:block}[data-sek-section-dialog-mode=remove].sek-is-removal-only [data-section-mode-switcher=save],[data-sek-section-dialog-mode=remove].sek-is-removal-only [data-section-mode-switcher=update]{display:none}#nimble-top-section-save-ui .spinner,#nimble-top-tmpl-save-ui .spinner{display:none}#nimble-top-section-save-ui.nimble-section-processing-ajax .spinner,#nimble-top-tmpl-save-ui.nimble-tmpl-processing-ajax .spinner{display:block;visibility:visible}#nimble-tmpl-gallery{-webkit-transition:top .3s ease-in-out;-moz-transition:top,.3s ease-in-out;-ms-transition:top,.3s ease-in-out;-o-transition:top,.3s ease-in-out;transition:top .3s ease-in-out}#nimble-tmpl-gallery{background:rgba(240,240,240,.89)!important;border-bottom:1px solid #aaa!important;color:#222!important;font-size:12px!important;position:absolute;top:-100vh;right:0;left:0;height:calc(100vh - 36px);overflow:auto;padding:15px;z-index:1000}.sek-template-gallery-expanded #nimble-tmpl-gallery{top:36px}#nimble-tmpl-gallery .sek-tmpl-gallery-inner{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;width:100%;margin-right:-10px;margin-left:-10px}#nimble-tmpl-gallery .sek-tmpl-gallery-inner *,#nimble-tmpl-gallery .sek-tmpl-gallery-inner :after,#nimble-tmpl-gallery .sek-tmpl-gallery-inner :before{box-sizing:border-box}.sek-tmpl-gallery-inner .sek-tmpl-item{-ms-flex:0 0 25%;flex:0 0 25%;max-width:25%;padding:5px 10px;width:100%;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;position:relative;cursor:pointer}@media (max-width:1300px){.sek-tmpl-gallery-inner .sek-tmpl-item{-ms-flex:0 0 33.333%;flex:0 0 33.333%;max-width:33.333%}}@media (max-width:1000px){.sek-tmpl-gallery-inner .sek-tmpl-item{-ms-flex:0 0 50%;flex:0 0 50%;max-width:50%}}.sek-tmpl-info{position:absolute;top:0;bottom:0;width:calc(100% - 20px);max-height:calc(100% - 20px);padding:10px;overflow:hidden}.sek-tmpl-info>h3,.sek-tmpl-info>p{color:#fff;overflow:hidden}.sek-tmpl-info>h3{font-size:15px;margin:.5em 0}.sek-tmpl-info>p{font-size:13px;margin:.5em 0}.sek-tmpl-info>.use-tmpl{cursor:pointer;font-size:25px;width:50px;height:50px;color:#535353;background:rgba(255,255,255,.7);border-radius:30px;opacity:0;-webkit-box-shadow:0 2px 6px rgba(0,0,0,.2);box-shadow:0 2px 6px rgba(0,0,0,.2);-webkit-transition:all .2s ease;-o-transition:all .2s ease;transition:all .2s ease;-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;position:absolute;top:calc(50% - 25px);left:calc(50% - 25px)}.sek-tmpl-info:hover>.use-tmpl{opacity:.7}.sek-tmpl-info>.use-tmpl:hover{opacity:.95}.sek-tmpl-info>.remove-tmpl{cursor:pointer;font-size:16px;width:30px;height:30px;color:#535353;background:rgba(255,255,255,.7);border-radius:30px;opacity:0;-webkit-box-shadow:0 2px 6px rgba(0,0,0,.2);box-shadow:0 2px 6px rgba(0,0,0,.2);-webkit-transition:all .2s ease;-o-transition:all .2s ease;transition:all .2s ease;-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;position:absolute;bottom:10px;right:10px}.sek-tmpl-info:hover>.remove-tmpl{opacity:.7}.sek-tmpl-info>.remove-tmpl:hover{opacity:.95;color:red}.sek-tmpl-gallery-inner .sek-tmpl-thumb{cursor:pointer;position:relative}.sek-tmpl-thumb img{max-width:100%}.sek-tmpl-gallery-inner .sek-tmpl-thumb::after{content:"";display:block;position:absolute;top:0;left:0;right:0;bottom:0;background-color:#000;opacity:.45;-webkit-transition:opacity .3s ease-in-out;-moz-transition:opacity .3s ease-in-out;-ms-transition:opacity .3s ease-in-out;-o-transition:opacity .3s ease-in-out;transition:opacity .3s ease-in-out}.sek-tmpl-gallery-inner .sek-tmpl-item:hover .sek-tmpl-thumb::after{opacity:.65}#sek-gal-top-bar{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}input.sek-filter-tmpl{width:60%}#sek-gal-top-bar .sek-ui-button-group{width:37%;text-align:right}.search-active .sek-tmpl-item{display:none}.search-active .sek-tmpl-item.search-match{display:-webkit-box;display:-ms-flexbox;display:flex}#nimble-level-tree{-webkit-transition:top .3s ease-in-out;-moz-transition:top,.3s ease-in-out;-ms-transition:top,.3s ease-in-out;-o-transition:top,.3s ease-in-out;transition:top .3s ease-in-out}.sek-level-tree-expanded #customize-preview iframe{top:366px;height:calc(100vh - 366px)}.sek-level-tree-expanded #nimble-top-bar .sek-level-tree button{color:#44b9e2}#nimble-level-tree{background:#f0f0f0!important;border-bottom:1px solid #aaa!important;color:#222!important;font-size:12px!important;position:absolute;top:36px;right:0;left:0;height:299px;overflow:auto;padding:15px;z-index:0}#nimble-level-tree ul li{padding-left:30px;cursor:pointer;margin-bottom:8px}#nimble-level-tree ul li .sek-remove-level{font-size:16px;opacity:.6}#nimble-level-tree ul li .sek-remove-level:hover{opacity:1}#nimble-level-tree ul li .sek-level-infos{line-height:30px;height:30px;padding-left:33px;position:relative;width:calc(100% - 25px)}.sek-level-infos .sek-inner-level-infos{background:inherit;width:inherit;height:inherit;line-height:inherit;padding-left:4px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-transition:background .2s ease;transition:background .2s ease;-o-transition:background .2s ease}.sek-inner-level-infos:hover{color:#000;background:#fff}.sek-close-level-tree{position:fixed;top:44px;right:25px}img.sek-svg-mod-icon{max-width:45px}.sek-level-infos::before{position:absolute;left:-31px;background:#a2aab2;width:63px;height:2px;content:"";top:calc(50% - 1px)}#nimble-level-tree ul>li:first-child::before{position:absolute;content:"";background:#a2aab2;top:-15px;height:16px;bottom:0;left:-2px;width:2px}#nimble-level-tree ul>li:last-child::after{position:absolute;content:"";background:#f0f0f0;top:16px;bottom:0;left:-2px;width:2px}#nimble-level-tree ul{border-left:2px solid #a2aab2;position:relative}#nimble-level-tree ul>li:last-child{position:relative}
1
+ @font-face{font-family:'Material Icons';font-style:normal;font-weight:400;src:url(../fonts/material-icons/MaterialIcons-Regular.eot);src:local('Material Icons'),local('MaterialIcons-Regular'),url(../fonts/material-icons/MaterialIcons-Regular.woff2) format('woff2'),url(../fonts/material-icons/MaterialIcons-Regular.woff) format('woff'),url(../fonts/material-icons/MaterialIcons-Regular.ttf) format('truetype')}.material-icons{font-family:'Material Icons';font-weight:400;font-style:normal;font-size:24px;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;-webkit-font-feature-settings:'liga';font-feature-settings:'liga'}#customize-preview iframe,#nimble-level-tree{-webkit-transition:top .3s ease-in-out;-moz-transition:top,.3s ease-in-out;-ms-transition:top,.3s ease-in-out;-o-transition:top,.3s ease-in-out;transition:top .3s ease-in-out}#customize-preview iframe{z-index:1}ul[id*=sub-accordion-section-__nimble__]{background:#f2f2f2!important}#customize-theme-controls .customize-pane-child[id*="__nimble__"]{-webkit-transition:unset;-o-transition:unset;transition:unset}li[id*="__nimble__"].customize-control{margin:8px 0;padding:2px;width:calc(100% - 4px);border:1px solid rgba(221,221,221,.43);box-shadow:1px 1px 2px 0 rgba(75,75,85,.2);-webkit-box-shadow:1px 1px 2px 0 rgba(75,75,85,.2);background-color:#fff}li[id*="__nimble__"].customize-control span.customize-control-title:first-child{margin-left:21px}#customize-theme-controls ul[id*=sub-accordion-section-__nimble__].open{top:0!important}.sek-float-right{float:right}.sek-float-left{float:left}.sek-flex-vertical-center{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}li[id^=accordion-section-__nimble__]{margin-top:16px}li[id^=accordion-section-__nimble__]>h3{border-top:1px solid #ddd}[data-sek-content-type]{float:left;padding:0;margin:1.8%;text-align:center;cursor:move;-webkit-transition:-webkit-box-shadow .2s ease;transition:-webkit-box-shadow .2s ease;-o-transition:box-shadow .2s ease;transition:box-shadow .2s ease;transition:box-shadow .2s ease,-webkit-box-shadow .2s ease;-webkit-box-shadow:0 2px 5px rgba(0,0,0,.25);box-shadow:0 2px 5px rgba(0,0,0,.25);border-radius:4px}[data-sek-content-type=module]{width:29%;height:130px;position:relative}.sek-is-pro{position:absolute;top:0;z-index:10;right:2px;height:20px;width:28px}li[id*=sek_draggable_modules] [data-sek-content-type=preset_section]{width:29%;height:130px}.sek-content-type-wrapper [data-sek-content-type=preset_section]{width:95%;height:165px;position:relative;overflow:hidden}.sek-demo-link{position:absolute;bottom:-22px;z-index:20;height:18px;width:100%;padding:2px 0;background:#000;background-color:rgba(0,0,0,.5);color:#fff;font-size:13px;cursor:pointer;-webkit-transition:bottom .2s ease-in-out;-moz-transition:bottom,.2s ease-in-out;-ms-transition:bottom,.2s ease-in-out;-o-transition:bottom,.2s ease-in-out;transition:bottom .2s ease-in-out}.sek-demo-link a,.sek-demo-link a:focus,.sek-demo-link a:visited,.sek-demo-link i{color:#fff}.sek-demo-link a{text-decoration:none;text-transform:uppercase;font-size:12px}.sek-demo-link a:hover{color:#fff;text-decoration:underline}[data-sek-content-type=preset_section]:hover .sek-demo-link{bottom:0}[data-sek-content-type=preset_section] .sek-overlay{display:block;position:absolute;top:0;left:0;right:0;bottom:0;background-color:#000;opacity:0;-webkit-transition:opacity .35s ease;transition:opacity .35s ease;-o-transition:opacity .35s ease}[data-sek-content-type=preset_section]:hover .sek-overlay{opacity:.15}[data-sek-content-type][draggable=true]:hover{-webkit-box-shadow:0 12px 20px rgba(0,0,0,.2);box-shadow:0 12px 20px rgba(0,0,0,.2)}[data-sek-content-type][draggable=false]{background:#eee;opacity:.8}.sek-user-section-wrapper{margin-bottom:15px;float:left;width:100%}.sek-user-section-wrapper [data-sek-content-type=preset_section] .sek-overlay{opacity:.4}.sek-user-section-wrapper [data-sek-content-type=preset_section]:hover .sek-overlay{opacity:.5}.sek-user-section-wrapper [data-sek-is-user-section=true]{height:165px;margin:0;width:97%}.sek-user-section-wrapper .sek-sec-thumb{position:absolute;opacity:.5;z-index:0;top:0;bottom:0;height:100%;width:100%}.sek-user-section-wrapper .sek-sec-info{position:relative;color:#fff;padding:2%;overflow:hidden;height:100%;max-height:138px;padding:10px}.sek-sec-info .sec-title{color:#fff;margin:0;line-height:20px;max-height:20px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.sek-sec-info .sec-date,.sek-sec-info .sec-desc{margin:0;margin-top:5px;font-size:12px}.sek-sec-info .sec-date{font-size:italic}.sek-sec-info>.remove-user-sec{cursor:pointer;font-size:16px;width:30px;height:30px;color:#535353;background:rgba(255,255,255,.7);border-radius:30px;opacity:0;-webkit-box-shadow:0 2px 6px rgba(0,0,0,.2);box-shadow:0 2px 6px rgba(0,0,0,.2);-webkit-transition:all .2s ease;-o-transition:all .2s ease;transition:all .2s ease;-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;position:absolute;bottom:0;right:5px}.sek-sec-info:hover>.remove-user-sec{opacity:.7}.sek-sec-info>.remove-user-sec:hover{opacity:.95;color:red}.sek-dragging [data-sek-content-type]{-webkit-box-shadow:0 2px 5px rgba(0,0,0,.25)!important;box-shadow:0 2px 5px rgba(0,0,0,.25)!important}.sek-dragged{background:#33b3db3d;background:rgba(51,179,219,.24)}[data-sek-content-type] .sek-module-icon{display:block;padding:0}[data-sek-content-type] .sek-module-icon .nimble-module-icons{font-size:3rem;max-width:100%;color:#878787;max-height:86px}[data-sek-content-type] .sek-module-icon.is-font-icon{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-flex:0;-ms-flex:0 0 100%;flex:0 0 100%;max-width:100%;min-height:70%}[data-sek-content-type] .sek-module-icon.is-font-icon i{font-size:35px}[data-sek-content-type] .sek-module-title{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:0 6px 0;font-size:.75rem;height:45px;justify-content:center;position:relative;top:-18px}.sek-centered-module-title{overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.sek-new-label{background:#ff0;border:1px solid #ff0;padding:3px 4px;line-height:12px;border-radius:8px;font-size:12px}.sek-accord-title{color:#4b4a4a;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:120px;height:23px;line-height:22px;font-size:13px;float:left;padding-left:10px}.sek-pad-marg-inner{font-size:12px;display:-webkit-box;display:-ms-flexbox;display:flex;margin:10px auto 10px auto;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;padding:0;background-color:#e6e6e6;border:1px solid #c5c5c5;height:192px;width:232px;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-transition:background-color .2s ease;-o-transition:background-color .2s ease;transition:background-color .2s ease}.sek-pm-top-bottom-wrap{height:46px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.sek-flex-center-stretch{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch}.sek-pm-input{width:35px;height:15px;padding:0;text-align:center;font-family:Source Sans Pro;padding:5px;border-radius:3px;text-align:left;font-size:13px;outline:0;-webkit-box-shadow:inset 1px 1px 3px rgba(0,0,0,.15);box-shadow:inset 1px 1px 3px rgba(0,0,0,.15);border:1px solid #ced6d9}.sek-pm-input-parent .sek-pm-input{-webkit-box-flex:1;-ms-flex:1 1 auto;flex:1 1 auto;display:block;margin:auto 3px;-webkit-box-sizing:border-box;box-sizing:border-box;padding:1px 3px;font-size:12px;font-weight:300;min-width:34px;min-height:20px;color:#313131}.sek-pm-middle-wrap{display:-webkit-box;display:-ms-flexbox;display:flex;height:100px;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.sek-pm-margin-left,.sek-pm-margin-right{width:46px}.sek-pm-padding-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;background-color:#fff;border:1px solid #ced6d9;height:100px;width:140px;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;padding:5px;-webkit-transition:background-color .2s ease;-o-transition:background-color .2s ease;transition:background-color .2s ease;-webkit-box-sizing:border-box;box-sizing:border-box;margin:auto}.sek-flex-justify-center{min-height:0;min-width:0;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.sek-flex-space-between{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.sek-pm-input-parent{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex}.sek-pm-input-parent .sek-pm-input{min-height:25px;min-width:40px;background-color:#fff}.sek-pm-input-parent .sek-pm-input{-webkit-box-flex:1;-ms-flex:1 1 auto;flex:1 1 auto;display:block;margin:auto 3px!important;-webkit-box-sizing:border-box;box-sizing:border-box;padding:1px 3px;font-size:12px;font-weight:300;min-width:34px;min-height:20px;color:#313131;width:40px!important;text-align:center}.sek-pm-padding-wrapper label{margin:0}.sek-pad-marg-inner label{-webkit-box-flex:0;-ms-flex:0;flex:0}.reset-spacing-wrap{padding:10px 0 0;font-size:.8em;text-decoration:underline;cursor:pointer;text-align:center}.reset-spacing-wrap:hover{color:#006799}.sek-bg-pos-wrapper{padding:10px;text-align:center;display:inline-block;width:90px;height:90px}.sek-bg-pos-wrapper{display:inline-block;width:90px;height:90px}.sek-bg-pos-wrapper .sek-bg-pos{cursor:pointer;width:24px;height:24px;margin:3px;float:left}.sek-bg-pos-wrapper input[type=radio]{display:none}.sek-bg-pos-wrapper .sek-bg-pos span{display:inline-block;width:100%;height:100%;border-radius:6px;background:#e6e6e6 no-repeat center;-webkit-transition:background-color .2s ease;-o-transition:background-color .2s ease;transition:background-color .2s ease}.sek-bg-pos-wrapper .sek-bg-pos span:hover{background-color:#33b3db}.sek-bg-pos-wrapper .sek-bg-pos span:hover svg{visibility:visible}.sek-bg-pos-wrapper .sek-bg-pos input[type=radio]:checked+span{background-color:#33b3db}.sek-bg-pos-wrapper .sek-bg-pos input[type=radio]:checked+span svg{visibility:visible}.sek-bg-pos-wrapper .sek-bg-pos span svg{visibility:hidden;shape-rendering:crispEdges}.sek-bg-pos-wrapper .sek-svg-bg-pos{fill:#fff}div[data-sek-align]{margin:0 5px;padding:4px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end;position:relative;text-align:center;width:23px;height:24px;top:-4px;border-radius:4px;cursor:pointer}div[data-input-type=horizTextAlignmentWithDeviceSwitcher] .czr-input{text-align:center}div[data-input-type=horizTextAlignmentWithDeviceSwitcher] .sek-h-align-wrapper{display:inline-block}div[data-input-type=horizAlignmentWithDeviceSwitcher] .czr-input{text-align:center}div[data-input-type=horizAlignmentWithDeviceSwitcher] .sek-h-align-wrapper{display:inline-block}.sek-h-align-wrapper .sek-align-icons{float:right}div[data-sek-align]:hover{-webkit-box-shadow:inset 0 0 0 1px #555d66,inset 0 0 0 2px #fff;box-shadow:inset 0 0 0 1px #555d66,inset 0 0 0 2px #fff}div[data-sek-align].selected{outline:0;color:#fff;-webkit-box-shadow:none;box-shadow:none;background:#555d66}div[data-sek-grid-layout]{margin:0 5px;padding:1px 3px 1px 1px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end;position:relative;text-align:center;border-radius:4px;cursor:pointer}div[data-sek-grid-layout] i{font-size:50px}div[data-input-type=grid_layout] .czr-input{text-align:center}div[data-input-type=grid_layout] .sek-grid-layout-wrapper{display:inline-block}.sek-grid-layout-wrapper .sek-grid-icons{float:right}div[data-sek-grid-layout]:hover{-webkit-box-shadow:inset 0 0 0 1px #555d66,inset 0 0 0 2px #fff;box-shadow:inset 0 0 0 1px #555d66,inset 0 0 0 2px #fff}div[data-sek-grid-layout].selected{outline:0;color:#fff;-webkit-box-shadow:none;box-shadow:none;background:#33b3db}.customize-control select[data-czrtype=categories]{height:28px}.sek-input-device-switcher .sek-switcher:before,.sek-mobile-device-icons .sek-switcher:before{display:inline-block;-webkit-font-smoothing:antialiased;font:normal 20px/30px dashicons;vertical-align:top;color:#656a6f;position:relative;top:-5px}.sek-input-device-switcher .sek-switcher{cursor:pointer}.sek-input-device-switcher .sek-switcher,.sek-mobile-device-icons .sek-switcher{background:0 0;border:none;padding:0 1px;margin:0 0 0 -2px;box-shadow:none;border-top:1px solid transparent;border-bottom:4px solid transparent;-webkit-transition:.15s color ease-in-out,.15s background-color ease-in-out,.15s border-color ease-in-out;-o-transition:.15s color ease-in-out,.15s background-color ease-in-out,.15s border-color ease-in-out;transition:.15s color ease-in-out,.15s background-color ease-in-out,.15s border-color ease-in-out}.sek-input-device-switcher .sek-switcher:focus,.sek-input-device-switcher .sek-switcher:hover{background-color:#fff}.sek-input-device-switcher .sek-switcher.active:before{color:#191e23}.sek-input-device-switcher .sek-switcher:focus:before,.sek-input-device-switcher .sek-switcher:hover:before{color:#0073aa}.sek-input-device-switcher .preview-desktop:before,.sek-mobile-device-icons .preview-desktop:before{content:"\f472"}.sek-input-device-switcher .preview-tablet:before,.sek-mobile-device-icons .preview-tablet:before{content:"\f471"}.sek-input-device-switcher .preview-mobile:before,.sek-mobile-device-icons .preview-mobile:before{content:"\f470"}.sek-borders{width:100%;float:left;margin-bottom:8px}.sek-borders>div{float:left;width:100%}.sek-borders .sek-range-unit-wrapper>div{float:left}.sek-borders .sek-border-type-wrapper{margin-bottom:5px}.sek-borders .sek-range-unit-wrapper{margin-bottom:5px}.sek-borders .sek-range-unit-wrapper .sek-unit-wrapper{float:right}.sek-borders .sek-color-wrapper{width:100%}.sek-borders .sek-color-wrapper .sek-color-picker{width:50%;float:left}.sek-borders .sek-color-wrapper .sek-reset-button{width:50%;float:right}[data-sek-radius-type=top_right]>i.material-icons{-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}[data-sek-radius-type=bottom_right]>i.material-icons{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}[data-sek-radius-type=bottom_left]>i.material-icons{-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.sek-range-with-unit-picker-wrapper{width:100%;float:left;margin-bottom:8px}.sek-range-with-unit-picker-wrapper .sek-unit-wrapper{float:right}.sek-range-with-unit-picker-wrapper>div{float:left}.sek-range-wrapper{width:44%;margin-right:4px}.sek-no-unit-picker .sek-range-wrapper{width:70%}.sek-number-wrapper,.sek-simple-number-wrapper{width:60px;margin-right:5px}.sek-simple-number-wrapper{text-align:right}.sek-range-input{flex:1;width:100%;padding:0;-webkit-appearance:none;background:0 0;height:26px}.sek-range-input::-webkit-slider-thumb{-webkit-appearance:none;height:20px;width:20px;border-radius:50%;cursor:pointer;background:#555d66;border:4px solid transparent;background-clip:padding-box;box-sizing:border-box;margin-top:-8px}.sek-range-input::-moz-range-thumb{height:20px;width:20px;border-radius:50%;cursor:pointer;background:#555d66;border:4px solid transparent;background-clip:padding-box;box-sizing:border-box;margin-top:-7px}.sek-range-input::-ms-thumb{height:20px;width:20px;border-radius:50%;cursor:pointer;background:#555d66;border:4px solid transparent;background-clip:padding-box;box-sizing:border-box;margin-top:-8px}.sek-range-input:focus{outline:0}.sek-range-input::-webkit-slider-runnable-track{height:3px;cursor:pointer;background:#e2e4e7;border-radius:1.5px;margin-top:-4px}.sek-range-input::-moz-range-track{height:3px;cursor:pointer;background:#e2e4e7;border-radius:1.5px}.sek-range-input::-ms-track{margin-top:-4px;background:0 0;border-color:transparent;color:transparent;height:3px;cursor:pointer;background:#e2e4e7;border-radius:1.5px}.sek-import-btn-wrap{padding:20px 0}.sek-import-btn-wrap input.sek-import-file{margin-bottom:10px}.sek-export-btn-wrap{padding-bottom:20px;border-bottom:1px solid #ddd}.sek-import-file{background:#eee;width:100%;margin:10px 0;padding:10px;font-size:12px}.sek-uploading{background:#eee;display:none;margin:10px 0;padding:10px;font-size:12px}.czr-import-dialog{display:none;padding:11px}.czr-import-message{padding-bottom:10px}.sek-import-btn-wrap .czr-import-dialog .czr-import-message{font-size:12px!important}.sek-import-btn-wrap .czr-import-dialog .button{margin:4px 0;font-size:12px!important}.sek-slide-thumb{width:32px;height:32px;overflow:hidden;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;float:left}.sek-slide-title{color:#4b4a4a;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:120px;height:32px;line-height:32px;font-size:13px;float:left;padding-left:10px}.sek-pro-notice{position:relative;padding-left:36px;font-size:13px}.sek-pro-notice a,.sek-pro-notice a:focus,.sek-pro-notice a:hover{color:#f07829;font-weight:700;text-decoration:none}.sek-pro-notice a:hover{text-decoration:underline}.sek-pro-icon{position:absolute;width:32px;left:0;top:-2px}.sek-pro-notice .sek-pro-notice-icon-bef-text{display:inline-block;width:23px;height:15px;position:relative}.sek-pro-notice .sek-pro-notice-icon-bef-text img{position:absolute;top:0}.sek-unit-wrapper{text-align:center}.sek-ui-button-group{display:inline-block}.sek-ui-button-group .sek-ui-button:first-child{border-radius:3px 0 0 3px}.sek-ui-button-group .sek-ui-button+.sek-ui-button{margin-left:-1px}.sek-ui-button-group .sek-ui-button:last-child{border-radius:0 3px 3px 0}.sek-ui-button{height:28px;padding:0 10px 2px;border-radius:3px;white-space:nowrap;border-width:1px;border-style:solid;display:inline-flex;text-decoration:none;font-size:12px;line-height:25px;font-weight:400;margin:0;cursor:pointer;-webkit-appearance:none;background:0 0;color:#555;border-color:#ccc;background:#f7f7f7;box-shadow:inset 0 -1px 0 #ccc;vertical-align:top;-webkit-transition:opacity .2s ease-in-out;-moz-transition:opacity .2s ease-in-out;-ms-transition:opacity .2s ease-in-out;-o-transition:opacity .2s ease-in-out;transition:opacity .2s ease-in-out}.sek-ui-button:hover{background:#fafafa;border-color:#999;box-shadow:inset 0 -1px 0 #999;color:#23282d;opacity:1!important}.sek-ui-button:active:not(:disabled){background:#eee;border-color:#999;box-shadow:inset 0 1px 0 #999}.sek-ui-button:focus:not(:disabled){background:#fafafa;color:#23282d;border-color:#999;box-shadow:inset 0 -1px 0 #999,0 0 0 2px #fbfbfb;outline:0}.sek-ui-button[aria-pressed=true]{background:#555d66;border-color:#555d66;box-shadow:inset 0 -1px 0 #555d66;color:#fff;text-decoration:none}.sek-ui-button[aria-pressed=true]:focus:not(:disabled),.sek-ui-button[aria-pressed=true]:hover{background:#555d66;border-color:#4f4f4f;color:#fff}.sek-ui-button[aria-pressed=true]:focus:not(:disabled){box-shadow:inset 0 -1px 0 #4f4f4f}.sek-ui-button[aria-pressed=true]:focus:not(:disabled){outline:0}.sek-content-type-wrapper,.sek-save-section-action,.sek-save-section-mode-switcher,.sek-save-tmpl-action,.sek-save-tmpl-mode-switcher{margin-bottom:8px;width:100%;float:left}#nimble-tmpl-gallery .sek-ui-button-group,.sek-content-type-wrapper .sek-ui-button-group,.sek-save-section-action .sek-ui-button-group,.sek-save-section-mode-switcher .sek-ui-button-group,.sek-save-tmpl-action .sek-ui-button-group,.sek-save-tmpl-mode-switcher .sek-ui-button-group{display:block}#nimble-tmpl-gallery .sek-ui-button,.sek-content-type-wrapper .sek-ui-button,.sek-save-section-action .sek-ui-button,.sek-save-section-mode-switcher .sek-ui-button,.sek-save-tmpl-action .sek-ui-button,.sek-save-tmpl-mode-switcher .sek-ui-button{text-align:center;display:inline-block;padding:3px 10px;height:auto;text-transform:uppercase}.sek-content-type-wrapper .sek-ui-button{width:49%}.sek-save-section-mode-switcher .sek-ui-button,.sek-save-tmpl-mode-switcher .sek-ui-button{width:32%}.sek-content-type-wrapper [data-sek-content-type=template]{width:98%;margin-top:5px}[data-input-type=module_option_switcher] .sek-content-type-wrapper{margin-bottom:0}[data-input-type=module_option_switcher] [aria-pressed=false]{opacity:.7}[data-input-type=module_option_switcher] [data-sek-option-type]{position:relative}.sek-wrap-opt-switch-btn{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;flex:0 0 100%;max-width:100%;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}[data-input-type=module_option_switcher] [data-sek-option-type] .sek-wrap-opt-switch-btn>i{font-size:21px;line-height:24px}[data-input-type=module_option_switcher] [data-sek-option-type] .sek-wrap-opt-switch-btn>span{position:relative;padding-left:10px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:center}.wp-core-ui .button.sek-reset-button{font-size:11px;padding:0 5px 1px;line-height:18px;height:25px;min-height:25px;color:#555;border-color:#ccc}.sek-animated-arrow{position:absolute;left:-20px;margin-left:6px;top:3px;font-size:10px;color:#617379;-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);-webkit-transition:-webkit-transform .2s ease-in-out;transition:-webkit-transform .2s ease-in-out;-o-transition:transform .2s ease-in-out;transition:transform .2s ease-in-out;transition:transform .2s ease-in-out,-webkit-transform .2s ease-in-out;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;height:100%;-webkit-box-align:center;-ms-flex-align:center;align-items:center}[data-sek-expanded=true] label>.customize-control-title .sek-animated-arrow{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}[data-sek-expanded=true] label>.customize-control-title .sek-ctrl-accordion-title,[data-sek-expanded] label>.customize-control-title .sek-ctrl-accordion-title:hover{text-decoration:underline;text-underline-position:under}.customize-control-title .sek-ctrl-accordion-title>i{font-size:1.2em;position:relative;top:4px;padding-right:4px}.sek-level-option-icon{padding-right:5px;min-width:22px;text-align:center}.sek-input-title-icon{position:relative;top:6px}.sek-pro-icon-next-title{padding:5px;min-width:22px}[data-sek-expanded=false]>.czr-open-pre-add-new{display:none}[data-sek-expanded=false]>.czr-items-wrapper{display:none}.sek-side-nimble-logo-wrapper{padding:4px 25px 0 2px!important;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;flex:0 0 100%;max-width:100%}.sek-side-nimble-logo-wrapper .sek-nimble-logo{height:45px}.sek-side-nimble-logo-wrapper .sek-pro-pastil{height:30px}[data-input-type=code_editor] .czr-input{width:100%;float:left}#customize-preview iframe{top:36px}#nimble-top-bar{max-height:36px;position:absolute;text-align:center;right:0;left:0;z-index:20;color:#fff;display:block;-webkit-transition:all .3s ease-in-out;-moz-transition:all,.3s ease-in-out;-ms-transition:all,.3s ease-in-out;-o-transition:all,.3s ease-in-out;transition:all .3s ease-in-out;opacity:.3;top:0;background:rgba(0,0,0,.5);padding:2px;z-index:99999;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;flex:0 0 100%;max-width:100%}.outer-section-open #nimble-top-bar,.themes-panel-expanded #nimble-top-bar{display:none}body.nimble-top-bar-visible #nimble-top-bar{opacity:1}#nimble-top-bar:hover{background:rgba(0,0,0,.7)}#nimble-top-bar .nimble-top-bar-content{display:inline-block;line-height:20px;width:80%}#nimble-top-bar .sek-do-undo .icon:before{display:inline-block;-webkit-font-smoothing:antialiased;font:normal 20px/30px dashicons;vertical-align:top;color:#fff}#nimble-top-bar .sek-settings,#nimble-top-bar .sek-tmpl-saving{font-size:18px;padding:0 5px}#nimble-top-bar button{background:0 0;border:none;color:#fff;cursor:pointer}#nimble-top-bar button[data-nimble-state=disabled]{cursor:inherit;opacity:.4!important;cursor:not-allowed}#nimble-top-bar .sek-do-undo button:hover{opacity:1}#nimble-top-bar .sek-do-undo button:focus{outline:0}#nimble-top-bar .sek-do-undo .icon:before{position:relative}#nimble-top-bar .sek-do-undo .icon.undo:before{content:"\f171";-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg)}#nimble-top-bar .sek-do-undo .icon.do:before{content:"\f172";-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}#nimble-top-bar .sek-add-content button{padding-top:3px}#nimble-top-bar .sek-nimble-doc{position:absolute;right:10px;cursor:pointer;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;flex:0 0 100%;max-width:100%}.rtl #nimble-top-bar .sek-nimble-doc{left:10px;right:auto}#nimble-top-bar .sek-nimble-doc img{width:30px;height:30px;position:relative;top:2px;-webkit-filter:grayscale(100%);filter:grayscale(100%);-webkit-filter:gray;filter:gray}#nimble-top-bar .sek-nimble-doc:hover img{-webkit-filter:none;filter:none}#nimble-top-bar .sek-notifications{max-width:410px;overflow:hidden}#nimble-top-bar .sek-notifications .debug-mode-notif{color:red;line-height:1.5em;padding:3px;background:#fff;display:inline-block;overflow:hidden}#nimble-top-section-save-ui,#nimble-top-tmpl-save-ui{height:auto;min-height:300px;padding:20px;position:absolute;top:-300px;right:0;left:0;z-index:20;color:#fff;display:block;-webkit-transition:all .3s ease-in-out;-moz-transition:all,.3s ease-in-out;-ms-transition:all,.3s ease-in-out;-o-transition:all,.3s ease-in-out;transition:all .3s ease-in-out;opacity:.3;background:rgba(0,0,0,.7);z-index:99999;max-width:100%;font-size:16px;line-height:1.5em}#nimble-top-section-save-ui .nb-section-save-inner,#nimble-top-tmpl-save-ui .nb-tmpl-save-inner{max-width:800px;margin:auto}body.sek-save-section-ui-visible #nimble-top-section-save-ui,body.sek-save-tmpl-ui-visible #nimble-top-tmpl-save-ui{opacity:1;top:36px}#nimble-top-section-save-ui .sek-close-dialog,#nimble-top-tmpl-save-ui .sek-close-dialog{position:absolute;bottom:10px;right:10px;border-radius:3px!important}#nimble-top-section-save-ui #sek-saved-section-title.error,#nimble-top-tmpl-save-ui #sek-saved-tmpl-title.error{border:1px solid red}.sek-section-description,.sek-section-title,.sek-tmpl-description,.sek-tmpl-title,select.sek-saved-section-picker,select.sek-saved-tmpl-picker{margin-top:10px;float:left;clear:both;width:100%}.sek-section-description textarea,.sek-tmpl-description textarea,input#sek-saved-section-title,input#sek-saved-tmpl-title,select.sek-saved-section-picker,select.sek-saved-tmpl-picker{width:97%;max-width:none;margin-bottom:10px}.sek-section-description textarea,.sek-tmpl-description textarea{min-height:100px}.sek-save-section-action .sek-do-save-section,.sek-save-section-action .sek-do-update-section,.sek-save-section-action .sek-open-remove-confirmation,.sek-save-tmpl-action .sek-do-save-tmpl,.sek-save-tmpl-action .sek-do-update-tmpl,.sek-save-tmpl-action .sek-open-remove-confirmation,.sek-saved-section-picker,.sek-saved-tmpl-picker,.sek-section-description,.sek-section-title,.sek-tmpl-description,.sek-tmpl-title{display:none}.section-collection-populated .sek-saved-section-picker,.tmpl-collection-populated .sek-saved-tmpl-picker{display:block}.sek-section-remove-dialog,.sek-tmpl-remove-dialog{display:none;color:red;background:#fff;padding:5px;text-transform:uppercase;float:left;width:96%}.sek-section-remove-dialog .sek-do-remove-section,.sek-tmpl-remove-dialog .sek-do-remove-tmpl{color:red}[data-sek-tmpl-dialog-mode=save] .sek-saved-tmpl-picker{display:none}[data-sek-tmpl-dialog-mode=save] .sek-tmpl-title{display:block}[data-sek-tmpl-dialog-mode=save] .sek-tmpl-description{display:block}[data-sek-tmpl-dialog-mode=save] .sek-do-save-tmpl{display:block;border-color:#ff0;background:#f9f9b6f7;border-radius:3px!important}[data-sek-tmpl-dialog-mode=update].sek-tmpl-update-selected .sek-tmpl-title{display:block}[data-sek-tmpl-dialog-mode=update].sek-tmpl-update-selected .sek-tmpl-description{display:block}[data-sek-tmpl-dialog-mode=update].sek-tmpl-update-selected .sek-do-update-tmpl{display:block}[data-sek-tmpl-dialog-mode=remove].sek-tmpl-remove-selected .sek-open-remove-confirmation{display:block}[data-sek-tmpl-dialog-mode=remove].sek-removal-confirmation-opened .sek-open-remove-confirmation{display:none!important}[data-sek-tmpl-dialog-mode=remove].sek-removal-confirmation-opened .sek-tmpl-remove-dialog{display:block}[data-sek-section-dialog-mode=save] .sek-saved-section-picker{display:none}[data-sek-section-dialog-mode=save] .sek-section-title{display:block}[data-sek-section-dialog-mode=save] .sek-section-description{display:block}[data-sek-section-dialog-mode=save] .sek-do-save-section{display:block;border-color:#ff0;background:#f9f9b6f7;border-radius:3px!important}[data-sek-section-dialog-mode=update].sek-section-update-selected .sek-section-title{display:block}[data-sek-section-dialog-mode=update].sek-section-update-selected .sek-section-description{display:block}[data-sek-section-dialog-mode=update].sek-section-update-selected .sek-do-update-section{display:block}[data-sek-section-dialog-mode=remove].sek-section-remove-selected .sek-open-remove-confirmation{display:block}[data-sek-section-dialog-mode=remove].sek-removal-confirmation-opened .sek-open-remove-confirmation{display:none!important}[data-sek-section-dialog-mode=remove].sek-removal-confirmation-opened .sek-section-remove-dialog{display:block}[data-sek-section-dialog-mode=remove].sek-is-removal-only [data-section-mode-switcher=save],[data-sek-section-dialog-mode=remove].sek-is-removal-only [data-section-mode-switcher=update]{display:none}#nimble-top-section-save-ui .spinner,#nimble-top-tmpl-save-ui .spinner{display:none}#nimble-top-section-save-ui.nimble-section-processing-ajax .spinner,#nimble-top-tmpl-save-ui.nimble-tmpl-processing-ajax .spinner{display:block;visibility:visible}#nimble-tmpl-gallery,#nimble-tmpl-gallery .sek-tmpl-gal-import-dialog{-webkit-transition:top .3s ease-in-out;-moz-transition:top,.3s ease-in-out;-ms-transition:top,.3s ease-in-out;-o-transition:top,.3s ease-in-out;transition:top .3s ease-in-out}#nimble-tmpl-gallery{background:rgba(240,240,240,.89)!important;border-bottom:1px solid #aaa!important;color:#222!important;font-size:12px!important;position:absolute;top:-100vh;right:0;left:0;height:calc(100vh - 36px);overflow:auto;padding:15px;z-index:1000}.sek-template-gallery-expanded #nimble-tmpl-gallery{top:36px}#nimble-tmpl-gallery .sek-tmpl-gal-import-dialog{background:rgba(240,240,240,.89)!important;border-bottom:1px solid #aaa!important;color:#222!important;font-size:12px!important;position:absolute;top:-100vh;right:0;left:0;height:calc(100vh - 36px);overflow:auto;padding:15px;z-index:1001}.sek-tmpl-dialog-expanded #nimble-tmpl-gallery .sek-tmpl-gal-import-dialog{top:36px}#nimble-tmpl-gallery .sek-tmpl-gallery-inner{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;width:100%;margin-right:-10px;margin-left:-10px}#nimble-tmpl-gallery .sek-tmpl-gallery-inner *,#nimble-tmpl-gallery .sek-tmpl-gallery-inner :after,#nimble-tmpl-gallery .sek-tmpl-gallery-inner :before{box-sizing:border-box}.sek-tmpl-gallery-inner .sek-tmpl-item{-ms-flex:0 0 25%;flex:0 0 25%;max-width:25%;padding:5px 10px;width:100%;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;position:relative;cursor:pointer}@media (max-width:1300px){.sek-tmpl-gallery-inner .sek-tmpl-item{-ms-flex:0 0 33.333%;flex:0 0 33.333%;max-width:33.333%}}@media (max-width:1000px){.sek-tmpl-gallery-inner .sek-tmpl-item{-ms-flex:0 0 50%;flex:0 0 50%;max-width:50%}}.sek-tmpl-info{position:absolute;top:0;bottom:0;width:calc(100% - 20px);max-height:calc(100% - 20px);padding:10px;overflow:hidden}.sek-tmpl-info>h3,.sek-tmpl-info>p{color:#fff;overflow:hidden}.sek-tmpl-info>h3{font-size:15px;margin:.5em 0}.sek-tmpl-info>p{font-size:13px;margin:.5em 0}.sek-tmpl-info>.use-tmpl{cursor:pointer;font-size:25px;width:50px;height:50px;color:#535353;background:rgba(255,255,255,.7);border-radius:30px;opacity:0;-webkit-box-shadow:0 2px 6px rgba(0,0,0,.2);box-shadow:0 2px 6px rgba(0,0,0,.2);-webkit-transition:all .2s ease;-o-transition:all .2s ease;transition:all .2s ease;-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;position:absolute;top:calc(50% - 25px);left:calc(50% - 25px)}.sek-tmpl-info:hover>.use-tmpl{opacity:.7}.sek-tmpl-info>.use-tmpl:hover{opacity:.95}.sek-tmpl-info>.remove-tmpl{cursor:pointer;font-size:16px;width:30px;height:30px;color:#535353;background:rgba(255,255,255,.7);border-radius:30px;opacity:0;-webkit-box-shadow:0 2px 6px rgba(0,0,0,.2);box-shadow:0 2px 6px rgba(0,0,0,.2);-webkit-transition:all .2s ease;-o-transition:all .2s ease;transition:all .2s ease;-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;position:absolute;bottom:10px;right:10px}.sek-tmpl-info:hover>.remove-tmpl{opacity:.7}.sek-tmpl-info>.remove-tmpl:hover{opacity:.95;color:red}.sek-tmpl-gallery-inner .sek-tmpl-thumb{cursor:pointer;position:relative}.sek-tmpl-thumb img{max-width:100%}.sek-tmpl-gallery-inner .sek-tmpl-thumb::after{content:"";display:block;position:absolute;top:0;left:0;right:0;bottom:0;background-color:#000;opacity:.45;-webkit-transition:opacity .3s ease-in-out;-moz-transition:opacity .3s ease-in-out;-ms-transition:opacity .3s ease-in-out;-o-transition:opacity .3s ease-in-out;transition:opacity .3s ease-in-out}.sek-tmpl-gallery-inner .sek-tmpl-item:hover .sek-tmpl-thumb::after{opacity:.65}#sek-gal-top-bar{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}input.sek-filter-tmpl{width:60%}#sek-gal-top-bar .sek-ui-button-group{width:37%;text-align:right}.search-active .sek-tmpl-item{display:none}.search-active .sek-tmpl-item.search-match{display:-webkit-box;display:-ms-flexbox;display:flex}#nimble-level-tree{-webkit-transition:top .3s ease-in-out;-moz-transition:top,.3s ease-in-out;-ms-transition:top,.3s ease-in-out;-o-transition:top,.3s ease-in-out;transition:top .3s ease-in-out}.sek-level-tree-expanded #customize-preview iframe{top:366px;height:calc(100vh - 366px)}.sek-level-tree-expanded #nimble-top-bar .sek-level-tree button{color:#44b9e2}#nimble-level-tree{background:#f0f0f0!important;border-bottom:1px solid #aaa!important;color:#222!important;font-size:12px!important;position:absolute;top:36px;right:0;left:0;height:299px;overflow:auto;padding:15px;z-index:0}#nimble-level-tree ul li{padding-left:30px;cursor:pointer;margin-bottom:8px}#nimble-level-tree ul li .sek-remove-level{font-size:16px;opacity:.6}#nimble-level-tree ul li .sek-remove-level:hover{opacity:1}#nimble-level-tree ul li .sek-level-infos{line-height:30px;height:30px;padding-left:33px;position:relative;width:calc(100% - 25px)}.sek-level-infos .sek-inner-level-infos{background:inherit;width:inherit;height:inherit;line-height:inherit;padding-left:4px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-transition:background .2s ease;transition:background .2s ease;-o-transition:background .2s ease}.sek-inner-level-infos:hover{color:#000;background:#fff}.sek-close-level-tree{position:fixed;top:44px;right:25px}img.sek-svg-mod-icon{max-width:45px}.sek-level-infos::before{position:absolute;left:-31px;background:#a2aab2;width:63px;height:2px;content:"";top:calc(50% - 1px)}#nimble-level-tree ul>li:first-child::before{position:absolute;content:"";background:#a2aab2;top:-15px;height:16px;bottom:0;left:-2px;width:2px}#nimble-level-tree ul>li:last-child::after{position:absolute;content:"";background:#f0f0f0;top:16px;bottom:0;left:-2px;width:2px}#nimble-level-tree ul{border-left:2px solid #a2aab2;position:relative}#nimble-level-tree ul>li:last-child{position:relative}
assets/czr/sek/js/ccat-sek-control.js CHANGED
@@ -551,6 +551,13 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
551
  api.previewer.bind('sek-active-locations-in-preview', function( activelocs ){
552
  self.activeLocations( ( _.isObject(activelocs) && _.isArray( activelocs.active_locations ) ) ? activelocs.active_locations : [] );
553
  self.activeLocationsInfo( ( _.isObject(activelocs) && _.isArray( activelocs.active_locs_info ) ) ? activelocs.active_locs_info : [] );
 
 
 
 
 
 
 
554
  });
555
 
556
 
@@ -2113,6 +2120,29 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2113
  },//saveOrUpdateSavedSection
2114
 
2115
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2116
 
2117
  // Fired on 'click on .sek-do-remove-section btn
2118
  removeSavedSection : function(evt, sectionPostNameCandidateForRemoval ) {
@@ -2298,29 +2328,6 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2298
  });
2299
 
2300
  return self.sectionCollectionPromise;
2301
- },
2302
-
2303
- // @return a section model
2304
- // Note : ids are reset server side
2305
- // Example of section model before preprocessing
2306
- // {
2307
- // collection: [{…}]
2308
- // id: "" //<= reset server side
2309
- // level: "section"
2310
- // is_nested : false
2311
- // options: {bg: {…}}
2312
- // ver_ini: "1.1.8"
2313
- // }
2314
- preProcessSection : function( sectionModel ) {
2315
- if ( !_.isObject( sectionModel ) ) {
2316
- return null;
2317
- }
2318
- var preprocessedModel = $.extend( {}, true, sectionModel );
2319
- // Make sure a nested section is saved as normal
2320
- if ( _.has( preprocessedModel, 'is_nested') ) {
2321
- preprocessedModel = _.omit( preprocessedModel, 'is_nested' );
2322
- }
2323
- return preprocessedModel;
2324
  }
2325
  });//$.extend()
2326
  })( wp.customize, jQuery );
@@ -2615,7 +2622,13 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2615
  tmpl_title = $_title.val(),
2616
  tmpl_description = $('#sek-saved-tmpl-description').val(),
2617
  collectionSettingId = self.localSectionsSettingId(),
2618
- currentLocalSettingValue = self.preProcessTmpl( api( collectionSettingId )() );
 
 
 
 
 
 
2619
 
2620
  if ( _.isEmpty( tmpl_title ) ) {
2621
  $_title.addClass('error');
@@ -2642,7 +2655,9 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2642
  tmpl_description: tmpl_description,
2643
  tmpl_post_name: tmplPostNameCandidateForUpdate || '',// <= provided when updating a template
2644
  skope_id: api.czr_skopeBase.getSkopeProperty( 'skope_id' ),
2645
- active_locations : api.czr_sektions.activeLocations()
 
 
2646
  })
2647
  .done( function( response ) {
2648
  //console.log('SAVED POST ID', response );
@@ -2674,7 +2689,71 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2674
  return _dfd_;
2675
  },//saveOrUpdateTemplate
2676
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2677
 
 
 
 
 
 
 
2678
 
2679
  // Fired on 'click on .sek-do-remove-tmpl btn
2680
  removeTemplate : function(evt, tmplPostNameCandidateForRemoval ) {
@@ -2813,9 +2892,10 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2813
  .done( function( tmpl_collection ) {
2814
  if ( _.isObject(tmpl_collection) && !_.isArray( tmpl_collection ) ) {
2815
  self.templateCollectionPromise.resolve( tmpl_collection );
 
2816
  } else {
2817
  self.templateCollectionPromise.resolve( {} );
2818
- api.errare('control::getSavedTmplCollection => error => tmpl collection is invalid');
2819
  }
2820
 
2821
  // response is {tmpl_post_id: 436}
@@ -2845,85 +2925,404 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2845
  });
2846
 
2847
  return self.templateCollectionPromise;
2848
- },
2849
-
2850
- // @return a tmpl model with clean ids
2851
- // also removes the tmpl properties "id" and "level", which are dynamically set when dragging and dropping
2852
- // Example of tmpl model before preprocessing
2853
- // {
2854
- // collection: [{…}]
2855
- // id: "" //<= to remove
2856
- // level: "tmpl" // <= to remove
2857
- // options: {bg: {…}}
2858
- // ver_ini: "1.1.8"
2859
- // }
2860
- preProcessTmpl : function( tmpl_data ) {
2861
- console.log('TO DO => make sure template is ok to be saved');
2862
- return tmpl_data;
2863
- },
2864
  });//$.extend()
2865
  })( wp.customize, jQuery );
2866
  //global sektionsLocalizedData
 
2867
  var CZRSeksPrototype = CZRSeksPrototype || {};
2868
  (function ( api, $ ) {
2869
  $.extend( CZRSeksPrototype, {
2870
- // the input id determine if we fetch the revision history of the local or global setting
2871
- // @return a deferred promise
2872
- // @params object : { is_local:bool} <= 'local_revisions' === input.id
2873
- getRevisionHistory : function(params) {
2874
- return wp.ajax.post( 'sek_get_revision_history', {
 
 
2875
  nonce: api.settings.nonce.save,
2876
- skope_id : params.is_local ? api.czr_skopeBase.getSkopeProperty( 'skope_id' ) : sektionsLocalizedData.globalSkopeId
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2877
  });
 
 
2878
  },
2879
 
2880
- // @return void()
2881
- // Fetches the_content and try to set the setting value through normalized ::updateAPISetting method
2882
- // @params {
2883
- // is_local : bool//<= 'local_revisions' === input.id
2884
- // revision_post_id : int
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2885
  // }
2886
- setSingleRevision : function(params) {
2887
  var self = this;
2888
- var _notify = function( message, type ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2889
  api.previewer.trigger('sek-notify', {
2890
- notif_id : 'restore-revision-error',
2891
- type : type || 'info',
2892
- duration : 10000,
2893
  message : [
2894
- '<span style="">',
2895
  '<strong>',
2896
- message || '',
2897
  '</strong>',
2898
  '</span>'
2899
  ].join('')
2900
  });
2901
- };
2902
- wp.ajax.post( 'sek_get_single_revision', {
2903
- nonce: api.settings.nonce.save,
2904
- //skope_id : api.czr_skopeBase.getSkopeProperty( 'skope_id' ),
2905
- revision_post_id : params.revision_post_id
2906
- }).done( function( revision_value ){
2907
- // If the setting value is unchanged, no need to go further
2908
- // is_local is decided with the input id => @see revision_history input type.
2909
- var setId = params.is_local ? self.localSectionsSettingId() : self.getGlobalSectionsSettingId();
2910
- if ( _.isEqual( api( setId )(), revision_value ) ) {
2911
- _notify( sektionsLocalizedData.i18n['This is the current version.'], 'info' );
2912
- return;
2913
- }
2914
- // api.infoLog( 'getSingleRevision response', revision_value );
2915
- // api.infoLog( 'Current val', api(self.localSectionsSettingId())() );
2916
- self.updateAPISetting({
2917
- action : 'sek-restore-revision',
2918
- is_global_location : !params.is_local,//<= will determine which setting will be updated,
2919
- // => self.getGlobalSectionsSettingId() or self.localSectionsSettingId()
2920
- revision_value : revision_value
2921
- }).done( function() {
2922
- //_notify( sektionsLocalizedData.i18n['The revision has been successfully restored.'], 'success' );
2923
- api.previewer.refresh();
2924
- }).fail( function( response ) {
2925
- api.errare( '::setSingleRevision error when firing ::updateAPISetting', response );
2926
- _notify( sektionsLocalizedData.i18n['The revision could not be restored.'], 'error' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2927
  });
2928
  //api.previewer.refresh();
2929
  }).fail( function( response ) {
@@ -3130,6 +3529,11 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3130
  } else {
3131
  // we have a level.
3132
  // - make sure we have at least the following properties : id, level
 
 
 
 
 
3133
 
3134
  // ID
3135
  if ( _.isEmpty( level.id ) || ! _.isString( level.id )) {
@@ -6139,8 +6543,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6139
  // in_column
6140
  // }
6141
  updateAPISetting : function( params ) {
6142
- var self = this,
6143
- __updateAPISettingDeferred__ = $.Deferred();
6144
 
6145
  // Are we in global location ?
6146
  // Add the global information to the params
@@ -6149,7 +6552,20 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6149
  params.is_global_location = 'global' === params.scope || self.isGlobalLocation( params );
6150
 
6151
  var _collectionSettingId_ = params.is_global_location ? self.getGlobalSectionsSettingId() : self.localSectionsSettingId();
6152
- var _do_update_setting_id = function() {
 
 
 
 
 
 
 
 
 
 
 
 
 
6153
  // api( _collectionSettingId_)() = {
6154
  // collection : [
6155
  // 'loop_start' : { level : location, collection : [ 'sek124' : { collection : [], level : section, options : {} }], options : {}},
@@ -6159,1699 +6575,2317 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6159
  // options : {}
6160
  //
6161
  // }
6162
- var currentSetValue = api( _collectionSettingId_ )(),
6163
- newSetValue = _.isObject( currentSetValue ) ? $.extend( true, {}, currentSetValue ) : self.getDefaultSektionSettingValue( params.is_global_location ? 'global' : 'local' ),
6164
- locationCandidate,
6165
- sektionCandidate,
6166
- columnCandidate,
6167
- moduleCandidate,
6168
- // move variables
6169
- originalCollection,
6170
- reorderedCollection,
6171
- //duplication variable
6172
- cloneId, //will be passed in resolve()
6173
- startingModuleValue,// will be populated by the optional starting value specificied on module registration
6174
- __presetSectionInjected__ = '_not_injection_scenario_',//this property is turned into a $.Deferred() object in a scenario of section injection
6175
- parentSektionCandidate,
6176
- position;//<= the position of the module or section or nested section in a column or location
6177
 
6178
  // make sure we have a collection array to populate
6179
- newSetValue.collection = _.isArray( newSetValue.collection ) ? newSetValue.collection : self.getDefaultSektionSettingValue( params.is_global_location ? 'global' : 'local' ).collection;
6180
 
6181
  switch( params.action ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6182
  //-------------------------------------------------------------------------------------------------
6183
  //-- SEKTION
6184
  //-------------------------------------------------------------------------------------------------
6185
  case 'sek-add-section' :
6186
- // an id must be provided
6187
- if ( _.isEmpty( params.id ) ) {
6188
- throw new Error( 'updateAPISetting => ' + params.action + ' => missing id' );
6189
- }
6190
-
6191
- if ( _.isEmpty( params.location ) ) {
6192
- throw new Error( 'updateAPISetting => ' + params.action + ' => missing location' );
6193
- }
6194
- // Is this a nested sektion ?
6195
- if ( true === params.is_nested ) {
6196
- columnCandidate = self.getLevelModel( params.in_column, newSetValue.collection );
6197
- // can we add this nested sektion ?
6198
- // if the parent sektion of the column has is_nested = true, then we can't
6199
- parentSektionCandidate = self.getLevelModel( params.in_sektion, newSetValue.collection );
6200
- if ( 'no_match' == parentSektionCandidate ) {
6201
- __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => no grand parent sektion found');
6202
- break;
6203
- }
6204
- if ( true === parentSektionCandidate.is_nested ) {
6205
- __updateAPISettingDeferred__.reject('');
6206
- api.previewer.trigger('sek-notify', {
6207
- type : 'info',
6208
- duration : 30000,
6209
- message : [
6210
- '<span style="font-size:0.95em">',
6211
- '<strong>' + sektionsLocalizedData.i18n[ "You've reached the maximum number of allowed nested sections." ] + '</strong>',
6212
- '</span>'
6213
- ].join('')
6214
- });
6215
-
6216
- break;
6217
- }
6218
- if ( 'no_match' == columnCandidate ) {
6219
- api.errare( 'updateAPISetting => ' + params.action + ' => no parent column matched' );
6220
- __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => no parent column matched');
6221
- break;
6222
- }
6223
- columnCandidate.collection = _.isArray( columnCandidate.collection ) ? columnCandidate.collection : [];
6224
- columnCandidate.collection.push({
6225
- id : params.id,
6226
- level : 'section',
6227
- collection : [{
6228
- id : sektionsLocalizedData.optPrefixForSektionsNotSaved + self.guid(),
6229
- level : 'column',
6230
- collection : [],
6231
- ver_ini : sektionsLocalizedData.nimbleVersion
6232
- }],
6233
- is_nested : true,
6234
- ver_ini : sektionsLocalizedData.nimbleVersion
6235
- });
6236
- } else {
6237
- locationCandidate = self.getLevelModel( params.location, newSetValue.collection );
6238
- if ( 'no_match' == locationCandidate ) {
6239
- api.errare( 'updateAPISetting => ' + params.action + ' => no location matched' );
6240
- __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => no location matched');
6241
- break;
6242
- }
6243
- locationCandidate.collection = _.isArray( locationCandidate.collection ) ? locationCandidate.collection : [];
6244
- _.each( locationCandidate.collection, function( secModel, index ) {
6245
- if ( params.before_section === secModel.id ) {
6246
- position = index;
6247
- }
6248
- if ( params.after_section === secModel.id ) {
6249
- position = index + 1;
6250
- }
6251
- });
6252
-
6253
- // @see reactToCollectionSettingIdChange
6254
- locationCandidate.collection = _.isArray( locationCandidate.collection ) ? locationCandidate.collection : [];
6255
- // insert the section in the collection at the right place
6256
- locationCandidate.collection.splice( position, 0, {
6257
- id : params.id,
6258
- level : 'section',
6259
- collection : [{
6260
- id : sektionsLocalizedData.optPrefixForSektionsNotSaved + self.guid(),
6261
- level : 'column',
6262
- collection : [],
6263
- ver_ini : sektionsLocalizedData.nimbleVersion
6264
- }],
6265
- ver_ini : sektionsLocalizedData.nimbleVersion
6266
- });
6267
- }
6268
  break;
6269
-
6270
-
6271
  case 'sek-duplicate-section' :
6272
- //api.infoLog('PARAMS IN sek-duplicate-section', params );
6273
- // an id must be provided
6274
- if ( _.isEmpty( params.id ) ) {
6275
- throw new Error( 'updateAPISetting => ' + params.action + ' => missing id' );
6276
- }
 
 
 
 
 
 
 
 
6277
 
6278
- if ( _.isEmpty( params.location ) ) {
6279
- throw new Error( 'updateAPISetting => ' + params.action + ' => missing location' );
6280
- }
6281
- var deepClonedSektion;
6282
- try { deepClonedSektion = self.cloneLevel( params.id ); } catch( er ) {
6283
- api.errare( 'updateAPISetting => ' + params.action, er );
6284
- break;
6285
- }
6286
-
6287
- // items id of multi-items module must always be unique
6288
- // this recursive method sniff and does the job
6289
- self.maybeGenerateNewItemIdsForCrudModules( deepClonedSektion );
6290
-
6291
- var _position_ = self.getLevelPositionInCollection( params.id, newSetValue.collection );
6292
- // Is this a nested sektion ?
6293
- if ( true === params.is_nested ) {
6294
- columnCandidate = self.getLevelModel( params.in_column, newSetValue.collection );
6295
- if ( 'no_match' == columnCandidate ) {
6296
- api.errare( 'updateAPISetting => ' + params.action + ' => no parent column matched' );
6297
- __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => no parent column matched');
6298
- break;
6299
- }
6300
-
6301
- columnCandidate.collection = _.isArray( columnCandidate.collection ) ? columnCandidate.collection : [];
6302
- columnCandidate.collection.splice( parseInt( _position_ + 1, 10 ), 0, deepClonedSektion );
6303
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6304
 
6305
- } else {
6306
- locationCandidate = self.getLevelModel( params.location, newSetValue.collection );
6307
- if ( 'no_match' == locationCandidate ) {
6308
- api.errare( 'updateAPISetting => ' + params.action + ' => no location matched' );
6309
- __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => no location matched');
6310
- break;
6311
- }
6312
- locationCandidate.collection = _.isArray( locationCandidate.collection ) ? locationCandidate.collection : [];
6313
- // @see reactToCollectionSettingIdChange
6314
- locationCandidate.collection.splice( parseInt( _position_ + 1, 10 ), 0, deepClonedSektion );
6315
 
6316
- }
6317
- cloneId = deepClonedSektion.id;//will be passed in resolve()
 
 
 
6318
  break;
6319
-
6320
- // in the case of a nested sektion, we have to remove it from a column
6321
- // otherwise from the root sektion collection
6322
- case 'sek-remove-section' :
6323
- //api.infoLog('PARAMS IN sek-remove-sektion', params );
6324
- if ( true === params.is_nested ) {
6325
- columnCandidate = self.getLevelModel( params.in_column, newSetValue.collection );
6326
- if ( 'no_match' != columnCandidate ) {
6327
- columnCandidate.collection = _.isArray( columnCandidate.collection ) ? columnCandidate.collection : [];
6328
- columnCandidate.collection = _.filter( columnCandidate.collection, function( col ) {
6329
- return col.id != params.id;
6330
- });
6331
- } else {
6332
- api.errare( 'updateAPISetting => ' + params.action + ' => no parent column matched' );
6333
- }
6334
- } else {
6335
- locationCandidate = self.getLevelModel( params.location, newSetValue.collection );
6336
- if ( 'no_match' == locationCandidate ) {
6337
- api.errare( 'updateAPISetting => ' + params.action + ' => no location matched' );
6338
- __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => no location matched');
6339
- break;
6340
- }
6341
- locationCandidate.collection = _.filter( locationCandidate.collection, function( sek ) {
6342
- return sek.id != params.id;
6343
- });
6344
- }
6345
  break;
6346
 
6347
- case 'sek-move-section' :
6348
- //api.infoLog('PARAMS in sek-move-section', params );
6349
- var toLocationCandidate = self.getLevelModel( params.to_location, newSetValue.collection ),
6350
- movedSektionCandidate,
6351
- copyOfMovedSektionCandidate;
6352
-
6353
- if ( _.isEmpty( toLocationCandidate ) || 'no_match' == toLocationCandidate ) {
6354
- throw new Error( 'updateAPISetting => ' + params.action + ' => missing target location' );
6355
- }
6356
 
6357
- // MOVED CROSS LOCATIONS
6358
- // - make a copy of the moved sektion
6359
- // - remove the moved sektion from the source location
6360
- if ( params.from_location != params.to_location ) {
6361
- // Remove the moved sektion from the source location
6362
- var fromLocationCandidate = self.getLevelModel( params.from_location, newSetValue.collection );
6363
- if ( _.isEmpty( fromLocationCandidate ) || 'no_match' == fromLocationCandidate ) {
6364
- throw new Error( 'updateAPISetting => ' + params.action + ' => missing source location' );
6365
- }
 
 
 
6366
 
6367
- fromLocationCandidate.collection = _.isArray( fromLocationCandidate.collection ) ? fromLocationCandidate.collection : [];
6368
- // Make a copy of the sektion candidate now, before removing it
6369
- movedSektionCandidate = self.getLevelModel( params.id, fromLocationCandidate.collection );
6370
- copyOfMovedSektionCandidate = $.extend( true, {}, movedSektionCandidate );
6371
- // remove the sektion from its previous sektion
6372
- fromLocationCandidate.collection = _.filter( fromLocationCandidate.collection, function( sektion ) {
6373
- return sektion.id != params.id;
6374
- });
6375
- }
6376
 
6377
- // UPDATE THE TARGET LOCATION
6378
- toLocationCandidate.collection = _.isArray( toLocationCandidate.collection ) ? toLocationCandidate.collection : [];
6379
- originalCollection = $.extend( true, [], toLocationCandidate.collection );
6380
- reorderedCollection = [];
6381
- _.each( params.newOrder, function( _id_ ) {
6382
- // in the case of a cross location movement, we need to add the moved sektion to the target location
6383
- if ( params.from_location != params.to_location && _id_ == copyOfMovedSektionCandidate.id ) {
6384
- reorderedCollection.push( copyOfMovedSektionCandidate );
6385
- } else {
6386
- sektionCandidate = self.getLevelModel( _id_, originalCollection );
6387
- if ( _.isEmpty( sektionCandidate ) || 'no_match' == sektionCandidate ) {
6388
- throw new Error( 'updateAPISetting => ' + params.action + ' => missing section candidate' );
6389
- }
6390
- reorderedCollection.push( sektionCandidate );
6391
- }
6392
- });
6393
- toLocationCandidate.collection = reorderedCollection;
6394
 
 
 
 
 
 
6395
  break;
6396
 
 
 
 
 
 
 
6397
 
6398
- // Fired on click on up / down arrows in the section ui menu
6399
- // This handles the nested sections case
6400
- case 'sek-move-section-up-down' :
6401
- parentCandidate = self.getLevelModel( params.is_nested ? params.in_column : params.location , newSetValue.collection );
6402
- if ( _.isEmpty( parentCandidate ) || 'no_match' == parentCandidate ) {
6403
- throw new Error( 'updateAPISetting => ' + params.action + ' => missing target location' );
6404
  }
6405
- parentCandidate.collection = _.isArray( parentCandidate.collection ) ? parentCandidate.collection : [];
6406
- originalCollection = $.extend( true, [], parentCandidate.collection );
6407
- reorderedCollection = $.extend( true, [], parentCandidate.collection );
6408
 
6409
- var _indexInOriginal = _.findIndex( originalCollection, function( _sec_ ) {
6410
- return _sec_.id === params.id;
 
 
 
 
 
 
6411
  });
6412
- // @see https://underscorejs.org/#findIndex
6413
- if ( -1 === _indexInOriginal ) {
6414
- throw new Error( 'updateAPISetting => ' + params.action + ' => invalid index' );
6415
- }
6416
 
6417
- // Swap up <=> down
6418
- var direction = params.direction || 'up',
6419
- isLastSectionInLocation = originalCollection.length === _indexInOriginal + 1,
6420
- isFirstSectionInLocation = 0 === _indexInOriginal,
6421
- _locInfo = self.activeLocationsInfo(),
6422
- _currentLocInfo = ! _.isArray( _locInfo ) ? {} : _.findWhere( _locInfo, { id : params.location } ),
6423
- isCurrentLocationGlobal = false,
6424
- isCurrentLocationHeaderOrFooter = false;
6425
-
6426
- // Is current location global ?
6427
- isCurrentLocationGlobal = _.isObject( _currentLocInfo ) && _currentLocInfo.is_global;
6428
-
6429
- // Is current location header footer ?
6430
- isCurrentLocationHeaderOrFooter = _.isObject( _currentLocInfo ) && _currentLocInfo.is_header_footer;
6431
-
6432
- // When a section is last in location and there's another location below, let's move the section to this sibling location
6433
- // This is possible when :
6434
- // - when moved section is not nested
6435
- // - only in locations that are 'local', not header or footer
6436
-
6437
- // Populate the eligible activeLocations in the page
6438
- var activeLocationsInPage = [];
6439
- // self.activeLocationsInfo() is set on ::initialized when send by the preview, and is structured the following way :
6440
- // [
6441
- // {
6442
- // id: "loop_start"
6443
- // is_global: false
6444
- // is_header_footer: false
6445
- // },
6446
- // {..},
6447
- // .
6448
- if ( _.isArray( _locInfo ) ) {
6449
- _.each( self.activeLocationsInfo(), function( _loc_ ) {
6450
- if ( ! _loc_.is_global && ! _loc_.is_header_footer ) {
6451
- activeLocationsInPage.push( _loc_.id );
6452
- }
6453
- });
6454
  }
6455
 
6456
- // Set the index of the current location
6457
- var indexOfCurrentLocation = _.findIndex( activeLocationsInPage, function( _loc_id ) {
6458
- return _loc_id === params.location;
6459
- });
6460
-
6461
- var isCurrentLocationEligibleForSectionMoveOutside = ! params.is_nested && ! isCurrentLocationGlobal && ! isCurrentLocationHeaderOrFooter,
6462
- isFirstLocationInPage = 0 === indexOfCurrentLocation,
6463
- isLastLocationInPage = activeLocationsInPage.length === indexOfCurrentLocation + 1,
6464
- newLocationId, newLocationCandidate;
6465
-
6466
- if ( isCurrentLocationEligibleForSectionMoveOutside && isLastSectionInLocation && 'up' !== direction && ! isLastLocationInPage ) {
6467
- newLocationId = activeLocationsInPage[ indexOfCurrentLocation + 1 ];
6468
- newLocationCandidate = self.getLevelModel( newLocationId , newSetValue.collection );
6469
-
6470
- // Add the section in first position of the section below
6471
- newLocationCandidate.collection.unshift( originalCollection[ _indexInOriginal ] );
6472
- // Removes the section in last position of the original section
6473
- parentCandidate.collection.pop();
6474
- // the new_location param will be used in the 'complete' callback of 'sek-move-section-down' / 'sek-move-section-up'
6475
- params.new_location = newLocationId;
6476
-
6477
- } else if ( isCurrentLocationEligibleForSectionMoveOutside && isFirstSectionInLocation && 'up' === direction && ! isFirstLocationInPage ) {
6478
- newLocationId = activeLocationsInPage[ indexOfCurrentLocation - 1 ];
6479
- newLocationCandidate = self.getLevelModel( newLocationId , newSetValue.collection );
6480
-
6481
- // Add the section in first position of the section below
6482
- newLocationCandidate.collection.push( originalCollection[ _indexInOriginal ] );
6483
- // Removes the section in last position of the original section
6484
- parentCandidate.collection.shift();
6485
- // the new_location param will be used in the 'complete' callback of 'sek-move-section-down' / 'sek-move-section-up'
6486
- params.new_location = newLocationId;
6487
- } else {
6488
- // prevent absurd movements of a section
6489
- // this should not happen because up / down arrows are not displayed when section is positionned top / bottom
6490
- // but safer to add it
6491
- if ( 'up' !== direction && originalCollection.length === _indexInOriginal + 1 ) {
6492
- //throw new Error( 'updateAPISetting => ' + params.action + ' => bottom reached' );
6493
- api.previewer.trigger('sek-notify', {
6494
- type : 'info',
6495
- duration : 30000,
6496
- message : [
6497
- '<span style="font-size:0.95em">',
6498
- '<strong>' + sektionsLocalizedData.i18n[ "The section cannot be moved lower." ] + '</strong>',
6499
- '</span>'
6500
- ].join('')
6501
- });
6502
- } else if ( 'up' === direction && 0 === _indexInOriginal ){
6503
- api.previewer.trigger('sek-notify', {
6504
- type : 'info',
6505
- duration : 30000,
6506
- message : [
6507
- '<span style="font-size:0.95em">',
6508
- '<strong>' + sektionsLocalizedData.i18n[ "The section cannot be moved higher." ] + '</strong>',
6509
- '</span>'
6510
- ].join('')
6511
- });
6512
- } else {
6513
- reorderedCollection[ _indexInOriginal ] = originalCollection[ 'up' === direction ? _indexInOriginal - 1 : _indexInOriginal + 1 ];
6514
- reorderedCollection[ 'up' === direction ? _indexInOriginal - 1 : _indexInOriginal + 1 ] = originalCollection[ _indexInOriginal ];
6515
- parentCandidate.collection = reorderedCollection;
6516
- }
6517
- }
6518
  break;
6519
 
6520
 
6521
 
6522
 
6523
 
6524
-
6525
-
6526
-
6527
  //-------------------------------------------------------------------------------------------------
6528
- //-- COLUMN
6529
  //-------------------------------------------------------------------------------------------------
6530
- case 'sek-add-column' :
6531
- // an id must be provided
6532
- if ( _.isEmpty( params.id ) ) {
6533
- throw new Error( 'updateAPISetting => ' + params.action + ' => missing id' );
6534
- }
6535
- sektionCandidate = self.getLevelModel( params.in_sektion, newSetValue.collection );
6536
- if ( 'no_match' == sektionCandidate ) {
6537
- api.errare( 'updateAPISetting => ' + params.action + ' => no parent sektion matched' );
6538
- __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => no parent sektion matched');
6539
- break;
6540
- }
6541
 
6542
- sektionCandidate.collection = _.isArray( sektionCandidate.collection ) ? sektionCandidate.collection : [];
6543
- // can we add another column ?
6544
- if ( ( self.MAX_NUMBER_OF_COLUMNS - 1 ) < _.size( sektionCandidate.collection ) ) {
6545
- __updateAPISettingDeferred__.reject( sektionsLocalizedData.i18n["You've reached the maximum number of columns allowed in this section."]);
6546
- break;
 
 
 
 
 
 
 
 
 
 
 
6547
  }
 
6548
 
6549
- // RESET ALL COLUMNS WIDTH
6550
- // _.each( sektionCandidate.collection, function( colModel ) {
6551
- // colModel.width = '';
6552
- // });
6553
- self.resetColumnsWidthInSection( sektionCandidate );
6554
 
6555
- sektionCandidate.collection.push({
6556
- id : params.id,
6557
- level : 'column',
6558
- collection : [],
6559
- ver_ini : sektionsLocalizedData.nimbleVersion
6560
- });
6561
- break;
6562
 
 
 
 
 
 
 
 
 
 
 
6563
 
6564
- case 'sek-remove-column' :
6565
- sektionCandidate = self.getLevelModel( params.in_sektion, newSetValue.collection );
6566
- if ( 'no_match' != sektionCandidate ) {
6567
- // can we remove the column ?
6568
- if ( 1 === _.size( sektionCandidate.collection ) ) {
6569
- __updateAPISettingDeferred__.reject( sektionsLocalizedData.i18n["A section must have at least one column."]);
6570
- break;
6571
  }
6572
- sektionCandidate.collection = _.isArray( sektionCandidate.collection ) ? sektionCandidate.collection : [];
6573
- sektionCandidate.collection = _.filter( sektionCandidate.collection, function( column ) {
6574
- return column.id != params.id;
6575
- });
6576
- // RESET ALL COLUMNS WIDTH
6577
- // _.each( sektionCandidate.collection, function( colModel ) {
6578
- // colModel.width = '';
6579
- // });
6580
- self.resetColumnsWidthInSection( sektionCandidate );
6581
- } else {
6582
- api.errare( 'updateAPISetting => ' + params.action + ' => no parent sektion matched' );
6583
  }
6584
 
 
 
 
6585
  break;
6586
 
6587
- case 'sek-duplicate-column' :
6588
- // an id must be provided
6589
- if ( _.isEmpty( params.id ) ) {
6590
- throw new Error( 'updateAPISetting => ' + params.action + ' => missing id' );
6591
- }
6592
-
6593
- sektionCandidate = self.getLevelModel( params.in_sektion, newSetValue.collection );
6594
- if ( 'no_match' == sektionCandidate ) {
6595
- api.errare( 'updateAPISetting => ' + params.action + ' => no parent sektion matched' );
6596
- __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => no parent sektion matched');
6597
- break;
6598
- }
6599
-
6600
- sektionCandidate.collection = _.isArray( sektionCandidate.collection ) ? sektionCandidate.collection : [];
6601
- // can we add another column ?
6602
- if ( ( self.MAX_NUMBER_OF_COLUMNS - 1 ) < _.size( sektionCandidate.collection ) ) {
6603
- __updateAPISettingDeferred__.reject( sektionsLocalizedData.i18n["You've reached the maximum number of columns allowed in this section."]);
6604
- break;
6605
- }
6606
 
6607
- var deepClonedColumn;
6608
- try { deepClonedColumn = self.cloneLevel( params.id ); } catch( er ) {
6609
- api.errare( 'updateAPISetting => ' + params.action, er );
6610
- break;
 
 
 
6611
  }
6612
-
6613
- // items id of multi-items module must always be unique
6614
- // this recursive method sniff and does the job
6615
- self.maybeGenerateNewItemIdsForCrudModules( deepClonedColumn );
6616
-
6617
- var _position = self.getLevelPositionInCollection( params.id, newSetValue.collection );
6618
- cloneId = deepClonedColumn.id;//will be passed in resolve()
6619
- sektionCandidate.collection.splice( parseInt( _position + 1, 10 ), 0, deepClonedColumn );
6620
- // RESET ALL COLUMNS WIDTH
6621
- // _.each( sektionCandidate.collection, function( colModel ) {
6622
- // colModel.width = '';
6623
- // });
6624
- self.resetColumnsWidthInSection( sektionCandidate );
6625
  break;
 
6626
 
6627
 
6628
- // Note : the css rules are generated in Sek_Dyn_CSS_Builder::sek_add_rules_for_column_width
6629
- case 'sek-resize-columns' :
6630
- if ( params.col_number < 2 )
6631
- break;
6632
 
6633
- var resizedColumn = self.getLevelModel( params.resized_column, newSetValue.collection ),
6634
- sistercolumn = self.getLevelModel( params.sister_column, newSetValue.collection );
 
 
6635
 
6636
- //api.infoLog( 'updateAPISetting => ' + params.action + ' => ', params );
 
 
 
 
 
 
 
6637
 
6638
- // SET RESIZED COLUMN WIDTH
6639
- if ( 'no_match' == resizedColumn ) {
6640
- api.errare( 'updateAPISetting => ' + params.action + ' => no resized column matched' );
6641
- __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => no resized column matched');
6642
- break;
6643
- }
6644
 
6645
- var _getColumnWidth = function( _candidate_ ) {
6646
- var _width = '_not_set_';
6647
- var _options = _.isObject( _candidate_.options ) ? _candidate_.options : {};
6648
- if ( ! _.isEmpty( _options ) && _options.width && _options.width['custom-width'] ) {
6649
- _width = parseFloat( _options.width['custom-width'] * 1 );
 
 
 
 
 
 
 
 
 
 
6650
  }
6651
- return _width;
6652
- };
6653
-
6654
- var _setColumnWidth = function( _candidate_, newWidthValue ) {
6655
- // start from a deep cloned object
6656
- // important => fixes https://github.com/presscustomizr/nimble-builder/issues/455
6657
- var _new_options_values = $.extend( true, {}, _candidate_.options || {} );
6658
- // april 2020 : due to a previous implementation of width option as an array, there could be a bug when trying to set the width
6659
- // because the check on _.isObject() was true for an array
6660
- // Fixes https://github.com/presscustomizr/nimble-builder/issues/620
6661
- _new_options_values.width = ( _.isObject( _new_options_values.width ) && _new_options_values.width['custom-width'] ) ? _new_options_values.width : {};
6662
- _new_options_values.width['custom-width'] = newWidthValue;
6663
- _candidate_.options = _new_options_values;
6664
-
6665
- // Live update the input value ( when rendered )
6666
- self.cachedElements.$body.find('[data-sek-width-range-column-id="'+ _candidate_.id +'"]').val( newWidthValue ).trigger('input', { is_resize_column_trigger : true } );
6667
- return newWidthValue;
6668
- };
6669
-
6670
- // DEPRECATED SINCE JUNE 2019 => resizedColumn.width = parseFloat( params.resizedColumnWidthInPercent );
6671
- var resizedColumnWidthInPercent = _setColumnWidth( resizedColumn, parseFloat( params.resizedColumnWidthInPercent ) );
6672
- // cast to number
6673
- resizedColumnWidthInPercent = parseFloat( resizedColumnWidthInPercent );
6674
-
6675
- // SET OTHER COLUMNS WIDTH
6676
- var parentSektion = self.getLevelModel( params.in_sektion, newSetValue.collection );
6677
- var otherColumns = _.filter( parentSektion.collection, function( _col_ ) {
6678
- return _col_.id != resizedColumn.id && _col_.id != sistercolumn.id;
6679
- });
6680
- var otherColumnsWidth = parseFloat( resizedColumnWidthInPercent.toFixed(3) );
6681
-
6682
- if ( ! _.isEmpty( otherColumns ) ) {
6683
- _.each( otherColumns, function( colModel ) {
6684
- currentColWidth = _getColumnWidth( colModel );
6685
- if ( '_not_set_' === currentColWidth || ! _.isNumber( currentColWidth * 1 ) || _.isEmpty( currentColWidth + '' ) || 1 > currentColWidth ) {
6686
- // DEPRECATED SINCE JUNE 2019 => colModel.width = parseFloat( ( 100 / params.col_number ).toFixed(3) );
6687
- currentColWidth = _setColumnWidth( colModel, parseFloat( ( 100 / params.col_number ).toFixed(3) ) );
6688
- }
6689
-
6690
- // sum up all other column's width, excluding the resized and sister one.
6691
- otherColumnsWidth = parseFloat( ( otherColumnsWidth + currentColWidth ).toFixed(3) );
6692
- });
6693
  }
 
6694
 
6695
- // SET SISTER COLUMN WIDTH
6696
- // sum up all other column's width, excluding the resized and sister one.
6697
- // api.infoLog( "resizedColumn.width", resizedColumn.width );
6698
- // api.infoLog( "otherColumns", otherColumns );
6699
-
6700
- // then calculate the sistercolumn so we are sure that we feel the entire space of the sektion
6701
- // DEPRECATED SINCE JUNE 2019 => sistercolumn.width = parseFloat( ( 100 - otherColumnsWidth ).toFixed(3) );
6702
- _setColumnWidth( sistercolumn, parseFloat( ( 100 - otherColumnsWidth ).toFixed(3) ) );
6703
- // api.infoLog('otherColumnsWidth', otherColumnsWidth );
6704
- // api.infoLog("sistercolumn.width", sistercolumn.width );
6705
- // api.infoLog( "parseFloat( ( 100 - otherColumnsWidth ).toFixed(3) )" , parseFloat( ( 100 - otherColumnsWidth ).toFixed(3) ) );
6706
- //api.infoLog('COLLECTION AFTER UPDATE ', parentSektion.collection );
6707
- break;
 
 
 
 
 
 
 
 
 
 
 
 
 
6708
 
6709
 
 
 
 
 
 
 
6710
 
6711
 
6712
- case 'sek-move-column' :
6713
- var toSektionCandidate = self.getLevelModel( params.to_sektion, newSetValue.collection ),
6714
- movedColumnCandidate,
6715
- copyOfMovedColumnCandidate;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6716
 
6717
- if ( _.isEmpty( toSektionCandidate ) || 'no_match' == toSektionCandidate ) {
6718
- throw new Error( 'updateAPISetting => ' + params.action + ' => missing target sektion' );
6719
  }
 
 
 
 
6720
 
6721
- if ( params.from_sektion != params.to_sektion ) {
6722
- // Remove the moved column from the source sektion
6723
- var fromSektionCandidate = self.getLevelModel( params.from_sektion, newSetValue.collection );
6724
- if ( _.isEmpty( fromSektionCandidate ) || 'no_match' == fromSektionCandidate ) {
6725
- throw new Error( 'updateAPISetting => ' + params.action + ' => missing source column' );
6726
- }
6727
 
6728
- fromSektionCandidate.collection = _.isArray( fromSektionCandidate.collection ) ? fromSektionCandidate.collection : [];
6729
- // Make a copy of the column candidate now, before removing it
6730
- movedColumnCandidate = self.getLevelModel( params.id, fromSektionCandidate.collection );
6731
- copyOfMovedColumnCandidate = $.extend( true, {}, movedColumnCandidate );
6732
- // remove the column from its previous sektion
6733
- fromSektionCandidate.collection = _.filter( fromSektionCandidate.collection, function( column ) {
6734
- return column.id != params.id;
6735
- });
6736
- // Reset the column's width in the target sektion
6737
- // _.each( fromSektionCandidate.collection, function( colModel ) {
6738
- // colModel.width = '';
6739
- // });
6740
- self.resetColumnsWidthInSection( fromSektionCandidate );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6741
  }
 
6742
 
6743
- // update the target sektion
6744
- toSektionCandidate.collection = _.isArray( toSektionCandidate.collection ) ? toSektionCandidate.collection : [];
6745
- originalCollection = $.extend( true, [], toSektionCandidate.collection );
6746
- reorderedCollection = [];
6747
- _.each( params.newOrder, function( _id_ ) {
6748
- // in the case of a cross sektion movement, we need to add the moved column to the target sektion
6749
- if ( params.from_sektion != params.to_sektion && _id_ == copyOfMovedColumnCandidate.id ) {
6750
- reorderedCollection.push( copyOfMovedColumnCandidate );
6751
- } else {
6752
- columnCandidate = self.getLevelModel( _id_, originalCollection );
6753
- if ( _.isEmpty( columnCandidate ) || 'no_match' == columnCandidate ) {
6754
- throw new Error( 'updateAPISetting => moveColumn => missing columnCandidate' );
6755
- }
6756
- reorderedCollection.push( columnCandidate );
6757
- }
6758
- });
6759
- toSektionCandidate.collection = reorderedCollection;
6760
 
6761
- // Reset the column's width in the target sektion
6762
- // _.each( toSektionCandidate.collection, function( colModel ) {
6763
- // colModel.width = '';
6764
- // });
6765
- self.resetColumnsWidthInSection( toSektionCandidate );
6766
 
6767
- break;
6768
 
6769
 
6770
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6771
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6772
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6773
 
 
6774
 
 
 
 
6775
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6776
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6777
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6778
 
6779
 
6780
- //-------------------------------------------------------------------------------------------------
6781
- //-- MODULE
6782
- //-------------------------------------------------------------------------------------------------
6783
- case 'sek-add-module' :
6784
- // an id must be provided
6785
- if ( _.isEmpty( params.id ) ) {
6786
- throw new Error( 'updateAPISetting => ' + params.action + ' => missing id' );
6787
- }
6788
- // a module_type must be provided
6789
- if ( _.isEmpty( params.module_type ) ) {
6790
- throw new Error( 'updateAPISetting => ' + params.action + ' => missing module_type' );
6791
- }
6792
- columnCandidate = self.getLevelModel( params.in_column, newSetValue.collection );
6793
- if ( 'no_match' === columnCandidate ) {
6794
- api.errare( 'updateAPISetting => ' + params.action + ' => no parent column matched' );
6795
- __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => no parent column matched');
6796
- break;
6797
- }
6798
 
6799
- position = 0;
6800
- columnCandidate.collection = _.isArray( columnCandidate.collection ) ? columnCandidate.collection : [];
6801
- // get the position of the before or after module or nested section
6802
- _.each( columnCandidate.collection, function( moduleOrNestedSectionModel, index ) {
6803
- if ( params.before_module_or_nested_section === moduleOrNestedSectionModel.id ) {
6804
- position = index;
6805
- }
6806
- if ( params.after_module_or_nested_section === moduleOrNestedSectionModel.id ) {
6807
- position = index + 1;
 
 
 
 
6808
  }
6809
- });
6810
 
6811
- var _moduleParams = {
6812
- id : params.id,
6813
- level : 'module',
6814
- module_type : params.module_type,
6815
- ver_ini : sektionsLocalizedData.nimbleVersion
6816
- };
6817
- // Let's add the starting value if provided when registrating the module
6818
- startingModuleValue = self.getModuleStartingValue( params.module_type );
6819
- if ( 'no_starting_value' !== startingModuleValue ) {
6820
- _moduleParams.value = startingModuleValue;
6821
- }
6822
 
6823
- columnCandidate.collection.splice( position, 0, _moduleParams );
6824
- break;
 
 
 
 
 
 
 
6825
 
6826
- case 'sek-duplicate-module' :
6827
- // an id must be provided
6828
- if ( _.isEmpty( params.id ) ) {
6829
- throw new Error( 'updateAPISetting => ' + params.action + ' => missing id' );
6830
- }
6831
- columnCandidate = self.getLevelModel( params.in_column, newSetValue.collection );
6832
- if ( 'no_match' == columnCandidate ) {
6833
- api.errare( 'updateAPISetting => ' + params.action + ' => no parent column matched' );
6834
- __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => no parent column matched');
6835
- break;
6836
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6837
 
6838
- columnCandidate.collection = _.isArray( columnCandidate.collection ) ? columnCandidate.collection : [];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6839
 
6840
- var deepClonedModule;
6841
- try { deepClonedModule = self.cloneLevel( params.id ); } catch( er ) {
6842
- api.errare( 'updateAPISetting => ' + params.action, er );
6843
- __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => error when cloning the level');
6844
- break;
6845
- }
6846
- // items id of multi-items module must always be unique
6847
- // this recursive method sniff and does the job
6848
- self.maybeGenerateNewItemIdsForCrudModules( deepClonedModule );
6849
 
6850
- var insertInposition = self.getLevelPositionInCollection( params.id, newSetValue.collection );
6851
- cloneId = deepClonedModule.id;//will be passed in resolve()
6852
- columnCandidate.collection.splice( parseInt( insertInposition + 1, 10 ), 0, deepClonedModule );
6853
- break;
6854
 
6855
- case 'sek-remove-module' :
6856
- // an id must be provided
6857
- if ( _.isEmpty( params.id ) ) {
6858
- throw new Error( 'updateAPISetting => ' + params.action + ' => missing id' );
6859
- }
6860
- columnCandidate = self.getLevelModel( params.in_column, newSetValue.collection );
6861
- if ( 'no_match' != columnCandidate ) {
6862
- columnCandidate.collection = _.isArray( columnCandidate.collection ) ? columnCandidate.collection : [];
6863
- columnCandidate.collection = _.filter( columnCandidate.collection, function( module ) {
6864
- return module.id != params.id;
6865
- });
6866
 
6867
- } else {
6868
- api.errare( 'updateAPISetting => ' + params.action + ' => no parent column matched' );
6869
- }
6870
- break;
6871
 
6872
- case 'sek-move-module' :
6873
- var toColumnCandidate,
6874
- movedModuleCandidate,
6875
- copyOfMovedModuleCandidate;
6876
-
6877
- // loop on the sektions to find the toColumnCandidate
6878
- // _.each( newSetValue.collection, function( _sektion_ ) {
6879
- // _.each( _sektion_.collection, function( _column_ ) {
6880
- // if ( _column_.id == params.to_column ) {
6881
- // toColumnCandidate = _column_;
6882
- // }
6883
- // });
6884
- // });
6885
- toColumnCandidate = self.getLevelModel( params.to_column, newSetValue.collection );
6886
 
6887
- if ( _.isEmpty( toColumnCandidate ) || 'no_match' == toColumnCandidate ) {
6888
- throw new Error( 'updateAPISetting => ' + params.action + ' => missing target column' );
6889
- }
6890
 
6891
- // If the module has been moved to another column
6892
- // => remove the moved module from the source column
6893
- if ( params.from_column != params.to_column ) {
6894
- var fromColumnCandidate;
6895
- fromColumnCandidate = self.getLevelModel( params.from_column, newSetValue.collection );
6896
 
6897
- if ( _.isEmpty( fromColumnCandidate ) || 'no_match' == fromColumnCandidate ) {
6898
- throw new Error( 'updateAPISetting => ' + params.action + ' => missing source column' );
6899
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6900
 
6901
- fromColumnCandidate.collection = _.isArray( fromColumnCandidate.collection ) ? fromColumnCandidate.collection : [];
6902
- // Make a copy of the module candidate now, before removing it
6903
- movedModuleCandidate = self.getLevelModel( params.id, newSetValue.collection );
6904
- copyOfMovedModuleCandidate = $.extend( true, {}, movedModuleCandidate );
6905
- // remove the module from its previous column
6906
- fromColumnCandidate.collection = _.filter( fromColumnCandidate.collection, function( module ) {
6907
- return module.id != params.id;
6908
- });
6909
- }// if params.from_column != params.to_column
6910
-
6911
- // update the target column
6912
- toColumnCandidate.collection = _.isArray( toColumnCandidate.collection ) ? toColumnCandidate.collection : [];
6913
- originalCollection = $.extend( true, [], toColumnCandidate.collection );
6914
- reorderedCollection = [];
6915
- _.each( params.newOrder, function( _id_ ) {
6916
- if ( params.from_column != params.to_column && _id_ == copyOfMovedModuleCandidate.id ) {
6917
- reorderedCollection.push( copyOfMovedModuleCandidate );
6918
- } else {
6919
- moduleCandidate = self.getLevelModel( _id_, newSetValue.collection );
6920
- if ( _.isEmpty( moduleCandidate ) || 'no_match' == moduleCandidate ) {
6921
- throw new Error( 'updateAPISetting => ' + params.action + ' => missing moduleCandidate' );
6922
- }
6923
- reorderedCollection.push( moduleCandidate );
6924
- }
6925
- });
6926
- // Check if we have duplicates ?
6927
- if ( reorderedCollection.length != _.uniq( reorderedCollection ).length ) {
6928
- throw new Error( 'updateAPISetting => ' + params.action + ' => there are duplicated modules in column : ' + toColumnCandidate.id );
6929
- } else {
6930
- toColumnCandidate.collection = reorderedCollection;
6931
- }
6932
- break;
6933
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6934
 
6935
- case 'sek-set-module-value' :
6936
- moduleCandidate = self.getLevelModel( params.id, newSetValue.collection );
 
 
 
 
 
 
 
 
 
 
 
6937
 
6938
- // Is this a multi-item module ?
6939
- // Fixes https://github.com/presscustomizr/nimble-builder/issues/616
6940
- var _ctrl_ = params.settingParams.args.moduleRegistrationParams.control,
6941
- _module_id_ = params.settingParams.args.moduleRegistrationParams.id,
6942
- parentModuleInstance = _ctrl_.czr_Module( _module_id_ );
6943
 
6944
- if ( ! _.isEmpty( parentModuleInstance ) ) {
6945
- isMultiItemModule = parentModuleInstance.isMultiItem();
6946
- } else {
6947
- api.errare( 'updateAPISetting => missing parentModuleInstance', params );
6948
- }
 
6949
 
6950
- // if multi-item module, the value is array of items, otherwise an object
6951
- var _modValueCandidate = isMultiItemModule ? [] : {};
6952
- // consider only the non empty settings for db
6953
- // booleans should bypass this check
6954
- _.each( params.value || (isMultiItemModule ? [] : {}), function( _val_, _key_ ) {
6955
- // Note : _.isEmpty( 5 ) returns true when checking an integer,
6956
- // that's why we need to cast the _val_ to a string when using _.isEmpty()
6957
- if ( ! _.isBoolean( _val_ ) && _.isEmpty( _val_ + "" ) )
6958
- return;
6959
- _modValueCandidate[ _key_ ] = _val_;
6960
- });
6961
- if ( 'no_match' == moduleCandidate ) {
6962
- api.errare( 'updateAPISetting => ' + params.action + ' => no module matched', params );
6963
- __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => error no module matched');
6964
- break;
6965
- }
6966
- if ( _.isEmpty( params.options_type ) ) {
6967
- api.errare( 'updateAPISetting => ' + params.action + ' => missing options_type');
6968
- __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => missing options_type');
6969
- break;
6970
- }
6971
 
6972
- // Is this a father module ?
6973
- // If yes, the module value is structured by option group, each option group being updated by a child module
6974
- // If no, the default option type is : '__no_option_group_to_be_updated_by_children_modules__'
6975
- if ( '__no_option_group_to_be_updated_by_children_modules__' === params.options_type ) {
6976
- moduleCandidate.value = _modValueCandidate;
 
 
 
6977
  } else {
6978
- // start from a deep cloned object
6979
- // prevents issues like https://github.com/presscustomizr/nimble-builder/issues/455
6980
- var _new_module_values = $.extend( true, {}, _.isEmpty( moduleCandidate.value ) ? {} : moduleCandidate.value );
6981
- _new_module_values[ params.options_type ] = _modValueCandidate;
6982
- moduleCandidate.value = _new_module_values;
6983
  }
6984
 
6985
- break;
 
 
 
 
6986
 
6987
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6988
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6989
 
 
6990
 
 
 
 
 
 
 
 
 
 
 
6991
 
6992
- //-------------------------------------------------------------------------------------------------
6993
- //-- LEVEL OPTIONS
6994
- //-------------------------------------------------------------------------------------------------
6995
- case 'sek-generate-level-options-ui' :
6996
- var _candidate_ = self.getLevelModel( params.id, newSetValue.collection ),
6997
- _valueCandidate = {};
6998
 
6999
- if ( 'no_match'=== _candidate_ ) {
7000
- api.errare( 'updateAPISetting => ' + params.action + ' => no parent sektion matched' );
7001
- __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => no parent sektion matched');
7002
- break;
7003
- }
7004
- // start from a deep cloned object
7005
- // important => fixes https://github.com/presscustomizr/nimble-builder/issues/455
7006
- var _new_options_values = $.extend( true, {}, _candidate_.options || {} );
7007
 
7008
- // consider only the non empty settings for db
7009
- // booleans should bypass this check
7010
- _.each( params.value || {}, function( _val_, _key_ ) {
7011
- // Note : _.isEmpty( 5 ) returns true when checking an integer,
7012
- // that's why we need to cast the _val_ to a string when using _.isEmpty()
7013
- if ( ! _.isBoolean( _val_ ) && _.isEmpty( _val_ + "" ) )
7014
- return;
7015
- _valueCandidate[ _key_ ] = _val_;
7016
- });
7017
 
7018
- if ( _.isEmpty( params.options_type ) ) {
7019
- api.errare( 'updateAPISetting => ' + params.action + ' => missing options_type');
7020
- }
 
7021
 
7022
- _new_options_values[ params.options_type ] = _valueCandidate;
7023
- _candidate_.options = _new_options_values;
7024
- break;
7025
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7026
 
 
 
 
 
7027
 
 
7028
 
 
 
 
 
7029
 
7030
- //-------------------------------------------------------------------------------------------------
7031
- //-- LOCAL SKOPE OPTIONS
7032
- //-------------------------------------------------------------------------------------------------
7033
- // Note : this is saved in "local_options"
7034
- case 'sek-generate-local-skope-options-ui' :
7035
- _valueCandidate = {};
7036
 
7037
- var _currentOptions = $.extend( true, {}, _.isObject( newSetValue.local_options ) ? newSetValue.local_options : {} );
7038
- // consider only the non empty settings for db
7039
- // booleans should bypass this check
7040
- _.each( params.value || {}, function( _val_, _key_ ) {
7041
- // Note : _.isEmpty( 5 ) returns true when checking an integer,
7042
- // that's why we need to cast the _val_ to a string when using _.isEmpty()
7043
- if ( ! _.isBoolean( _val_ ) && _.isEmpty( _val_ + "" ) )
7044
- return;
7045
- _valueCandidate[ _key_ ] = _val_;
7046
- });
7047
- if ( _.isEmpty( params.options_type ) || ! _.isString( params.options_type ) ) {
7048
- api.errare( 'updateAPISetting => ' + params.action + ' => missing options_type');
7049
- } else {
7050
- var newOptionsValues = {};
7051
- newOptionsValues[ params.options_type ] = _valueCandidate;
7052
- newSetValue.local_options = $.extend( _currentOptions, newOptionsValues );
7053
- }
7054
- break;
7055
 
 
 
 
 
 
7056
 
 
 
 
7057
 
 
 
 
 
 
 
 
 
 
7058
 
 
 
 
7059
 
 
7060
 
 
 
7061
 
 
 
7062
 
 
7063
 
 
 
 
 
 
 
7064
 
 
 
 
 
 
 
 
 
7065
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7066
 
 
 
 
 
7067
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7068
 
 
 
 
 
7069
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7070
 
 
 
 
 
7071
 
 
7072
 
 
 
 
7073
 
 
 
 
7074
 
 
 
 
 
 
 
7075
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7076
 
7077
- //-------------------------------------------------------------------------------------------------
7078
- //-- CONTENT IN NEW SEKTION
7079
- //-------------------------------------------------------------------------------------------------
7080
- // @params {
7081
- // drop_target_element : $(this),
7082
- // position : _position,// <= top or bottom
7083
- // before_section : $(this).data('sek-before-section'),
7084
- // after_section : $(this).data('sek-after-section'),
7085
- // content_type : event.originalEvent.dataTransfer.getData( "sek-content-type" ), //<= module or preset_section
7086
- // content_id : event.originalEvent.dataTransfer.getData( "sek-content-id" )
7087
- // }
7088
- case 'sek-add-content-in-new-sektion' :
7089
- // get the position of the before or after section
7090
- var positionIndex = 0;
7091
- locationCandidate = self.getLevelModel( params.location, newSetValue.collection );
7092
- if ( 'no_match' == locationCandidate ) {
7093
- api.errare( 'updateAPISetting => ' + params.action + ' => no location matched' );
7094
- __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => no location matched');
7095
- break;
7096
- }
7097
- locationCandidate.collection = _.isArray( locationCandidate.collection ) ? locationCandidate.collection : [];
7098
- _.each( locationCandidate.collection, function( secModel, index ) {
7099
- if ( params.before_section === secModel.id ) {
7100
- positionIndex = index;
7101
- }
7102
- if ( params.after_section === secModel.id ) {
7103
- positionIndex = index + 1;
7104
- }
7105
- });
7106
 
7107
- switch( params.content_type) {
7108
- // When a module is dropped in a section + column structure to be generated
7109
- case 'module' :
7110
- // Let's add the starting value if provided when registrating the module
7111
- // Note : params.content_id is the module_type
7112
- startingModuleValue = self.getModuleStartingValue( params.content_id );
7113
-
7114
- // insert the section in the collection at the right place
7115
- locationCandidate.collection.splice( positionIndex, 0, {
7116
- id : params.id,
7117
- level : 'section',
7118
- collection : [
7119
- {
7120
- id : sektionsLocalizedData.optPrefixForSektionsNotSaved + self.guid(),
7121
- level : 'column',
7122
- collection : [
7123
- {
7124
- id : params.droppedModuleId,
7125
- level : 'module',
7126
- module_type : params.content_id,
7127
- value : 'no_starting_value' !== startingModuleValue ? startingModuleValue : null,
7128
- ver_ini : sektionsLocalizedData.nimbleVersion
7129
- }
7130
- ],
7131
- ver_ini : sektionsLocalizedData.nimbleVersion
7132
- }
7133
- ],
7134
- ver_ini : sektionsLocalizedData.nimbleVersion
7135
- });
7136
- break;//case 'module' :
7137
 
7138
- // When a preset section is dropped
7139
- case 'preset_section' :
7140
- // insert the section in the collection at the right place
7141
- __presetSectionInjected__ = $.Deferred();//defined at the beginning of the method
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7142
 
7143
- // we use a section index here to display the section in the same order as in the json
7144
- // introduced when implementing multi-section pre-build section
7145
- // @see https://github.com/presscustomizr/nimble-builder/issues/489
7146
- var _injectPresetSectionInLocationOrParentColumn = function( sectionReadyToInject, positionIndex ) {
7147
- // If the preset_section is inserted in a an empty nested section, add it at the right place in the parent column of the nested section.
7148
- // Otherwise, add the preset section at the right position in the parent location of the section.
7149
- var insertedInANestedSektion = false;
7150
- if ( ! _.isEmpty( params.sektion_to_replace ) ) {
7151
- var sektionToReplace = self.getLevelModel( params.sektion_to_replace, newSetValue.collection );
7152
- if ( 'no_match' === sektionToReplace ) {
7153
- api.errare( 'updateAPISetting => ' + params.action + ' => no sektionToReplace matched' );
7154
- __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => no sektionToReplace matched');
7155
- }
7156
- insertedInANestedSektion = true === sektionToReplace.is_nested;
7157
- }
7158
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7159
 
7160
- // The following param "collection_of_preset_section_id" has been introduced when implementing support for multi-section pre-build sections
7161
- // @see https://github.com/presscustomizr/nimble-builder/issues/489
7162
- // It is sent to the preview with ::reactToPreviewMsg, see bottom of the method.
7163
- var injected_section_id = sektionsLocalizedData.optPrefixForSektionsNotSaved + self.guid();
7164
- params.collection_of_preset_section_id = params.collection_of_preset_section_id || [];
7165
- params.collection_of_preset_section_id.push( injected_section_id );
7166
-
7167
- if ( ! insertedInANestedSektion ) {
7168
- locationCandidate.collection.splice( positionIndex, 0, {
7169
- id : injected_section_id,//params.id,//self.guid()
7170
- level : 'section',
7171
- collection : sectionReadyToInject.collection,
7172
- options : sectionReadyToInject.options || {},
7173
- ver_ini : sektionsLocalizedData.nimbleVersion
7174
- });
7175
- } else {
7176
- columnCandidate = self.getLevelModel( params.in_column, newSetValue.collection );
7177
- if ( 'no_match' === columnCandidate ) {
7178
- api.errare( 'updateAPISetting => ' + params.action + ' => no parent column matched' );
7179
- __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => no parent column matched');
7180
- }
7181
 
7182
- columnCandidate.collection = _.isArray( columnCandidate.collection ) ? columnCandidate.collection : [];
7183
-
7184
- // get the position of the before or after module
7185
- _.each( columnCandidate.collection, function( moduleOrSectionModel, index ) {
7186
- if ( params.before_section === moduleOrSectionModel.id ) {
7187
- positionIndex = index;
7188
- }
7189
- if ( params.after_section === moduleOrSectionModel.id ) {
7190
- positionIndex = index + 1;
7191
- }
7192
- });
7193
-
7194
- columnCandidate.collection.splice( positionIndex, 0, {
7195
- id : injected_section_id,
7196
- is_nested : true,
7197
- level : 'section',
7198
- collection : sectionReadyToInject.collection,
7199
- options : sectionReadyToInject.options || {},
7200
- ver_ini : sektionsLocalizedData.nimbleVersion
7201
- });
7202
- }
7203
- };//_injectPresetSectionInLocationOrParentColumn
7204
- var _doWhenPresetSectionCollectionFetched = function( presetColumnOrSectionCollection ) {
7205
- self.preparePresetSectionForInjection( presetColumnOrSectionCollection )
7206
- .fail( function( _er_ ){
7207
- __updateAPISettingDeferred__.reject( 'updateAPISetting => error when preparePresetSectionForInjection => ' + params.action + ' => ' + _er_ );
7208
- // Used when updating the setting
7209
- // @see end of this method
7210
- __presetSectionInjected__.reject( _er_ );
7211
- })
7212
- .done( function( maybeMultiSectionReadyToInject ) {
7213
- var is_multi_section = 'section' === maybeMultiSectionReadyToInject.collection[0].level;
7214
- // support for pre-built multi-section has been introduced in july 2019
7215
- // @see https://github.com/presscustomizr/nimble-builder/issues/489
7216
- if ( is_multi_section ) {
7217
- // we use a section index here to display the section in the same order as in the json
7218
- var sectionIndex = 0;
7219
- _.each( maybeMultiSectionReadyToInject.collection, function( sectionReadyToInject ) {
7220
- _injectPresetSectionInLocationOrParentColumn( sectionReadyToInject, positionIndex );
7221
- positionIndex++;
7222
- });
7223
- } else {
7224
- _injectPresetSectionInLocationOrParentColumn( maybeMultiSectionReadyToInject, positionIndex );
7225
- }
7226
-
7227
- // Used when updating the setting
7228
- // @see end of this method
7229
- __presetSectionInjected__.resolve();
7230
- });// self.preparePresetSectionForInjection.done()
7231
- };//_doWhenPresetSectionCollectionFetched()
7232
-
7233
- // Try to fetch the sections from the server
7234
- // if sucessfull, resolve __presetSectionInjected__.promise()
7235
- self.getPresetSectionCollection({
7236
- is_user_section : params.is_user_section,
7237
- presetSectionId : params.content_id
7238
- })
7239
- .fail( function( _er_ ) {
7240
- api.errare( 'updateAPISetting => ' + params.action + ' => Error with self.getPresetSectionCollection()', _er_ );
7241
- __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => Error with self.getPresetSectionCollection()');
7242
- })
7243
- .done( function( presetColumnOrSectionCollection ) {
7244
- if ( ! _.isObject( presetColumnOrSectionCollection ) || _.isEmpty( presetColumnOrSectionCollection ) ) {
7245
- api.errare( 'updateAPISetting => ' + params.action + ' => preset section type not found or empty : ' + params.content_id, presetColumnOrSectionCollection );
7246
- __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => preset section type not found or empty');
7247
- }
7248
- // OK. time to resolve __presetSectionInjected__.promise()
7249
- _doWhenPresetSectionCollectionFetched( presetColumnOrSectionCollection );
7250
- });//self.getPresetSectionCollection().done()
7251
 
7252
- break;//case 'preset_section' :
7253
- }//switch( params.content_type)
7254
- break;
7255
 
7256
 
 
 
 
 
7257
 
 
7258
 
 
 
 
 
 
 
 
 
 
 
7259
 
 
7260
 
 
 
 
 
 
 
 
 
 
7261
 
 
 
 
 
7262
 
 
 
 
 
7263
 
 
7264
 
 
 
 
 
 
 
 
 
 
 
7265
 
 
 
 
 
7266
 
 
 
 
7267
 
 
7268
 
 
 
 
7269
 
 
 
 
 
 
 
 
 
 
7270
 
 
 
 
7271
 
 
 
 
 
 
7272
 
 
 
 
7273
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7274
 
7275
- //-------------------------------------------------------------------------------------------------
7276
- //-- CONTENT IN NEW NESTED SEKTION
7277
- //-------------------------------------------------------------------------------------------------
7278
- // @params {
7279
- // drop_target_element : $(this),
7280
- // position : _position,// <= top or bottom
7281
- // before_section : $(this).data('sek-before-section'),
7282
- // after_section : $(this).data('sek-after-section'),
7283
- // content_type : event.originalEvent.dataTransfer.getData( "sek-content-type" ), //<= module or preset_section
7284
- // content_id : event.originalEvent.dataTransfer.getData( "sek-content-id" )
7285
- // }
7286
- case 'sek-add-preset-section-in-new-nested-sektion' :
7287
 
7288
- columnCandidate = self.getLevelModel( params.in_column, newSetValue.collection );
7289
- if ( 'no_match' === columnCandidate ) {
7290
- api.errare( 'updateAPISetting => ' + params.action + ' => no parent column matched' );
7291
- __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => no parent column matched');
7292
- break;
7293
- }
7294
 
7295
- var positionIndexInColumn = 0;
7296
- columnCandidate.collection = _.isArray( columnCandidate.collection ) ? columnCandidate.collection : [];
7297
- // get the position of the before or after module or nested section
7298
- _.each( columnCandidate.collection, function( moduleOrNestedSectionModel, index ) {
7299
- if ( params.before_module_or_nested_section === moduleOrNestedSectionModel.id ) {
7300
- positionIndexInColumn = index;
7301
- }
7302
- if ( params.after_module_or_nested_section === moduleOrNestedSectionModel.id ) {
7303
- positionIndexInColumn = index + 1;
7304
- }
7305
- });
7306
 
7307
- // can we add this nested sektion ?
7308
- // if the parent sektion of the column has is_nested = true, then we can't
7309
- parentSektionCandidate = self.getLevelModel( params.in_sektion, newSetValue.collection );
7310
- if ( 'no_match' == parentSektionCandidate ) {
7311
- __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => no grand parent sektion found');
7312
- break;
7313
- }
7314
- if ( true === parentSektionCandidate.is_nested ) {
7315
- __updateAPISettingDeferred__.reject('');
7316
- api.previewer.trigger('sek-notify', {
7317
- type : 'info',
7318
- duration : 30000,
7319
- message : [
7320
- '<span style="font-size:0.95em">',
7321
- '<strong>' + sektionsLocalizedData.i18n[ "You've reached the maximum number of allowed nested sections." ] + '</strong>',
7322
- '</span>'
7323
- ].join('')
7324
- });
7325
- break;
7326
- }
7327
 
7328
- // insert the nested section in the collection at the right place
7329
- var presetColumnOrSectionCollection;
7330
- __presetSectionInjected__ = $.Deferred();//defined at the beginning of the method
 
 
7331
 
7332
- var _doWhenPrebuiltSectionCollectionFetched = function( presetColumnOrSectionCollection ) {
7333
- self.preparePresetSectionForInjection( presetColumnOrSectionCollection )
7334
- .fail( function( _er_ ){
7335
- __updateAPISettingDeferred__.reject( 'updateAPISetting => error when preparePresetSectionForInjection => ' + params.action + ' => ' + _er_ );
7336
- // Used when updating the setting
7337
- // @see end of this method
7338
- __presetSectionInjected__.reject( _er_ );
7339
- })
7340
- .done( function( maybeMultiSectionReadyToInject ) {
 
 
 
 
 
 
 
 
 
 
 
 
7341
 
7342
- var _injectNestedSectionInParentColumn = function( sectionReadyToInject, positionIndexInColumn ) {
7343
- positionIndexInColumn = positionIndexInColumn || 0;
 
 
 
 
 
 
 
 
 
 
 
7344
 
7345
- // The following param "collection_of_preset_section_id" has been introduced when implementing support for multi-section pre-build sections
7346
- // @see https://github.com/presscustomizr/nimble-builder/issues/489
7347
- // It is sent to the preview with ::reactToPreviewMsg, see bottom of the method.
7348
- var injected_section_id = sektionsLocalizedData.optPrefixForSektionsNotSaved + self.guid();
7349
- params.collection_of_preset_section_id = params.collection_of_preset_section_id || [];
7350
- params.collection_of_preset_section_id.push( injected_section_id );
7351
-
7352
- columnCandidate.collection.splice( positionIndexInColumn, 0, {
7353
- id : injected_section_id,
7354
- level : 'section',
7355
- collection : sectionReadyToInject.collection,
7356
- options : sectionReadyToInject.options || {},
7357
- is_nested : true,
7358
- ver_ini : sektionsLocalizedData.nimbleVersion
7359
- });
7360
- };
7361
-
7362
- // support for pre-built multi-section has been introduced in july 2019
7363
- // @see https://github.com/presscustomizr/nimble-builder/issues/489
7364
- var is_multi_section = 'section' === maybeMultiSectionReadyToInject.collection[0].level;
7365
- if ( is_multi_section ) {
7366
- _.each( maybeMultiSectionReadyToInject.collection, function( sectionReadyToInject ) {
7367
- _injectNestedSectionInParentColumn( sectionReadyToInject, positionIndexInColumn );
7368
- positionIndexInColumn++;
7369
- });
7370
- } else {
7371
- _injectNestedSectionInParentColumn( maybeMultiSectionReadyToInject, positionIndexInColumn );
7372
- }
7373
 
7374
- // Used when updating the setting
7375
- // @see end of this method
7376
- __presetSectionInjected__.resolve();
7377
- });//self.preparePresetSectionForInjection.done()
7378
- };//_doWhenPrebuiltSectionCollectionFetched
7379
 
 
7380
 
7381
- // Try to fetch the sections from the server
7382
- // if sucessfull, resolve __presetSectionInjected__.promise()
7383
- self.getPresetSectionCollection({
7384
- is_user_section : params.is_user_section,
7385
- presetSectionId : params.content_id
7386
- })
7387
- .fail( function() {
7388
- api.errare( 'updateAPISetting => ' + params.action + ' => Error with self.getPresetSectionCollection()', _er_ );
7389
- __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => Error with self.getPresetSectionCollection()');
7390
- })
7391
- .done( function( presetColumnOrSectionCollection ) {
7392
- if ( ! _.isObject( presetColumnOrSectionCollection ) || _.isEmpty( presetColumnOrSectionCollection ) ) {
7393
- api.errare( 'updateAPISetting => ' + params.action + ' => preset section type not found or empty : ' + params.content_id, presetColumnOrSectionCollection );
7394
- __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => preset section type not found or empty');
7395
- }
7396
- // OK. time to resolve __presetSectionInjected__.promise()
7397
- _doWhenPrebuiltSectionCollectionFetched( presetColumnOrSectionCollection );
7398
- });//self.getPresetSectionCollection().done()
7399
- break;
7400
 
 
7401
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7402
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7403
 
 
 
 
7404
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7405
 
 
 
 
7406
 
 
 
 
7407
 
 
 
 
 
 
 
7408
 
7409
- //-------------------------------------------------------------------------------------------------
7410
- //-- POPULATE GOOGLE FONTS
7411
- //-------------------------------------------------------------------------------------------------
7412
- //@params {
7413
- // action : 'sek-update-fonts',
7414
- // font_family : newFontFamily,
7415
- // }
7416
- case 'sek-update-fonts' :
7417
- // Get the gfonts from the level options and modules values
7418
- var currentGfonts = self.sniffGFonts( { is_global_location : ( params && true === params.is_global_location ) } );
7419
 
7420
- // add it only if gfont
7421
- if ( ! _.isEmpty( params.font_family ) && _.isString( params.font_family ) ) {
7422
- if ( params.font_family.indexOf('gfont') > -1 && ! _.contains( currentGfonts, params.font_family ) ) {
7423
- currentGfonts.push( params.font_family );
7424
- }
7425
- }
7426
 
7427
- // update the global gfonts collection
7428
- // this is then used server side in Sek_Dyn_CSS_Handler::sek_get_gfont_print_candidates to build the Google Fonts request
7429
- newSetValue.fonts = currentGfonts;
7430
- break;
7431
 
7432
- //-------------------------------------------------------------------------------------------------
7433
- //-- RESTORE A REVISION
7434
- //-------------------------------------------------------------------------------------------------
7435
- case 'sek-restore-revision' :
7436
- //api.infoLog( 'sek-restore-revision', params );
7437
- newSetValue = params.revision_value;
7438
- break;
7439
 
7440
- //-------------------------------------------------------------------------------------------------
7441
- //-- FILE IMPORT
7442
- //-------------------------------------------------------------------------------------------------
7443
- case 'sek-import-from-file' :
7444
- api.infoLog( 'sek-import-from-file', params );
7445
- if ( _.isUndefined( params.imported_content.data ) || _.isUndefined( params.imported_content.metas ) ) {
7446
- api.errare( 'updateAPISetting::sek-import-from-file => invalid imported content', imported_content );
7447
- break;
7448
- }
7449
 
7450
- var importedCollection = _.isArray( params.imported_content.data.collection ) ? $.extend( true, [], params.imported_content.data.collection ) : [];
7451
-
7452
- // SHALL WE ASSIGN SECTIONS FROM MISSING LOCATIONS TO THE FIRST ACTIVE LOCATION ?
7453
- // For example the current page has only the 'loop_start' location, whereas the imported content includes 3 locations :
7454
- // - after_header
7455
- // - loop_start
7456
- // - before_footer
7457
- // Among those 3 locations, 2 are not active in the page.
7458
- // We will merge all section collections from the 3 imported locations one new collection, that will be assigned to 'loop_start'
7459
- // Note that the active imported locations are ordered like they were on the page when exported.
7460
- //
7461
- // So :
7462
- // 1) identify the first active location of the page
7463
- // 2) populate a new collection of combined sections from all active imported locations.
7464
- // 3) updated the imported collection with this
7465
- if ( true === params.assign_missing_locations ) {
7466
- var importedActiveLocations = params.imported_content.metas.active_locations,
7467
- currentActiveLocations = api.czr_sektions.activeLocations();
7468
-
7469
- // console.log('Current set value ?', api( _collectionSettingId_ )() );
7470
- // console.log('import params', params );
7471
- // console.log('importedCollection?', importedCollection );
7472
- // console.log('importedActiveLocations', importedActiveLocations );
7473
-
7474
- // first active location of the current setting
7475
- var firstCurrentActiveLocationId = _.first( currentActiveLocations );
7476
-
7477
- if ( !_.isEmpty( firstCurrentActiveLocationId ) && !_.isEmpty( importedActiveLocations ) && _.isArray( importedActiveLocations ) ) {
7478
- // importedActiveLocationsNotAvailableInCurrentActiveLocations
7479
- // Example :
7480
- // active location in the page : loop_start, loop_end
7481
- // active locations imported : after_header, loop_start, before_footer
7482
- // importedActiveLocationsNotAvailableInCurrentActiveLocations => after_header, before_footer
7483
- var importedActiveLocationsNotAvailableInCurrentActiveLocations = $(importedActiveLocations).not(currentActiveLocations).get(),
7484
- firstCurrentLocationData = self.getLevelModel( firstCurrentActiveLocationId, newSetValue.collection ),
7485
- importedTargetLocationData = self.getLevelModel( firstCurrentActiveLocationId, params.imported_content.data.collection ),
7486
- newCollectionForTargetLocation = [];// the collection that will hold the merge of all active imported collections
7487
-
7488
- // normalize
7489
- // => make sure we have a collection array, even empty
7490
- firstCurrentLocationData.collection = _.isArray( firstCurrentLocationData.collection ) ? firstCurrentLocationData.collection : [];
7491
- importedTargetLocationData.collection = _.isArray( importedTargetLocationData.collection ) ? importedTargetLocationData.collection : [];
7492
-
7493
- // loop on the active imported locations
7494
- // Example : ["__after_header", "__before_main_wrapper", "loop_start", "__before_footer"]
7495
- // and populate newCollectionForTargetLocation, with locations ordered as they were on export
7496
- // importedCollection is a clone
7497
- _.each( importedActiveLocations, function( impLocationId ){
7498
- var impLocationData = self.getLevelModel( impLocationId, importedCollection );
7499
- if ( _.isEmpty( impLocationData.collection ) )
7500
- return;
7501
- newCollectionForTargetLocation = _.union( newCollectionForTargetLocation, impLocationData.collection );
7502
- });//_.each( importedActiveLocations
7503
-
7504
- // replace the previous collection of the target location, by the union of all collections.
7505
- // for example, if 'loop_start' is the target location, all sections will be added to it.
7506
- importedTargetLocationData.collection = newCollectionForTargetLocation;
7507
-
7508
- // remove the missing locations from the imported collection
7509
- // importedActiveLocationsNotAvailableInCurrentActiveLocations
7510
- params.imported_content.data.collection = _.filter( params.imported_content.data.collection, function( _location ) {
7511
- return !_.contains( importedActiveLocationsNotAvailableInCurrentActiveLocations, _location.id );
7512
- });
7513
- }//if ( !_.isEmpty( firstCurrentActiveLocationId ) )
7514
- }//if ( true === params.assign_missing_locations )
7515
-
7516
-
7517
- // SHALL WE MERGE ?
7518
- // Sept 2019 note : for local import only. Not implemented for global https://github.com/presscustomizr/nimble-builder/issues/495
7519
- // loop on each location of the imported content
7520
- // if the current setting value has sections in a location, add them before the imported ones
7521
- // keep_existing_sections is a user check option
7522
- // @see PHP sek_get_module_params_for_sek_local_imp_exp()
7523
- if ( true === params.keep_existing_sections ) {
7524
- // note that importedCollection is a unlinked clone of params.imported_content.data.collection
7525
- // merge sections
7526
- _.each( importedCollection, function( imp_location_data ) {
7527
- var currentLocationData = self.getLevelModel( imp_location_data.id, newSetValue.collection );
7528
- if ( _.isEmpty( currentLocationData.collection ) )
7529
- return;
7530
 
7531
- var importedLocationData = self.getLevelModel( imp_location_data.id, params.imported_content.data.collection );
7532
- importedLocationData.collection = _.union( currentLocationData.collection, importedLocationData.collection );
7533
- });
7534
 
7535
- // merge fonts if needed
7536
- if ( newSetValue.fonts && !_.isEmpty( newSetValue.fonts ) && _.isArray( newSetValue.fonts ) ) {
7537
- params.imported_content.data.fonts = _.isArray( params.imported_content.data.fonts ) ? params.imported_content.data.fonts : [];
7538
- // merge and remove duplicated fonts
7539
- params.imported_content.data.fonts = _.uniq( _.union( newSetValue.fonts, params.imported_content.data.fonts ) );
7540
- }
7541
- }// if true === params.merge
7542
 
7543
- newSetValue = params.imported_content.data;
7544
- break;
7545
 
7546
- //-------------------------------------------------------------------------------------------------
7547
- //-- RESET COLLECTION, LOCAL OR GLOBAL
7548
- //-------------------------------------------------------------------------------------------------
7549
- case 'sek-reset-collection' :
7550
- //api.infoLog( 'sek-import-from-file', params );
7551
- try { newSetValue = api.czr_sektions.resetCollectionSetting( params.scope ); } catch( er ) {
7552
- api.errare( 'sek-reset-collection => error when firing resetCollectionSetting()', er );
7553
- }
7554
- break;
7555
- }// switch
7556
 
7557
 
7558
 
7559
- // if we did not already rejected the request, let's check if the setting object has actually been modified
7560
- // at this point it should have been.
7561
- if ( 'pending' == __updateAPISettingDeferred__.state() ) {
7562
- var mayBeUpdateSektionsSetting = function() {
 
 
 
 
 
 
 
 
 
 
 
7563
 
7564
- // When a sektion setting is changed, "from" and "to" are passed to the .settingParams property
7565
- // settingParams : {
7566
- // to : to,
7567
- // from : from,
7568
- // args : args
7569
- // }
7570
- // @see for example ::generateUIforFrontModules or ::generateUIforLevelOptions
7571
- var isSettingValueChangeCase = params.settingParams && params.settingParams.from && params.settingParams.to;
7572
 
 
7573
 
7574
- // in a setting value change case, the from and to must be different
7575
- // implemented when fixing https://github.com/presscustomizr/nimble-builder/issues/455
7576
- if ( isSettingValueChangeCase && _.isEqual( params.settingParams.from, params.settingParams.to ) ) {
7577
- __updateAPISettingDeferred__.reject( 'updateAPISetting => main sektion setting change => the new setting value is unchanged when firing action : ' + params.action );
7578
- } else if ( ! isSettingValueChangeCase && _.isEqual( currentSetValue, newSetValue ) ) {
7579
- __updateAPISettingDeferred__.reject( 'updateAPISetting => the new setting value is unchanged when firing action : ' + params.action );
7580
- } else {
7581
- if ( null !== self.validateSettingValue( newSetValue, params.is_global_location ? 'global' : 'local' ) ) {
7582
- api( _collectionSettingId_ )( newSetValue, params );
7583
- // Add the cloneId to the params when we resolve
7584
- // the cloneId is only needed in the duplication scenarii
7585
- params.cloneId = cloneId;
7586
- __updateAPISettingDeferred__.resolve( params );
7587
- } else {
7588
- __updateAPISettingDeferred__.reject( 'Validation problem for action ' + params.action );
7589
- }
7590
- //api.infoLog('COLLECTION SETTING UPDATED => ', _collectionSettingId_, api( _collectionSettingId_ )() );
7591
- }
7592
- };//mayBeUpdateSektionsSetting()
7593
 
7594
- // For all scenarios but section injection, we can update the sektion setting now
7595
- // otherwise we need to wait for the injection to be processed asynchronously
7596
- // CRITICAL => __updateAPISettingDeferred__ has to be resolved / rejected
7597
- // otherwise this can lead to scenarios where a change is not taken into account in ::updateAPISettingAndExecutePreviewActions
7598
- // like in https://github.com/presscustomizr/nimble-builder/issues/373
7599
- if ( '_not_injection_scenario_' === __presetSectionInjected__ ) {
7600
- mayBeUpdateSektionsSetting();
7601
- // At this point the __updateAPISettingDeferred__ obj can't be in a 'pending' state
7602
- if ( 'pending' === __updateAPISettingDeferred__.state() ) {
7603
- api.errare( '::updateAPISetting => The __updateAPISettingDeferred__ promise has not been resolved properly.');
7604
- }
7605
- } else {
7606
- __presetSectionInjected__
7607
- .done( function() {
7608
- mayBeUpdateSektionsSetting();
7609
- // At this point the __updateAPISettingDeferred__ obj can't be in a 'pending' state
7610
- if ( 'pending' === __updateAPISettingDeferred__.state() ) {
7611
- api.errare( '::updateAPISetting => The __updateAPISettingDeferred__ promise has not been resolved properly.');
7612
- }
7613
- })
7614
- .fail( function( _er_ ) {
7615
- api.errare( 'updateAPISetting => __presetSectionInjected__ failed', _er_ );
7616
- });
7617
- }
7618
- }
7619
- };//_do_update_setting_id()
7620
 
 
 
 
 
7621
 
7622
- // Update the sektion collection
7623
- api( _collectionSettingId_, function( sektionSetInstance ) {
7624
- _do_update_setting_id();
7625
- });
7626
- return __updateAPISettingDeferred__.promise();
7627
- },//updateAPISetting
7628
 
 
 
 
 
 
 
 
 
7629
 
7630
- // used on :
7631
- // - add column
7632
- // - remove column
7633
- // - duplicate column
7634
- // - move column
7635
- // added in June 2019 for https://github.com/presscustomizr/nimble-builder/issues/279
7636
- resetColumnsWidthInSection : function( sektionCandidate ) {
7637
- // RESET ALL COLUMNS WIDTH
7638
- _.each( sektionCandidate.collection, function( colModel ) {
7639
- if ( colModel.options && colModel.options.width && colModel.options.width['custom-width'] ) {
7640
- colModel.options.width = _.omit( colModel.options.width, 'custom-width' );
7641
- }
7642
- colModel.width = '';// For backward compat since June 2019
7643
- });
7644
- },
7645
 
 
 
 
7646
 
7647
- // @return a promise()
7648
- // caches the sections in api.sek_presetSections when api.section( '__content_picker__') is registered
7649
- // caches the user saved sections on the first drag and drop of a user-saved section
7650
- _maybeFetchSectionsFromServer : function() {
7651
- var dfd = $.Deferred(),
7652
- _ajaxRequest_;
7653
 
7654
- if ( ! _.isEmpty( api.sek_presetSections ) ) {
7655
- dfd.resolve( api.sek_presetSections );
7656
- } else {
7657
- if ( ! _.isUndefined( api.sek_fetchingPresetSections ) && 'pending' == api.sek_fetchingPresetSections.state() ) {
7658
- _ajaxRequest_ = api.sek_fetchingPresetSections;
7659
- } else {
7660
- _ajaxRequest_ = wp.ajax.post( 'sek_get_preset_sections', { nonce: api.settings.nonce.save } );
7661
- api.sek_fetchingPresetSections = _ajaxRequest_;
7662
  }
7663
- _ajaxRequest_.done( function( _collection_ ) {
7664
- //api.sek_presetSections = JSON.parse( _collection_ );
7665
- api.sek_presetSections = _collection_;
7666
- dfd.resolve( api.sek_presetSections );
7667
- }).fail( function( _r_ ) {
7668
- dfd.reject( _r_ );
7669
- });
7670
  }
7671
- return dfd.promise();
7672
- },
7673
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7674
 
7675
 
7676
 
7677
- // First run : fetches the collection from the server
7678
- // Next runs : uses the cached collection
7679
- //
7680
- // @return a JSON parsed string,
7681
- // + guid() ids for each levels
7682
- // ready for insertion
7683
- //
7684
- // @sectionParams : {
7685
- // is_user_section : bool, //<= is this section a "saved" section ?
7686
- // presetSectionId : params.content_id,
7687
- // }
7688
- getPresetSectionCollection : function( sectionParams ) {
7689
- var self = this,
7690
- __dfd__ = $.Deferred();
7691
- if ( sectionParams.is_user_section ) {
7692
- wp.ajax.post( 'sek_get_user_section_json', {
7693
- nonce: api.settings.nonce.save,
7694
- section_post_name: sectionParams.presetSectionId
7695
- //skope_id: api.czr_skopeBase.getSkopeProperty( 'skope_id' )
7696
- })
7697
- .done( function( userSection ) {
7698
- // User section looks like
7699
- // {
7700
- // data : {}
7701
- // metas : {}
7702
- // section_post_name : ''
7703
- // }
7704
- if ( ! _.isObject( userSection ) || _.isEmpty( userSection ) || _.isUndefined( userSection.data ) ) {
7705
- api.errare( 'getPresetSectionCollection => preset section type not found or empty : ' + sectionParams.presetSectionId, userSection );
7706
- throw new Error( 'getPresetSectionCollection => preset section type not found or empty');
7707
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7708
 
7709
- var userSectionCandidate = $.extend( {}, true, userSection.data );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7710
 
7711
- // ID's
7712
- // the level's id have to be generated
7713
- // 1) root level
7714
- userSectionCandidate.id = sektionsLocalizedData.optPrefixForSektionsNotSaved + self.guid();
7715
- // 2) children levels
7716
- userSectionCandidate.collection = self.setPresetOrUserSectionIds( userSectionCandidate.collection );
7717
 
7718
- // NIMBLE VERSION
7719
- // set the section version
7720
- userSectionCandidate.ver_ini = sektionsLocalizedData.nimbleVersion;
7721
- // the other level's version have to be added
7722
- userSectionCandidate.collection = self.setPresetSectionVersion( userSectionCandidate.collection );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7723
 
7724
- // OK. time to resolve __presetSectionInjected__.promise()
7725
- __dfd__.resolve( userSectionCandidate );
7726
- })
7727
- .fail( function( er ) {
7728
- __dfd__.reject( er );
7729
- });
7730
- } else {
7731
- self._maybeFetchSectionsFromServer()
7732
- .fail( function( er ) {
7733
- __dfd__.reject( er );
7734
- })
7735
- .done( function( _collection_ ) {
7736
- //api.infoLog( 'preset_sections fetched', api.sek_presetSections );
7737
- var presetSection,
7738
- allPresets = $.extend( true, {}, _.isObject( _collection_ ) ? _collection_ : {} );
7739
 
7740
- if ( _.isEmpty( allPresets ) ) {
7741
- throw new Error( 'getPresetSectionCollection => Invalid collection');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7742
  }
7743
- if ( _.isEmpty( allPresets[ sectionParams.presetSectionId ] ) ) {
7744
- throw new Error( 'getPresetSectionCollection => the preset section : "' + sectionParams.presetSectionId + '" has not been found in the collection');
 
 
 
7745
  }
7746
- var presetCandidate = allPresets[ sectionParams.presetSectionId ];
7747
 
7748
- // Ensure we have a string that's JSON.parse-able
7749
- // if ( typeof presetCandidate !== 'string' || presetCandidate[0] !== '{' ) {
7750
- // throw new Error( 'getPresetSectionCollection => ' + sectionParams.presetSectionId + ' is not JSON.parse-able');
7751
- // }
7752
- // presetCandidate = JSON.parse( presetCandidate );
7753
 
7754
- // ID's
7755
- // the level's id have to be generated
7756
- presetCandidate.collection = self.setPresetOrUserSectionIds( presetCandidate.collection );
7757
 
7758
- // NIMBLE VERSION
7759
- // set the section version
7760
- presetCandidate.ver_ini = sektionsLocalizedData.nimbleVersion;
7761
- // the other level's version have to be added
7762
- presetCandidate.collection = self.setPresetSectionVersion( presetCandidate.collection );
7763
- __dfd__.resolve( presetCandidate );
7764
- });//_maybeFetchSectionsFromServer.done()
7765
- }
7766
- return __dfd__.promise();
7767
- },
7768
 
 
 
7769
 
7770
- // SECTION HELPERS
7771
- // Replaces __rep__me__ by an id looking like __nimble__1eda909f0cfe
7772
- setPresetOrUserSectionIds : function( collection ) {
7773
- var self = this;
7774
- // Only collection set as arrays hold columns or modules
7775
- if ( _.isArray( collection ) ) {
7776
- _.each( collection, function( levelData ) {
7777
- levelData.id = sektionsLocalizedData.optPrefixForSektionsNotSaved + self.guid();
7778
- if ( _.isArray( levelData.collection ) ) {
7779
- self.setPresetOrUserSectionIds( levelData.collection );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7780
  }
7781
- });
7782
- }
7783
- return collection;
7784
- },
7785
 
7786
- setPresetSectionVersion : function( collection ) {
7787
- var self = this;
7788
- _.each( collection, function( levelData ) {
7789
- levelData.ver_ini = sektionsLocalizedData.nimbleVersion;
7790
- if ( _.isArray( levelData.collection ) ) {
7791
- self.setPresetSectionVersion( levelData.collection );
7792
- }
7793
- });
7794
- return collection;
7795
- },
7796
 
 
 
7797
 
 
 
7798
 
7799
- // Walk the column collection of a preset section, and replace '__img_url__*' pattern by image ids that we get from ajax calls
7800
- // Is designed to handle multiple ajax calls in parallel if the preset_section includes several images
7801
- // @return a promise()
7802
- preparePresetSectionForInjection : function( columnCollection ) {
7803
- var self = this,
7804
- deferreds = {},
7805
- preparedSection = {},
7806
- _dfd_ = $.Deferred();
 
 
 
 
 
 
 
7807
 
7808
- // items id of multi-items module must always be unique
7809
- // this recursive method sniff and does the job
7810
- self.maybeGenerateNewItemIdsForCrudModules( columnCollection );
7811
 
7812
- // walk the column collection and populates the deferreds object recursively
7813
- var _sniffImg = function( data ) {
7814
- _.each( data, function( val, key ) {
7815
- if ( _.isObject( val ) || _.isArray( val ) ) {
7816
- _sniffImg( val );
7817
- } else if ( _.isString( val ) && -1 != val.indexOf( '__img_url__' ) ) {
7818
- // scenario when a section uses an image more than once.
7819
- // => we don't need to fire a new ajax request for an image already sniffed
7820
- if ( ! _.has( deferreds, val ) ) {
7821
- deferreds[ val ] = self.importAttachment( val.replace( '__img_url__', '' ) );
7822
- }
7823
- }
7824
- });
7825
- return deferreds;
7826
- };
 
 
 
7827
 
7828
- // walk the column collection and populates the deferreds object recursively
7829
- // imdList is formed this way :
7830
- // __img_url__/assets/img/1.jpg : {id: 2547, url: "http://customizr-dev.test/wp-content/uploads/2018/09/nimble_asset_1.jpg"}
7831
- // __img_url__/assets/img/2.jpg : {id: 2548, url: "http://customizr-dev.test/wp-content/uploads/2018/09/nimble_asset_2.jpg"}
7832
- // __img_url__/assets/img/3.jpg : {id: 2549, url: "http://customizr-dev.test/wp-content/uploads/2018/09/nimble_asset_3.jpg"}
7833
- var _replaceImgPlaceholderById = function( data, imgList) {
7834
- _.each( data, function( val, key ) {
7835
- if ( _.isObject( val ) || _.isArray( val ) ) {
7836
- _replaceImgPlaceholderById( val, imgList );
7837
- } else if ( _.isString( val ) && -1 != val.indexOf( '__img_url__' ) && _.has( imgList, val ) && _.isObject( imgList[ val ] ) ) {
7838
- data[ key ] = imgList[ val ].id;
7839
- }
7840
- });
7841
- return columnCollection;
7842
- };
7843
 
7844
- self.whenAllPromisesInParallel( _sniffImg( columnCollection ) )
7845
- .done( function( imgList ) {
7846
- var imgReadySection = _replaceImgPlaceholderById( columnCollection, imgList );
7847
- _dfd_.resolve( imgReadySection );
7848
- })
7849
- .fail( function( _er_ ){
7850
- _dfd_.reject( _er_ );
7851
- });
7852
 
7853
- return _dfd_.promise();
7854
- }
7855
  });//$.extend()
7856
  })( wp.customize, jQuery );//global sektionsLocalizedData
7857
  var CZRSeksPrototype = CZRSeksPrototype || {};
@@ -8089,6 +9123,13 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8089
  return walkCollection( id ) !== 'no_match';
8090
  },
8091
 
 
 
 
 
 
 
 
8092
  // @return bool
8093
  // June 2020 : introduced for https://github.com/presscustomizr/nimble-builder-pro/issues/6
8094
  isHeaderLocation : function( id ) {
@@ -8100,7 +9141,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8100
  // @return bool
8101
  // June 2020 : introduced for https://github.com/presscustomizr/nimble-builder-pro/issues/6
8102
  isFooterLocation : function( id ) {
8103
- var _locCollection = self.activeLocationsInfo(),
8104
  _currentLocInfo = !_.isArray( _locCollection ) ? {} : _.findWhere( _locCollection, { id : id } );
8105
  return _.isObject( _currentLocInfo ) && _currentLocInfo.is_footer;
8106
  },
@@ -8968,6 +10009,14 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8968
  // @see api.czrInputMap['code_editor']
8969
  // @see https://github.com/presscustomizr/nimble-builder/issues/176
8970
  $control.trigger( "true" == $control.attr('data-sek-expanded') ? 'sek-accordion-expanded' : 'sek-accordion-collapsed' );
 
 
 
 
 
 
 
 
8971
  });
8972
 
8973
  _section_.container.data('sek-module-accordion-has-been-setup', true );
@@ -9002,7 +10051,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
9002
  // Nov 2020 => make sure the setup has been done on the control so that it reacts on a on custom event ( here 'sek-accordion-expanded' )
9003
  // see fmk CZRModuleMths::initialize
9004
  // event defined on module registration with api.czrModuleMap[ module.module_type ].ready_on_section_expanded
9005
- if ( _ctrl_.module_ready_on_custom_control_event_is_setup ) {
9006
  _ctrl_.container.trigger( 'sek-accordion-expanded' );
9007
  } else {
9008
  _ctrl_.container.one('module_ready_on_custom_control_event_is_setup', function() {
@@ -9139,6 +10188,40 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
9139
  this.bind( function( to ) {
9140
  item.czr_Input( controlledInputId ).visible( visibilityCallBack() );
9141
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9142
  }
9143
  });//$.extend()
9144
  })( wp.customize, jQuery );//global sektionsLocalizedData
@@ -10314,80 +11397,9 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
10314
 
10315
 
10316
 
10317
-
10318
-
10319
-
10320
-
10321
-
10322
-
10323
  ////////////////////////////////////////////////////////
10324
- // IMPORT FROM USER SAVED COLLECTION OR REMOTE API
10325
  ////////////////////////////////////////////////////////
10326
- // @return promise
10327
- getTmplJsonFromUserTmpl : function( template_name ) {
10328
- var self = this, _dfd_ = $.Deferred();
10329
- wp.ajax.post( 'sek_get_user_tmpl_json', {
10330
- nonce: api.settings.nonce.save,
10331
- tmpl_post_name: template_name
10332
- //skope_id: api.czr_skopeBase.getSkopeProperty( 'skope_id' )
10333
- })
10334
- .done( function( response ) {
10335
- _dfd_.resolve( {success:true, tmpl_json:response });
10336
- })
10337
- .fail( function( er ) {
10338
- _dfd_.resolve( {success:false});
10339
- api.errorLog( 'ajax getTmplJsonFromUserTmpl => error', er );
10340
- api.previewer.trigger('sek-notify', {
10341
- type : 'error',
10342
- duration : 10000,
10343
- message : [
10344
- '<span style="font-size:0.95em">',
10345
- '<strong>@missi18n error when fetching the template</strong>',
10346
- '</span>'
10347
- ].join('')
10348
- });
10349
- });
10350
-
10351
- return _dfd_;
10352
- },
10353
-
10354
- // @return promise
10355
- getTmplJsonFromApi : function( template_name ) {
10356
- var self, _dfd_ = $.Deferred();
10357
- $.getJSON( 'https://api.nimblebuilder.com/wp-json/nimble/v2/cravan' )
10358
- .done( function( resp ) {
10359
- if ( !_.isObject( resp ) || !resp.lib || !resp.lib.templates ) {
10360
- api.errare( '::import_nimble_template success but invalid response => ', resp );
10361
- _dfd_.resolve({success:false});
10362
- }
10363
- var _json_data = resp.lib.templates[template_name];
10364
- if ( !_json_data ) {
10365
- api.errare( '::import_nimble_template => the requested template is not available', resp.lib.templates );
10366
- api.previewer.trigger('sek-notify', {
10367
- notif_id : 'missing-tmpl',
10368
- type : 'info',
10369
- duration : 10000,
10370
- message : [
10371
- '<span style="color:#0075a2">',
10372
- '<strong>',
10373
- '@missi18n the requested template is not available',
10374
- '</strong>',
10375
- '</span>'
10376
- ].join('')
10377
- });
10378
- _dfd_.resolve({success:false});
10379
- }
10380
- _dfd_.resolve( {success:true, tmpl_json:_json_data } );
10381
-
10382
- })
10383
- .fail(function( er ) {
10384
- api.errare( '::import_nimble_template failed => ', er );
10385
- _dfd_.resolve({success:false});
10386
- });
10387
-
10388
- return _dfd_.promise();
10389
- },
10390
-
10391
  // @params
10392
  // {
10393
  // is_file_import : true,
@@ -10396,192 +11408,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
10396
  // input : <= input instance when import is manual
10397
  // file_input : $file_input
10398
  // }
10399
- // April 2020 : added for https://github.com/presscustomizr/nimble-builder/issues/651
10400
- // @param params {
10401
- // template_name : string,
10402
- // from : nimble_api or user
10403
- // }
10404
- import_nimble_template : function( params ) {
10405
- var self = this;
10406
- params = $.extend( {
10407
- template_name : '',
10408
- from : 'user'
10409
- }, params || {});
10410
- var tmpl_name = params.template_name;
10411
- if ( _.isEmpty( tmpl_name ) || ! _.isString( tmpl_name ) ) {
10412
- api.errare('::import => error => invalid template name');
10413
- }
10414
- console.log('import_nimble_template params ?', params );
10415
- var _promise;
10416
- if ( 'nimble_api' === params.from ) {
10417
- // doc : https://api.jquery.com/jQuery.getJSON/
10418
- _promise = self.getTmplJsonFromApi(tmpl_name);
10419
- } else {
10420
- _promise = self.getTmplJsonFromUserTmpl(tmpl_name);
10421
- }
10422
-
10423
- // response object structure :
10424
- // {
10425
- // data : { nimble content },
10426
- // metas : {
10427
- // skope_id :
10428
- // version :
10429
- // active_location :
10430
- // date :
10431
- // theme :
10432
- // }
10433
- // }
10434
- _promise.done( function( response ) {
10435
- console.log('SO IMPORT ??', response );
10436
- if ( response.success ) {
10437
- //console.log('IMPORT NIMBLE TEMPLATE', response.lib.templates[template_name] );
10438
- self.import_template_from_user_collection_or_remote_api({
10439
- pre_import_check : false,
10440
- template_name : tmpl_name,
10441
- template_data : response.tmpl_json
10442
- });
10443
- }
10444
- });
10445
- },
10446
-
10447
- // @param params
10448
- // {
10449
- // pre_import_check : false,
10450
- // template_name : tmpl_name,
10451
- // template_data : response.tmpl_json
10452
- // }
10453
- import_template_from_user_collection_or_remote_api : function( params ) {
10454
- console.log('import_template_from_user_collection_or_remote_api', params );
10455
- var self = this;
10456
- params = params || {};
10457
- // normalize params
10458
- params = $.extend({
10459
- is_file_import : false,
10460
- pre_import_check : false,
10461
- assign_missing_locations : false,
10462
- }, params );
10463
-
10464
- // SETUP FOR MANUAL INPUT
10465
- var __request__,
10466
- _scope = 'local';//<= when importing a template not manually, scope is always local
10467
-
10468
-
10469
- // remote template import case
10470
- if ( !params.template_data ) {
10471
- throw new Error( '::import_template => missing remote template data' );
10472
- }
10473
- __request__ = wp.ajax.post( 'sek_process_template_json', {
10474
- nonce: api.settings.nonce.save,
10475
- template_data : JSON.stringify( params.template_data ),
10476
- pre_import_check : false//<= might be used in the future do stuffs. For example when importing manually, this property is used to skip the img sniffing on the first pass.
10477
- //sek_export_nonce : api.settings.nonce.save,
10478
- //skope_id : 'local' === params.scope ? api.czr_skopeBase.getSkopeProperty( 'skope_id' ) : sektionsLocalizedData.globalSkopeId,
10479
- //active_locations : api.czr_sektions.activeLocations()
10480
- }).done( function( server_resp ) {
10481
- api.infoLog('TEMPLATE PRE PROCESS DONE', server_resp );
10482
- }).fail( function( error_resp ) {
10483
- api.previewer.trigger('sek-notify', {
10484
- notif_id : 'import-failed',
10485
- type : 'error',
10486
- duration : 30000,
10487
- message : [
10488
- '<span>',
10489
- '<strong>',
10490
- [ sektionsLocalizedData.i18n['Export failed'], encodeURIComponent( error_resp ) ].join(' '),
10491
- '</strong>',
10492
- '</span>'
10493
- ].join('')
10494
- });
10495
- });
10496
-
10497
-
10498
-
10499
- /////////////////////////////////////////////
10500
- /// NOW THAT WE HAVE OUR PROMISE
10501
- /// 1) CHECK IF CONTENT IS WELL FORMED AND ELIGIBLE FOR API
10502
- /// 2) LET'S PROCESS THE SETTING ID'S
10503
- /// 3) ATTEMPT TO UPDATE THE SETTING API, LOCAL OR GLOBAL. ( always local for template import )
10504
-
10505
- // fire a previewer loader removed on .always()
10506
- api.previewer.send( 'sek-maybe-print-loader', { fullPageLoader : true, duration : 30000 });
10507
-
10508
- // After 30 s display a failure notification
10509
- // april 2020 : introduced for https://github.com/presscustomizr/nimble-builder/issues/663
10510
- _.delay( function() {
10511
- if ( 'pending' !== __request__.state() )
10512
- return;
10513
- api.previewer.trigger('sek-notify', {
10514
- notif_id : 'import-too-long',
10515
- type : 'error',
10516
- duration : 20000,
10517
- message : [
10518
- '<span>',
10519
- '<strong>',
10520
- sektionsLocalizedData.i18n['Import exceeds server response time, try to uncheck "import images" option.'],
10521
- '</strong>',
10522
- '</span>'
10523
- ].join('')
10524
- });
10525
- }, 30000 );
10526
-
10527
-
10528
- // At this stage, we are not in a pre-check case
10529
- // the ajax request is processed and will upload images if needed
10530
- __request__
10531
- .done( function( server_resp ) {
10532
-
10533
- // When manually importing a file, the server adds a "success" property
10534
- // When loading a template this property is not sent. Let's normalize.
10535
- if ( _.isObject(server_resp) ) {
10536
- server_resp = {success:true, data:server_resp};
10537
- }
10538
- //console.log('SERVER RESP 2 ?', server_resp );
10539
- if ( !api.czr_sektions.isImportedContentEligibleForAPI( server_resp, params ) ) {
10540
- api.infoLog('::import_template problem => !api.czr_sektions.isImportedContentEligibleForAPI', server_resp, params );
10541
- return;
10542
- }
10543
-
10544
- //console.log('MANUAL IMPORT DATA', server_resp );
10545
- server_resp.data.data.collection = self.setIdsForImportedTmpl( server_resp.data.data.collection );
10546
- // and try to update the api setting
10547
- api.czr_sektions.doUpdateApiSettingAfterTmplImport( server_resp, params );
10548
- })
10549
- .fail( function( response ) {
10550
- api.errare( '::import_template => ajax error', response );
10551
- api.previewer.trigger('sek-notify', {
10552
- notif_id : 'import-failed',
10553
- type : 'error',
10554
- duration : 30000,
10555
- message : [
10556
- '<span>',
10557
- '<strong>',
10558
- sektionsLocalizedData.i18n['Import failed, file problem'],
10559
- '</strong>',
10560
- '</span>'
10561
- ].join('')
10562
- });
10563
- });
10564
- },//import_template_from_user_collection_or_remote_api
10565
-
10566
-
10567
-
10568
-
10569
-
10570
-
10571
-
10572
-
10573
-
10574
-
10575
-
10576
-
10577
-
10578
-
10579
-
10580
- ////////////////////////////////////////////////////////
10581
- // IMPORT FROM FILE
10582
- ////////////////////////////////////////////////////////
10583
  import_template_from_file : function( params ) {
10584
- console.log('import_template_from_file', params );
10585
 
10586
  params = params || {};
10587
  // normalize params
@@ -10743,7 +11571,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
10743
  //console.log('MANUAL IMPORT DATA', server_resp );
10744
  server_resp.data.data.collection = api.czr_sektions.setIdsForImportedTmpl( server_resp.data.data.collection );
10745
  // and try to update the api setting
10746
- api.czr_sektions.doUpdateApiSettingAfterTmplImport( server_resp, params );
10747
  })
10748
  .fail( function( response ) {
10749
  api.errare( '::import_template => ajax error', response );
@@ -10761,7 +11589,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
10761
  });
10762
  })
10763
  .always( function() {
10764
- api.czr_sektions.doAlwaysAfterManualImportAndApiSettingUpdate( params );
10765
  });
10766
  },//import_template_from_file
10767
 
@@ -10836,7 +11664,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
10836
  ].join('')
10837
  });
10838
  if ( params.is_file_import ) {
10839
- api.czr_sektions.doAlwaysAfterManualImportAndApiSettingUpdate( params );
10840
  }
10841
  }
10842
  },//pre_checks_from_file_import
@@ -10987,10 +11815,11 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
10987
  // fired on ajaxrequest done
10988
  // At this stage, the server_resp data structure has been validated.
10989
  // We can try to the update the api setting
10990
- doUpdateApiSettingAfterTmplImport : function( server_resp, params ){
 
10991
  params = params || {};
10992
  if ( !api.czr_sektions.isImportedContentEligibleForAPI( server_resp, params ) && params.is_file_import ) {
10993
- api.czr_sektions.doAlwaysAfterManualImportAndApiSettingUpdate( params );
10994
  return;
10995
  }
10996
 
@@ -11048,7 +11877,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
11048
  ].join('')
11049
  });
11050
  }).fail( function( response ) {
11051
- api.errare( '::doUpdateApiSettingAfterTmplImport => error when firing ::updateAPISetting', response );
11052
  api.previewer.trigger('sek-notify', {
11053
  notif_id : 'import-failed',
11054
  type : 'error',
@@ -11065,7 +11894,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
11065
 
11066
  // Refresh the preview, so the markup is refreshed and the css stylesheet are generated
11067
  api.previewer.refresh();
11068
- },//doUpdateApiSettingAfterTmplImport()
11069
 
11070
 
11071
 
@@ -11077,7 +11906,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
11077
 
11078
 
11079
  // Fired when params.is_file_import only
11080
- doAlwaysAfterManualImportAndApiSettingUpdate : function( params ) {
11081
  api.previewer.send( 'sek-clean-loader', { cleanFullPageLoader : true });
11082
 
11083
  params = params || {};
@@ -11113,22 +11942,20 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
11113
  ////////////////////////////////////////////////////////
11114
  // APRIL 2020 : for https://github.com/presscustomizr/nimble-builder/issues/651
11115
  setupTemplateGallery : function() {
11116
-
11117
-
11118
  var self = this;
11119
  self.templateGalleryExpanded = new api.Value(false);
 
11120
  if ( !sektionsLocalizedData.isTemplateGalleryEnabled )
11121
  return;
11122
 
11123
  self.templateGalleryExpanded.bind( function( expanded ) {
11124
-
11125
-
11126
  self.cachedElements.$body.toggleClass( 'sek-template-gallery-expanded', expanded );
11127
  if ( expanded ) {
11128
  // close template saver
11129
  // close level tree
11130
  self.tmplDialogVisible(false);
11131
  self.levelTreeExpanded(false);
 
11132
  $('#customize-preview iframe').css('z-index', 1);
11133
  self.renderOrRefreshTempGallery();
11134
  } else {
@@ -11136,6 +11963,17 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
11136
  }
11137
  });
11138
 
 
 
 
 
 
 
 
 
 
 
 
11139
  // API READY
11140
  api.previewer.bind('ready', function() {
11141
  self.templateGalleryExpanded( false );
@@ -11177,29 +12015,61 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
11177
  });
11178
  },
11179
 
 
11180
  // @return void()
11181
  setupTmplGalleryDOMEvents : function() {
11182
  var $galWrapper = $('#nimble-tmpl-gallery');
11183
  var self = this;
11184
  $galWrapper
11185
  // Schedule click event with delegation
 
11186
  .on('click', '.sek-tmpl-item .use-tmpl', function( evt ) {
11187
  evt.preventDefault();
11188
  evt.stopPropagation();
11189
  var tmpl_id = $(this).closest('.sek-tmpl-item').data('sek-tmpl-item-id');
11190
  if ( _.isEmpty(tmpl_id) ) {
11191
  api.errare('::setupTmplGalleryDOMEvents => error => invalid template id');
 
11192
  }
11193
- //api.czr_sektions.import_nimble_template( $(this).data('sek-tmpl-item-id') );
11194
- //api.czr_sektions.import_nimble_template( {template_name : 'test_one', from: 'nimble_api'});// FOR TEST PURPOSES UNTIL THE COLLECTION IS SETUP
11195
- api.czr_sektions.import_nimble_template( {template_name : tmpl_id, from: 'user'});
11196
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11197
  self.templateGalleryExpanded(false);
11198
  })
 
11199
  .on('propertychange change click keyup input paste', '.sek-filter-tmpl', _.debounce( function(evt) {
11200
  evt.preventDefault();
11201
  var _s = $(this).val();
11202
- console.log('searched string ??', _s );
11203
  var _reset = function() {
11204
  $galWrapper.removeClass('search-active');
11205
  $galWrapper.find('.sek-tmpl-item').each( function() {
@@ -11228,6 +12098,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
11228
  }
11229
 
11230
  }, 100 ) )
 
11231
  .on( 'click', '.sek-tmpl-info .remove-tmpl', function(evt) {
11232
  evt.preventDefault();
11233
  var _focusOnRemoveCandidate = function( mode ) {
@@ -14089,6 +14960,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
14089
  };
14090
 
14091
  init_settings.wpautop = isAutoPEnabled();
 
14092
  // forced_root_block is added to remove <p> tags automatically added
14093
  // @see https://stackoverflow.com/questions/20464028/how-to-remove-unwanted-p-tags-from-wordpress-editor-using-tinymce
14094
  if ( !isAutoPEnabled() ) {
@@ -14099,6 +14971,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
14099
  init_settings.toolbar1 = sektionsLocalizedData.defaultToolbarBtns;
14100
  init_settings.toolbar2 = "";
14101
 
 
14102
  window.tinymce.init( init_settings );
14103
  window.QTags.getInstance( _id );
14104
  // wp.editor.initialize( _id, {
@@ -14119,7 +14992,11 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
14119
  // To ensure retro-compat with content created prior to Nimble v1.5.2, in which the editor has been updated
14120
  // @see https://github.com/presscustomizr/nimble-builder/issues/404
14121
  // we add the <p> tag on init, if autop option is checked
14122
- var initial_content = ( !isAutoPEnabled() || ! _.isFunction( wp.editor.autop ) ) ? input() : wp.editor.autop( input() );
 
 
 
 
14123
  _editor.setContent( initial_content );
14124
  api.sekEditorExpanded( true );
14125
  // trigger a resize to adjust height on init https://github.com/presscustomizr/nimble-builder/issues/409
@@ -14250,7 +15127,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
14250
  })
14251
  .fail( function( error_resp ) {
14252
  api.errare( 'import_export_ input => pre_checks_from_file_import failed', error_resp );
14253
- api.czr_sektions.doAlwaysAfterManualImportAndApiSettingUpdate({
14254
  input : input,
14255
  file_input : $file_input
14256
  });
@@ -14275,7 +15152,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
14275
  });
14276
  break;
14277
  case 'sek-cancel-import' :
14278
- api.czr_sektions.doAlwaysAfterManualImportAndApiSettingUpdate({
14279
  input : input,
14280
  file_input : $file_input
14281
  });
551
  api.previewer.bind('sek-active-locations-in-preview', function( activelocs ){
552
  self.activeLocations( ( _.isObject(activelocs) && _.isArray( activelocs.active_locations ) ) ? activelocs.active_locations : [] );
553
  self.activeLocationsInfo( ( _.isObject(activelocs) && _.isArray( activelocs.active_locs_info ) ) ? activelocs.active_locs_info : [] );
554
+ // December 2020 => refresh local setting when an active location is available locally but not present in the local setting
555
+ // Fixes the problem of importing template from the gallery, with locations different than the current local page
556
+ if ( !_.isEmpty( api.dirtyValues() ) ) {
557
+ try{ self.updateAPISetting({ action : 'sek-maybe-add-missing-locations'}); } catch(er) {
558
+ api.errare( '::initialize => error with sek-maybe-add-missing-locations', er );
559
+ }
560
+ }
561
  });
562
 
563
 
2120
  },//saveOrUpdateSavedSection
2121
 
2122
 
2123
+ // @return a section model
2124
+ // Note : ids are reset server side
2125
+ // Example of section model before preprocessing
2126
+ // {
2127
+ // collection: [{…}]
2128
+ // id: "" //<= reset server side
2129
+ // level: "section"
2130
+ // is_nested : false
2131
+ // options: {bg: {…}}
2132
+ // ver_ini: "1.1.8"
2133
+ // }
2134
+ preProcessSection : function( sectionModel ) {
2135
+ if ( !_.isObject( sectionModel ) ) {
2136
+ return null;
2137
+ }
2138
+ var preprocessedModel = $.extend( {}, true, sectionModel );
2139
+ // Make sure a nested section is saved as normal
2140
+ if ( _.has( preprocessedModel, 'is_nested') ) {
2141
+ preprocessedModel = _.omit( preprocessedModel, 'is_nested' );
2142
+ }
2143
+ return preprocessedModel;
2144
+ },
2145
+
2146
 
2147
  // Fired on 'click on .sek-do-remove-section btn
2148
  removeSavedSection : function(evt, sectionPostNameCandidateForRemoval ) {
2328
  });
2329
 
2330
  return self.sectionCollectionPromise;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2331
  }
2332
  });//$.extend()
2333
  })( wp.customize, jQuery );
2622
  tmpl_title = $_title.val(),
2623
  tmpl_description = $('#sek-saved-tmpl-description').val(),
2624
  collectionSettingId = self.localSectionsSettingId(),
2625
+ currentLocalSettingValue;
2626
+
2627
+ // Dec 2020 : remove locations not active on the page or empty before saving the tmpl
2628
+ try { currentLocalSettingValue = self.preProcessTmpl( api( collectionSettingId )() ); } catch( er ) {
2629
+ api.errorLog( 'error in ::saveOrUpdateTemplate', er );
2630
+ _dfd_.resolve( {success:false});
2631
+ }
2632
 
2633
  if ( _.isEmpty( tmpl_title ) ) {
2634
  $_title.addClass('error');
2655
  tmpl_description: tmpl_description,
2656
  tmpl_post_name: tmplPostNameCandidateForUpdate || '',// <= provided when updating a template
2657
  skope_id: api.czr_skopeBase.getSkopeProperty( 'skope_id' ),
2658
+ tmpl_locations : self.getActiveLocationsForTmpl( currentLocalSettingValue ),
2659
+ tmpl_header_location : self.getHeaderOrFooterLocationIdForTmpl( 'header', currentLocalSettingValue ),
2660
+ tmpl_footer_location : self.getHeaderOrFooterLocationIdForTmpl( 'footer', currentLocalSettingValue )
2661
  })
2662
  .done( function( response ) {
2663
  //console.log('SAVED POST ID', response );
2689
  return _dfd_;
2690
  },//saveOrUpdateTemplate
2691
 
2692
+ // return an array of the location used for the template, to be used as template meta for a future injection
2693
+ // we don't need to list all inactive locations of the current page in the template meta
2694
+ getActiveLocationsForTmpl : function( tmpl_data ) {
2695
+ if ( !_.isObject( tmpl_data ) ) {
2696
+ throw new Error('preProcess Tmpl => error : tmpl_data must be an object');
2697
+ }
2698
+ var _tmpl_locations = [];
2699
+ _.each( tmpl_data.collection, function( _loc_params ) {
2700
+ if ( !_.isObject( _loc_params ) || !_loc_params.id || !_loc_params.level )
2701
+ return;
2702
+
2703
+ if ( 'location' === _loc_params.level ) {
2704
+ _tmpl_locations.push( _loc_params.id );
2705
+ }
2706
+ });
2707
+ return _tmpl_locations;
2708
+ },
2709
+
2710
+ getHeaderOrFooterLocationIdForTmpl : function( headerOrFooter, tmpl_data) {
2711
+ var self = this;
2712
+ if ( !_.isObject( tmpl_data ) ) {
2713
+ throw new Error('preProcess Tmpl => error : tmpl_data must be an object');
2714
+ }
2715
+ var _loc = '';
2716
+ _.each( tmpl_data.collection, function( _loc_params ) {
2717
+ if ( !_.isObject( _loc_params ) || !_loc_params.id || !_loc_params.level )
2718
+ return;
2719
+ if ( ( 'header' === headerOrFooter && self.isHeaderLocation( _loc_params.id ) ) || ( 'footer' === headerOrFooter && self.isFooterLocation( _loc_params.id ) ) ) {
2720
+ _loc = _loc_params.id;
2721
+ }
2722
+ });
2723
+ return _loc;
2724
+ },
2725
+
2726
+ // @return a tmpl model
2727
+ // Note : ids are reset server side
2728
+ // Example of tmpl model before preprocessing
2729
+ // {
2730
+ // collection: [{…}]
2731
+ // id: "" //<= to remove
2732
+ // level: "tmpl" // <= to remove
2733
+ // options: {bg: {…}}
2734
+ // ver_ini: "1.1.8"
2735
+ // }
2736
+ // Dec 2020 : remove locations not active on the page or empty before saving the tmpl
2737
+ preProcessTmpl : function( tmpl_data ) {
2738
+ var self = this, tmpl_processed, activeLocations;
2739
+ if ( !_.isObject( tmpl_data ) ) {
2740
+ throw new Error('preProcess Tmpl => error : tmpl_data must be an object');
2741
+ }
2742
+ tmpl_processed = $.extend( true, {}, tmpl_data );
2743
+ tmpl_processed.collection = [];
2744
+ activeLocations = self.activeLocations();
2745
+
2746
+ //console.log('TO DO => make sure template is ok to be saved', tmpl_data, self.activeLocations() );
2747
+ _.each( tmpl_data.collection, function( _loc_params ) {
2748
+ if ( !_.isObject( _loc_params ) || !_loc_params.id || !_loc_params.collection )
2749
+ return;
2750
 
2751
+ if ( _.contains( activeLocations, _loc_params.id ) && !_.isEmpty(_loc_params.collection) ) {
2752
+ tmpl_processed.collection.push( _loc_params );
2753
+ }
2754
+ });
2755
+ return tmpl_processed;
2756
+ },
2757
 
2758
  // Fired on 'click on .sek-do-remove-tmpl btn
2759
  removeTemplate : function(evt, tmplPostNameCandidateForRemoval ) {
2892
  .done( function( tmpl_collection ) {
2893
  if ( _.isObject(tmpl_collection) && !_.isArray( tmpl_collection ) ) {
2894
  self.templateCollectionPromise.resolve( tmpl_collection );
2895
+ console.log('GET SAVED TMPL COLLECTION', tmpl_collection );
2896
  } else {
2897
  self.templateCollectionPromise.resolve( {} );
2898
+ api.errare('control::getSavedTmplCollection => error => tmpl collection is invalid', tmpl_collection);
2899
  }
2900
 
2901
  // response is {tmpl_post_id: 436}
2925
  });
2926
 
2927
  return self.templateCollectionPromise;
2928
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2929
  });//$.extend()
2930
  })( wp.customize, jQuery );
2931
  //global sektionsLocalizedData
2932
+ // introduced in december 2020 for https://github.com/presscustomizr/nimble-builder/issues/655
2933
  var CZRSeksPrototype = CZRSeksPrototype || {};
2934
  (function ( api, $ ) {
2935
  $.extend( CZRSeksPrototype, {
2936
+ ////////////////////////////////////////////////////////
2937
+ // IMPORT TEMPLATE FROM GALLERY => FROM USER SAVED COLLECTION OR REMOTE API
2938
+ ////////////////////////////////////////////////////////
2939
+ // @return promise
2940
+ getTmplJsonFromUserTmpl : function( template_name ) {
2941
+ var self = this, _dfd_ = $.Deferred();
2942
+ wp.ajax.post( 'sek_get_user_tmpl_json', {
2943
  nonce: api.settings.nonce.save,
2944
+ tmpl_post_name: template_name
2945
+ //skope_id: api.czr_skopeBase.getSkopeProperty( 'skope_id' )
2946
+ })
2947
+ .done( function( response ) {
2948
+ _dfd_.resolve( {success:true, tmpl_json:response });
2949
+ })
2950
+ .fail( function( er ) {
2951
+ _dfd_.resolve( {success:false});
2952
+ api.errorLog( 'ajax getTmplJsonFromUserTmpl => error', er );
2953
+ api.previewer.trigger('sek-notify', {
2954
+ type : 'error',
2955
+ duration : 10000,
2956
+ message : [
2957
+ '<span style="font-size:0.95em">',
2958
+ '<strong>@missi18n error when fetching the template</strong>',
2959
+ '</span>'
2960
+ ].join('')
2961
+ });
2962
  });
2963
+
2964
+ return _dfd_;
2965
  },
2966
 
2967
+ // @return promise
2968
+ getTmplJsonFromApi : function( template_name ) {
2969
+ var self, _dfd_ = $.Deferred();
2970
+ if ( self.apiTmplGalleryJson ) {
2971
+ api.infoLog( 'cached api tmpl gallery json', self.apiTmplGalleryJson );
2972
+ _dfd_.resolve( {success : true, tmpl_json : self.apiTmplGalleryJson } );
2973
+ } else {
2974
+ $.getJSON( sektionsLocalizedData.templateAPIUrl )
2975
+ .done( function( resp ) {
2976
+ if ( !_.isObject( resp ) || !resp.lib || !resp.lib.templates ) {
2977
+ api.errare( '::get_gallery_tmpl_json_and_import success but invalid response => ', resp );
2978
+ _dfd_.resolve({success:false});
2979
+ return;
2980
+ }
2981
+ var _json_data = resp.lib.templates[template_name];
2982
+ if ( !_json_data ) {
2983
+ api.errare( '::get_gallery_tmpl_json_and_import => the requested template is not available', resp.lib.templates );
2984
+ api.previewer.trigger('sek-notify', {
2985
+ notif_id : 'missing-tmpl',
2986
+ type : 'info',
2987
+ duration : 10000,
2988
+ message : [
2989
+ '<span style="color:#0075a2">',
2990
+ '<strong>',
2991
+ '@missi18n the requested template is not available',
2992
+ '</strong>',
2993
+ '</span>'
2994
+ ].join('')
2995
+ });
2996
+ _dfd_.resolve({success:false});
2997
+ return;
2998
+ }
2999
+ self.apiTmplGalleryJson = _json_data;
3000
+ _dfd_.resolve( {success:true, tmpl_json:self.apiTmplGalleryJson } );
3001
+
3002
+ })
3003
+ .fail(function( er ) {
3004
+ api.errare( '::get_gallery_tmpl_json_and_import failed => ', er );
3005
+ _dfd_.resolve({success:false});
3006
+ });
3007
+ }
3008
+
3009
+ return _dfd_.promise();
3010
+ },
3011
+
3012
+
3013
+ // April 2020 : added for https://github.com/presscustomizr/nimble-builder/issues/651
3014
+ // @param params {
3015
+ // template_name : string,
3016
+ // from : nimble_api or user,
3017
+ // tmpl_import_mode : 3 possible import modes : replace, before, after
3018
  // }
3019
+ get_gallery_tmpl_json_and_import : function( params ) {
3020
  var self = this;
3021
+ params = $.extend( {
3022
+ template_name : '',
3023
+ from : 'user',
3024
+ tmpl_import_mode : 'replace'
3025
+ }, params || {});
3026
+ var tmpl_name = params.template_name;
3027
+ if ( _.isEmpty( tmpl_name ) || ! _.isString( tmpl_name ) ) {
3028
+ api.errare('::import => error => invalid template name');
3029
+ }
3030
+ //console.log('get_gallery_tmpl_json_and_import params ?', params );
3031
+ var _promise;
3032
+ if ( 'nimble_api' === params.from ) {
3033
+ // doc : https://api.jquery.com/jQuery.getJSON/
3034
+ _promise = self.getTmplJsonFromApi(tmpl_name);
3035
+ } else {
3036
+ _promise = self.getTmplJsonFromUserTmpl(tmpl_name);
3037
+ }
3038
+
3039
+ // response object structure :
3040
+ // {
3041
+ // data : { nimble content },
3042
+ // metas : {
3043
+ // skope_id :
3044
+ // version :
3045
+ // tmpl_locations :
3046
+ // date :
3047
+ // theme :
3048
+ // }
3049
+ // }
3050
+ _promise.done( function( response ) {
3051
+ //console.log('get_gallery_tmpl_json_and_import', params, response );
3052
+ if ( response.success ) {
3053
+ //console.log('IMPORT NIMBLE TEMPLATE', response.lib.templates[template_name] );
3054
+ self.import_tmpl_from_gallery({
3055
+ pre_import_check : false,
3056
+ template_name : tmpl_name,
3057
+ template_data : response.tmpl_json,
3058
+ tmpl_import_mode : params.tmpl_import_mode
3059
+ });
3060
+ }
3061
+ });
3062
+ },
3063
+
3064
+ // IMPORT TEMPLATE FROM GALLERY
3065
+ // => REMOTE API COLLECTION + USER COLLECTION
3066
+ // @param params
3067
+ // {
3068
+ // pre_import_check : false,
3069
+ // template_name : tmpl_name,
3070
+ // template_data : response.tmpl_json,
3071
+ // tmpl_import_mode : 3 possible import modes : replace, before, after
3072
+ // }
3073
+ import_tmpl_from_gallery : function( params ) {
3074
+ //console.log('import_tmpl_from_gallery', params );
3075
+ var self = this;
3076
+ params = params || {};
3077
+ // normalize params
3078
+ params = $.extend({
3079
+ is_file_import : false,
3080
+ pre_import_check : false,
3081
+ tmpl_import_mode : 'replace'
3082
+ }, params );
3083
+
3084
+ // SETUP FOR MANUAL INPUT
3085
+ var __request__,
3086
+ _scope = 'local';//<= when importing a template not manually, scope is always local
3087
+
3088
+
3089
+ // remote template import case
3090
+ if ( !params.template_data ) {
3091
+ throw new Error( '::import_template => missing remote template data' );
3092
+ }
3093
+ __request__ = wp.ajax.post( 'sek_process_template_json', {
3094
+ nonce: api.settings.nonce.save,
3095
+ template_data : JSON.stringify( params.template_data ),
3096
+ pre_import_check : false//<= might be used in the future do stuffs. For example when importing manually, this property is used to skip the img sniffing on the first pass.
3097
+ //sek_export_nonce : api.settings.nonce.save,
3098
+ //skope_id : 'local' === params.scope ? api.czr_skopeBase.getSkopeProperty( 'skope_id' ) : sektionsLocalizedData.globalSkopeId,
3099
+ //active_locations : api.czr_sektions.activeLocations()
3100
+ }).done( function( server_resp ) {
3101
+ //api.infoLog('TEMPLATE PRE PROCESS DONE', server_resp );
3102
+ }).fail( function( error_resp ) {
3103
  api.previewer.trigger('sek-notify', {
3104
+ notif_id : 'import-failed',
3105
+ type : 'error',
3106
+ duration : 30000,
3107
  message : [
3108
+ '<span>',
3109
  '<strong>',
3110
+ [ sektionsLocalizedData.i18n['Export failed'], encodeURIComponent( error_resp ) ].join(' '),
3111
  '</strong>',
3112
  '</span>'
3113
  ].join('')
3114
  });
3115
+ });
3116
+
3117
+
3118
+
3119
+ /////////////////////////////////////////////
3120
+ /// NOW THAT WE HAVE OUR PROMISE
3121
+ /// 1) CHECK IF CONTENT IS WELL FORMED AND ELIGIBLE FOR API
3122
+ /// 2) LET'S PROCESS THE SETTING ID'S
3123
+ /// 3) ATTEMPT TO UPDATE THE SETTING API, LOCAL OR GLOBAL. ( always local for template import )
3124
+
3125
+ // fire a previewer loader removed on .always()
3126
+ api.previewer.send( 'sek-maybe-print-loader', { fullPageLoader : true, duration : 30000 });
3127
+
3128
+ // After 30 s display a failure notification
3129
+ // april 2020 : introduced for https://github.com/presscustomizr/nimble-builder/issues/663
3130
+ _.delay( function() {
3131
+ if ( 'pending' !== __request__.state() )
3132
+ return;
3133
+ api.previewer.trigger('sek-notify', {
3134
+ notif_id : 'import-too-long',
3135
+ type : 'error',
3136
+ duration : 20000,
3137
+ message : [
3138
+ '<span>',
3139
+ '<strong>',
3140
+ sektionsLocalizedData.i18n['Import exceeds server response time, try to uncheck "import images" option.'],
3141
+ '</strong>',
3142
+ '</span>'
3143
+ ].join('')
3144
+ });
3145
+ }, 30000 );
3146
+
3147
+
3148
+ // At this stage, we are not in a pre-check case
3149
+ // the ajax request is processed and will upload images if needed
3150
+ __request__
3151
+ .done( function( server_resp ) {
3152
+ // When manually importing a file, the server adds a "success" property
3153
+ // When loading a template this property is not sent. Let's normalize.
3154
+ if ( _.isObject(server_resp) ) {
3155
+ server_resp = {success:true, data:server_resp};
3156
+ }
3157
+ //console.log('SERVER RESP 2 ?', server_resp );
3158
+ if ( !api.czr_sektions.isImportedContentEligibleForAPI( server_resp, params ) ) {
3159
+ api.infoLog('::import_template problem => !api.czr_sektions.isImportedContentEligibleForAPI', server_resp, params );
3160
+ return;
3161
+ }
3162
+
3163
+ //console.log('MANUAL IMPORT DATA', server_resp );
3164
+ server_resp.data.data.collection = self.setIdsForImportedTmpl( server_resp.data.data.collection );
3165
+ // and try to update the api setting
3166
+ api.czr_sektions.doUpdateApiSettingAfter_TmplGalleryImport( server_resp, params );
3167
+ })
3168
+ .fail( function( response ) {
3169
+ api.errare( '::import_template => ajax error', response );
3170
+ api.previewer.trigger('sek-notify', {
3171
+ notif_id : 'import-failed',
3172
+ type : 'error',
3173
+ duration : 30000,
3174
+ message : [
3175
+ '<span>',
3176
+ '<strong>',
3177
+ sektionsLocalizedData.i18n['Import failed, file problem'],
3178
+ '</strong>',
3179
+ '</span>'
3180
+ ].join('')
3181
+ });
3182
+ });
3183
+ },//import_tmpl_from_gallery
3184
+
3185
+
3186
+ // fired on ajaxrequest done
3187
+ // At this stage, the server_resp data structure has been validated.
3188
+ // We can try to the update the api setting
3189
+ // @param params
3190
+ // {
3191
+ // pre_import_check : false,
3192
+ // template_name : tmpl_name,
3193
+ // template_data : response.tmpl_json,
3194
+ // tmpl_import_mode : 3 possible import modes : replace, before, after,
3195
+ // is_file_import : false
3196
+ // }
3197
+ doUpdateApiSettingAfter_TmplGalleryImport : function( server_resp, params ){
3198
+ //console.log('doUpdateApiSettingAfter_TmplGalleryImport ???', params, server_resp );
3199
+ params = params || {};
3200
+ if ( !api.czr_sektions.isImportedContentEligibleForAPI( server_resp, params ) && params.is_file_import ) {
3201
+ api.previewer.send( 'sek-clean-loader', { cleanFullPageLoader : true });
3202
+ return;
3203
+ }
3204
+
3205
+ var _scope = 'local';// <= always local when template gallery import
3206
+
3207
+ //api.infoLog('TODO => verify metas => version, active locations, etc ... ');
3208
+
3209
+ // Update the setting api via the normalized method
3210
+ // the scope will determine the setting id, local or global
3211
+ api.czr_sektions.updateAPISetting({
3212
+ action : 'sek-import-tmpl-from-gallery',
3213
+ scope : _scope,//'global' or 'local'<= will determine which setting will be updated,
3214
+ // => self.getGlobalSectionsSettingId() or self.localSectionsSettingId()
3215
+ imported_content : server_resp.data,
3216
+ tmpl_import_mode : params.tmpl_import_mode
3217
+ }).done( function() {
3218
+ // Clean an regenerate the local option setting
3219
+ // Settings are normally registered once and never cleaned, unlike controls.
3220
+ // After the import, updating the setting value will refresh the sections
3221
+ // but the local options, persisted in separate settings, won't be updated if the settings are not cleaned
3222
+ if ( 'local' === _scope ) {
3223
+ api.czr_sektions.generateUI({
3224
+ action : 'sek-generate-local-skope-options-ui',
3225
+ clean_settings : true//<= see api.czr_sektions.generateUIforLocalSkopeOptions()
3226
+ });
3227
+ }
3228
+
3229
+ //_notify( sektionsLocalizedData.i18n['The revision has been successfully restored.'], 'success' );
3230
+ api.previewer.refresh();
3231
+ api.previewer.trigger('sek-notify', {
3232
+ notif_id : 'import-success',
3233
+ type : 'success',
3234
+ duration : 30000,
3235
+ message : [
3236
+ '<span>',
3237
+ '<strong>',
3238
+ sektionsLocalizedData.i18n['Template successfully imported'],
3239
+ '</strong>',
3240
+ '</span>'
3241
+ ].join('')
3242
+ });
3243
+ }).fail( function( response ) {
3244
+ api.errare( '::doUpdateApiSettingAfter_TmplGalleryImport => error when firing ::updateAPISetting', response );
3245
+ api.previewer.trigger('sek-notify', {
3246
+ notif_id : 'import-failed',
3247
+ type : 'error',
3248
+ duration : 30000,
3249
+ message : [
3250
+ '<span>',
3251
+ '<strong>',
3252
+ [ sektionsLocalizedData.i18n['Import failed'], response ].join(' : '),
3253
+ '</strong>',
3254
+ '</span>'
3255
+ ].join('')
3256
+ });
3257
+ });
3258
+
3259
+ // Refresh the preview, so the markup is refreshed and the css stylesheet are generated
3260
+ api.previewer.refresh();
3261
+ }//doUpdateApiSettingAfter_TmplGalleryImport()
3262
+
3263
+ });//$.extend()
3264
+ })( wp.customize, jQuery );
3265
+ //global sektionsLocalizedData
3266
+ var CZRSeksPrototype = CZRSeksPrototype || {};
3267
+ (function ( api, $ ) {
3268
+ $.extend( CZRSeksPrototype, {
3269
+ // the input id determine if we fetch the revision history of the local or global setting
3270
+ // @return a deferred promise
3271
+ // @params object : { is_local:bool} <= 'local_revisions' === input.id
3272
+ getRevisionHistory : function(params) {
3273
+ return wp.ajax.post( 'sek_get_revision_history', {
3274
+ nonce: api.settings.nonce.save,
3275
+ skope_id : params.is_local ? api.czr_skopeBase.getSkopeProperty( 'skope_id' ) : sektionsLocalizedData.globalSkopeId
3276
+ });
3277
+ },
3278
+
3279
+ // @return void()
3280
+ // Fetches the_content and try to set the setting value through normalized ::updateAPISetting method
3281
+ // @params {
3282
+ // is_local : bool//<= 'local_revisions' === input.id
3283
+ // revision_post_id : int
3284
+ // }
3285
+ setSingleRevision : function(params) {
3286
+ var self = this;
3287
+ var _notify = function( message, type ) {
3288
+ api.previewer.trigger('sek-notify', {
3289
+ notif_id : 'restore-revision-error',
3290
+ type : type || 'info',
3291
+ duration : 10000,
3292
+ message : [
3293
+ '<span style="">',
3294
+ '<strong>',
3295
+ message || '',
3296
+ '</strong>',
3297
+ '</span>'
3298
+ ].join('')
3299
+ });
3300
+ };
3301
+ wp.ajax.post( 'sek_get_single_revision', {
3302
+ nonce: api.settings.nonce.save,
3303
+ //skope_id : api.czr_skopeBase.getSkopeProperty( 'skope_id' ),
3304
+ revision_post_id : params.revision_post_id
3305
+ }).done( function( revision_value ){
3306
+ // If the setting value is unchanged, no need to go further
3307
+ // is_local is decided with the input id => @see revision_history input type.
3308
+ var setId = params.is_local ? self.localSectionsSettingId() : self.getGlobalSectionsSettingId();
3309
+ if ( _.isEqual( api( setId )(), revision_value ) ) {
3310
+ _notify( sektionsLocalizedData.i18n['This is the current version.'], 'info' );
3311
+ return;
3312
+ }
3313
+ // api.infoLog( 'getSingleRevision response', revision_value );
3314
+ // api.infoLog( 'Current val', api(self.localSectionsSettingId())() );
3315
+ self.updateAPISetting({
3316
+ action : 'sek-restore-revision',
3317
+ is_global_location : !params.is_local,//<= will determine which setting will be updated,
3318
+ // => self.getGlobalSectionsSettingId() or self.localSectionsSettingId()
3319
+ revision_value : revision_value
3320
+ }).done( function() {
3321
+ //_notify( sektionsLocalizedData.i18n['The revision has been successfully restored.'], 'success' );
3322
+ api.previewer.refresh();
3323
+ }).fail( function( response ) {
3324
+ api.errare( '::setSingleRevision error when firing ::updateAPISetting', response );
3325
+ _notify( sektionsLocalizedData.i18n['The revision could not be restored.'], 'error' );
3326
  });
3327
  //api.previewer.refresh();
3328
  }).fail( function( response ) {
3529
  } else {
3530
  // we have a level.
3531
  // - make sure we have at least the following properties : id, level
3532
+ // LEVEL should be an object
3533
+ if ( _.isUndefined( level ) || !_.isObject( level ) ) {
3534
+ _errorDetected_('validation error => a level is invalid' );
3535
+ return;
3536
+ }
3537
 
3538
  // ID
3539
  if ( _.isEmpty( level.id ) || ! _.isString( level.id )) {
6543
  // in_column
6544
  // }
6545
  updateAPISetting : function( params ) {
6546
+ var self = this;
 
6547
 
6548
  // Are we in global location ?
6549
  // Add the global information to the params
6552
  params.is_global_location = 'global' === params.scope || self.isGlobalLocation( params );
6553
 
6554
  var _collectionSettingId_ = params.is_global_location ? self.getGlobalSectionsSettingId() : self.localSectionsSettingId();
6555
+ var currentSetValue = api( _collectionSettingId_ )();
6556
+
6557
+ // The following property is populated on each api setting update
6558
+ // some properties are modified during the sub-callbacks of _updateSektionSettingInstanceWithAction
6559
+ self.updAPISetParams = {
6560
+ params : params,
6561
+ promise : $.Deferred(),
6562
+ newSetValue : _.isObject( currentSetValue ) ? $.extend( true, {}, currentSetValue ) : self.getDefaultSektionSettingValue( params.is_global_location ? 'global' : 'local' ),
6563
+ cloneId : '', // the cloneId is only needed in the duplication scenarii
6564
+ sectionInjectPromise : '_not_injection_scenario_'//this property is turned into a $.Deferred() object in a scenario of section injection
6565
+ };
6566
+
6567
+ // callback ran in api( _collectionSettingId_, function( sektionSetInstance ) {})
6568
+ var _updateSektionSettingInstanceWithAction = function() {
6569
  // api( _collectionSettingId_)() = {
6570
  // collection : [
6571
  // 'loop_start' : { level : location, collection : [ 'sek124' : { collection : [], level : section, options : {} }], options : {}},
6575
  // options : {}
6576
  //
6577
  // }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6578
 
6579
  // make sure we have a collection array to populate
6580
+ self.updAPISetParams.newSetValue.collection = _.isArray( self.updAPISetParams.newSetValue.collection ) ? self.updAPISetParams.newSetValue.collection : self.getDefaultSektionSettingValue( params.is_global_location ? 'global' : 'local' ).collection;
6581
 
6582
  switch( params.action ) {
6583
+ //-------------------------------------------------------------------------------------------------
6584
+ //-- LOCATION
6585
+ //-------------------------------------------------------------------------------------------------
6586
+ // December 2020 => this action is triggered in ::initialize self.activeLocations.bind()
6587
+ // when injecting template from the gallery it may happen that the collection of location in the local setting value is not synchronized anymore with the actual active locations on the page
6588
+ case 'sek-maybe-add-missing-locations' :
6589
+ var activeLocations = self.activeLocations(),
6590
+ settingLocations = [],
6591
+ locInSetting,
6592
+ missingLoc,
6593
+ newSettingCollection = [],
6594
+ currentSettingCollection = $.extend( true, [], self.updAPISetParams.newSetValue.collection );
6595
+
6596
+ //console.log('SOO current Setting Collection', currentSettingCollection, activeLocations );
6597
+
6598
+ _.each( self.activeLocations(), function( _loc_id ) {
6599
+ locInSetting = _.findWhere( self.updAPISetParams.newSetValue.collection, { id : _loc_id } );
6600
+ if ( _.isUndefined( locInSetting ) ) {
6601
+ missingLoc = $.extend( true, {}, sektionsLocalizedData.defaultLocationModel );
6602
+ missingLoc.id = _loc_id;
6603
+ api.infoLog('=> adding missing location to api setting value', missingLoc );
6604
+ self.updAPISetParams.newSetValue.collection.push(missingLoc);
6605
+ }
6606
+ });
6607
+ break;
6608
+
6609
  //-------------------------------------------------------------------------------------------------
6610
  //-- SEKTION
6611
  //-------------------------------------------------------------------------------------------------
6612
  case 'sek-add-section' :
6613
+ self._updAPISet_sek_add_sektion();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6614
  break;
 
 
6615
  case 'sek-duplicate-section' :
6616
+ self._updAPISet_sek_duplicate_sektion();
6617
+ break;
6618
+ case 'sek-remove-section' :
6619
+ self._updAPISet_sek_remove_sektion();
6620
+ break;
6621
+ case 'sek-move-section' :
6622
+ self._updAPISet_sek_move_sektion();
6623
+ break;
6624
+ // Fired on click on up / down arrows in the section ui menu
6625
+ // This handles the nested sections case
6626
+ case 'sek-move-section-up-down' :
6627
+ self._updAPISet_sek_move_sektion_up_down();
6628
+ break;
6629
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6630
 
6631
+ //-------------------------------------------------------------------------------------------------
6632
+ //-- COLUMN
6633
+ //-------------------------------------------------------------------------------------------------
6634
+ case 'sek-add-column' :
6635
+ self._updAPISet_sek_add_column();
6636
+ break;
6637
+ case 'sek-remove-column' :
6638
+ self._updAPISet_sek_remove_column();
6639
+ break;
6640
+ case 'sek-duplicate-column' :
6641
+ self._updAPISet_sek_duplicate_column();
6642
+ break;
6643
+ // Note : the css rules are generated in Sek_Dyn_CSS_Builder::sek_add_rules_for_column_width
6644
+ case 'sek-resize-columns' :
6645
+ self._updAPISet_sek_resize_column();
6646
+ break;
6647
+ case 'sek-move-column' :
6648
+ self._updAPISet_sek_move_column();
6649
+ break;
6650
 
 
 
 
 
 
 
 
 
 
 
6651
 
6652
+ //-------------------------------------------------------------------------------------------------
6653
+ //-- MODULE
6654
+ //-------------------------------------------------------------------------------------------------
6655
+ case 'sek-add-module' :
6656
+ self._updAPISet_sek_add_module();
6657
  break;
6658
+ case 'sek-duplicate-module' :
6659
+ self._updAPISet_sek_duplicate_module();
6660
+ break;
6661
+ case 'sek-remove-module' :
6662
+ self._updAPISet_sek_remove_module();
6663
+ break;
6664
+ case 'sek-move-module' :
6665
+ self._updAPISet_sek_move_module();
6666
+ break;
6667
+ case 'sek-set-module-value' :
6668
+ self._updAPISet_sek_set_module_value();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6669
  break;
6670
 
 
 
 
 
 
 
 
 
 
6671
 
6672
+ //-------------------------------------------------------------------------------------------------
6673
+ //-- CONTENT IN NEW SEKTION
6674
+ //-------------------------------------------------------------------------------------------------
6675
+ case 'sek-add-content-in-new-sektion' :
6676
+ self._updAPISet_sek_add_content_in_new_sektion();
6677
+ break;
6678
+ //-------------------------------------------------------------------------------------------------
6679
+ //-- CONTENT IN NEW NESTED SEKTION
6680
+ //-------------------------------------------------------------------------------------------------
6681
+ case 'sek-add-preset-section-in-new-nested-sektion' :
6682
+ self._updAPISet_sek_add_preset_sektion_in_new_nested_sektion();
6683
+ break;
6684
 
 
 
 
 
 
 
 
 
 
6685
 
6686
+ //-------------------------------------------------------------------------------------------------
6687
+ //-- FILE IMPORT
6688
+ //-------------------------------------------------------------------------------------------------
6689
+ case 'sek-import-from-file' :
6690
+ self._updAPISet_sek_import_from_file();
6691
+ break;
 
 
 
 
 
 
 
 
 
 
 
6692
 
6693
+ //-------------------------------------------------------------------------------------------------
6694
+ //-- INJECT TEMPLATE FROM GALLERY
6695
+ //-------------------------------------------------------------------------------------------------
6696
+ case 'sek-import-tmpl-from-gallery' :
6697
+ self._updAPISet_sek_import_tmpl_from_gallery();
6698
  break;
6699
 
6700
+ //-------------------------------------------------------------------------------------------------
6701
+ //-- LEVEL OPTIONS
6702
+ //-------------------------------------------------------------------------------------------------
6703
+ case 'sek-generate-level-options-ui' :
6704
+ var _candidate_ = self.getLevelModel( params.id, self.updAPISetParams.newSetValue.collection ),
6705
+ _valueCandidate = {};
6706
 
6707
+ if ( 'no_match'=== _candidate_ ) {
6708
+ api.errare( 'updateAPISetting => ' + params.action + ' => no parent sektion matched' );
6709
+ self.updAPISetParams.promise.reject( 'updateAPISetting => ' + params.action + ' => no parent sektion matched');
6710
+ break;
 
 
6711
  }
6712
+ // start from a deep cloned object
6713
+ // important => fixes https://github.com/presscustomizr/nimble-builder/issues/455
6714
+ var _new_options_values = $.extend( true, {}, _candidate_.options || {} );
6715
 
6716
+ // consider only the non empty settings for db
6717
+ // booleans should bypass this check
6718
+ _.each( params.value || {}, function( _val_, _key_ ) {
6719
+ // Note : _.isEmpty( 5 ) returns true when checking an integer,
6720
+ // that's why we need to cast the _val_ to a string when using _.isEmpty()
6721
+ if ( ! _.isBoolean( _val_ ) && _.isEmpty( _val_ + "" ) )
6722
+ return;
6723
+ _valueCandidate[ _key_ ] = _val_;
6724
  });
 
 
 
 
6725
 
6726
+ if ( _.isEmpty( params.options_type ) ) {
6727
+ api.errare( 'updateAPISetting => ' + params.action + ' => missing options_type');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6728
  }
6729
 
6730
+ _new_options_values[ params.options_type ] = _valueCandidate;
6731
+ _candidate_.options = _new_options_values;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6732
  break;
6733
 
6734
 
6735
 
6736
 
6737
 
 
 
 
6738
  //-------------------------------------------------------------------------------------------------
6739
+ //-- LOCAL SKOPE OPTIONS
6740
  //-------------------------------------------------------------------------------------------------
6741
+ // Note : this is saved in "local_options"
6742
+ case 'sek-generate-local-skope-options-ui' :
6743
+ _valueCandidate = {};
 
 
 
 
 
 
 
 
6744
 
6745
+ var _currentOptions = $.extend( true, {}, _.isObject( self.updAPISetParams.newSetValue.local_options ) ? self.updAPISetParams.newSetValue.local_options : {} );
6746
+ // consider only the non empty settings for db
6747
+ // booleans should bypass this check
6748
+ _.each( params.value || {}, function( _val_, _key_ ) {
6749
+ // Note : _.isEmpty( 5 ) returns true when checking an integer,
6750
+ // that's why we need to cast the _val_ to a string when using _.isEmpty()
6751
+ if ( ! _.isBoolean( _val_ ) && _.isEmpty( _val_ + "" ) )
6752
+ return;
6753
+ _valueCandidate[ _key_ ] = _val_;
6754
+ });
6755
+ if ( _.isEmpty( params.options_type ) || ! _.isString( params.options_type ) ) {
6756
+ api.errare( 'updateAPISetting => ' + params.action + ' => missing options_type');
6757
+ } else {
6758
+ var newOptionsValues = {};
6759
+ newOptionsValues[ params.options_type ] = _valueCandidate;
6760
+ self.updAPISetParams.newSetValue.local_options = $.extend( _currentOptions, newOptionsValues );
6761
  }
6762
+ break;
6763
 
 
 
 
 
 
6764
 
 
 
 
 
 
 
 
6765
 
6766
+ //-------------------------------------------------------------------------------------------------
6767
+ //-- POPULATE GOOGLE FONTS
6768
+ //-------------------------------------------------------------------------------------------------
6769
+ //@params {
6770
+ // action : 'sek-update-fonts',
6771
+ // font_family : newFontFamily,
6772
+ // }
6773
+ case 'sek-update-fonts' :
6774
+ // Get the gfonts from the level options and modules values
6775
+ var currentGfonts = self.sniffGFonts( { is_global_location : ( params && true === params.is_global_location ) } );
6776
 
6777
+ // add it only if gfont
6778
+ if ( ! _.isEmpty( params.font_family ) && _.isString( params.font_family ) ) {
6779
+ if ( params.font_family.indexOf('gfont') > -1 && ! _.contains( currentGfonts, params.font_family ) ) {
6780
+ currentGfonts.push( params.font_family );
 
 
 
6781
  }
 
 
 
 
 
 
 
 
 
 
 
6782
  }
6783
 
6784
+ // update the global gfonts collection
6785
+ // this is then used server side in Sek_Dyn_CSS_Handler::sek_get_gfont_print_candidates to build the Google Fonts request
6786
+ self.updAPISetParams.newSetValue.fonts = currentGfonts;
6787
  break;
6788
 
6789
+ //-------------------------------------------------------------------------------------------------
6790
+ //-- RESTORE A REVISION
6791
+ //-------------------------------------------------------------------------------------------------
6792
+ case 'sek-restore-revision' :
6793
+ //api.infoLog( 'sek-restore-revision', params );
6794
+ self.updAPISetParams.newSetValue = params.revision_value;
6795
+ break;
 
 
 
 
 
 
 
 
 
 
 
 
6796
 
6797
+ //-------------------------------------------------------------------------------------------------
6798
+ //-- RESET COLLECTION, LOCAL OR GLOBAL
6799
+ //-------------------------------------------------------------------------------------------------
6800
+ case 'sek-reset-collection' :
6801
+ //api.infoLog( 'sek-import-from-file', params );
6802
+ try { self.updAPISetParams.newSetValue = api.czr_sektions.resetCollectionSetting( params.scope ); } catch( er ) {
6803
+ api.errare( 'sek-reset-collection => error when firing resetCollectionSetting()', er );
6804
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
6805
  break;
6806
+ }// switch
6807
 
6808
 
 
 
 
 
6809
 
6810
+ // if we did not already rejected the request, let's check if the setting object has actually been modified
6811
+ // at this point it should have been.
6812
+ if ( 'pending' == self.updAPISetParams.promise.state() ) {
6813
+ var mayBeUpdateSektionsSetting = function() {
6814
 
6815
+ // When a sektion setting is changed, "from" and "to" are passed to the .settingParams property
6816
+ // settingParams : {
6817
+ // to : to,
6818
+ // from : from,
6819
+ // args : args
6820
+ // }
6821
+ // @see for example ::generateUIforFrontModules or ::generateUIforLevelOptions
6822
+ var isSettingValueChangeCase = params.settingParams && params.settingParams.from && params.settingParams.to;
6823
 
 
 
 
 
 
 
6824
 
6825
+ // in a setting value change case, the from and to must be different
6826
+ // implemented when fixing https://github.com/presscustomizr/nimble-builder/issues/455
6827
+ if ( isSettingValueChangeCase && _.isEqual( params.settingParams.from, params.settingParams.to ) ) {
6828
+ self.updAPISetParams.promise.reject( 'updateAPISetting => main sektion setting change => the new setting value is unchanged when firing action : ' + params.action );
6829
+ } else if ( ! isSettingValueChangeCase && _.isEqual( currentSetValue, self.updAPISetParams.newSetValue ) ) {
6830
+ self.updAPISetParams.promise.reject( 'updateAPISetting => the new setting value is unchanged when firing action : ' + params.action );
6831
+ } else {
6832
+ if ( null !== self.validateSettingValue( self.updAPISetParams.newSetValue, params.is_global_location ? 'global' : 'local' ) ) {
6833
+ api( _collectionSettingId_ )( self.updAPISetParams.newSetValue, params );
6834
+ // Add the cloneId to the params when we resolve
6835
+ // the cloneId is only needed in the duplication scenarii
6836
+ params.cloneId = self.updAPISetParams.cloneId;
6837
+ self.updAPISetParams.promise.resolve( params );
6838
+ } else {
6839
+ self.updAPISetParams.promise.reject( 'Validation problem for action ' + params.action );
6840
  }
6841
+ //api.infoLog('COLLECTION SETTING UPDATED => ', _collectionSettingId_, api( _collectionSettingId_ )() );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6842
  }
6843
+ };//mayBeUpdateSektionsSetting()
6844
 
6845
+ // For all scenarios but section injection, we can update the sektion setting now
6846
+ // otherwise we need to wait for the injection to be processed asynchronously
6847
+ // CRITICAL => self.updAPISetParams.promise has to be resolved / rejected
6848
+ // otherwise this can lead to scenarios where a change is not taken into account in ::updateAPISettingAndExecutePreviewActions
6849
+ // like in https://github.com/presscustomizr/nimble-builder/issues/373
6850
+ if ( '_not_injection_scenario_' === self.updAPISetParams.sectionInjectPromise ) {
6851
+ mayBeUpdateSektionsSetting();
6852
+ // At this point the self.updAPISetParams.promise obj can't be in a 'pending' state
6853
+ if ( 'pending' === self.updAPISetParams.promise.state() ) {
6854
+ api.errare( '::updateAPISetting => The self.updAPISetParams.promise has not been resolved properly.');
6855
+ }
6856
+ } else {
6857
+ self.updAPISetParams.sectionInjectPromise
6858
+ .done( function() {
6859
+ mayBeUpdateSektionsSetting();
6860
+ // At this point the self.updAPISetParams.promise obj can't be in a 'pending' state
6861
+ if ( 'pending' === self.updAPISetParams.promise.state() ) {
6862
+ api.errare( '::updateAPISetting => The self.updAPISetParams.promise has not been resolved properly.');
6863
+ }
6864
+ })
6865
+ .fail( function( _er_ ) {
6866
+ api.errare( 'updateAPISetting => self.updAPISetParams.sectionInjectPromise failed', _er_ );
6867
+ });
6868
+ }
6869
+ }
6870
+ };//_updateSektionSettingInstanceWithAction()
6871
 
6872
 
6873
+ // Update the sektion collection
6874
+ api( _collectionSettingId_, function( sektionSetInstance ) {
6875
+ _updateSektionSettingInstanceWithAction();
6876
+ });
6877
+ return self.updAPISetParams.promise.promise();
6878
+ },//updateAPISetting
6879
 
6880
 
6881
+ // used on :
6882
+ // - add column
6883
+ // - remove column
6884
+ // - duplicate column
6885
+ // - move column
6886
+ // added in June 2019 for https://github.com/presscustomizr/nimble-builder/issues/279
6887
+ resetColumnsWidthInSection : function( sektionCandidate ) {
6888
+ // RESET ALL COLUMNS WIDTH
6889
+ _.each( sektionCandidate.collection, function( colModel ) {
6890
+ if ( colModel.options && colModel.options.width && colModel.options.width['custom-width'] ) {
6891
+ colModel.options.width = _.omit( colModel.options.width, 'custom-width' );
6892
+ }
6893
+ colModel.width = '';// For backward compat since June 2019
6894
+ });
6895
+ },
6896
+
6897
+
6898
+ // @return a promise()
6899
+ // caches the sections in api.sek_presetSections when api.section( '__content_picker__') is registered
6900
+ // caches the user saved sections on the first drag and drop of a user-saved section
6901
+ _maybeFetchSectionsFromServer : function() {
6902
+ var dfd = $.Deferred(),
6903
+ _ajaxRequest_;
6904
+
6905
+ if ( ! _.isEmpty( api.sek_presetSections ) ) {
6906
+ dfd.resolve( api.sek_presetSections );
6907
+ } else {
6908
+ if ( ! _.isUndefined( api.sek_fetchingPresetSections ) && 'pending' == api.sek_fetchingPresetSections.state() ) {
6909
+ _ajaxRequest_ = api.sek_fetchingPresetSections;
6910
+ } else {
6911
+ _ajaxRequest_ = wp.ajax.post( 'sek_get_preset_sections', { nonce: api.settings.nonce.save } );
6912
+ api.sek_fetchingPresetSections = _ajaxRequest_;
6913
+ }
6914
+ _ajaxRequest_.done( function( _collection_ ) {
6915
+ //api.sek_presetSections = JSON.parse( _collection_ );
6916
+ api.sek_presetSections = _collection_;
6917
+ dfd.resolve( api.sek_presetSections );
6918
+ }).fail( function( _r_ ) {
6919
+ dfd.reject( _r_ );
6920
+ });
6921
+ }
6922
+ return dfd.promise();
6923
+ },
6924
+
6925
+
6926
+
6927
+
6928
+ // First run : fetches the collection from the server
6929
+ // Next runs : uses the cached collection
6930
+ //
6931
+ // @return a JSON parsed string,
6932
+ // + guid() ids for each levels
6933
+ // ready for insertion
6934
+ //
6935
+ // @sectionParams : {
6936
+ // is_user_section : bool, //<= is this section a "saved" section ?
6937
+ // presetSectionId : params.content_id,
6938
+ // }
6939
+ getPresetSectionCollection : function( sectionParams ) {
6940
+ var self = this,
6941
+ __dfd__ = $.Deferred();
6942
+ if ( sectionParams.is_user_section ) {
6943
+ wp.ajax.post( 'sek_get_user_section_json', {
6944
+ nonce: api.settings.nonce.save,
6945
+ section_post_name: sectionParams.presetSectionId
6946
+ //skope_id: api.czr_skopeBase.getSkopeProperty( 'skope_id' )
6947
+ })
6948
+ .done( function( userSection ) {
6949
+ // User section looks like
6950
+ // {
6951
+ // data : {}
6952
+ // metas : {}
6953
+ // section_post_name : ''
6954
+ // }
6955
+ if ( ! _.isObject( userSection ) || _.isEmpty( userSection ) || _.isUndefined( userSection.data ) ) {
6956
+ api.errare( 'getPresetSectionCollection => preset section type not found or empty : ' + sectionParams.presetSectionId, userSection );
6957
+ throw new Error( 'getPresetSectionCollection => preset section type not found or empty');
6958
+ }
6959
+
6960
+ var userSectionCandidate = $.extend( {}, true, userSection.data );
6961
+
6962
+ // ID's
6963
+ // the level's id have to be generated
6964
+ // 1) root level
6965
+ userSectionCandidate.id = sektionsLocalizedData.optPrefixForSektionsNotSaved + self.guid();
6966
+ // 2) children levels
6967
+ userSectionCandidate.collection = self.setPresetOrUserSectionIds( userSectionCandidate.collection );
6968
+
6969
+ // NIMBLE VERSION
6970
+ // set the section version
6971
+ userSectionCandidate.ver_ini = sektionsLocalizedData.nimbleVersion;
6972
+ // the other level's version have to be added
6973
+ userSectionCandidate.collection = self.setPresetSectionVersion( userSectionCandidate.collection );
6974
+
6975
+ // OK. time to resolve self.updAPISetParams.sectionInjectPromise.promise()
6976
+ __dfd__.resolve( userSectionCandidate );
6977
+ })
6978
+ .fail( function( er ) {
6979
+ __dfd__.reject( er );
6980
+ });
6981
+ } else {
6982
+ self._maybeFetchSectionsFromServer()
6983
+ .fail( function( er ) {
6984
+ __dfd__.reject( er );
6985
+ })
6986
+ .done( function( _collection_ ) {
6987
+ //api.infoLog( 'preset_sections fetched', api.sek_presetSections );
6988
+ var presetSection,
6989
+ allPresets = $.extend( true, {}, _.isObject( _collection_ ) ? _collection_ : {} );
6990
 
6991
+ if ( _.isEmpty( allPresets ) ) {
6992
+ throw new Error( 'getPresetSectionCollection => Invalid collection');
6993
  }
6994
+ if ( _.isEmpty( allPresets[ sectionParams.presetSectionId ] ) ) {
6995
+ throw new Error( 'getPresetSectionCollection => the preset section : "' + sectionParams.presetSectionId + '" has not been found in the collection');
6996
+ }
6997
+ var presetCandidate = allPresets[ sectionParams.presetSectionId ];
6998
 
6999
+ // Ensure we have a string that's JSON.parse-able
7000
+ // if ( typeof presetCandidate !== 'string' || presetCandidate[0] !== '{' ) {
7001
+ // throw new Error( 'getPresetSectionCollection => ' + sectionParams.presetSectionId + ' is not JSON.parse-able');
7002
+ // }
7003
+ // presetCandidate = JSON.parse( presetCandidate );
 
7004
 
7005
+ // ID's
7006
+ // the level's id have to be generated
7007
+ presetCandidate.collection = self.setPresetOrUserSectionIds( presetCandidate.collection );
7008
+
7009
+ // NIMBLE VERSION
7010
+ // set the section version
7011
+ presetCandidate.ver_ini = sektionsLocalizedData.nimbleVersion;
7012
+ // the other level's version have to be added
7013
+ presetCandidate.collection = self.setPresetSectionVersion( presetCandidate.collection );
7014
+ __dfd__.resolve( presetCandidate );
7015
+ });//_maybeFetchSectionsFromServer.done()
7016
+ }
7017
+ return __dfd__.promise();
7018
+ },
7019
+
7020
+
7021
+ // SECTION HELPERS
7022
+ // Replaces __rep__me__ by an id looking like __nimble__1eda909f0cfe
7023
+ setPresetOrUserSectionIds : function( collection ) {
7024
+ var self = this;
7025
+ // Only collection set as arrays hold columns or modules
7026
+ if ( _.isArray( collection ) ) {
7027
+ _.each( collection, function( levelData ) {
7028
+ levelData.id = sektionsLocalizedData.optPrefixForSektionsNotSaved + self.guid();
7029
+ if ( _.isArray( levelData.collection ) ) {
7030
+ self.setPresetOrUserSectionIds( levelData.collection );
7031
+ }
7032
+ });
7033
+ }
7034
+ return collection;
7035
+ },
7036
+
7037
+ setPresetSectionVersion : function( collection ) {
7038
+ var self = this;
7039
+ _.each( collection, function( levelData ) {
7040
+ levelData.ver_ini = sektionsLocalizedData.nimbleVersion;
7041
+ if ( _.isArray( levelData.collection ) ) {
7042
+ self.setPresetSectionVersion( levelData.collection );
7043
+ }
7044
+ });
7045
+ return collection;
7046
+ },
7047
+
7048
+
7049
+
7050
+ // Walk the column collection of a preset section, and replace '__img_url__*' pattern by image ids that we get from ajax calls
7051
+ // Is designed to handle multiple ajax calls in parallel if the preset_section includes several images
7052
+ // @return a promise()
7053
+ preparePresetSectionForInjection : function( columnCollection ) {
7054
+ var self = this,
7055
+ deferreds = {},
7056
+ preparedSection = {},
7057
+ _dfd_ = $.Deferred();
7058
+
7059
+ // items id of multi-items module must always be unique
7060
+ // this recursive method sniff and does the job
7061
+ self.maybeGenerateNewItemIdsForCrudModules( columnCollection );
7062
+
7063
+ // walk the column collection and populates the deferreds object recursively
7064
+ var _sniffImg = function( data ) {
7065
+ _.each( data, function( val, key ) {
7066
+ if ( _.isObject( val ) || _.isArray( val ) ) {
7067
+ _sniffImg( val );
7068
+ } else if ( _.isString( val ) && -1 != val.indexOf( '__img_url__' ) ) {
7069
+ // scenario when a section uses an image more than once.
7070
+ // => we don't need to fire a new ajax request for an image already sniffed
7071
+ if ( ! _.has( deferreds, val ) ) {
7072
+ deferreds[ val ] = self.importAttachment( val.replace( '__img_url__', '' ) );
7073
+ }
7074
+ }
7075
+ });
7076
+ return deferreds;
7077
+ };
7078
+
7079
+ // walk the column collection and populates the deferreds object recursively
7080
+ // imdList is formed this way :
7081
+ // __img_url__/assets/img/1.jpg : {id: 2547, url: "http://customizr-dev.test/wp-content/uploads/2018/09/nimble_asset_1.jpg"}
7082
+ // __img_url__/assets/img/2.jpg : {id: 2548, url: "http://customizr-dev.test/wp-content/uploads/2018/09/nimble_asset_2.jpg"}
7083
+ // __img_url__/assets/img/3.jpg : {id: 2549, url: "http://customizr-dev.test/wp-content/uploads/2018/09/nimble_asset_3.jpg"}
7084
+ var _replaceImgPlaceholderById = function( data, imgList) {
7085
+ _.each( data, function( val, key ) {
7086
+ if ( _.isObject( val ) || _.isArray( val ) ) {
7087
+ _replaceImgPlaceholderById( val, imgList );
7088
+ } else if ( _.isString( val ) && -1 != val.indexOf( '__img_url__' ) && _.has( imgList, val ) && _.isObject( imgList[ val ] ) ) {
7089
+ data[ key ] = imgList[ val ].id;
7090
+ }
7091
+ });
7092
+ return columnCollection;
7093
+ };
7094
+
7095
+ self.whenAllPromisesInParallel( _sniffImg( columnCollection ) )
7096
+ .done( function( imgList ) {
7097
+ var imgReadySection = _replaceImgPlaceholderById( columnCollection, imgList );
7098
+ _dfd_.resolve( imgReadySection );
7099
+ })
7100
+ .fail( function( _er_ ){
7101
+ _dfd_.reject( _er_ );
7102
+ });
7103
+
7104
+ return _dfd_.promise();
7105
+ }
7106
+ });//$.extend()
7107
+ })( wp.customize, jQuery );//global sektionsLocalizedData, serverControlParams
7108
+ //self.updAPISetParams = {
7109
+ // params : params,
7110
+ // promise : $.Deferred(),
7111
+ // newSetValue : _.isObject( _currentSetValue ) ? $.extend( true, {}, _currentSetValue ) : self.getDefaultSektionSettingValue( params.is_global_location ? 'global' : 'local' ),
7112
+ // cloneId : '',
7113
+ // sectionInjectPromise
7114
+ // };
7115
+ var CZRSeksPrototype = CZRSeksPrototype || {};
7116
+ (function ( api, $ ) {
7117
+ $.extend( CZRSeksPrototype, {
7118
+ //-------------------------------------------------------------------------------------------------
7119
+ //-- ADD SECTION
7120
+ //-------------------------------------------------------------------------------------------------
7121
+ _updAPISet_sek_add_sektion : function() {
7122
+ var self = this,
7123
+ params,
7124
+ columnCandidate,
7125
+ parentSektionCandidate,
7126
+ locationCandidate;
7127
+
7128
+ params = self.updAPISetParams.params;
7129
+
7130
+ //console.log('ADD SECTION ?', params, self.updAPISetParams );
7131
+ // an id must be provided
7132
+ if ( _.isEmpty( params.id ) ) {
7133
+ throw new Error( 'updateAPISetting => ' + params.action + ' => missing id' );
7134
+ }
7135
+
7136
+ if ( _.isEmpty( params.location ) ) {
7137
+ throw new Error( 'updateAPISetting => ' + params.action + ' => missing location' );
7138
+ }
7139
+ // Is this a nested sektion ?
7140
+ if ( true === params.is_nested ) {
7141
+ columnCandidate = self.getLevelModel( params.in_column, self.updAPISetParams.newSetValue.collection );
7142
+ // can we add this nested sektion ?
7143
+ // if the parent sektion of the column has is_nested = true, then we can't
7144
+ parentSektionCandidate = self.getLevelModel( params.in_sektion, self.updAPISetParams.newSetValue.collection );
7145
+ if ( 'no_match' == parentSektionCandidate ) {
7146
+ self.updAPISetParams.promise.reject( 'updateAPISetting => ' + params.action + ' => no grand parent sektion found');
7147
+ } else if ( true === parentSektionCandidate.is_nested ) {
7148
+ self.updAPISetParams.promise.reject('');
7149
+ api.previewer.trigger('sek-notify', {
7150
+ type : 'info',
7151
+ duration : 30000,
7152
+ message : [
7153
+ '<span style="font-size:0.95em">',
7154
+ '<strong>' + sektionsLocalizedData.i18n[ "You've reached the maximum number of allowed nested sections." ] + '</strong>',
7155
+ '</span>'
7156
+ ].join('')
7157
+ });
7158
+ } else if ( 'no_match' == columnCandidate ) {
7159
+ api.errare( 'updateAPISetting => ' + params.action + ' => no parent column matched' );
7160
+ self.updAPISetParams.promise.reject( 'updateAPISetting => ' + params.action + ' => no parent column matched');
7161
+ } else {
7162
+ columnCandidate.collection = _.isArray( columnCandidate.collection ) ? columnCandidate.collection : [];
7163
+ columnCandidate.collection.push({
7164
+ id : params.id,
7165
+ level : 'section',
7166
+ collection : [{
7167
+ id : sektionsLocalizedData.optPrefixForSektionsNotSaved + self.guid(),
7168
+ level : 'column',
7169
+ collection : [],
7170
+ ver_ini : sektionsLocalizedData.nimbleVersion
7171
+ }],
7172
+ is_nested : true,
7173
+ ver_ini : sektionsLocalizedData.nimbleVersion
7174
+ });
7175
+ }
7176
+ } else {
7177
+ locationCandidate = self.getLevelModel( params.location, self.updAPISetParams.newSetValue.collection );
7178
+ if ( 'no_match' == locationCandidate ) {
7179
+ api.errare( 'updateAPISetting => ' + params.action + ' => no location matched' );
7180
+ self.updAPISetParams.promise.reject( 'updateAPISetting => ' + params.action + ' => no location matched');
7181
+ } else {
7182
+ var position = 0;
7183
+ locationCandidate.collection = _.isArray( locationCandidate.collection ) ? locationCandidate.collection : [];
7184
+ _.each( locationCandidate.collection, function( secModel, index ) {
7185
+ if ( params.before_section === secModel.id ) {
7186
+ position = index;
7187
+ }
7188
+ if ( params.after_section === secModel.id ) {
7189
+ position = index + 1;
7190
  }
7191
+ });
7192
 
7193
+ // @see reactToCollectionSettingIdChange
7194
+ locationCandidate.collection = _.isArray( locationCandidate.collection ) ? locationCandidate.collection : [];
7195
+ // insert the section in the collection at the right place
7196
+ locationCandidate.collection.splice( position, 0, {
7197
+ id : params.id,
7198
+ level : 'section',
7199
+ collection : [{
7200
+ id : sektionsLocalizedData.optPrefixForSektionsNotSaved + self.guid(),
7201
+ level : 'column',
7202
+ collection : [],
7203
+ ver_ini : sektionsLocalizedData.nimbleVersion
7204
+ }],
7205
+ ver_ini : sektionsLocalizedData.nimbleVersion
7206
+ });
7207
+ }
7208
+ }
7209
+ },//_updAPISet_sek_add_sektion
7210
 
 
 
 
 
 
7211
 
 
7212
 
7213
 
7214
 
7215
+ //-------------------------------------------------------------------------------------------------
7216
+ //-- DUPLICATE SECTION
7217
+ //-------------------------------------------------------------------------------------------------
7218
+ _updAPISet_sek_duplicate_sektion : function() {
7219
+ var self = this,
7220
+ params,
7221
+ columnCandidate,
7222
+ locationCandidate,
7223
+ deepClonedSektion;
7224
+
7225
+ params = self.updAPISetParams.params;
7226
+
7227
+ // an id must be provided
7228
+ if ( _.isEmpty( params.id ) ) {
7229
+ throw new Error( 'updateAPISetting => ' + params.action + ' => missing id' );
7230
+ }
7231
+ if ( _.isEmpty( params.location ) ) {
7232
+ throw new Error( 'updateAPISetting => ' + params.action + ' => missing location' );
7233
+ }
7234
+ try { deepClonedSektion = self.cloneLevel( params.id ); } catch( er ) {
7235
+ api.errare( 'updateAPISetting => ' + params.action, er );
7236
+ return;
7237
+ }
7238
+
7239
+ // items id of multi-items module must always be unique
7240
+ // this recursive method sniff and does the job
7241
+ self.maybeGenerateNewItemIdsForCrudModules( deepClonedSektion );
7242
+
7243
+ var _position_ = self.getLevelPositionInCollection( params.id, self.updAPISetParams.newSetValue.collection );
7244
+ // Is this a nested sektion ?
7245
+ if ( true === params.is_nested ) {
7246
+ columnCandidate = self.getLevelModel( params.in_column, self.updAPISetParams.newSetValue.collection );
7247
+ if ( 'no_match' == columnCandidate ) {
7248
+ api.errare( 'updateAPISetting => ' + params.action + ' => no parent column matched' );
7249
+ self.updAPISetParams.promise.reject( 'updateAPISetting => ' + params.action + ' => no parent column matched');
7250
+ return;
7251
+ }
7252
+
7253
+ columnCandidate.collection = _.isArray( columnCandidate.collection ) ? columnCandidate.collection : [];
7254
+ columnCandidate.collection.splice( parseInt( _position_ + 1, 10 ), 0, deepClonedSektion );
7255
+
7256
+
7257
+ } else {
7258
+ locationCandidate = self.getLevelModel( params.location, self.updAPISetParams.newSetValue.collection );
7259
+ if ( 'no_match' == locationCandidate ) {
7260
+ api.errare( 'updateAPISetting => ' + params.action + ' => no location matched' );
7261
+ self.updAPISetParams.promise.reject( 'updateAPISetting => ' + params.action + ' => no location matched');
7262
+ return;
7263
+ }
7264
+ locationCandidate.collection = _.isArray( locationCandidate.collection ) ? locationCandidate.collection : [];
7265
+ // @see reactToCollectionSettingIdChange
7266
+ locationCandidate.collection.splice( parseInt( _position_ + 1, 10 ), 0, deepClonedSektion );
7267
+
7268
+ }
7269
+ self.updAPISetParams.cloneId = deepClonedSektion.id;//will be passed in resolve()
7270
+ },//_updAPISet_sek_duplicate_sektion
7271
+
7272
+
7273
+ //-------------------------------------------------------------------------------------------------
7274
+ //-- REMOVE SECTION
7275
+ //-------------------------------------------------------------------------------------------------
7276
+ // in the case of a nested sektion, we have to remove it from a column
7277
+ // otherwise from the root sektion collection
7278
+ _updAPISet_sek_remove_sektion : function() {
7279
+ var self = this,
7280
+ params,
7281
+ columnCandidate,
7282
+ locationCandidate;
7283
+
7284
+ params = self.updAPISetParams.params;
7285
+ //api.infoLog('PARAMS IN sek-remove-sektion', params );
7286
+ if ( true === params.is_nested ) {
7287
+ columnCandidate = self.getLevelModel( params.in_column, self.updAPISetParams.newSetValue.collection );
7288
+ if ( 'no_match' != columnCandidate ) {
7289
+ columnCandidate.collection = _.isArray( columnCandidate.collection ) ? columnCandidate.collection : [];
7290
+ columnCandidate.collection = _.filter( columnCandidate.collection, function( col ) {
7291
+ return col.id != params.id;
7292
+ });
7293
+ } else {
7294
+ api.errare( 'updateAPISetting => ' + params.action + ' => no parent column matched' );
7295
+ }
7296
+ } else {
7297
+ locationCandidate = self.getLevelModel( params.location, self.updAPISetParams.newSetValue.collection );
7298
+ if ( 'no_match' == locationCandidate ) {
7299
+ api.errare( 'updateAPISetting => ' + params.action + ' => no location matched' );
7300
+ self.updAPISetParams.promise.reject( 'updateAPISetting => ' + params.action + ' => no location matched');
7301
+ return;
7302
+ }
7303
+ locationCandidate.collection = _.filter( locationCandidate.collection, function( sek ) {
7304
+ return sek.id != params.id;
7305
+ });
7306
+ }
7307
+ },
7308
+
7309
+
7310
+
7311
+
7312
+ //-------------------------------------------------------------------------------------------------
7313
+ //-- MOVE SECTION (DRAG IN THE PAGE INSIDE A LOCATION, OR CROSS LOCATIONS)
7314
+ //-------------------------------------------------------------------------------------------------
7315
+ _updAPISet_sek_move_sektion : function() {
7316
+ var self = this,
7317
+ params,
7318
+ originalCollection,
7319
+ reorderedCollection,
7320
+ locationCandidate;
7321
+
7322
+ params = self.updAPISetParams.params;
7323
+
7324
+ //api.infoLog('PARAMS in sek-move-section', params );
7325
+ var toLocationCandidate = self.getLevelModel( params.to_location, self.updAPISetParams.newSetValue.collection ),
7326
+ movedSektionCandidate,
7327
+ copyOfMovedSektionCandidate;
7328
+
7329
+ if ( _.isEmpty( toLocationCandidate ) || 'no_match' == toLocationCandidate ) {
7330
+ throw new Error( 'updateAPISetting => ' + params.action + ' => missing target location' );
7331
+ }
7332
+
7333
+ // MOVED CROSS LOCATIONS
7334
+ // - make a copy of the moved sektion
7335
+ // - remove the moved sektion from the source location
7336
+ if ( params.from_location != params.to_location ) {
7337
+ // Remove the moved sektion from the source location
7338
+ var fromLocationCandidate = self.getLevelModel( params.from_location, self.updAPISetParams.newSetValue.collection );
7339
+ if ( _.isEmpty( fromLocationCandidate ) || 'no_match' == fromLocationCandidate ) {
7340
+ throw new Error( 'updateAPISetting => ' + params.action + ' => missing source location' );
7341
+ }
7342
+
7343
+ fromLocationCandidate.collection = _.isArray( fromLocationCandidate.collection ) ? fromLocationCandidate.collection : [];
7344
+ // Make a copy of the sektion candidate now, before removing it
7345
+ movedSektionCandidate = self.getLevelModel( params.id, fromLocationCandidate.collection );
7346
+ copyOfMovedSektionCandidate = $.extend( true, {}, movedSektionCandidate );
7347
+ // remove the sektion from its previous sektion
7348
+ fromLocationCandidate.collection = _.filter( fromLocationCandidate.collection, function( sektion ) {
7349
+ return sektion.id != params.id;
7350
+ });
7351
+ }
7352
+
7353
+ // UPDATE THE TARGET LOCATION
7354
+ toLocationCandidate.collection = _.isArray( toLocationCandidate.collection ) ? toLocationCandidate.collection : [];
7355
+ originalCollection = $.extend( true, [], toLocationCandidate.collection );
7356
+ reorderedCollection = [];
7357
+ _.each( params.newOrder, function( _id_ ) {
7358
+ // in the case of a cross location movement, we need to add the moved sektion to the target location
7359
+ if ( params.from_location != params.to_location && _id_ == copyOfMovedSektionCandidate.id ) {
7360
+ reorderedCollection.push( copyOfMovedSektionCandidate );
7361
+ } else {
7362
+ sektionCandidate = self.getLevelModel( _id_, originalCollection );
7363
+ if ( _.isEmpty( sektionCandidate ) || 'no_match' == sektionCandidate ) {
7364
+ throw new Error( 'updateAPISetting => ' + params.action + ' => missing section candidate' );
7365
+ }
7366
+ reorderedCollection.push( sektionCandidate );
7367
+ }
7368
+ });
7369
+ toLocationCandidate.collection = reorderedCollection;
7370
+ },//_updAPISet_sek_move_sektion
7371
+
7372
+ //-------------------------------------------------------------------------------------------------
7373
+ //-- MOVE SECTION UP DOWN
7374
+ //-------------------------------------------------------------------------------------------------
7375
+ _updAPISet_sek_move_sektion_up_down : function() {
7376
+ var self = this,
7377
+ params,
7378
+ parentCandidate,
7379
+ originalCollection,
7380
+ reorderedCollection,
7381
+ locationCandidate;
7382
+
7383
+ params = self.updAPISetParams.params;
7384
+
7385
+ parentCandidate = self.getLevelModel( params.is_nested ? params.in_column : params.location , self.updAPISetParams.newSetValue.collection );
7386
+ if ( _.isEmpty( parentCandidate ) || 'no_match' == parentCandidate ) {
7387
+ throw new Error( 'updateAPISetting => ' + params.action + ' => missing target location' );
7388
+ }
7389
+ parentCandidate.collection = _.isArray( parentCandidate.collection ) ? parentCandidate.collection : [];
7390
+ originalCollection = $.extend( true, [], parentCandidate.collection );
7391
+ reorderedCollection = $.extend( true, [], parentCandidate.collection );
7392
+
7393
+ var _indexInOriginal = _.findIndex( originalCollection, function( _sec_ ) {
7394
+ return _sec_.id === params.id;
7395
+ });
7396
+ // @see https://underscorejs.org/#findIndex
7397
+ if ( -1 === _indexInOriginal ) {
7398
+ throw new Error( 'updateAPISetting => ' + params.action + ' => invalid index' );
7399
+ }
7400
+
7401
+ // Swap up <=> down
7402
+ var direction = params.direction || 'up',
7403
+ isLastSectionInLocation = originalCollection.length === _indexInOriginal + 1,
7404
+ isFirstSectionInLocation = 0 === _indexInOriginal,
7405
+ _locInfo = self.activeLocationsInfo(),
7406
+ _currentLocInfo = ! _.isArray( _locInfo ) ? {} : _.findWhere( _locInfo, { id : params.location } ),
7407
+ isCurrentLocationGlobal = false,
7408
+ isCurrentLocationHeaderOrFooter = false;
7409
+
7410
+ // Is current location global ?
7411
+ isCurrentLocationGlobal = _.isObject( _currentLocInfo ) && _currentLocInfo.is_global;
7412
+
7413
+ // Is current location header footer ?
7414
+ isCurrentLocationHeaderOrFooter = _.isObject( _currentLocInfo ) && _currentLocInfo.is_header_footer;
7415
+
7416
+ // When a section is last in location and there's another location below, let's move the section to this sibling location
7417
+ // This is possible when :
7418
+ // - when moved section is not nested
7419
+ // - only in locations that are 'local', not header or footer
7420
+
7421
+ // Populate the eligible activeLocations in the page
7422
+ var activeLocationsInPage = [];
7423
+ // self.activeLocationsInfo() is set on ::initialized when send by the preview, and is structured the following way :
7424
+ // [
7425
+ // {
7426
+ // id: "loop_start"
7427
+ // is_global: false
7428
+ // is_header_footer: false
7429
+ // },
7430
+ // {..},
7431
+ // .
7432
+ if ( _.isArray( _locInfo ) ) {
7433
+ _.each( self.activeLocationsInfo(), function( _loc_ ) {
7434
+ if ( ! _loc_.is_global && ! _loc_.is_header_footer ) {
7435
+ activeLocationsInPage.push( _loc_.id );
7436
+ }
7437
+ });
7438
+ }
7439
+
7440
+ // Set the index of the current location
7441
+ var indexOfCurrentLocation = _.findIndex( activeLocationsInPage, function( _loc_id ) {
7442
+ return _loc_id === params.location;
7443
+ });
7444
 
7445
+ var isCurrentLocationEligibleForSectionMoveOutside = ! params.is_nested && ! isCurrentLocationGlobal && ! isCurrentLocationHeaderOrFooter,
7446
+ isFirstLocationInPage = 0 === indexOfCurrentLocation,
7447
+ isLastLocationInPage = activeLocationsInPage.length === indexOfCurrentLocation + 1,
7448
+ newLocationId, newLocationCandidate;
7449
+
7450
+ if ( isCurrentLocationEligibleForSectionMoveOutside && isLastSectionInLocation && 'up' !== direction && ! isLastLocationInPage ) {
7451
+ newLocationId = activeLocationsInPage[ indexOfCurrentLocation + 1 ];
7452
+ newLocationCandidate = self.getLevelModel( newLocationId , self.updAPISetParams.newSetValue.collection );
7453
+
7454
+ // Add the section in first position of the section below
7455
+ newLocationCandidate.collection.unshift( originalCollection[ _indexInOriginal ] );
7456
+ // Removes the section in last position of the original section
7457
+ parentCandidate.collection.pop();
7458
+ // the new_location param will be used in the 'complete' callback of 'sek-move-section-down' / 'sek-move-section-up'
7459
+ params.new_location = newLocationId;
7460
+
7461
+ } else if ( isCurrentLocationEligibleForSectionMoveOutside && isFirstSectionInLocation && 'up' === direction && ! isFirstLocationInPage ) {
7462
+ newLocationId = activeLocationsInPage[ indexOfCurrentLocation - 1 ];
7463
+ newLocationCandidate = self.getLevelModel( newLocationId , self.updAPISetParams.newSetValue.collection );
7464
+
7465
+ // Add the section in first position of the section below
7466
+ newLocationCandidate.collection.push( originalCollection[ _indexInOriginal ] );
7467
+ // Removes the section in last position of the original section
7468
+ parentCandidate.collection.shift();
7469
+ // the new_location param will be used in the 'complete' callback of 'sek-move-section-down' / 'sek-move-section-up'
7470
+ params.new_location = newLocationId;
7471
+ } else {
7472
+ // prevent absurd movements of a section
7473
+ // this should not happen because up / down arrows are not displayed when section is positionned top / bottom
7474
+ // but safer to add it
7475
+ if ( 'up' !== direction && originalCollection.length === _indexInOriginal + 1 ) {
7476
+ //throw new Error( 'updateAPISetting => ' + params.action + ' => bottom reached' );
7477
+ api.previewer.trigger('sek-notify', {
7478
+ type : 'info',
7479
+ duration : 30000,
7480
+ message : [
7481
+ '<span style="font-size:0.95em">',
7482
+ '<strong>' + sektionsLocalizedData.i18n[ "The section cannot be moved lower." ] + '</strong>',
7483
+ '</span>'
7484
+ ].join('')
7485
+ });
7486
+ } else if ( 'up' === direction && 0 === _indexInOriginal ){
7487
+ api.previewer.trigger('sek-notify', {
7488
+ type : 'info',
7489
+ duration : 30000,
7490
+ message : [
7491
+ '<span style="font-size:0.95em">',
7492
+ '<strong>' + sektionsLocalizedData.i18n[ "The section cannot be moved higher." ] + '</strong>',
7493
+ '</span>'
7494
+ ].join('')
7495
+ });
7496
+ } else {
7497
+ reorderedCollection[ _indexInOriginal ] = originalCollection[ 'up' === direction ? _indexInOriginal - 1 : _indexInOriginal + 1 ];
7498
+ reorderedCollection[ 'up' === direction ? _indexInOriginal - 1 : _indexInOriginal + 1 ] = originalCollection[ _indexInOriginal ];
7499
+ parentCandidate.collection = reorderedCollection;
7500
+ }
7501
+ }
7502
+ }//_updAPISet_sek_move_sektion_up_down
7503
 
7504
+ });//$.extend()
7505
+ })( wp.customize, jQuery );//global sektionsLocalizedData, serverControlParams
7506
+ //self.updAPISetParams = {
7507
+ // params : params,
7508
+ // promise : $.Deferred(),
7509
+ // newSetValue : _.isObject( _currentSetValue ) ? $.extend( true, {}, _currentSetValue ) : self.getDefaultSektionSettingValue( params.is_global_location ? 'global' : 'local' ),
7510
+ // cloneId : '',
7511
+ // sectionInjectPromise
7512
+ // };
7513
+ var CZRSeksPrototype = CZRSeksPrototype || {};
7514
+ (function ( api, $ ) {
7515
+ $.extend( CZRSeksPrototype, {
7516
+ // @params {
7517
+ // drop_target_element : $(this),
7518
+ // position : _position,// <= top or bottom
7519
+ // before_section : $(this).data('sek-before-section'),
7520
+ // after_section : $(this).data('sek-after-section'),
7521
+ // content_type : event.originalEvent.dataTransfer.getData( "sek-content-type" ), //<= module or preset_section
7522
+ // content_id : event.originalEvent.dataTransfer.getData( "sek-content-id" )
7523
+ // }
7524
+ _updAPISet_sek_add_content_in_new_sektion : function() {
7525
+ var self = this,
7526
+ params,
7527
+ columnCandidate,
7528
+ locationCandidate;
7529
 
7530
+ params = self.updAPISetParams.params;
7531
 
7532
+ // get the position of the before or after section
7533
+ var positionIndex = 0,
7534
+ startingModuleValue;
7535
 
7536
+ locationCandidate = self.getLevelModel( params.location, self.updAPISetParams.newSetValue.collection );
7537
+ if ( 'no_match' == locationCandidate ) {
7538
+ api.errare( 'updateAPISetting => ' + params.action + ' => no location matched' );
7539
+ self.updAPISetParams.promise.reject( 'updateAPISetting => ' + params.action + ' => no location matched');
7540
+ return;
7541
+ }
7542
+ locationCandidate.collection = _.isArray( locationCandidate.collection ) ? locationCandidate.collection : [];
7543
+ _.each( locationCandidate.collection, function( secModel, index ) {
7544
+ if ( params.before_section === secModel.id ) {
7545
+ positionIndex = index;
7546
+ }
7547
+ if ( params.after_section === secModel.id ) {
7548
+ positionIndex = index + 1;
7549
+ }
7550
+ });
7551
 
7552
+ switch( params.content_type) {
7553
+ // When a module is dropped in a section + column structure to be generated
7554
+ case 'module' :
7555
+ // Let's add the starting value if provided when registrating the module
7556
+ // Note : params.content_id is the module_type
7557
+ startingModuleValue = self.getModuleStartingValue( params.content_id );
7558
+
7559
+ // insert the section in the collection at the right place
7560
+ locationCandidate.collection.splice( positionIndex, 0, {
7561
+ id : params.id,
7562
+ level : 'section',
7563
+ collection : [
7564
+ {
7565
+ id : sektionsLocalizedData.optPrefixForSektionsNotSaved + self.guid(),
7566
+ level : 'column',
7567
+ collection : [
7568
+ {
7569
+ id : params.droppedModuleId,
7570
+ level : 'module',
7571
+ module_type : params.content_id,
7572
+ value : 'no_starting_value' !== startingModuleValue ? startingModuleValue : null,
7573
+ ver_ini : sektionsLocalizedData.nimbleVersion
7574
+ }
7575
+ ],
7576
+ ver_ini : sektionsLocalizedData.nimbleVersion
7577
+ }
7578
+ ],
7579
+ ver_ini : sektionsLocalizedData.nimbleVersion
7580
+ });
7581
+ break;//case 'module' :
7582
 
7583
+ // When a preset section is dropped
7584
+ case 'preset_section' :
7585
+ // insert the section in the collection at the right place
7586
+ self.updAPISetParams.sectionInjectPromise = $.Deferred();//defined at the beginning of the method
7587
+
7588
+ // we use a section index here to display the section in the same order as in the json
7589
+ // introduced when implementing multi-section pre-build section
7590
+ // @see https://github.com/presscustomizr/nimble-builder/issues/489
7591
+ var _injectPresetSectionInLocationOrParentColumn = function( sectionReadyToInject, positionIndex ) {
7592
+ // If the preset_section is inserted in a an empty nested section, add it at the right place in the parent column of the nested section.
7593
+ // Otherwise, add the preset section at the right position in the parent location of the section.
7594
+ var insertedInANestedSektion = false;
7595
+ if ( ! _.isEmpty( params.sektion_to_replace ) ) {
7596
+ var sektionToReplace = self.getLevelModel( params.sektion_to_replace, self.updAPISetParams.newSetValue.collection );
7597
+ if ( 'no_match' === sektionToReplace ) {
7598
+ api.errare( 'updateAPISetting => ' + params.action + ' => no sektionToReplace matched' );
7599
+ self.updAPISetParams.promise.reject( 'updateAPISetting => ' + params.action + ' => no sektionToReplace matched');
7600
+ }
7601
+ insertedInANestedSektion = true === sektionToReplace.is_nested;
7602
+ }
7603
 
7604
 
7605
+ // The following param "collection_of_preset_section_id" has been introduced when implementing support for multi-section pre-build sections
7606
+ // @see https://github.com/presscustomizr/nimble-builder/issues/489
7607
+ // It is sent to the preview with ::reactToPreviewMsg, see bottom of the method.
7608
+ var injected_section_id = sektionsLocalizedData.optPrefixForSektionsNotSaved + self.guid();
7609
+ params.collection_of_preset_section_id = params.collection_of_preset_section_id || [];
7610
+ params.collection_of_preset_section_id.push( injected_section_id );
 
 
 
 
 
 
 
 
 
 
 
 
7611
 
7612
+ if ( ! insertedInANestedSektion ) {
7613
+ locationCandidate.collection.splice( positionIndex, 0, {
7614
+ id : injected_section_id,//params.id,//self.guid()
7615
+ level : 'section',
7616
+ collection : sectionReadyToInject.collection,
7617
+ options : sectionReadyToInject.options || {},
7618
+ ver_ini : sektionsLocalizedData.nimbleVersion
7619
+ });
7620
+ } else {
7621
+ columnCandidate = self.getLevelModel( params.in_column, self.updAPISetParams.newSetValue.collection );
7622
+ if ( 'no_match' === columnCandidate ) {
7623
+ api.errare( 'updateAPISetting => ' + params.action + ' => no parent column matched' );
7624
+ self.updAPISetParams.promise.reject( 'updateAPISetting => ' + params.action + ' => no parent column matched');
7625
  }
 
7626
 
7627
+ columnCandidate.collection = _.isArray( columnCandidate.collection ) ? columnCandidate.collection : [];
 
 
 
 
 
 
 
 
 
 
7628
 
7629
+ // get the position of the before or after module
7630
+ _.each( columnCandidate.collection, function( moduleOrSectionModel, index ) {
7631
+ if ( params.before_section === moduleOrSectionModel.id ) {
7632
+ positionIndex = index;
7633
+ }
7634
+ if ( params.after_section === moduleOrSectionModel.id ) {
7635
+ positionIndex = index + 1;
7636
+ }
7637
+ });
7638
 
7639
+ columnCandidate.collection.splice( positionIndex, 0, {
7640
+ id : injected_section_id,
7641
+ is_nested : true,
7642
+ level : 'section',
7643
+ collection : sectionReadyToInject.collection,
7644
+ options : sectionReadyToInject.options || {},
7645
+ ver_ini : sektionsLocalizedData.nimbleVersion
7646
+ });
 
 
7647
  }
7648
+ };//_injectPresetSectionInLocationOrParentColumn
7649
+ var _doWhenPresetSectionCollectionFetched = function( presetColumnOrSectionCollection ) {
7650
+ self.preparePresetSectionForInjection( presetColumnOrSectionCollection )
7651
+ .fail( function( _er_ ){
7652
+ self.updAPISetParams.promise.reject( 'updateAPISetting => error when preparePresetSectionForInjection => ' + params.action + ' => ' + _er_ );
7653
+ // Used when updating the setting
7654
+ // @see end of this method
7655
+ self.updAPISetParams.sectionInjectPromise.reject( _er_ );
7656
+ })
7657
+ .done( function( maybeMultiSectionReadyToInject ) {
7658
+ var is_multi_section = 'section' === maybeMultiSectionReadyToInject.collection[0].level;
7659
+ // support for pre-built multi-section has been introduced in july 2019
7660
+ // @see https://github.com/presscustomizr/nimble-builder/issues/489
7661
+ if ( is_multi_section ) {
7662
+ // we use a section index here to display the section in the same order as in the json
7663
+ var sectionIndex = 0;
7664
+ _.each( maybeMultiSectionReadyToInject.collection, function( sectionReadyToInject ) {
7665
+ _injectPresetSectionInLocationOrParentColumn( sectionReadyToInject, positionIndex );
7666
+ positionIndex++;
7667
+ });
7668
+ } else {
7669
+ _injectPresetSectionInLocationOrParentColumn( maybeMultiSectionReadyToInject, positionIndex );
7670
+ }
7671
 
7672
+ // Used when updating the setting
7673
+ // @see end of this method
7674
+ self.updAPISetParams.sectionInjectPromise.resolve();
7675
+ });// self.preparePresetSectionForInjection.done()
7676
+ };//_doWhenPresetSectionCollectionFetched()
7677
+
7678
+ // Try to fetch the sections from the server
7679
+ // if sucessfull, resolve self.updAPISetParams.sectionInjectPromise.promise()
7680
+ self.getPresetSectionCollection({
7681
+ is_user_section : params.is_user_section,
7682
+ presetSectionId : params.content_id
7683
+ })
7684
+ .fail( function( _er_ ) {
7685
+ api.errare( 'updateAPISetting => ' + params.action + ' => Error with self.getPresetSectionCollection()', _er_ );
7686
+ self.updAPISetParams.promise.reject( 'updateAPISetting => ' + params.action + ' => Error with self.getPresetSectionCollection()');
7687
+ })
7688
+ .done( function( presetColumnOrSectionCollection ) {
7689
+ if ( ! _.isObject( presetColumnOrSectionCollection ) || _.isEmpty( presetColumnOrSectionCollection ) ) {
7690
+ api.errare( 'updateAPISetting => ' + params.action + ' => preset section type not found or empty : ' + params.content_id, presetColumnOrSectionCollection );
7691
+ self.updAPISetParams.promise.reject( 'updateAPISetting => ' + params.action + ' => preset section type not found or empty');
7692
+ }
7693
+ // OK. time to resolve self.updAPISetParams.sectionInjectPromise.promise()
7694
+ _doWhenPresetSectionCollectionFetched( presetColumnOrSectionCollection );
7695
+ });//self.getPresetSectionCollection().done()
7696
 
7697
+ break;//case 'preset_section' :
7698
+ }//switch( params.content_type)
7699
+ },
 
 
 
 
 
 
7700
 
 
 
 
 
7701
 
 
 
 
 
 
 
 
 
 
 
 
7702
 
 
 
 
 
7703
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7704
 
 
 
 
7705
 
 
 
 
 
 
7706
 
7707
+ // @params {
7708
+ // drop_target_element : $(this),
7709
+ // position : _position,// <= top or bottom
7710
+ // before_section : $(this).data('sek-before-section'),
7711
+ // after_section : $(this).data('sek-after-section'),
7712
+ // content_type : event.originalEvent.dataTransfer.getData( "sek-content-type" ), //<= module or preset_section
7713
+ // content_id : event.originalEvent.dataTransfer.getData( "sek-content-id" )
7714
+ // }
7715
+ _updAPISet_sek_add_preset_sektion_in_new_nested_sektion : function() {
7716
+ var self = this,
7717
+ params,
7718
+ columnCandidate,
7719
+ parentSektionCandidate;
7720
+
7721
+ params = self.updAPISetParams.params;
7722
+ columnCandidate = self.getLevelModel( params.in_column, self.updAPISetParams.newSetValue.collection );
7723
+ if ( 'no_match' === columnCandidate ) {
7724
+ api.errare( 'updateAPISetting => ' + params.action + ' => no parent column matched' );
7725
+ self.updAPISetParams.promise.reject( 'updateAPISetting => ' + params.action + ' => no parent column matched');
7726
+ return;
7727
+ }
7728
 
7729
+ var positionIndexInColumn = 0;
7730
+ columnCandidate.collection = _.isArray( columnCandidate.collection ) ? columnCandidate.collection : [];
7731
+ // get the position of the before or after module or nested section
7732
+ _.each( columnCandidate.collection, function( moduleOrNestedSectionModel, index ) {
7733
+ if ( params.before_module_or_nested_section === moduleOrNestedSectionModel.id ) {
7734
+ positionIndexInColumn = index;
7735
+ }
7736
+ if ( params.after_module_or_nested_section === moduleOrNestedSectionModel.id ) {
7737
+ positionIndexInColumn = index + 1;
7738
+ }
7739
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7740
 
7741
+ // can we add this nested sektion ?
7742
+ // if the parent sektion of the column has is_nested = true, then we can't
7743
+ parentSektionCandidate = self.getLevelModel( params.in_sektion, self.updAPISetParams.newSetValue.collection );
7744
+ if ( 'no_match' == parentSektionCandidate ) {
7745
+ self.updAPISetParams.promise.reject( 'updateAPISetting => ' + params.action + ' => no grand parent sektion found');
7746
+ return;
7747
+ }
7748
+ if ( true === parentSektionCandidate.is_nested ) {
7749
+ self.updAPISetParams.promise.reject('');
7750
+ api.previewer.trigger('sek-notify', {
7751
+ type : 'info',
7752
+ duration : 30000,
7753
+ message : [
7754
+ '<span style="font-size:0.95em">',
7755
+ '<strong>' + sektionsLocalizedData.i18n[ "You've reached the maximum number of allowed nested sections." ] + '</strong>',
7756
+ '</span>'
7757
+ ].join('')
7758
+ });
7759
+ return;
7760
+ }
7761
 
7762
+ // insert the nested section in the collection at the right place
7763
+ var presetColumnOrSectionCollection;
7764
+ self.updAPISetParams.sectionInjectPromise = $.Deferred();
7765
+
7766
+ var _doWhenPrebuiltSectionCollectionFetched = function( presetColumnOrSectionCollection ) {
7767
+ self.preparePresetSectionForInjection( presetColumnOrSectionCollection )
7768
+ .fail( function( _er_ ){
7769
+ self.updAPISetParams.promise.reject( 'updateAPISetting => error when preparePresetSectionForInjection => ' + params.action + ' => ' + _er_ );
7770
+ // Used when updating the setting
7771
+ // @see end of this method
7772
+ self.updAPISetParams.sectionInjectPromise.reject( _er_ );
7773
+ })
7774
+ .done( function( maybeMultiSectionReadyToInject ) {
7775
 
7776
+ var _injectNestedSectionInParentColumn = function( sectionReadyToInject, positionIndexInColumn ) {
7777
+ positionIndexInColumn = positionIndexInColumn || 0;
 
 
 
7778
 
7779
+ // The following param "collection_of_preset_section_id" has been introduced when implementing support for multi-section pre-build sections
7780
+ // @see https://github.com/presscustomizr/nimble-builder/issues/489
7781
+ // It is sent to the preview with ::reactToPreviewMsg, see bottom of the method.
7782
+ var injected_section_id = sektionsLocalizedData.optPrefixForSektionsNotSaved + self.guid();
7783
+ params.collection_of_preset_section_id = params.collection_of_preset_section_id || [];
7784
+ params.collection_of_preset_section_id.push( injected_section_id );
7785
 
7786
+ columnCandidate.collection.splice( positionIndexInColumn, 0, {
7787
+ id : injected_section_id,
7788
+ level : 'section',
7789
+ collection : sectionReadyToInject.collection,
7790
+ options : sectionReadyToInject.options || {},
7791
+ is_nested : true,
7792
+ ver_ini : sektionsLocalizedData.nimbleVersion
7793
+ });
7794
+ };
 
 
 
 
 
 
 
 
 
 
 
 
7795
 
7796
+ // support for pre-built multi-section has been introduced in july 2019
7797
+ // @see https://github.com/presscustomizr/nimble-builder/issues/489
7798
+ var is_multi_section = 'section' === maybeMultiSectionReadyToInject.collection[0].level;
7799
+ if ( is_multi_section ) {
7800
+ _.each( maybeMultiSectionReadyToInject.collection, function( sectionReadyToInject ) {
7801
+ _injectNestedSectionInParentColumn( sectionReadyToInject, positionIndexInColumn );
7802
+ positionIndexInColumn++;
7803
+ });
7804
  } else {
7805
+ _injectNestedSectionInParentColumn( maybeMultiSectionReadyToInject, positionIndexInColumn );
 
 
 
 
7806
  }
7807
 
7808
+ // Used when updating the setting
7809
+ // @see end of this method
7810
+ self.updAPISetParams.sectionInjectPromise.resolve();
7811
+ });//self.preparePresetSectionForInjection.done()
7812
+ };//_doWhenPrebuiltSectionCollectionFetched
7813
 
7814
 
7815
+ // Try to fetch the sections from the server
7816
+ // if sucessfull, resolve self.updAPISetParams.sectionInjectPromise.promise()
7817
+ self.getPresetSectionCollection({
7818
+ is_user_section : params.is_user_section,
7819
+ presetSectionId : params.content_id
7820
+ })
7821
+ .fail( function() {
7822
+ api.errare( 'updateAPISetting => ' + params.action + ' => Error with self.getPresetSectionCollection()', _er_ );
7823
+ self.updAPISetParams.promise.reject( 'updateAPISetting => ' + params.action + ' => Error with self.getPresetSectionCollection()');
7824
+ })
7825
+ .done( function( presetColumnOrSectionCollection ) {
7826
+ if ( ! _.isObject( presetColumnOrSectionCollection ) || _.isEmpty( presetColumnOrSectionCollection ) ) {
7827
+ api.errare( 'updateAPISetting => ' + params.action + ' => preset section type not found or empty : ' + params.content_id, presetColumnOrSectionCollection );
7828
+ self.updAPISetParams.promise.reject( 'updateAPISetting => ' + params.action + ' => preset section type not found or empty');
7829
+ }
7830
+ // OK. time to resolve self.updAPISetParams.sectionInjectPromise.promise()
7831
+ _doWhenPrebuiltSectionCollectionFetched( presetColumnOrSectionCollection );
7832
+ });//self.getPresetSectionCollection().done()
7833
+ }
7834
 
7835
+ });//$.extend()
7836
+ })( wp.customize, jQuery );//global sektionsLocalizedData, serverControlParams
7837
+ //self.updAPISetParams = {
7838
+ // params : params,
7839
+ // promise : $.Deferred(),
7840
+ // newSetValue : _.isObject( _currentSetValue ) ? $.extend( true, {}, _currentSetValue ) : self.getDefaultSektionSettingValue( params.is_global_location ? 'global' : 'local' ),
7841
+ // cloneId : '',
7842
+ // sectionInjectPromise
7843
+ // };
7844
+ var CZRSeksPrototype = CZRSeksPrototype || {};
7845
+ (function ( api, $ ) {
7846
+ $.extend( CZRSeksPrototype, {
7847
+ _updAPISet_sek_add_column : function() {
7848
+ var self = this,
7849
+ params,
7850
+ sektionCandidate;
7851
 
7852
+ params = self.updAPISetParams.params;
7853
 
7854
+ // an id must be provided
7855
+ if ( _.isEmpty( params.id ) ) {
7856
+ throw new Error( 'updateAPISetting => ' + params.action + ' => missing id' );
7857
+ }
7858
+ sektionCandidate = self.getLevelModel( params.in_sektion, self.updAPISetParams.newSetValue.collection );
7859
+ if ( 'no_match' == sektionCandidate ) {
7860
+ api.errare( 'updateAPISetting => ' + params.action + ' => no parent sektion matched' );
7861
+ self.updAPISetParams.promise.reject( 'updateAPISetting => ' + params.action + ' => no parent sektion matched');
7862
+ return;
7863
+ }
7864
 
7865
+ sektionCandidate.collection = _.isArray( sektionCandidate.collection ) ? sektionCandidate.collection : [];
7866
+ // can we add another column ?
7867
+ if ( ( self.MAX_NUMBER_OF_COLUMNS - 1 ) < _.size( sektionCandidate.collection ) ) {
7868
+ self.updAPISetParams.promise.reject( sektionsLocalizedData.i18n["You've reached the maximum number of columns allowed in this section."]);
7869
+ return;
7870
+ }
7871
 
7872
+ // RESET ALL COLUMNS WIDTH
7873
+ // _.each( sektionCandidate.collection, function( colModel ) {
7874
+ // colModel.width = '';
7875
+ // });
7876
+ self.resetColumnsWidthInSection( sektionCandidate );
 
 
 
7877
 
7878
+ sektionCandidate.collection.push({
7879
+ id : params.id,
7880
+ level : 'column',
7881
+ collection : [],
7882
+ ver_ini : sektionsLocalizedData.nimbleVersion
7883
+ });
7884
+ },
 
 
7885
 
7886
+ _updAPISet_sek_remove_column : function() {
7887
+ var self = this,
7888
+ params,
7889
+ sektionCandidate;
7890
 
7891
+ params = self.updAPISetParams.params;
 
 
7892
 
7893
+ sektionCandidate = self.getLevelModel( params.in_sektion, self.updAPISetParams.newSetValue.collection );
7894
+ if ( 'no_match' != sektionCandidate ) {
7895
+ // can we remove the column ?
7896
+ if ( 1 === _.size( sektionCandidate.collection ) ) {
7897
+ self.updAPISetParams.promise.reject( sektionsLocalizedData.i18n["A section must have at least one column."]);
7898
+ return;
7899
+ }
7900
+ sektionCandidate.collection = _.isArray( sektionCandidate.collection ) ? sektionCandidate.collection : [];
7901
+ sektionCandidate.collection = _.filter( sektionCandidate.collection, function( column ) {
7902
+ return column.id != params.id;
7903
+ });
7904
+ // RESET ALL COLUMNS WIDTH
7905
+ // _.each( sektionCandidate.collection, function( colModel ) {
7906
+ // colModel.width = '';
7907
+ // });
7908
+ self.resetColumnsWidthInSection( sektionCandidate );
7909
+ } else {
7910
+ api.errare( 'updateAPISetting => ' + params.action + ' => no parent sektion matched' );
7911
+ }
7912
+ },
7913
 
7914
+ _updAPISet_sek_duplicate_column : function() {
7915
+ var self = this,
7916
+ params,
7917
+ sektionCandidate;
7918
 
7919
+ params = self.updAPISetParams.params;
7920
 
7921
+ // an id must be provided
7922
+ if ( _.isEmpty( params.id ) ) {
7923
+ throw new Error( 'updateAPISetting => ' + params.action + ' => missing id' );
7924
+ }
7925
 
7926
+ sektionCandidate = self.getLevelModel( params.in_sektion, self.updAPISetParams.newSetValue.collection );
7927
+ if ( 'no_match' == sektionCandidate ) {
7928
+ api.errare( 'updateAPISetting => ' + params.action + ' => no parent sektion matched' );
7929
+ self.updAPISetParams.promise.reject( 'updateAPISetting => ' + params.action + ' => no parent sektion matched');
7930
+ return;
7931
+ }
7932
 
7933
+ sektionCandidate.collection = _.isArray( sektionCandidate.collection ) ? sektionCandidate.collection : [];
7934
+ // can we add another column ?
7935
+ if ( ( self.MAX_NUMBER_OF_COLUMNS - 1 ) < _.size( sektionCandidate.collection ) ) {
7936
+ self.updAPISetParams.promise.reject( sektionsLocalizedData.i18n["You've reached the maximum number of columns allowed in this section."]);
7937
+ return;
7938
+ }
 
 
 
 
 
 
 
 
 
 
 
 
7939
 
7940
+ var deepClonedColumn;
7941
+ try { deepClonedColumn = self.cloneLevel( params.id ); } catch( er ) {
7942
+ api.errare( 'updateAPISetting => ' + params.action, er );
7943
+ return;
7944
+ }
7945
 
7946
+ // items id of multi-items module must always be unique
7947
+ // this recursive method sniff and does the job
7948
+ self.maybeGenerateNewItemIdsForCrudModules( deepClonedColumn );
7949
 
7950
+ var _position = self.getLevelPositionInCollection( params.id, self.updAPISetParams.newSetValue.collection );
7951
+ self.updAPISetParams.cloneId = deepClonedColumn.id;//will be passed in resolve()
7952
+ sektionCandidate.collection.splice( parseInt( _position + 1, 10 ), 0, deepClonedColumn );
7953
+ // RESET ALL COLUMNS WIDTH
7954
+ // _.each( sektionCandidate.collection, function( colModel ) {
7955
+ // colModel.width = '';
7956
+ // });
7957
+ self.resetColumnsWidthInSection( sektionCandidate );
7958
+ },
7959
 
7960
+ _updAPISet_sek_resize_column : function() {
7961
+ var self = this,
7962
+ params;
7963
 
7964
+ params = self.updAPISetParams.params;
7965
 
7966
+ if ( params.col_number < 2 )
7967
+ return;
7968
 
7969
+ var resizedColumn = self.getLevelModel( params.resized_column, self.updAPISetParams.newSetValue.collection ),
7970
+ sistercolumn = self.getLevelModel( params.sister_column, self.updAPISetParams.newSetValue.collection );
7971
 
7972
+ //api.infoLog( 'updateAPISetting => ' + params.action + ' => ', params );
7973
 
7974
+ // SET RESIZED COLUMN WIDTH
7975
+ if ( 'no_match' == resizedColumn ) {
7976
+ api.errare( 'updateAPISetting => ' + params.action + ' => no resized column matched' );
7977
+ self.updAPISetParams.promise.reject( 'updateAPISetting => ' + params.action + ' => no resized column matched');
7978
+ return;
7979
+ }
7980
 
7981
+ var _getColumnWidth = function( _candidate_ ) {
7982
+ var _width = '_not_set_';
7983
+ var _options = _.isObject( _candidate_.options ) ? _candidate_.options : {};
7984
+ if ( ! _.isEmpty( _options ) && _options.width && _options.width['custom-width'] ) {
7985
+ _width = parseFloat( _options.width['custom-width'] * 1 );
7986
+ }
7987
+ return _width;
7988
+ };
7989
 
7990
+ var _setColumnWidth = function( _candidate_, newWidthValue ) {
7991
+ // start from a deep cloned object
7992
+ // important => fixes https://github.com/presscustomizr/nimble-builder/issues/455
7993
+ var _new_options_values = $.extend( true, {}, _candidate_.options || {} );
7994
+ // april 2020 : due to a previous implementation of width option as an array, there could be a bug when trying to set the width
7995
+ // because the check on _.isObject() was true for an array
7996
+ // Fixes https://github.com/presscustomizr/nimble-builder/issues/620
7997
+ _new_options_values.width = ( _.isObject( _new_options_values.width ) && _new_options_values.width['custom-width'] ) ? _new_options_values.width : {};
7998
+ _new_options_values.width['custom-width'] = newWidthValue;
7999
+ _candidate_.options = _new_options_values;
8000
+
8001
+ // Live update the input value ( when rendered )
8002
+ self.cachedElements.$body.find('[data-sek-width-range-column-id="'+ _candidate_.id +'"]').val( newWidthValue ).trigger('input', { is_resize_column_trigger : true } );
8003
+ return newWidthValue;
8004
+ };
8005
 
8006
+ // DEPRECATED SINCE JUNE 2019 => resizedColumn.width = parseFloat( params.resizedColumnWidthInPercent );
8007
+ var resizedColumnWidthInPercent = _setColumnWidth( resizedColumn, parseFloat( params.resizedColumnWidthInPercent ) );
8008
+ // cast to number
8009
+ resizedColumnWidthInPercent = parseFloat( resizedColumnWidthInPercent );
8010
 
8011
+ // SET OTHER COLUMNS WIDTH
8012
+ var parentSektion = self.getLevelModel( params.in_sektion, self.updAPISetParams.newSetValue.collection );
8013
+ var otherColumns = _.filter( parentSektion.collection, function( _col_ ) {
8014
+ return _col_.id != resizedColumn.id && _col_.id != sistercolumn.id;
8015
+ });
8016
+ var otherColumnsWidth = parseFloat( resizedColumnWidthInPercent.toFixed(3) );
8017
+
8018
+ if ( ! _.isEmpty( otherColumns ) ) {
8019
+ _.each( otherColumns, function( colModel ) {
8020
+ currentColWidth = _getColumnWidth( colModel );
8021
+ if ( '_not_set_' === currentColWidth || ! _.isNumber( currentColWidth * 1 ) || _.isEmpty( currentColWidth + '' ) || 1 > currentColWidth ) {
8022
+ // DEPRECATED SINCE JUNE 2019 => colModel.width = parseFloat( ( 100 / params.col_number ).toFixed(3) );
8023
+ currentColWidth = _setColumnWidth( colModel, parseFloat( ( 100 / params.col_number ).toFixed(3) ) );
8024
+ }
8025
 
8026
+ // sum up all other column's width, excluding the resized and sister one.
8027
+ otherColumnsWidth = parseFloat( ( otherColumnsWidth + currentColWidth ).toFixed(3) );
8028
+ });
8029
+ }
8030
 
8031
+ // SET SISTER COLUMN WIDTH
8032
+ // sum up all other column's width, excluding the resized and sister one.
8033
+ // api.infoLog( "resizedColumn.width", resizedColumn.width );
8034
+ // api.infoLog( "otherColumns", otherColumns );
8035
+
8036
+ // then calculate the sistercolumn so we are sure that we feel the entire space of the sektion
8037
+ // DEPRECATED SINCE JUNE 2019 => sistercolumn.width = parseFloat( ( 100 - otherColumnsWidth ).toFixed(3) );
8038
+ _setColumnWidth( sistercolumn, parseFloat( ( 100 - otherColumnsWidth ).toFixed(3) ) );
8039
+ // api.infoLog('otherColumnsWidth', otherColumnsWidth );
8040
+ // api.infoLog("sistercolumn.width", sistercolumn.width );
8041
+ // api.infoLog( "parseFloat( ( 100 - otherColumnsWidth ).toFixed(3) )" , parseFloat( ( 100 - otherColumnsWidth ).toFixed(3) ) );
8042
+ //api.infoLog('COLLECTION AFTER UPDATE ', parentSektion.collection );
8043
+ },
8044
 
8045
+ _updAPISet_sek_move_column : function() {
8046
+ var self = this,
8047
+ params,
8048
+ sektionCandidate;
8049
 
8050
+ params = self.updAPISetParams.params;
8051
 
8052
+ var toSektionCandidate = self.getLevelModel( params.to_sektion, self.updAPISetParams.newSetValue.collection ),
8053
+ movedColumnCandidate,
8054
+ copyOfMovedColumnCandidate;
8055
 
8056
+ if ( _.isEmpty( toSektionCandidate ) || 'no_match' == toSektionCandidate ) {
8057
+ throw new Error( 'updateAPISetting => ' + params.action + ' => missing target sektion' );
8058
+ }
8059
 
8060
+ if ( params.from_sektion != params.to_sektion ) {
8061
+ // Remove the moved column from the source sektion
8062
+ var fromSektionCandidate = self.getLevelModel( params.from_sektion, self.updAPISetParams.newSetValue.collection );
8063
+ if ( _.isEmpty( fromSektionCandidate ) || 'no_match' == fromSektionCandidate ) {
8064
+ throw new Error( 'updateAPISetting => ' + params.action + ' => missing source column' );
8065
+ }
8066
 
8067
+ fromSektionCandidate.collection = _.isArray( fromSektionCandidate.collection ) ? fromSektionCandidate.collection : [];
8068
+ // Make a copy of the column candidate now, before removing it
8069
+ movedColumnCandidate = self.getLevelModel( params.id, fromSektionCandidate.collection );
8070
+ copyOfMovedColumnCandidate = $.extend( true, {}, movedColumnCandidate );
8071
+ // remove the column from its previous sektion
8072
+ fromSektionCandidate.collection = _.filter( fromSektionCandidate.collection, function( column ) {
8073
+ return column.id != params.id;
8074
+ });
8075
+ // Reset the column's width in the target sektion
8076
+ // _.each( fromSektionCandidate.collection, function( colModel ) {
8077
+ // colModel.width = '';
8078
+ // });
8079
+ self.resetColumnsWidthInSection( fromSektionCandidate );
8080
+ }
8081
 
8082
+ // update the target sektion
8083
+ toSektionCandidate.collection = _.isArray( toSektionCandidate.collection ) ? toSektionCandidate.collection : [];
8084
+ originalCollection = $.extend( true, [], toSektionCandidate.collection );
8085
+ reorderedCollection = [];
8086
+ _.each( params.newOrder, function( _id_ ) {
8087
+ // in the case of a cross sektion movement, we need to add the moved column to the target sektion
8088
+ if ( params.from_sektion != params.to_sektion && _id_ == copyOfMovedColumnCandidate.id ) {
8089
+ reorderedCollection.push( copyOfMovedColumnCandidate );
8090
+ } else {
8091
+ columnCandidate = self.getLevelModel( _id_, originalCollection );
8092
+ if ( _.isEmpty( columnCandidate ) || 'no_match' == columnCandidate ) {
8093
+ throw new Error( 'updateAPISetting => moveColumn => missing columnCandidate' );
8094
+ }
8095
+ reorderedCollection.push( columnCandidate );
8096
+ }
8097
+ });
8098
+ toSektionCandidate.collection = reorderedCollection;
 
 
 
 
 
 
 
 
 
 
 
 
8099
 
8100
+ // Reset the column's width in the target sektion
8101
+ // _.each( toSektionCandidate.collection, function( colModel ) {
8102
+ // colModel.width = '';
8103
+ // });
8104
+ self.resetColumnsWidthInSection( toSektionCandidate );
8105
+ },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8106
 
8107
+ });//$.extend()
8108
+ })( wp.customize, jQuery );//global sektionsLocalizedData, serverControlParams
8109
+ //self.updAPISetParams = {
8110
+ // params : params,
8111
+ // promise : $.Deferred(),
8112
+ // newSetValue : _.isObject( _currentSetValue ) ? $.extend( true, {}, _currentSetValue ) : self.getDefaultSektionSettingValue( params.is_global_location ? 'global' : 'local' ),
8113
+ // cloneId : '',
8114
+ // sectionInjectPromise
8115
+ // };
8116
+ var CZRSeksPrototype = CZRSeksPrototype || {};
8117
+ (function ( api, $ ) {
8118
+ $.extend( CZRSeksPrototype, {
8119
+ _updAPISet_sek_add_module : function() {
8120
+ var self = this,
8121
+ params,
8122
+ columnCandidate,
8123
+ startingModuleValue,// will be populated by the optional starting value specificied on module registration
8124
+ position;//<= the position of the module or section or nested section in a column or location
8125
 
8126
+ params = self.updAPISetParams.params;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8127
 
8128
+ // an id must be provided
8129
+ if ( _.isEmpty( params.id ) ) {
8130
+ throw new Error( 'updateAPISetting => ' + params.action + ' => missing id' );
8131
+ }
8132
+ // a module_type must be provided
8133
+ if ( _.isEmpty( params.module_type ) ) {
8134
+ throw new Error( 'updateAPISetting => ' + params.action + ' => missing module_type' );
8135
+ }
8136
+ columnCandidate = self.getLevelModel( params.in_column, self.updAPISetParams.newSetValue.collection );
8137
+ if ( 'no_match' === columnCandidate ) {
8138
+ api.errare( 'updateAPISetting => ' + params.action + ' => no parent column matched' );
8139
+ self.updAPISetParams.promise.reject( 'updateAPISetting => ' + params.action + ' => no parent column matched');
8140
+ return;
8141
+ }
8142
 
8143
+ position = 0;
8144
+ columnCandidate.collection = _.isArray( columnCandidate.collection ) ? columnCandidate.collection : [];
8145
+ // get the position of the before or after module or nested section
8146
+ _.each( columnCandidate.collection, function( moduleOrNestedSectionModel, index ) {
8147
+ if ( params.before_module_or_nested_section === moduleOrNestedSectionModel.id ) {
8148
+ position = index;
8149
+ }
8150
+ if ( params.after_module_or_nested_section === moduleOrNestedSectionModel.id ) {
8151
+ position = index + 1;
8152
+ }
8153
+ });
 
 
 
 
 
 
 
 
 
 
8154
 
8155
+ var _moduleParams = {
8156
+ id : params.id,
8157
+ level : 'module',
8158
+ module_type : params.module_type,
8159
+ ver_ini : sektionsLocalizedData.nimbleVersion
8160
+ };
8161
+ // Let's add the starting value if provided when registrating the module
8162
+ startingModuleValue = self.getModuleStartingValue( params.module_type );
8163
+ if ( 'no_starting_value' !== startingModuleValue ) {
8164
+ _moduleParams.value = startingModuleValue;
8165
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8166
 
8167
+ columnCandidate.collection.splice( position, 0, _moduleParams );
8168
+ },
 
8169
 
8170
 
8171
+ _updAPISet_sek_duplicate_module : function() {
8172
+ var self = this,
8173
+ params,
8174
+ columnCandidate;
8175
 
8176
+ params = self.updAPISetParams.params;
8177
 
8178
+ // an id must be provided
8179
+ if ( _.isEmpty( params.id ) ) {
8180
+ throw new Error( 'updateAPISetting => ' + params.action + ' => missing id' );
8181
+ }
8182
+ columnCandidate = self.getLevelModel( params.in_column, self.updAPISetParams.newSetValue.collection );
8183
+ if ( 'no_match' == columnCandidate ) {
8184
+ api.errare( 'updateAPISetting => ' + params.action + ' => no parent column matched' );
8185
+ self.updAPISetParams.promise.reject( 'updateAPISetting => ' + params.action + ' => no parent column matched');
8186
+ return;
8187
+ }
8188
 
8189
+ columnCandidate.collection = _.isArray( columnCandidate.collection ) ? columnCandidate.collection : [];
8190
 
8191
+ var deepClonedModule;
8192
+ try { deepClonedModule = self.cloneLevel( params.id ); } catch( er ) {
8193
+ api.errare( 'updateAPISetting => ' + params.action, er );
8194
+ self.updAPISetParams.promise.reject( 'updateAPISetting => ' + params.action + ' => error when cloning the level');
8195
+ return;
8196
+ }
8197
+ // items id of multi-items module must always be unique
8198
+ // this recursive method sniff and does the job
8199
+ self.maybeGenerateNewItemIdsForCrudModules( deepClonedModule );
8200
 
8201
+ var insertInposition = self.getLevelPositionInCollection( params.id, self.updAPISetParams.newSetValue.collection );
8202
+ self.updAPISetParams.cloneId = deepClonedModule.id;//will be passed in resolve()
8203
+ columnCandidate.collection.splice( parseInt( insertInposition + 1, 10 ), 0, deepClonedModule );
8204
+ },
8205
 
8206
+ _updAPISet_sek_remove_module : function() {
8207
+ var self = this,
8208
+ params,
8209
+ columnCandidate;
8210
 
8211
+ params = self.updAPISetParams.params;
8212
 
8213
+ // an id must be provided
8214
+ if ( _.isEmpty( params.id ) ) {
8215
+ throw new Error( 'updateAPISetting => ' + params.action + ' => missing id' );
8216
+ }
8217
+ columnCandidate = self.getLevelModel( params.in_column, self.updAPISetParams.newSetValue.collection );
8218
+ if ( 'no_match' != columnCandidate ) {
8219
+ columnCandidate.collection = _.isArray( columnCandidate.collection ) ? columnCandidate.collection : [];
8220
+ columnCandidate.collection = _.filter( columnCandidate.collection, function( module ) {
8221
+ return module.id != params.id;
8222
+ });
8223
 
8224
+ } else {
8225
+ api.errare( 'updateAPISetting => ' + params.action + ' => no parent column matched' );
8226
+ }
8227
+ },
8228
 
8229
+ _updAPISet_sek_move_module : function() {
8230
+ var self = this,
8231
+ params;
8232
 
8233
+ params = self.updAPISetParams.params;
8234
 
8235
+ var toColumnCandidate,
8236
+ movedModuleCandidate,
8237
+ copyOfMovedModuleCandidate;
8238
 
8239
+ // loop on the sektions to find the toColumnCandidate
8240
+ // _.each( self.updAPISetParams.newSetValue.collection, function( _sektion_ ) {
8241
+ // _.each( _sektion_.collection, function( _column_ ) {
8242
+ // if ( _column_.id == params.to_column ) {
8243
+ // toColumnCandidate = _column_;
8244
+ // }
8245
+ // });
8246
+ // });
8247
+ toColumnCandidate = self.getLevelModel( params.to_column, self.updAPISetParams.newSetValue.collection );
8248
 
8249
+ if ( _.isEmpty( toColumnCandidate ) || 'no_match' == toColumnCandidate ) {
8250
+ throw new Error( 'updateAPISetting => ' + params.action + ' => missing target column' );
8251
+ }
8252
 
8253
+ // If the module has been moved to another column
8254
+ // => remove the moved module from the source column
8255
+ if ( params.from_column != params.to_column ) {
8256
+ var fromColumnCandidate;
8257
+ fromColumnCandidate = self.getLevelModel( params.from_column, self.updAPISetParams.newSetValue.collection );
8258
 
8259
+ if ( _.isEmpty( fromColumnCandidate ) || 'no_match' == fromColumnCandidate ) {
8260
+ throw new Error( 'updateAPISetting => ' + params.action + ' => missing source column' );
8261
+ }
8262
 
8263
+ fromColumnCandidate.collection = _.isArray( fromColumnCandidate.collection ) ? fromColumnCandidate.collection : [];
8264
+ // Make a copy of the module candidate now, before removing it
8265
+ movedModuleCandidate = self.getLevelModel( params.id, self.updAPISetParams.newSetValue.collection );
8266
+ copyOfMovedModuleCandidate = $.extend( true, {}, movedModuleCandidate );
8267
+ // remove the module from its previous column
8268
+ fromColumnCandidate.collection = _.filter( fromColumnCandidate.collection, function( module ) {
8269
+ return module.id != params.id;
8270
+ });
8271
+ }// if params.from_column != params.to_column
8272
+
8273
+ // update the target column
8274
+ toColumnCandidate.collection = _.isArray( toColumnCandidate.collection ) ? toColumnCandidate.collection : [];
8275
+ originalCollection = $.extend( true, [], toColumnCandidate.collection );
8276
+ var reorderedCollection = [];
8277
+ _.each( params.newOrder, function( _id_ ) {
8278
+ if ( params.from_column != params.to_column && _id_ == copyOfMovedModuleCandidate.id ) {
8279
+ reorderedCollection.push( copyOfMovedModuleCandidate );
8280
+ } else {
8281
+ moduleCandidate = self.getLevelModel( _id_, self.updAPISetParams.newSetValue.collection );
8282
+ if ( _.isEmpty( moduleCandidate ) || 'no_match' == moduleCandidate ) {
8283
+ throw new Error( 'updateAPISetting => ' + params.action + ' => missing moduleCandidate' );
8284
+ }
8285
+ reorderedCollection.push( moduleCandidate );
8286
+ }
8287
+ });
8288
+ // Check if we have duplicates ?
8289
+ if ( reorderedCollection.length != _.uniq( reorderedCollection ).length ) {
8290
+ throw new Error( 'updateAPISetting => ' + params.action + ' => there are duplicated modules in column : ' + toColumnCandidate.id );
8291
+ } else {
8292
+ toColumnCandidate.collection = reorderedCollection;
8293
+ }
8294
+ },
8295
 
8296
+ _updAPISet_sek_set_module_value : function() {
8297
+ var self = this,
8298
+ params,
8299
+ moduleCandidate;
 
 
 
 
 
 
 
 
8300
 
8301
+ params = self.updAPISetParams.params;
 
 
 
 
 
8302
 
8303
+ moduleCandidate = self.getLevelModel( params.id, self.updAPISetParams.newSetValue.collection );
 
 
 
 
 
 
 
 
 
 
8304
 
8305
+ // Is this a multi-item module ?
8306
+ // Fixes https://github.com/presscustomizr/nimble-builder/issues/616
8307
+ var _ctrl_ = params.settingParams.args.moduleRegistrationParams.control,
8308
+ _module_id_ = params.settingParams.args.moduleRegistrationParams.id,
8309
+ parentModuleInstance = _ctrl_.czr_Module( _module_id_ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8310
 
8311
+ if ( ! _.isEmpty( parentModuleInstance ) ) {
8312
+ isMultiItemModule = parentModuleInstance.isMultiItem();
8313
+ } else {
8314
+ api.errare( 'updateAPISetting => missing parentModuleInstance', params );
8315
+ }
8316
 
8317
+ // if multi-item module, the value is array of items, otherwise an object
8318
+ var _modValueCandidate = isMultiItemModule ? [] : {};
8319
+ // consider only the non empty settings for db
8320
+ // booleans should bypass this check
8321
+ _.each( params.value || (isMultiItemModule ? [] : {}), function( _val_, _key_ ) {
8322
+ // Note : _.isEmpty( 5 ) returns true when checking an integer,
8323
+ // that's why we need to cast the _val_ to a string when using _.isEmpty()
8324
+ if ( ! _.isBoolean( _val_ ) && _.isEmpty( _val_ + "" ) )
8325
+ return;
8326
+ _modValueCandidate[ _key_ ] = _val_;
8327
+ });
8328
+ if ( 'no_match' == moduleCandidate ) {
8329
+ api.errare( 'updateAPISetting => ' + params.action + ' => no module matched', params );
8330
+ self.updAPISetParams.promise.reject( 'updateAPISetting => ' + params.action + ' => error no module matched');
8331
+ return;
8332
+ }
8333
+ if ( _.isEmpty( params.options_type ) ) {
8334
+ api.errare( 'updateAPISetting => ' + params.action + ' => missing options_type');
8335
+ self.updAPISetParams.promise.reject( 'updateAPISetting => ' + params.action + ' => missing options_type');
8336
+ return;
8337
+ }
8338
 
8339
+ // Is this a father module ?
8340
+ // If yes, the module value is structured by option group, each option group being updated by a child module
8341
+ // If no, the default option type is : '__no_option_group_to_be_updated_by_children_modules__'
8342
+ if ( '__no_option_group_to_be_updated_by_children_modules__' === params.options_type ) {
8343
+ moduleCandidate.value = _modValueCandidate;
8344
+ } else {
8345
+ // start from a deep cloned object
8346
+ // prevents issues like https://github.com/presscustomizr/nimble-builder/issues/455
8347
+ var _new_module_values = $.extend( true, {}, _.isEmpty( moduleCandidate.value ) ? {} : moduleCandidate.value );
8348
+ _new_module_values[ params.options_type ] = _modValueCandidate;
8349
+ moduleCandidate.value = _new_module_values;
8350
+ }
8351
+ },
8352
 
8353
+ });//$.extend()
8354
+ })( wp.customize, jQuery );//global sektionsLocalizedData, serverControlParams
8355
+ //self.updAPISetParams = {
8356
+ // params : params,
8357
+ // promise : $.Deferred(),
8358
+ // newSetValue : _.isObject( _currentSetValue ) ? $.extend( true, {}, _currentSetValue ) : self.getDefaultSektionSettingValue( params.is_global_location ? 'global' : 'local' ),
8359
+ // cloneId : '',
8360
+ // sectionInjectPromise
8361
+ // };
8362
+ var CZRSeksPrototype = CZRSeksPrototype || {};
8363
+ (function ( api, $ ) {
8364
+ $.extend( CZRSeksPrototype, {
8365
+ //-------------------------------------------------------------------------------------------------
8366
+ //-- FILE IMPORT
8367
+ //-------------------------------------------------------------------------------------------------
8368
+ _updAPISet_sek_import_from_file : function() {
8369
+ var self = this,
8370
+ params;
 
 
 
 
 
 
 
 
 
 
8371
 
8372
+ params = self.updAPISetParams.params;
 
 
 
 
8373
 
8374
+ //api.infoLog( 'sek-import-from-file', params );
8375
 
8376
+ if ( _.isUndefined( params.imported_content.data ) || _.isUndefined( params.imported_content.metas ) ) {
8377
+ api.errare( 'updateAPISetting::sek-import-from-file => invalid imported content', imported_content );
8378
+ return;
8379
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8380
 
8381
+ var importedCollection = _.isArray( params.imported_content.data.collection ) ? $.extend( true, [], params.imported_content.data.collection ) : [];
8382
 
8383
+ // ASSIGN MISSING LOCATIONS => IF IMPORTED LOCATIONS DON'T MATCH CURRENT PAGE LOCATIONS
8384
+ // NB will import sections in the first active location of the page
8385
+ // Important : header and footer must be excluded from active locations
8386
+ //
8387
+ // For example the current page has only the 'loop_start' location, whereas the imported content includes 3 locations :
8388
+ // - after_header
8389
+ // - loop_start
8390
+ // - before_footer
8391
+ // Among those 3 locations, 2 are not active in the page.
8392
+ // We will merge all section collections from the 3 imported locations one new collection, that will be assigned to 'loop_start'
8393
+ // Note that the active imported locations are ordered like they were on the page when exported.
8394
+ //
8395
+ // So :
8396
+ // 1) identify the first active location of the page
8397
+ // 2) populate a new collection of combined sections from all active imported locations.
8398
+ // 3) updated the imported collection with this
8399
+ if ( true === params.assign_missing_locations ) {
8400
+ var importedActiveLocations = params.imported_content.metas.active_locations,
8401
+ allActiveLocations = api.czr_sektions.activeLocations(),
8402
+ currentActiveLocations;
8403
+
8404
+ // Set the current active locations excluding header and footer location
8405
+ _.each( allActiveLocations, function( loc_id ) {
8406
+ if( !self.isHeaderLocation( loc_id ) && !self.isFooterLocation( loc_id ) ) {
8407
+ currentActiveLocations.push(loc_id);
8408
+ }
8409
+ });
8410
 
8411
+ // console.log('Current set value ?', api( _collectionSettingId_ )() );
8412
+ // console.log('import params', params );
8413
+ // console.log('importedCollection?', importedCollection );
8414
+ // console.log('importedActiveLocations', importedActiveLocations );
8415
+
8416
+ // first active location of the current setting
8417
+ var firstCurrentActiveLocationId = _.first( currentActiveLocations );
8418
+
8419
+ if ( !_.isEmpty( firstCurrentActiveLocationId ) && !_.isEmpty( importedActiveLocations ) && _.isArray( importedActiveLocations ) ) {
8420
+ // importedActiveLocationsNotAvailableInCurrentActiveLocations
8421
+ // Example :
8422
+ // active location in the page : loop_start, loop_end
8423
+ // active locations imported : after_header, loop_start, before_footer
8424
+ // importedActiveLocationsNotAvailableInCurrentActiveLocations => after_header, before_footer
8425
+ var importedActiveLocationsNotAvailableInCurrentActiveLocations = $(importedActiveLocations).not(currentActiveLocations).get(),
8426
+ firstCurrentLocationData = self.getLevelModel( firstCurrentActiveLocationId, self.updAPISetParams.newSetValue.collection ),
8427
+ importedTargetLocationData = self.getLevelModel( firstCurrentActiveLocationId, params.imported_content.data.collection ),
8428
+ newCollectionForTargetLocation = [];// the collection that will hold the merge of all active imported collections
8429
+
8430
+ // normalize
8431
+ // => make sure we have a collection array, even empty
8432
+ firstCurrentLocationData.collection = _.isArray( firstCurrentLocationData.collection ) ? firstCurrentLocationData.collection : [];
8433
+ importedTargetLocationData.collection = _.isArray( importedTargetLocationData.collection ) ? importedTargetLocationData.collection : [];
8434
+
8435
+ // loop on the active imported locations
8436
+ // Example : ["__after_header", "__before_main_wrapper", "loop_start", "__before_footer"]
8437
+ // and populate newCollectionForTargetLocation, with locations ordered as they were on export
8438
+ // importedCollection is a clone
8439
+ _.each( importedActiveLocations, function( impLocationId ){
8440
+ var impLocationData = self.getLevelModel( impLocationId, importedCollection );
8441
+ if ( _.isEmpty( impLocationData.collection ) )
8442
+ return;
8443
+ newCollectionForTargetLocation = _.union( newCollectionForTargetLocation, impLocationData.collection );
8444
+ });//_.each( importedActiveLocations
8445
 
8446
+ // replace the previous collection of the target location, by the union of all collections.
8447
+ // for example, if 'loop_start' is the target location, all sections will be added to it.
8448
+ importedTargetLocationData.collection = newCollectionForTargetLocation;
8449
 
8450
+ // remove the missing locations from the imported collection
8451
+ // importedActiveLocationsNotAvailableInCurrentActiveLocations
8452
+ params.imported_content.data.collection = _.filter( params.imported_content.data.collection, function( _location ) {
8453
+ return !_.contains( importedActiveLocationsNotAvailableInCurrentActiveLocations, _location.id );
8454
+ });
8455
+ }//if ( !_.isEmpty( firstCurrentActiveLocationId ) )
8456
+ }//if ( true === params.assign_missing_locations )
8457
+
8458
+
8459
+ // SHALL WE MERGE ?
8460
+ // Sept 2019 note : for local import only. Not implemented for global https://github.com/presscustomizr/nimble-builder/issues/495
8461
+ // loop on each location of the imported content
8462
+ // if the current setting value has sections in a location, add them before the imported ones
8463
+ // keep_existing_sections is a user check option
8464
+ // @see PHP sek_get_module_params_for_sek_local_imp_exp()
8465
+ if ( true === params.keep_existing_sections ) {
8466
+ // note that importedCollection is a unlinked clone of params.imported_content.data.collection
8467
+ // merge sections
8468
+ _.each( importedCollection, function( imp_location_data ) {
8469
+ var currentLocationData = self.getLevelModel( imp_location_data.id, self.updAPISetParams.newSetValue.collection );
8470
+ if ( _.isEmpty( currentLocationData.collection ) )
8471
+ return;
8472
 
8473
+ var importedLocationData = self.getLevelModel( imp_location_data.id, params.imported_content.data.collection );
8474
+ importedLocationData.collection = _.union( currentLocationData.collection, importedLocationData.collection );
8475
+ });
8476
 
8477
+ // merge fonts if needed
8478
+ var currentFonts = self.updAPISetParams.newSetValue.fonts,
8479
+ importedFonts = params.imported_content.data.fonts;
8480
 
8481
+ if ( currentFonts && !_.isEmpty( currentFonts ) && _.isArray( currentFonts ) ) {
8482
+ importedFonts = _.isArray( importedFonts ) ? importedFonts : [];
8483
+ // merge and remove duplicated fonts
8484
+ params.imported_content.data.fonts = _.uniq( _.union( currentFonts, importedFonts ) );
8485
+ }
8486
+ }// if true === params.merge
8487
 
8488
+ self.updAPISetParams.newSetValue = params.imported_content.data;
8489
+ },
 
 
 
 
 
 
 
 
8490
 
 
 
 
 
 
 
8491
 
 
 
 
 
8492
 
 
 
 
 
 
 
 
8493
 
 
 
 
 
 
 
 
 
 
8494
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8495
 
 
 
 
8496
 
 
 
 
 
 
 
 
8497
 
 
 
8498
 
 
 
 
 
 
 
 
 
 
 
8499
 
8500
 
8501
 
8502
+ //-------------------------------------------------------------------------------------------------
8503
+ //-- IMPORT FROM TMPL GALLERY
8504
+ //-------------------------------------------------------------------------------------------------
8505
+ // self.updAPISetParams.params : {
8506
+ // action: "sek-import-tmpl-from-gallery"
8507
+ // assign_missing_locations: undefined
8508
+ // cloneId: ""
8509
+ // imported_content: {data: {…}, metas: {…}, img_errors: Array(0)}
8510
+ // is_global_location: false
8511
+ // scope: "local"
8512
+ // tmpl_import_mode: "replace"
8513
+ // }
8514
+ _updAPISet_sek_import_tmpl_from_gallery : function() {
8515
+ var self = this,
8516
+ params;
8517
 
8518
+ params = self.updAPISetParams.params;
 
 
 
 
 
 
 
8519
 
8520
+ api.infoLog( 'sek-import-tmpl-from-gallery', params );
8521
 
8522
+ // DO WE HAVE PROPER CONTENT DO IMPORT ?
8523
+ if ( _.isUndefined( params.imported_content.data ) || _.isUndefined( params.imported_content.metas ) ) {
8524
+ api.errare( 'updateAPISetting::sek-import-tmpl-from-gallery => invalid imported content', imported_content );
8525
+ return;
8526
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8527
 
8528
+ //-------------------------------------------------------------------------------------------------
8529
+ //-- HELPERS
8530
+ //-------------------------------------------------------------------------------------------------
8531
+ var _allTmplLocationsExistLocally = function() {
8532
+ var bool = true;
8533
+ _.each( tmplLocations, function( loc_id ){
8534
+ if (!bool)
8535
+ return;
8536
+ bool = _.contains(localLocations, loc_id);
8537
+ });
8538
+ return bool;
8539
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8540
 
8541
+ // @return bool
8542
+ var _isTmplHeaderLocId = function( loc_id ) {
8543
+ return params.imported_content && params.imported_content.metas && loc_id === params.imported_content.metas.tmpl_header_location;
8544
+ };
8545
 
8546
+ // @return bool
8547
+ var _isTmplFooterLocId = function( loc_id ) {
8548
+ return params.imported_content && params.imported_content.metas && loc_id === params.imported_content.metas.tmpl_footer_location;
8549
+ };
 
 
8550
 
8551
+ // The template has a header/footer if we find the header or the footer location
8552
+ // AND
8553
+ // if there's a local_header_footer property set in the local_options
8554
+ var _hasTmplHeaderFooter = function() {
8555
+ var hasHeaderFooterLoc = false;
8556
+ _.each( tmplLocations, function( loc_id ){
8557
+ if (hasHeaderFooterLoc)
8558
+ return;
8559
 
8560
+ if ( _isTmplHeaderLocId( loc_id ) || _isTmplFooterLocId( loc_id ) ) {
8561
+ hasHeaderFooterLoc = self.getLevelModel( loc_id, tmplCollection );
8562
+ hasHeaderFooterLoc = 'no_match' != hasHeaderFooterLoc;
8563
+ }
8564
+ });
8565
+ return hasHeaderFooterLoc && !_.isEmpty( tmplLocalOptions.local_header_footer );
8566
+ };
 
 
 
 
 
 
 
 
8567
 
8568
+ var _tmplUsesNBtemplate = function() {
8569
+ return tmplLocalOptions && tmplLocalOptions.template && 'nimble_template' === tmplLocalOptions.template.local_template;
8570
+ };
8571
 
8572
+ var tmplCollection = _.isArray( params.imported_content.data.collection ) ? $.extend( true, [], params.imported_content.data.collection ) : [],
8573
+ tmplLocations = params.imported_content.metas.tmpl_locations,
8574
+ localLocations = [],
8575
+ currentSettingCollection = self.updAPISetParams.newSetValue.collection;
 
 
8576
 
8577
+
8578
+ // Set the current local locations, make sure we exclude all global locations
8579
+ _.each( api.czr_sektions.activeLocations(), function( loc_id ) {
8580
+ if( !self.isGlobalLocationId(loc_id) ) {
8581
+ localLocations.push(loc_id);
 
 
 
8582
  }
8583
+ });
8584
+
8585
+ // Imported Active Locations has to be an array not empty
8586
+ if ( !_.isArray(tmplLocations) || _.isEmpty(tmplLocations) ) {
8587
+ api.errare( 'updateAPISetting::sek-import-tmpl-from-gallery => invalid imported template locations', params );
8588
+ return;
 
8589
  }
 
 
8590
 
8591
+ // TEMPLATE LOCAL OPTIONS and FONTS
8592
+ // Important :
8593
+ // - Local options is structured as an object : { local_header_footer: {…}, widths: {…}} }. But when not populated, it can be an array []. So make sure the type if set as object before merging it with current page local options
8594
+ // - Fonts is a collection described with an array
8595
+ var tmplLocalOptions = params.imported_content.data.local_options;
8596
+ tmplLocalOptions = $.extend( true, {}, _.isObject( tmplLocalOptions ) ? tmplLocalOptions : {} );
8597
+ var tmplFonts = params.imported_content.data.fonts;
8598
+ tmplFonts = _.isArray( tmplFonts ) ? $.extend( true, [], tmplFonts ) : [];
8599
+
8600
+ // Define variables uses for all cases
8601
+ var newSetValueCollection = $.extend( true, [], currentSettingCollection ),// Create a deep copy of the current API collection
8602
+ _allContentSectionsInTmpl = [],
8603
+ targetLocationId = '__not_set__',
8604
+ locModel,
8605
+ targetLocationModel,
8606
+ tmplLocCandidate, localLocCandidate;
8607
+
8608
+ // Gather all template content sections from potentially multiple locations in one collection
8609
+ // => header and footer locations are excluded from this collection
8610
+ // This collection is used :
8611
+ // - in 'replace' mode when template locations don't exists in the local context
8612
+ // - in 'before' and 'after' mode
8613
+ // Note : if this collection is used the template header and footer ( if any ) have to be added separately
8614
+ _.each( tmplCollection, function( loc_data ){
8615
+ if ( _isTmplHeaderLocId( loc_data.id ) || _isTmplFooterLocId( loc_data.id ) )
8616
+ return;
8617
+ if( !_.isEmpty( loc_data.collection ) ) {
8618
+ _allContentSectionsInTmpl = _.union( _allContentSectionsInTmpl, loc_data.collection );
8619
+ }
8620
+ });
8621
 
8622
 
8623
 
8624
+ // console.log('_hasTmplHeaderFooter ?', _hasTmplHeaderFooter() );
8625
+
8626
+ // console.log('_allContentSectionsInTmpl ?', _allContentSectionsInTmpl);
8627
+ // console.log('NEW SET VALUE COLLECTION? ', $.extend( true, [], newSetValueCollection ) );
8628
+ // If the current page already has NB sections, the user can chose 3 options : REPLACE, BEFORE, AFTER.
8629
+ // when the page has no NB sections, the default option is REPLACE
8630
+ switch( params.tmpl_import_mode ) {
8631
+ //-------------------------------------------------------------------------------------------------
8632
+ //-- REPLACE CASE ( default case )
8633
+ //-------------------------------------------------------------------------------------------------
8634
+ case 'replace' :
8635
+ // api.infoLog('CURRENT SETTING VALUE ?', self.updAPISetParams.newSetValue );
8636
+ // console.log('SO COLLECTION BEFORE ?', tmplCollection );
8637
+ // return bool
8638
+
8639
+ // IF ALL TEMPLATE LOCATIONS EXIST IN CURRENT PAGE
8640
+ // Loop on local locations, use template locations when exists, otherwise use local ones
8641
+ if ( _allTmplLocationsExistLocally() ) {
8642
+ // Replace locations from local collection that are provided by the tmpl, and not empty
8643
+ // => if the header / footer template location is empty, keep the local one
8644
+ // => the tmpl location will replace the local location in the collection
8645
+ newSetValueCollection = [];
8646
+ var resetLocalLocation, newLocalLocation;
8647
+ _.each( currentSettingCollection, function( _localLocation ) {
8648
+ tmplLocCandidate = _.findWhere(tmplCollection, { id : _localLocation.id }) || {};
8649
+ if ( _.isEmpty( tmplLocCandidate.collection ) ) {
8650
+ if ( self.isHeaderLocation( _localLocation.id ) || self.isFooterLocation( _localLocation.id ) ) {
8651
+ newSetValueCollection.push( _localLocation );
8652
+ } else {
8653
+ // Reset previous local location to defaults
8654
+ resetLocalLocation = { collection : [], options :[] };
8655
+ newLocalLocation = $.extend( true, {}, _localLocation );
8656
+ newLocalLocation = $.extend( newLocalLocation, resetLocalLocation );
8657
+ newSetValueCollection.push( newLocalLocation );
8658
+ }
8659
+ } else {
8660
+ newSetValueCollection.push( tmplLocCandidate );
8661
+ }
8662
+ });
8663
+ // console.log('tmplCollection ??', tmplCollection );
8664
+ // console.log('localLocations ??', localLocations);
8665
+ } else {
8666
+ // IF TEMPLATE LOCATIONS DO NOT MATCH THE ONES OF THE CURRENT PAGE => ASSIGN ALL TEMPLATE SECTIONS TO LOOP_START OR First local content location
8667
+ if ( _tmplUsesNBtemplate() ) {
8668
+ targetLocationId = 'loop_start';
8669
+ } else {
8670
+ if ( _.contains(localLocations, 'loop_start') ) {
8671
+ targetLocationId = 'loop_start';
8672
+ } else {
8673
+ _.each( localLocations, function( loc_id ) {
8674
+ if ( !self.isHeaderLocation( loc_id ) && !self.isFooterLocation( loc_id ) ) {
8675
+ targetLocationId = loc_id;
8676
+ }
8677
+ });
8678
+ }
8679
+ }
8680
+ // At this point, we need a target location id
8681
+ if ( '__not_set__' === targetLocationId ) {
8682
+ api.errare( 'updateAPISetting::sek-import-tmpl-from-gallery => target location id is empty' );
8683
+ break;
8684
+ }
8685
 
8686
+ // Get the current target location model
8687
+ targetLocationModel = self.getLevelModel( targetLocationId, newSetValueCollection );
8688
+ if ( 'no_match' === targetLocationModel ) {
8689
+ api.errare('::_updAPISet_sek_import_tmpl_from_gallery => error => target location id ' + targetLocationId );
8690
+ break;
8691
+ }
8692
+ targetLocationModel = $.extend( true, {}, targetLocationModel );// <= create a deep copy
8693
+
8694
+ // Replace the target location collection with the template one
8695
+ targetLocationModel.collection = _allContentSectionsInTmpl;
8696
+
8697
+ // remove all locations from future setting value
8698
+ newSetValueCollection = [];
8699
+
8700
+ // If the template has a header/footer use it
8701
+ // else, if a header footer is defined locally
8702
+ if ( _hasTmplHeaderFooter() ) {
8703
+ _.each( tmplLocations, function( loc_id ) {
8704
+ if ( _isTmplHeaderLocId( loc_id ) || _isTmplFooterLocId( loc_id ) ) {
8705
+ tmplLocCandidate = self.getLevelModel( loc_id, tmplCollection );
8706
+ if ( 'no_match' === tmplLocCandidate ) {
8707
+ api.errare('::_updAPISet_sek_import_tmpl_from_gallery => error => location id ' + loc_id +' not found in template collection');
8708
+ return;
8709
+ } else {
8710
+ newSetValueCollection.push( tmplLocCandidate );
8711
+ }
8712
+ }
8713
+ });
8714
+ }
8715
 
 
 
 
 
 
 
8716
 
8717
+ // Populate the local target location with the template section collection
8718
+ // AND
8719
+ // Re-populate the header and footer location, either with the local one, or the template one ( if any)
8720
+ _.each( localLocations, function( loc_id ) {
8721
+ if ( targetLocationId === loc_id ) {
8722
+ newSetValueCollection.push( targetLocationModel );
8723
+ }
8724
+ localLocModel = self.getLevelModel( loc_id, currentSettingCollection );
8725
+ if ( 'no_match' === localLocModel ) {
8726
+ api.errare('::_updAPISet_sek_import_tmpl_from_gallery => error => location id ' + loc_id +' not found in current setting collection');
8727
+ return;
8728
+ }
8729
+ // re-add header and footer if _hasTmplHeaderFooter()
8730
+ if ( !_hasTmplHeaderFooter() ) {
8731
+ if ( self.isHeaderLocation( loc_id ) || self.isFooterLocation( loc_id ) ) {
8732
+ newSetValueCollection.push( localLocModel );
8733
+ }
8734
+ }
8735
+ });
8736
+ }
8737
+ break;
8738
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8739
 
8740
+ //-------------------------------------------------------------------------------------------------
8741
+ //-- INJECT BEFORE CASE
8742
+ //-------------------------------------------------------------------------------------------------
8743
+ case 'before' :
8744
+ // For the before case, we are sure that hasCurrentPageNBSectionsNotHeaderFooter() is true
8745
+ // so there's at least one location that has section(s)
8746
+ // Find the first non header/footer location not empty
8747
+ _.each( localLocations, function( loc_id ){
8748
+ // stop if the location id has been found
8749
+ if ( '__not_set__' != targetLocationId )
8750
+ return;
8751
+
8752
+ locModel = self.getLevelModel( loc_id, newSetValueCollection );
8753
+ if ( 'no_match' === locModel ) {
8754
+ api.errare('::_updAPISet_sek_import_tmpl_from_gallery => error => location id not found' + loc_id );
8755
+ return;
8756
  }
8757
+ if ( !self.isHeaderLocation( loc_id ) && !self.isFooterLocation( loc_id ) ) {
8758
+ if ( !_.isEmpty( locModel.collection ) ) {
8759
+ targetLocationId = loc_id;
8760
+ targetLocationModel = locModel;
8761
+ }
8762
  }
8763
+ });
8764
 
8765
+ // At this point, we need a target location id
8766
+ if ( '__not_set__' === targetLocationId ) {
8767
+ api.errare( 'updateAPISetting::sek-import-tmpl-from-gallery => target location id is empty' );
8768
+ break;
8769
+ }
8770
 
8771
+ // Get the current target location model
8772
+ targetLocationModel = $.extend( true, {}, targetLocationModel );
 
8773
 
8774
+ // Adds the template sections BEFORE the existing sections of the target location
8775
+ targetLocationModel.collection = _.union( _allContentSectionsInTmpl, targetLocationModel.collection );
 
 
 
 
 
 
 
 
8776
 
8777
+ // remove all locations from future setting value
8778
+ newSetValueCollection = [];
8779
 
8780
+ // Re-populate the location models previously removed the updated target location model
8781
+ _.each( localLocations, function( loc_id ){
8782
+ if ( targetLocationId === loc_id ) {
8783
+ newSetValueCollection.push( targetLocationModel );
8784
+ } else {
8785
+ if ( 'no_match' === locModel ) {
8786
+ api.errare('::_updAPISet_sek_import_tmpl_from_gallery => error => location id not found' + loc_id );
8787
+ return;
8788
+ }
8789
+ newSetValueCollection.push( self.getLevelModel( loc_id, currentSettingCollection ) );
8790
+ }
8791
+ });
8792
+ break;
8793
+
8794
+ //-------------------------------------------------------------------------------------------------
8795
+ //-- INJECT AFTER CASE
8796
+ //-------------------------------------------------------------------------------------------------
8797
+ case 'after' :
8798
+ // For the after case, we are sure that hasCurrentPageNBSectionsNotHeaderFooter() is true
8799
+ // so there's at least one location that has section(s)
8800
+ // Find the last non header/footer location not empty
8801
+ _.each( localLocations.reverse(), function( loc_id ){
8802
+ // stop if the location id has been found
8803
+ if ( '__not_set__' != targetLocationId )
8804
+ return;
8805
+
8806
+ locModel = self.getLevelModel( loc_id, newSetValueCollection );
8807
+ if ( 'no_match' === locModel ) {
8808
+ api.errare('::_updAPISet_sek_import_tmpl_from_gallery => error => location id not found' + loc_id );
8809
+ return;
8810
+ }
8811
+ if ( !self.isHeaderLocation( loc_id ) && !self.isFooterLocation( loc_id ) ) {
8812
+ if ( !_.isEmpty( locModel.collection ) ) {
8813
+ targetLocationId = loc_id;
8814
+ targetLocationModel = locModel;
8815
+ }
8816
+ }
8817
+ });
8818
+
8819
+ // At this point, we need a target location id
8820
+ if ( '__not_set__' === targetLocationId ) {
8821
+ api.errare( 'updateAPISetting::sek-import-tmpl-from-gallery => target location id is empty' );
8822
+ break;
8823
  }
 
 
 
 
8824
 
8825
+ // Get the current target location model
8826
+ targetLocationModel = $.extend( true, {}, targetLocationModel );
 
 
 
 
 
 
 
 
8827
 
8828
+ // Adds the template sections AFTER the existing sections of the target location
8829
+ targetLocationModel.collection = _.union( targetLocationModel.collection, _allContentSectionsInTmpl );
8830
 
8831
+ // remove all locations from future setting value
8832
+ newSetValueCollection = [];
8833
 
8834
+ // Re-populate the location models previously removed the updated target location model
8835
+ _.each( localLocations, function( loc_id ){
8836
+ if ( targetLocationId === loc_id ) {
8837
+ newSetValueCollection.push( targetLocationModel );
8838
+ } else {
8839
+ locModel = self.getLevelModel( loc_id, currentSettingCollection );
8840
+ if ( 'no_match' === locModel ) {
8841
+ api.errare('::_updAPISet_sek_import_tmpl_from_gallery => error => loc id not found' + loc_id );
8842
+ return;
8843
+ }
8844
+ newSetValueCollection.push( locModel );
8845
+ }
8846
+ });
8847
+ break;
8848
+ }
8849
 
8850
+ // update the API setting
8851
+ // this is a candiate setting value, the new setting value will be validated in ::updateAPISetting => ::validateSettingValue()
8852
+ self.updAPISetParams.newSetValue.collection = newSetValueCollection;
8853
 
8854
+ // LOCAL OPTIONS
8855
+ // local_options states if the imported template uses nimble_template, or use custom_width, custom_css, performance, etc.. see the full list of local options in ::generateUIforLocalSkopeOptions
8856
+ // Design decision : by default NB extends existing local options with the imported ones.
8857
+ // import mode :
8858
+ // 'replace' (default) => local options extended
8859
+ // insert 'before' or 'after' => existing local options are preserved
8860
+ //
8861
+ // Scenario :
8862
+ // 1) user has created NB sections on a single post and wants to insert a NB template before the existing sections ( 'before' import_mode )
8863
+ // => in this case, we need to keep the default theme template, local options must be the existing ones => no extension of local options.
8864
+ //
8865
+ // 2) the current page has no NB sections yet, import mode is 'replace' by default
8866
+ // => it means that if the imported template uses NB template as canvas, it must be set in local options => extension of local options
8867
+ if ( !_.isEmpty( tmplLocalOptions ) && 'replace' === params.tmpl_import_mode ) {
8868
+ var currentLocalOptions = self.updAPISetParams.newSetValue.local_options;
8869
+ currentLocalOptions = $.extend( true, {}, _.isObject( currentLocalOptions ) ? currentLocalOptions : {} );
8870
+ self.updAPISetParams.newSetValue.local_options = _.extend( currentLocalOptions, tmplLocalOptions );
8871
+ }
8872
 
8873
+ // FONTS
8874
+ // If there are imported fonts, we need to merge when import mode is not 'replace', otherwise we need to copy the imported font collection in .fonts property of the API setting.
8875
+ if ( _.isArray( tmplFonts ) && !_.isEmpty( tmplFonts ) ) {
8876
+ if ( 'replace' != params.tmpl_import_mode ) {
8877
+ var currentFonts = self.updAPISetParams.newSetValue.fonts;
8878
+ currentFonts = $.extend( true, [], _.isArray( currentFonts ) ? currentFonts : [] );
8879
+ // merge two collection of fonts without duplicates
8880
+ self.updAPISetParams.newSetValue.fonts = _.uniq( _.union( tmplFonts, currentFonts ));
8881
+ } else {
8882
+ self.updAPISetParams.newSetValue.fonts = tmplFonts;
8883
+ }
8884
+ }
 
 
 
8885
 
8886
+ //api.infoLog('SETTING VALUE AFTER ?', self.updAPISetParams.newSetValue );
8887
+ }//_updAPISet_sek_import_tmpl_from_gallery
 
 
 
 
 
 
8888
 
 
 
8889
  });//$.extend()
8890
  })( wp.customize, jQuery );//global sektionsLocalizedData
8891
  var CZRSeksPrototype = CZRSeksPrototype || {};
9123
  return walkCollection( id ) !== 'no_match';
9124
  },
9125
 
9126
+ // @return bool
9127
+ isGlobalLocationId : function( id ) {
9128
+ var _locCollection = this.activeLocationsInfo(),
9129
+ _currentLocInfo = !_.isArray( _locCollection ) ? {} : _.findWhere( _locCollection, { id : id } );
9130
+ return _.isObject( _currentLocInfo ) && _currentLocInfo.is_global;
9131
+ },
9132
+
9133
  // @return bool
9134
  // June 2020 : introduced for https://github.com/presscustomizr/nimble-builder-pro/issues/6
9135
  isHeaderLocation : function( id ) {
9141
  // @return bool
9142
  // June 2020 : introduced for https://github.com/presscustomizr/nimble-builder-pro/issues/6
9143
  isFooterLocation : function( id ) {
9144
+ var _locCollection = this.activeLocationsInfo(),
9145
  _currentLocInfo = !_.isArray( _locCollection ) ? {} : _.findWhere( _locCollection, { id : id } );
9146
  return _.isObject( _currentLocInfo ) && _currentLocInfo.is_footer;
9147
  },
10009
  // @see api.czrInputMap['code_editor']
10010
  // @see https://github.com/presscustomizr/nimble-builder/issues/176
10011
  $control.trigger( "true" == $control.attr('data-sek-expanded') ? 'sek-accordion-expanded' : 'sek-accordion-collapsed' );
10012
+ if ( true === $control.data('module_ready_on_custom_control_event_is_setup' ) ) {
10013
+ $control.trigger( 'sek-accordion-expanded' );
10014
+ } else {
10015
+ $control.one('module_ready_on_custom_control_event_is_setup', function() {
10016
+ $control.trigger( 'sek-accordion-expanded' );
10017
+ });
10018
+
10019
+ }
10020
  });
10021
 
10022
  _section_.container.data('sek-module-accordion-has-been-setup', true );
10051
  // Nov 2020 => make sure the setup has been done on the control so that it reacts on a on custom event ( here 'sek-accordion-expanded' )
10052
  // see fmk CZRModuleMths::initialize
10053
  // event defined on module registration with api.czrModuleMap[ module.module_type ].ready_on_section_expanded
10054
+ if ( true === _ctrl_.container.data('module_ready_on_custom_control_event_is_setup' ) ) {
10055
  _ctrl_.container.trigger( 'sek-accordion-expanded' );
10056
  } else {
10057
  _ctrl_.container.one('module_ready_on_custom_control_event_is_setup', function() {
10188
  this.bind( function( to ) {
10189
  item.czr_Input( controlledInputId ).visible( visibilityCallBack() );
10190
  });
10191
+ },
10192
+
10193
+
10194
+ //-------------------------------------------------------------------------------------------------
10195
+ //-- TEMPLATE HELPERS
10196
+ // Dec 2020
10197
+ //-------------------------------------------------------------------------------------------------
10198
+
10199
+ // @return boolean
10200
+ // introduced when implementing #655
10201
+ // When importing a template, if current page has NB sections, out of header and footer, display an import dialog, otherwise import now
10202
+ hasCurrentPageNBSectionsNotHeaderFooter : function() {
10203
+ var self = this,
10204
+ _bool = false,
10205
+ _collection,
10206
+ localCollSetId = this.localSectionsSettingId(),
10207
+ localColSetValue = api(localCollSetId)(),
10208
+ activeLocationInfos = this.activeLocationsInfo();
10209
+
10210
+ localColSetValue = _.isObject( localColSetValue ) ? localColSetValue : {};
10211
+ _collection = $.extend( true, {}, localColSetValue );
10212
+ _collection = ! _.isEmpty( _collection.collection ) ? _collection.collection : [];
10213
+ _collection = _.isArray( _collection ) ? _collection : [];
10214
+ _.each( _collection, function( loc_data ){
10215
+ if ( _bool )
10216
+ return;
10217
+ if ( _.isObject(loc_data) && 'location' == loc_data.level && loc_data.collection ) {
10218
+ // skip if the location is a header
10219
+ if ( !self.isHeaderLocation( loc_data.id ) && !self.isFooterLocation( loc_data.id ) ) {
10220
+ _bool = !_.isEmpty( loc_data.collection );
10221
+ }
10222
+ }
10223
+ });
10224
+ return _bool;
10225
  }
10226
  });//$.extend()
10227
  })( wp.customize, jQuery );//global sektionsLocalizedData
11397
 
11398
 
11399
 
 
 
 
 
 
 
11400
  ////////////////////////////////////////////////////////
11401
+ // IMPORT TEMPLATE FROM FILE
11402
  ////////////////////////////////////////////////////////
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11403
  // @params
11404
  // {
11405
  // is_file_import : true,
11408
  // input : <= input instance when import is manual
11409
  // file_input : $file_input
11410
  // }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11411
  import_template_from_file : function( params ) {
11412
+ //console.log('import_template_from_file ??', params );
11413
 
11414
  params = params || {};
11415
  // normalize params
11571
  //console.log('MANUAL IMPORT DATA', server_resp );
11572
  server_resp.data.data.collection = api.czr_sektions.setIdsForImportedTmpl( server_resp.data.data.collection );
11573
  // and try to update the api setting
11574
+ api.czr_sektions.doUpdateApiSettingAfter_FileImport( server_resp, params );
11575
  })
11576
  .fail( function( response ) {
11577
  api.errare( '::import_template => ajax error', response );
11589
  });
11590
  })
11591
  .always( function() {
11592
+ api.czr_sektions.doAlwaysAfterFileImportAndApiSettingUpdate( params );
11593
  });
11594
  },//import_template_from_file
11595
 
11664
  ].join('')
11665
  });
11666
  if ( params.is_file_import ) {
11667
+ api.czr_sektions.doAlwaysAfterFileImportAndApiSettingUpdate( params );
11668
  }
11669
  }
11670
  },//pre_checks_from_file_import
11815
  // fired on ajaxrequest done
11816
  // At this stage, the server_resp data structure has been validated.
11817
  // We can try to the update the api setting
11818
+ doUpdateApiSettingAfter_FileImport : function( server_resp, params ){
11819
+ //console.log('doUpdateApiSettingAfter_FileImport ???', params, server_resp );
11820
  params = params || {};
11821
  if ( !api.czr_sektions.isImportedContentEligibleForAPI( server_resp, params ) && params.is_file_import ) {
11822
+ api.czr_sektions.doAlwaysAfterFileImportAndApiSettingUpdate( params );
11823
  return;
11824
  }
11825
 
11877
  ].join('')
11878
  });
11879
  }).fail( function( response ) {
11880
+ api.errare( '::doUpdateApiSettingAfter_FileImport => error when firing ::updateAPISetting', response );
11881
  api.previewer.trigger('sek-notify', {
11882
  notif_id : 'import-failed',
11883
  type : 'error',
11894
 
11895
  // Refresh the preview, so the markup is refreshed and the css stylesheet are generated
11896
  api.previewer.refresh();
11897
+ },//doUpdateApiSettingAfter_FileImport()
11898
 
11899
 
11900
 
11906
 
11907
 
11908
  // Fired when params.is_file_import only
11909
+ doAlwaysAfterFileImportAndApiSettingUpdate : function( params ) {
11910
  api.previewer.send( 'sek-clean-loader', { cleanFullPageLoader : true });
11911
 
11912
  params = params || {};
11942
  ////////////////////////////////////////////////////////
11943
  // APRIL 2020 : for https://github.com/presscustomizr/nimble-builder/issues/651
11944
  setupTemplateGallery : function() {
 
 
11945
  var self = this;
11946
  self.templateGalleryExpanded = new api.Value(false);
11947
+ self.tmplImportDialogVisible = new api.Value(false);// Hidden by default
11948
  if ( !sektionsLocalizedData.isTemplateGalleryEnabled )
11949
  return;
11950
 
11951
  self.templateGalleryExpanded.bind( function( expanded ) {
 
 
11952
  self.cachedElements.$body.toggleClass( 'sek-template-gallery-expanded', expanded );
11953
  if ( expanded ) {
11954
  // close template saver
11955
  // close level tree
11956
  self.tmplDialogVisible(false);
11957
  self.levelTreeExpanded(false);
11958
+ self.tmplImportDialogVisible(false);
11959
  $('#customize-preview iframe').css('z-index', 1);
11960
  self.renderOrRefreshTempGallery();
11961
  } else {
11963
  }
11964
  });
11965
 
11966
+ self.tmplImportDialogVisible.bind( function( expanded ) {
11967
+ self.cachedElements.$body.toggleClass( 'sek-tmpl-dialog-expanded', expanded );
11968
+ if ( expanded ) {
11969
+ // close template saver
11970
+ // close level tree
11971
+ self.tmplDialogVisible(false);
11972
+ self.levelTreeExpanded(false);
11973
+ $('#customize-preview iframe').css('z-index', 1);
11974
+ }
11975
+ });
11976
+
11977
  // API READY
11978
  api.previewer.bind('ready', function() {
11979
  self.templateGalleryExpanded( false );
12015
  });
12016
  },
12017
 
12018
+
12019
  // @return void()
12020
  setupTmplGalleryDOMEvents : function() {
12021
  var $galWrapper = $('#nimble-tmpl-gallery');
12022
  var self = this;
12023
  $galWrapper
12024
  // Schedule click event with delegation
12025
+ // PICK A TEMPLATE
12026
  .on('click', '.sek-tmpl-item .use-tmpl', function( evt ) {
12027
  evt.preventDefault();
12028
  evt.stopPropagation();
12029
  var tmpl_id = $(this).closest('.sek-tmpl-item').data('sek-tmpl-item-id');
12030
  if ( _.isEmpty(tmpl_id) ) {
12031
  api.errare('::setupTmplGalleryDOMEvents => error => invalid template id');
12032
+ return;
12033
  }
 
 
 
12034
 
12035
+ // if current page has NB sections, display an import dialog, otherwise import now
12036
+ if ( self.hasCurrentPageNBSectionsNotHeaderFooter() ) {
12037
+ self._tmplNameWhileImportDialog = tmpl_id;
12038
+ self.tmplImportDialogVisible(true);
12039
+ } else {
12040
+ //api.czr_sektions.get_gallery_tmpl_json_and_import( $(this).data('sek-tmpl-item-id') );
12041
+ //api.czr_sektions.get_gallery_tmpl_json_and_import( {template_name : 'test_one', from: 'nimble_api'});// FOR TEST PURPOSES UNTIL THE COLLECTION IS SETUP
12042
+ api.czr_sektions.get_gallery_tmpl_json_and_import( {template_name : tmpl_id, from: 'user'});
12043
+ self.templateGalleryExpanded(false);
12044
+ }
12045
+ })
12046
+ // PICK AN IMPORT MODE WHEN PAGE HAS SECTIONS ALREADY
12047
+ .on('click', '.sek-tmpl-gal-import-dialog .sek-ui-button', function( evt ) {
12048
+ evt.preventDefault();
12049
+ evt.stopPropagation();
12050
+ // 3 possible import modes : replace, before, after
12051
+ var tmpl_import_mode = $(this).data('sek-tmpl-import-mode');
12052
+ if ( !_.contains(['replace', 'before', 'after'], tmpl_import_mode ) ) {
12053
+ api.errare('::setupTmplGalleryDOMEvents => error => invalid import mode');
12054
+ return;
12055
+ }
12056
+ api.czr_sektions.get_gallery_tmpl_json_and_import({
12057
+ template_name : self._tmplNameWhileImportDialog,
12058
+ from: 'user',
12059
+ tmpl_import_mode: tmpl_import_mode
12060
+ });
12061
+ // api.czr_sektions.get_gallery_tmpl_json_and_import({
12062
+ // template_name : 'test_one',
12063
+ // from: 'nimble_api',
12064
+ // tmpl_import_mode: tmpl_import_mode
12065
+ // });
12066
  self.templateGalleryExpanded(false);
12067
  })
12068
+ // SEARCH ACTIONS
12069
  .on('propertychange change click keyup input paste', '.sek-filter-tmpl', _.debounce( function(evt) {
12070
  evt.preventDefault();
12071
  var _s = $(this).val();
12072
+ //console.log('searched string ??', _s );
12073
  var _reset = function() {
12074
  $galWrapper.removeClass('search-active');
12075
  $galWrapper.find('.sek-tmpl-item').each( function() {
12098
  }
12099
 
12100
  }, 100 ) )
12101
+ // REMOVE
12102
  .on( 'click', '.sek-tmpl-info .remove-tmpl', function(evt) {
12103
  evt.preventDefault();
12104
  var _focusOnRemoveCandidate = function( mode ) {
14960
  };
14961
 
14962
  init_settings.wpautop = isAutoPEnabled();
14963
+
14964
  // forced_root_block is added to remove <p> tags automatically added
14965
  // @see https://stackoverflow.com/questions/20464028/how-to-remove-unwanted-p-tags-from-wordpress-editor-using-tinymce
14966
  if ( !isAutoPEnabled() ) {
14971
  init_settings.toolbar1 = sektionsLocalizedData.defaultToolbarBtns;
14972
  init_settings.toolbar2 = "";
14973
 
14974
+
14975
  window.tinymce.init( init_settings );
14976
  window.QTags.getInstance( _id );
14977
  // wp.editor.initialize( _id, {
14992
  // To ensure retro-compat with content created prior to Nimble v1.5.2, in which the editor has been updated
14993
  // @see https://github.com/presscustomizr/nimble-builder/issues/404
14994
  // we add the <p> tag on init, if autop option is checked
14995
+ // December 2020 : when running wp.editor.autop( input() , line break not preserved when re-opening a text module UI,
14996
+ // see https://github.com/presscustomizr/nimble-builder/issues/769
14997
+ // var initial_content = ( !isAutoPEnabled() || ! _.isFunction( wp.editor.autop ) ) ? input() : wp.editor.autop( input() );
14998
+ // console.log('INITIAL CONTENT', input(), wp.editor.autop( input() ) );
14999
+ var initial_content = input();
15000
  _editor.setContent( initial_content );
15001
  api.sekEditorExpanded( true );
15002
  // trigger a resize to adjust height on init https://github.com/presscustomizr/nimble-builder/issues/409
15127
  })
15128
  .fail( function( error_resp ) {
15129
  api.errare( 'import_export_ input => pre_checks_from_file_import failed', error_resp );
15130
+ api.czr_sektions.doAlwaysAfterFileImportAndApiSettingUpdate({
15131
  input : input,
15132
  file_input : $file_input
15133
  });
15152
  });
15153
  break;
15154
  case 'sek-cancel-import' :
15155
+ api.czr_sektions.doAlwaysAfterFileImportAndApiSettingUpdate({
15156
  input : input,
15157
  file_input : $file_input
15158
  });
assets/czr/sek/js/ccat-sek-control.min.js CHANGED
@@ -1 +1 @@
1
- !function(p,m){p.CZR_Helpers.getInputSubTemplate=function(e){return 0<m("#tmpl-nimble-subtemplate___"+e).length?wp.template("nimble-subtemplate___"+e):(p.errare("problem in api.czr_sektions.getInputSubTemplate(), missing js template in the DOM for template_name : "+e),null)};var f=p.CZR_Helpers.getModuleTmpl;p.CZR_Helpers.getModuleTmpl=function(n){if(-1===(n=_.extend({tmpl:"",module_type:"",module_id:"",cache:!0,nonce:p.settings.nonce.save},n)).module_id.indexOf("__nimble__"))return f(n);var o=m.Deferred();if((_.isEmpty(n.tmpl)||_.isEmpty(n.module_type))&&o.reject("api.CZR_Helpers.getModuleTmpl => missing tmpl or module_type param"),!p.czr_sektions.isModuleRegistered(n.module_type))return o.reject("api.CZR_Helpers.getModuleTmpl => module type not registered"),o.resolve(),f(n);if(_.contains([],n.module_type))return o.resolve(),f(n);var e=p.czr_sektions.getRegisteredModuleProperty(n.module_type,"tmpl"),t=_.isObject(e)&&e[n.tmpl]?e[n.tmpl]:{};!_.isEmpty(t)&&_.isObject(t)||(p.errare("getModuleTmpl => Error empty or invalid input map for module : ",n.module_type),o.reject("getModuleTmpl => Error empty or invalid input map for module : ",n.module_type));var r=n.item_model,i=m.extend(!0,{},p.czr_sektions.getDefaultItemModelFromRegisteredModuleData(n.module_type)),s=m.extend(!0,{},i);r=m.extend(s,r),_.isEmpty(r)&&(p.errare("getModuleTmpl => Error invalid item model for module : ",n.module_type),o.reject("getModuleTmpl => Error invalid item model for module : ",n.module_type));var a,c="",l=function(e){var i="";return _.each(e,function(e,t){a=e.input_type;try{i+=wp.template("nimble-input-wrapper")({input_type:a,input_data:e,input_id:t,item_model:r,input_tmpl:function(e){var t=e;switch(e){case"czr_layouts":case"select":case"simpleselect":case"fa_icon_picker":case"font_picker":case"animation_picker":t="simpleselect";break;case"simpleselectWithDeviceSwitcher":t="simpleselect_deviceswitcher";break;case"multiselect":case"category_picker":t="multiselect";break;case"h_alignment":case"horizAlignmentWithDeviceSwitcher":t="h_alignment";break;case"h_text_alignment":case"horizTextAlignmentWithDeviceSwitcher":t="h_text_alignment";break;case"range_simple":case"range_simple_device_switcher":t="range_simple";break;case"number_simple":t="number_simple";break;case"font_size":case"line_height":case"range_with_unit_picker":case"range_with_unit_picker_device_switcher":t="range_with_unit_picker";break;case"spacing":case"spacingWithDeviceSwitcher":t="spacing";break;case"upload":case"upload_url":t="upload";break;case"bg_position":case"bgPositionWithDeviceSwitcher":t="bg_position";break;case"verticalAlignWithDeviceSwitcher":t="v_alignment"}return 0<m("#tmpl-nimble-input___"+t).length?wp.template("nimble-input___"+t):(p.errare("problem in getInputTemplate(), missing js template in the DOM for input_type : "+e),null)}(a),control_id:n.control_id})}catch(e){return p.errare("getModuleTmpl => Error when parsing the nimble-input-wrapper template",e),o.reject("getModuleTmpl => Error when parsing the nimble-input-wrapper template"),!1}}),i};if(t.tabs){var d="",u="";_.each(t.tabs,function(e,t){var i=m.extend(!0,{},e);i=m.extend({inputs:{},title:""},i);var n=_.isEmpty(i.attributes)?"":i.attributes;d+='<li data-tab-id="section-topline-'+(+t+1)+'" '+n+'><a href="#" title="'+i.title+'"><span>'+i.title+"</span></a></li>";var o=l(i.inputs);u+='<section id="section-topline-'+(+t+1)+'">'+o+"</section>"}),c+=['<div class="tabs tabs-style-topline">',"<nav>","<ul>",d,"</ul>","</nav>",'<div class="content-wrap">',u,"</div>","</div>"].join("")}else c=l(t);return o.resolve(c).promise()}}(wp.customize,jQuery);var CZRSeksPrototype=CZRSeksPrototype||{};!function(r,s){s.extend(CZRSeksPrototype,{cachedElements:{$body:s("body"),$window:s(window)},initialize:function(){var e=this;if(_.isUndefined(window.sektionsLocalizedData))throw new Error("CZRSeksPrototype => missing localized server params sektionsLocalizedData");if(!_.isFunction(r.czr_activeSkopes))throw new Error("CZRSeksPrototype => api.czr_activeSkopes");e.SECTION_ID_FOR_GLOBAL_OPTIONS="__globalOptionsSectionId",e.SECTION_ID_FOR_LOCAL_OPTIONS="__localOptionsSection",e.SECTION_ID_FOR_CONTENT_PICKER="__content_picker__",e.MAX_NUMBER_OF_COLUMNS=12,e.SETTING_UPDATE_BUFFER=100,e.TINYMCE_EDITOR_HEIGHT=100,e.defaultLocalSektionSettingValue=e.getDefaultSektionSettingValue("local"),e.localSectionsSettingId=new r.Value({}),e.registered=new r.Value([]),wp.customize.apiIsReady?e.doSektionThinksOnApiReady():r.bind("ready",function(){e.doSektionThinksOnApiReady()}),r.bind("save-request-params",function(e){s.extend(e,{local_skope_id:r.czr_skopeBase.getSkopeProperty("skope_id"),active_locations:r.czr_sektions.activeLocations()})});var t=function(){_.isArray(r.czrActiveWPEditors)&&(_.each(r.czrActiveWPEditors,function(e){wp.editor.remove(e)}),r.czrActiveWPEditors=[])};r.bind("sek-before-clean-registered",t),r.bind("czr-all-items-closed",t)},doSektionThinksOnApiReady:function(){var o=this;o.registerAndSetupDefaultPanelSectionOptions(),o.localSectionsSettingId.callbacks.add(function(e,t){try{o.setupSettingsToBeSaved()}catch(e){r.errare("Error in self.localSectionsSettingId.callbacks => self.setupSettingsToBeSaved()",e)}o.initializeHistoryLogWhenSettingsRegistered(),r.previewer.send("sek-request-active-locations")});var i=function(e,t){o.setContextualCollectionSettingIdWhenSkopeSet(e,t),r.section(o.SECTION_ID_FOR_LOCAL_OPTIONS,function(e){e.deferred.embedded.done(function(){!0!==e.boundForLocalOptionGeneration&&(e.boundForLocalOptionGeneration=!0,e.expanded.bind(function(e){!0===e&&o.generateUI({action:"sek-generate-local-skope-options-ui"})}))})}),r.section(o.SECTION_ID_FOR_GLOBAL_OPTIONS,function(e){!0!==e.nimbleGlobalOptionGenerated&&(o.generateUI({action:"sek-generate-global-options-ui"}),e.nimbleGlobalOptionGenerated=!0)}),o.nb_is_ready=!0,r.trigger("nimble-ready-for-current-skope")};_.isEmpty(r.czr_activeSkopes().local)||i(),r.czr_activeSkopes.callbacks.add(function(e,t){i(e,t)}),o.reactToPreviewMsg(),o.setupDnd(),o.setupTinyMceEditor(),o.schedulePrintSectionJson(),r.previewedDevice.bind(function(t){var e=_.filter(o.registered(),function(e){return"control"==e.what});_.each(e||[],function(e){r.control(e.id,function(e){e.container.find('[data-sek-device="'+t+'"]').each(function(){s(this).trigger("click")})})})}),s("#customize-notifications-area").on("click",'[data-sek-reset="true"]',function(){r.previewer.trigger("sek-reset-collection",{scope:"local"})}),o.bind("sek-ui-pre-removal",function(e){"control"==e.what&&-1<e.id.indexOf("draggable")&&r.control(e.id,function(e){e.container.find("[draggable]").each(function(){s(this).off("dragstart dragend")})}),"control"==e.what&&r.control(e.id,function(e){e.container.find("select").each(function(){_.isUndefined(s(this).data("czrSelect2"))||s(this).czrSelect2("destroy")})})}),r.bind("czr-new-registered",function(e){if(_.isUndefined(e.origin))throw new Error("czr-new-registered event => missing params.origin");if("nimble"===e.origin&&!1!==e.track){var t=o.registered(),i=s.extend(!0,[],t),n=_.findWhere(i,{id:e.id});if(!_.isEmpty(n)&&_.isEqual(n,e))throw new Error("register => duplicated element in self.registered() collection "+e.id);i.push(e),o.registered(i)}}),o.activeLocations=new r.Value([]),o.activeLocationsInfo=new r.Value([]),r.previewer.bind("sek-active-locations-in-preview",function(e){o.activeLocations(_.isObject(e)&&_.isArray(e.active_locations)?e.active_locations:[]),o.activeLocationsInfo(_.isObject(e)&&_.isArray(e.active_locs_info)?e.active_locs_info:[])}),o.setupTopBar(),o.setupSaveSectionUI(),o.setupSaveTmplUI(),o.lastClickedTargetInPreview=new r.Value,o.lastClickedTargetInPreview.bind(function(e,t){_.isObject(e)&&e.id?r.previewer.send("sek-set-double-click-target",e):r.previewer.send("sek-reset-double-click-target"),clearTimeout(o.cachedElements.$window.data("_preview_target_timer_")),o.cachedElements.$window.data("_preview_target_timer_",setTimeout(function(){o.lastClickedTargetInPreview({}),r.previewer.send("sek-reset-double-click-target")},2e4))}),r.previewer.bind("sek-clean-target-drop-zone",function(){o.lastClickedTargetInPreview({})}),s(document).keydown(function(e){e&&27===e.keyCode&&o.lastClickedTargetInPreview({})}),sektionsLocalizedData.hasActiveCachePlugin&&_.delay(function(){r.previewer.trigger("sek-notify",{notif_id:"has-active-cache-plugin",type:"info",duration:2e4,message:['<span style="color:#0075a2">',sektionsLocalizedData.i18n["You seem to be using a cache plugin."],!_.isString(sektionsLocalizedData.hasActiveCachePlugin)||sektionsLocalizedData.hasActiveCachePlugin.length<2?"":"<strong> ("+sektionsLocalizedData.hasActiveCachePlugin+")</strong><br/>"," <strong>",sektionsLocalizedData.i18n["It is recommended to disable your cache plugin when customizing your website."],"</strong>","</span>"].join("")})},2e3),r.previewer.bind("multi-items-module-refreshed",function(t){_.isUndefined(t.apiParams.control_id)||r.control(t.apiParams.control_id,function(e){_.isUndefined(e.params.sek_registration_params)||r.control(e.id).params.sek_registration_params.module_id===t.apiParams.id&&e.czr_Module.each(function(e){e.czr_Item.each(function(e){"expanded"===e.viewState()&&e.trigger("sek-request-item-focus-in-preview")})})})}),o.setupTemplateGallery()},registerAndSetupDefaultPanelSectionOptions:function(){var n=this,e=r.Panel.extend({isContextuallyActive:function(){return this.active()},_toggleActive:function(){return!0}});r.panel(sektionsLocalizedData.sektionsPanelId,function(n){n.deferred.embedded.done(function(){var e=n.container.first().find("h3.accordion-section-title"),t=(n.container.first().find(".panel-meta .accordion-section-title"),['<img class="sek-nimble-logo" alt="'+n.params.title+'" src="',sektionsLocalizedData.baseUrl,"/assets/img/nimble/nimble_horizontal.svg?ver="+sektionsLocalizedData.nimbleVersion,'"/>'].join(""));if(sektionsLocalizedData.isPro&&(t+=['<img class="sek-nimble-logo sek-pro-pastil" src="',sektionsLocalizedData.baseUrl,"/assets/czr/sek/img/pro_white.svg?ver="+sektionsLocalizedData.nimbleVersion,'"/>'].join("")),0<e.length){var i=e.find("span");e.addClass("sek-side-nimble-logo-wrapper").html(t).append(i)}})}),r.CZR_Helpers.register({origin:"nimble",what:"panel",id:sektionsLocalizedData.sektionsPanelId,title:sektionsLocalizedData.i18n["Nimble Builder"],priority:-1e3,constructWith:e,track:!1}),r.CZR_Helpers.register({origin:"nimble",what:"section",id:n.SECTION_ID_FOR_GLOBAL_OPTIONS,title:sektionsLocalizedData.i18n["Site wide options"],panel:sektionsLocalizedData.sektionsPanelId,priority:20,track:!1,constructWith:r.Section.extend({isContextuallyActive:function(){return this.active()},_toggleActive:function(){return!0}})}).done(function(){r.section(n.SECTION_ID_FOR_GLOBAL_OPTIONS,function(e){var t=e.container.find(".accordion-section-title"),i=e.container.find(".customize-section-title h3");0<t.length&&t.prepend('<i class="fas fa-globe sek-level-option-icon"></i>'),0<i.length&&i.find(".customize-action").after('<i class="fas fa-globe sek-level-option-icon"></i>'),n.scheduleModuleAccordion.call(e)})}),r.CZR_Helpers.register({origin:"nimble",what:"section",id:n.SECTION_ID_FOR_LOCAL_OPTIONS,title:sektionsLocalizedData.i18n["Current page options"],panel:sektionsLocalizedData.sektionsPanelId,priority:10,track:!1,constructWith:r.Section.extend({isContextuallyActive:function(){return this.active()},_toggleActive:function(){return!0}})}).done(function(){r.section(n.SECTION_ID_FOR_LOCAL_OPTIONS,function(e){var t=e.container.find(".accordion-section-title"),i=e.container.find(".customize-section-title h3");0<t.length&&t.prepend('<i class="fas fa-map-marker-alt sek-level-option-icon"></i>'),0<i.length&&i.find(".customize-action").after('<i class="fas fa-map-marker-alt sek-level-option-icon"></i>'),n.scheduleModuleAccordion.call(e)})}),r.CZR_Helpers.register({origin:"nimble",what:"setting",id:sektionsLocalizedData.optNameForGlobalOptions,dirty:!1,value:sektionsLocalizedData.globalOptionDBValues,transport:"postMessage",type:"option"}),r.CZR_Helpers.register({origin:"nimble",what:"section",id:n.SECTION_ID_FOR_CONTENT_PICKER,title:sektionsLocalizedData.i18n["Content Picker"],panel:sektionsLocalizedData.sektionsPanelId,priority:30,track:!1,constructWith:r.Section.extend({isContextuallyActive:function(){return this.active()},_toggleActive:function(){return!0}})}).done(function(){r.section(n.SECTION_ID_FOR_CONTENT_PICKER,function(e){"resolved"!=r.czr_initialSkopeCollectionPopulated.state()?r.czr_initialSkopeCollectionPopulated.done(function(){r.previewer.trigger("sek-pick-content",{focus:!1})}):r.previewer.trigger("sek-pick-content",{focus:!1})})})},setContextualCollectionSettingIdWhenSkopeSet:function(e,t){t=t||{},!_.isEmpty(t.local)&&r.panel(sektionsLocalizedData.sektionsPanelId).expanded()&&r.previewer.trigger("sek-pick-content"),sektionsData=r.czr_skopeBase.getSkopeProperty("sektions","local"),sektionsLocalizedData.isDevMode&&r.infoLog("::setContextualCollectionSettingIdWhenSkopeSet => SEKTIONS DATA ? ",sektionsData),_.isEmpty(sektionsData)&&r.errare("::setContextualCollectionSettingIdWhenSkopeSet() => no sektionsData"),_.isEmpty(sektionsData.setting_id)&&r.errare("::setContextualCollectionSettingIdWhenSkopeSet() => missing setting_id"),this.localSectionsSettingId(sektionsData.setting_id)}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(r,s){s.extend(CZRSeksPrototype,{setupTopBar:function(){var t=this;t.topBarId="#nimble-top-bar",t.topBarVisible=new r.Value(!1),t.topBarVisible.bind(function(e){t.levelTreeExpanded()||t.toggleTopBar(e)}),t.mouseMovedRecently=new r.Value({}),t.mouseMovedRecently.bind(function(e){t.topBarVisible(!_.isEmpty(e))});var e=function(e){t.mouseMovedRecently({x:e.clientX,y:e.clientY}),clearTimeout(t.cachedElements.$window.data("_scroll_move_timer_")),t.cachedElements.$window.data("_scroll_move_timer_",setTimeout(function(){t.mouseMovedRecently.set({})},4e3))};t.cachedElements.$window.on("mousemove scroll,",_.throttle(e,50)),r.previewer.bind("ready",function(){s(r.previewer.targetWindow().document).on("mousemove scroll,",_.throttle(e,50))}),t.setupLevelTree()},toggleTopBar:function(e){e=!!_.isUndefined(e)||e;var t,i=this;e?s.when(i.renderAndSetupTopBarTmpl({})).done(function(e){i.topBarContainer=e,_.delay(function(){i.cachedElements.$body.addClass("nimble-top-bar-visible")},200)}):(t=s.Deferred(),i.cachedElements.$body.removeClass("nimble-top-bar-visible"),i.topBarContainer&&i.topBarContainer.length?_.delay(function(){t.resolve()},300):t.resolve(),t.promise()).done(function(){i.topBarVisible(!1)})},renderAndSetupTopBarTmpl:function(e){var t,i=this;if(0<s(i.topBarId).length)return s(i.topBarId);try{t=wp.template("nimble-top-bar")({})}catch(e){return r.errare("Error when parsing the the top note template",e),!1}s("#customize-preview").after(s(t)),s(document).keydown(function(e){if(e.ctrlKey&&_.contains([89,90],e.keyCode))try{i.navigateHistory(90===e.keyCode?"undo":"redo")}catch(e){r.errare("Error when firing self.navigateHistory",e)}}),s(".sek-add-content",i.topBarId).on("click",function(e){e.preventDefault(),r.previewer.trigger("sek-pick-content",{content_type:"module"})}),s(".sek-level-tree",i.topBarId).on("click",function(e){e.preventDefault(),i.levelTreeExpanded(!i.levelTreeExpanded())}),s("[data-nimble-history]",i.topBarId).on("click",function(e){try{i.navigateHistory(s(this).data("nimble-history"))}catch(e){r.errare("Error when firing self.navigateHistory",e)}}),s(".sek-settings",i.topBarId).on("click",function(e){r.panel(sektionsLocalizedData.sektionsPanelId,function(e){i.rootPanelFocus(),e.focus()})}),s(".sek-nimble-doc",i.topBarId).on("click",function(e){e.preventDefault(),window.open(s(this).data("doc-href"),"_blank")}),s(".sek-tmpl-saving",i.topBarId).on("click",function(e){e.preventDefault(),i.tmplDialogVisible(!i.tmplDialogVisible())});var n=function(e){s(i.topBarId).length<1||sektionsLocalizedData.isDebugMode||(_.isObject(e)&&e.local_template&&"default"!==e.local_template?s(i.topBarId).find(".sek-notifications").html(['<span class="fas fa-info-circle"></span>',sektionsLocalizedData.i18n["This page uses a custom template."]].join(" ")):s(i.topBarId).find(".sek-notifications").html(""))},o=function(){r(i.localSectionsSettingId(),function(e){var t=e(),i=_.isObject(t)&&t.local_options&&t.local_options.template?t.local_options.template:null;n(i)}),r(i.getLocalSkopeOptionId()+"__template",function(e){e.bind(function(e,t){n(e)})})};return o(),r.bind("nimble-ready-for-current-skope",function(){o()}),s(i.topBarId)}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{initializeHistoryLogWhenSettingsRegistered:function(){this.historyLog=new l.Value([{status:"current",value:{local:l(this.localSectionsSettingId())(),global:l(this.getGlobalSectionsSettingId())()},action:"initial"}]),this.historyLog.bind(function(e){if(!_.isEmpty(e)){var t=_.findKey(e,{status:"current"});t=Number(t),d("#nimble-top-bar").find("[data-nimble-history]").each(function(){"undo"===d(this).data("nimble-history")?d(this).attr("data-nimble-state",t<=0?"disabled":"enabled"):d(this).attr("data-nimble-state",e.length<=t+1?"disabled":"enabled")})}})},trackHistoryLog:function(e,t){var i=this,n=e.id===i.getGlobalSectionsSettingId();if(!_.isObject(t)||!_.isFunction(i.historyLog)||!_.isArray(i.historyLog()))throw l.errare("params, self.historyLog() ",t,i.historyLog()),new Error("trackHistoryLog => invalid params or historyLog value");var o,r=[],s=d.extend(!0,[],i.historyLog());_.isEmpty(t.in_sektion)?_.isEmpty(t.to_sektion)||(o=t.to_sektion):o=t.in_sektion,_.each(s,function(e){"future"!=e.status&&(d.extend(e,{status:"previous"}),r.push(e))}),r.push({status:"current",value:n?{global:e()}:{local:e()},action:_.isObject(t)&&t.action||"",sektionToRefresh:o}),i.historyLog(r)},navigateHistory:function(i){var t,n,o,r,e=this,s=d.extend(!0,[],e.historyLog()),a=[];if(_.each(s,function(e){if(_.isEmpty(r)){switch(e.status){case"previous":t=e;break;case"current":n=e;break;case"future":o=e}switch(i){case"undo":_.isEmpty(n)||_.isEmpty(t)||(r=t.value,n.sektionToRefresh,t.sektionToRefresh);break;case"redo":_.isEmpty(o)||(r=o.value,n.sektionToRefresh,o.sektionToRefresh)}}}),!_.isUndefined(r)){_.isEmpty(r.local)||(l(e.localSectionsSettingId())(e.validateSettingValue(r.local,"local"),{navigatingHistoryLogs:!0}),l.czr_sektions.generateUI({action:"sek-generate-local-skope-options-ui",clean_settings:!0})),_.isEmpty(r.global)||l(e.getGlobalSectionsSettingId())(e.validateSettingValue(r.global,"global"),{navigatingHistoryLogs:!0});l.previewer.refresh(),l.previewer.trigger("sek-pick-content",{}),e.cleanRegistered(),e.cleanRegisteredLevelSettingsAfterHistoryNavigation()}var c=_.findKey(s,{status:"current"});c=Number(c),_.isNumber(c)?(_.each(s,function(e,t){switch(newLog=d.extend(!0,{},e),t=Number(t),i){case"undo":0<c&&(t===c-1?newLog.status="current":t===c&&(newLog.status="future"));break;case"redo":s.length>c+1&&(t===c?newLog.status="previous":t===c+1&&(newLog.status="current"))}a.push(newLog)}),e.historyLog(a)):l.errare("Error when navigating the history log, the current key should be a number")}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(b,z){z.extend(CZRSeksPrototype,{setupLevelTree:function(){var i=this;i.levelTree=new b.Value([]),i.levelTree.bind(function(){i.levelTreeExpanded()&&i.renderOrRefreshTree()}),i.levelTreeExpanded=new b.Value(!1),i.levelTreeExpanded.bind(function(e){if(i.cachedElements.$body.toggleClass("sek-level-tree-expanded",e),e){if(i.templateGalleryExpanded(!1),i.tmplDialogVisible(!1),i.saveSectionDialogVisible&&i.saveSectionDialogVisible(!1),i.setLevelTreeValue(),_.isEmpty(i.levelTree()))return b.previewer.trigger("sek-notify",{type:"info",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["No sections to navigate"]+"</strong>","</span>"].join("")}),void i.levelTreeExpanded(!1);z("#customize-preview iframe").css("z-index",1),i.renderOrRefreshTree()}else 0<z("#nimble-level-tree").length&&_.delay(function(){z("#nimble-level-tree").remove(),z("#customize-preview iframe").css("z-index","")},300)}),i.activeLocations.bind(function(){_.isEmpty(i.levelTree())||i.renderOrRefreshTree()}),b.previewer.bind("ready",function(){i.localSectionsSettingId.callbacks.add(function(){i.levelTreeExpanded(!1),_.each([i.getGlobalSectionsSettingId(),i.localSectionsSettingId(),sektionsLocalizedData.optNameForGlobalOptions],function(e){b(e)._isBoundForNimbleLevelTree||(b(e).bind(function(e){i.setLevelTreeValue()}),b(e)._isBoundForNimbleLevelTree=!0)})})}),i.cachedElements.$body.on("click","#nimble-level-tree [data-nimb-level]",function(e){e.preventDefault(),e.stopPropagation();var i=z(e.target).closest("[data-nimb-level]");b.previewer.send("sek-animate-to-level",{id:i.data("nimb-id")}),b.previewer.send("sek-clean-level-uis"),_.delay(function(){b.previewer.send("sek-display-level-ui",{id:i.data("nimb-id")});var e=i.data("nimb-id"),t=i.data("nimb-level");"column"===t||"section"===t?b.previewer.trigger("sek-edit-options",{id:e,level:t}):"module"===t&&b.previewer.trigger("sek-edit-module",{id:e,level:t})},100)}),i.cachedElements.$body.on("click","#nimble-level-tree .sek-remove-level",function(e){e.preventDefault(),e.stopPropagation();var t=z(e.target).closest("[data-nimb-level]");b.previewer.trigger("sek-remove",{level:t.data("nimb-level"),id:t.data("nimb-id"),location:t.closest('[data-nimb-level="location"]').data("nimb-id"),in_sektion:t.closest('[data-nimb-level="section"]').data("nimb-id"),in_column:t.closest('[data-nimb-level="column"]').data("nimb-id")}),t.fadeOut("slow"),i.renderOrRefreshTree()}),i.cachedElements.$body.on("click",".sek-close-level-tree",function(e){e.preventDefault(),i.levelTreeExpanded(!1)})},setLevelTreeValue:function(){var e,t,i,n,o,r=this.getGlobalSectionsSettingId(),s=this.localSectionsSettingId(),a=sektionsLocalizedData.optNameForGlobalOptions,c=!1;if(_.each([r,s,a],function(e){b.has(e)||(c=e)}),!1===c){e=b(r)(),i=_.isObject(e)?z.extend(!0,{},e):{},i=_.isEmpty(i.collection)?[]:i.collection,i=_.isArray(i)?i:[],t=b(s)(),t=_.isObject(t)?t:{},n=z.extend(!0,{},t),n=_.isEmpty(n.collection)?[]:n.collection,n=_.isArray(n)?n:[];var l,d=_.union(i,n),u=!1,p=!1;o=b(a)(),o=_.isObject(o)?o:{},t.local_options&&t.local_options.local_header_footer&&(u="nimble_local"===(l=t.local_options.local_header_footer["header-footer"])),o.global_header_footer&&!u&&"theme"!==l&&(p="nimble_global"===o.global_header_footer["header-footer"]||"nimble_global"===l);var m,f,g=z.extend(!0,[],d);g=_.filter(g,function(e,t){return!_.contains(["nimble_global_header","nimble_global_footer","nimble_local_header","nimble_local_footer"],e.id)});var h=function(e){m=_.findWhere(d,{id:"nimble_"+e+"_header"}),f=_.findWhere(d,{id:"nimble_"+e+"_footer"}),g.unshift(m),g.push(f)};u?h("local"):p&&h("global");var v,k=this.activeLocations(),y=[];_.isEmpty(k)?y=g:_.each(k,function(e){v=_.findWhere(g,{id:e}),_.isUndefined(v)||y.push(v)}),this.levelTree(y)}else b.errare("::setLevelTreeValue => a setting id is not registered ")},renderOrRefreshTree:function(){var e;if(z("#nimble-level-tree").length<1){try{e=wp.template("nimble-level-tree")({})}catch(e){return b.errare("Error when parsing the nimble-level-tree template",e),!1}z("#customize-preview").after(z(e))}z("#nimble-level-tree").find(".sek-tree-wrap").html(this.getLevelTreeHtml())},getLevelTreeHtml:function(e,t){var i=this;e=e||i.levelTree();var n,o,r,s=!1;if(!_.isArray(e)||_.isEmpty(e))return b.errare("::buildLevelTree => invalid collection param",e),r;var a='<i class="material-icons sek-remove-level" title="'+sektionsLocalizedData.i18n["Remove this element"]+'">delete_forever</i>';return r="<ul>",_.each(e,function(e){_.isUndefined(e.level)?b.errare("::buildLevelTree => missing level property",e):_.isUndefined(e.id)?b.errare("::buildLevelTree => missing id property",e):(n=e.level,"location"===(o=n)&&(s=!_.contains(i.activeLocations(),e.id)),s||(sektionsLocalizedData.i18n[n]&&(o=sektionsLocalizedData.i18n[n]),!0===e.is_nested&&(o=sektionsLocalizedData.i18n["nested section"]),a="location"!==n?a:"",r+='<li data-nimb-level="'+n+'" data-nimb-id="'+e.id+'">',r+='<div class="sek-level-infos"><div class="sek-inner-level-infos">',"module"===n&&(r+=[i.getTreeModuleIcon(e.module_type),i.getTreeModuleTitle(e.module_type)].join(" ")),r+=[" ",o,"( id :",e.id,")",a].join(" "),r+="</div></div>",_.isArray(e.collection)&&!_.isEmpty(e.collection)&&(r+=i.getLevelTreeHtml(e.collection,t)),r+="</li>"))}),r+="</ul>"},getTreeModuleIcon:function(t){var i,n={};return _.each(sektionsLocalizedData.moduleCollection,function(e){_.isEmpty(n)&&t===e["content-id"]&&(_.isEmpty(e.icon)||(i="http"===e.icon.substring(0,4)?e.icon:sektionsLocalizedData.moduleIconPath+e.icon,n={svg:e.icon?i:"",font:e.font_icon?e.font_icon:""}))}),_.isEmpty(n.svg)?_.isEmpty(n.font)?void 0:n.font:'<img class="sek-svg-mod-icon" src="'+n.svg+'"/>'},getTreeModuleTitle:function(t){var i={};return _.each(sektionsLocalizedData.moduleCollection,function(e){_.isEmpty(i)&&t===e["content-id"]&&(i=e.title)}),i}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(c,l){l.extend(CZRSeksPrototype,{setupSaveSectionUI:function(){var o=this;o.saveSectionDialogVisible=new c.Value(!1),o.saveSectionDialogVisible.bind(function(e){e&&(o.templateGalleryExpanded(!1),o.levelTreeExpanded(!1),o.tmplDialogVisible&&o.tmplDialogVisible(!1)),o.toggleSaveSectionUI(e)}),o.allSavedSections=new c.Value("_not_populated_"),o.allSavedSections.bind(function(e){_.isObject(e)?(e=_.isEmpty(e)?{}:e,o.refreshSectionPickerHtml(e)):c.errare("error setupSaveSectionUI => section collection should be an object")}),o.saveSectionDialogMode=new c.Value("hidden"),o.saveSectionDialogMode.bind(function(e){_.contains(["hidden","save","update","remove"],e)||(c.errare("error setupSaveSectionUI => unknown section dialog mode",e),e="save");var t=l("#nimble-top-section-save-ui"),i=t.find("#sek-saved-section-title"),n=t.find("#sek-saved-section-description");switch(t.find("[data-section-mode-switcher]").attr("aria-pressed",!1),t.find('[data-section-mode-switcher="'+e+'"]').attr("aria-pressed",!0),l("#nimble-top-section-save-ui").attr("data-sek-section-dialog-mode",e),t.removeClass("sek-removal-confirmation-opened"),e){case"save":i.val(""),n.val("");break;case"update":case"remove":t.find(".sek-saved-section-picker").val("none").trigger("change"),o.setSavedSectionCollection().done(function(e){o.refreshSectionPickerHtml()})}"remove"===e&&_.isEmpty(o.idOfSectionToSave)?t.addClass("sek-is-removal-only"):t.removeClass("sek-is-removal-only")})},refreshSectionPickerHtml:function(e){e=e||this.allSavedSections();var t=l("#nimble-top-section-save-ui"),i=t.find(".sek-saved-section-picker");i.val("none").trigger("change"),i.find("option").each(function(){"none"!==l(this).attr("value")&&l(this).remove()});var n,o,r="";_.each(e,function(e,t){_.isObject(e)&&(o=e.last_modified_date?e.last_modified_date:"",n=e.title?e.title:"section title not set",r+='<option value="'+t+'">'+[n,sektionsLocalizedData.i18n["Last modified"]+" : "+o].join(" | ")+"</option>")}),i.append(r),t.addClass("section-collection-populated")},renderSectionSaveUI:function(e){if(0<l("#nimble-top-section-save-ui").length)return l("#nimble-top-section-save-ui");try{_tmpl=wp.template("nimble-top-section-save-ui")({})}catch(e){return c.errare("Error when parsing nimble-top-section-save-ui template",e),!1}return l("#customize-preview").after(l(_tmpl)),l("#nimble-top-section-save-ui")},maybeScheduleSectionSaveDOMEvents:function(){var i=this,n=l("#nimble-top-section-save-ui");n.data("nimble-sec-save-dom-events-scheduled")||(n.on("click","[data-section-mode-switcher]",function(e){e.preventDefault(),i.saveSectionDialogMode(l(this).data("section-mode-switcher"))}),n.on("change",".sek-saved-section-picker",function(e){i.reactOnSectionSelection(e,l(this))}),n.on("click",".sek-do-save-section",function(e){n.addClass("nimble-section-processing-ajax"),i.saveOrUpdateSavedSection(e).done(function(e){n.removeClass("nimble-section-processing-ajax"),e.success&&(i.saveSectionDialogVisible(!1),i.setSavedSectionCollection({refresh:!0}))})}),n.on("click",".sek-do-update-section",function(e){var t=n.find(".sek-saved-section-picker").val();"none"===t||_.isEmpty(t)||(n.addClass("nimble-section-processing-ajax"),i.saveOrUpdateSavedSection(e,t).done(function(e){n.removeClass("nimble-section-processing-ajax"),e.success&&(i.saveSectionDialogVisible(!1),i.setSavedSectionCollection({refresh:!0}).done(function(e){i.refreshSectionPickerHtml()}))}))}),n.on("click",".sek-open-remove-confirmation",function(e){n.addClass("sek-removal-confirmation-opened")}),n.on("click",".sek-do-remove-section",function(e){var t=n.find(".sek-saved-section-picker").val();"none"===t||_.isEmpty(t)||(n.addClass("nimble-section-processing-ajax"),i.removeSavedSection(e,t).done(function(e){n.removeClass("nimble-section-processing-ajax"),n.removeClass("sek-removal-confirmation-opened"),e.success&&i.setSavedSectionCollection({refresh:!0})}))}),n.on("click",".sek-cancel-remove-section",function(e){n.removeClass("sek-removal-confirmation-opened")}),l(".sek-close-dialog",n).on("click",function(e){e.preventDefault(),i.saveSectionDialogVisible(!1)}),n.data("nimble-sec-save-dom-events-scheduled",!0))},reactOnSectionSelection:function(e,t){var i=l("#nimble-top-section-save-ui"),n=t.val(),o=i.find("#sek-saved-section-title"),r=i.find("#sek-saved-section-description"),s="update"===this.saveSectionDialogMode()?"sek-section-update-selected":"sek-section-remove-selected";if("none"===n)o.val(""),r.val(""),i.removeClass(s);else{var a=this.allSavedSections();(a=_.isObject(a)&&!_.isArray(a)?a:{})[n]=l.extend({title:"",description:"",last_modified_date:""},a[n]||{}),o.val(a[n].title),r.val(a[n].description),i.addClass(s)}},saveOrUpdateSavedSection:function(e,t){var i=this,n=l.Deferred();if(!i.idOfSectionToSave||_.isEmpty(i.idOfSectionToSave))return c.errare("saveOrUpdateSavedSection => error => missing section id"),n.resolve({success:!1});e.preventDefault();var o=l("#sek-saved-section-title"),r=o.val(),s=l("#sek-saved-section-description").val(),a=l.extend(!0,{},i.getLevelModel(i.idOfSectionToSave));return"no_match"==a?(c.errare("saveOrUpdateSavedSection => error => no section model with id "+i.idOfSectionToSave),n.resolve({success:!1})):_.isEmpty(r)?(o.addClass("error"),c.previewer.trigger("sek-notify",{type:"error",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["A title is required"]+"</strong>","</span>"].join("")}),n.resolve({success:!1})):(l("#sek-saved-section-title").removeClass("error"),a=i.preProcessSection(a),_.isObject(a)||(c.errare("::saveOrUpdateSavedSection => error => invalid sectionModel"),n.resolve({success:!1})),wp.ajax.post("sek_save_user_section",{nonce:c.settings.nonce.save,section_data:JSON.stringify(a),section_title:r,section_description:s,section_post_name:t||"",skope_id:c.czr_skopeBase.getSkopeProperty("skope_id")}).done(function(e){n.resolve({success:!0}),c.previewer.trigger("sek-notify",{type:"success",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["Template saved"]+"</strong>","</span>"].join("")})}).fail(function(e){n.resolve({success:!1}),c.errorLog("ajax sek_save_section => error",e),c.previewer.trigger("sek-notify",{type:"error",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["Error when processing template"]+"</strong>","</span>"].join("")})}).always(function(){i.idOfSectionToSave=null}),n)},removeSavedSection:function(e,t){var i=this,n=l.Deferred();return e.preventDefault(),wp.ajax.post("sek_remove_user_section",{nonce:c.settings.nonce.save,section_post_name:t}).done(function(e){n.resolve({success:!0}),c.previewer.trigger("sek-notify",{type:"success",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["Template removed"]+"</strong>","</span>"].join("")})}).fail(function(e){n.resolve({success:!1}),c.errorLog("ajax sek_remove_section => error",e),c.previewer.trigger("sek-notify",{type:"error",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["Error when processing templates"]+"</strong>","</span>"].join("")})}).always(function(){i.idOfSectionToSave=null}),n},toggleSaveSectionUI:function(e){e=!!_.isUndefined(e)||e;var t,i=this;e?l.when(i.renderSectionSaveUI({})).done(function(e){i.maybeScheduleSectionSaveDOMEvents(),i.saveUIContainer=e,_.delay(function(){i.saveSectionDialogMode("save"),i.cachedElements.$body.addClass("sek-save-section-ui-visible")},200)}):(t=l.Deferred(),i.cachedElements.$body.removeClass("sek-save-section-ui-visible"),0<l("#nimble-top-section-save-ui").length?_.delay(function(){i.saveSectionDialogMode=i.saveSectionDialogMode?i.saveSectionDialogMode:new c.Value,i.saveSectionDialogMode("hidden"),i.saveUIContainer.remove(),i.idOfSectionToSave=null,t.resolve()},250):t.resolve(),t.promise()).done(function(){i.saveSectionDialogVisible(!1)})},setSavedSectionCollection:function(e){var t=this,i=l.Deferred();return(e=e||{refresh:!1}).refresh||"_not_populated_"===t.allSavedSections()?((t.sectionCollectionPromise&&"pending"===t.sectionCollectionPromise.state()?t.sectionCollectionPromise:t.getSavedSectionCollection(e)).done(function(e){t.allSavedSections(e),i.resolve(e)}),i.promise()):i.resolve(t.allSavedSections())},getSavedSectionCollection:function(e){var t=this;return e=e||{refresh:!1},t.sectionCollectionPromise=l.Deferred(),e.refresh||"_not_populated_"===t.allSavedSections()?wp.ajax.post("sek_get_all_saved_sections",{nonce:c.settings.nonce.save}).done(function(e){_.isObject(e)&&!_.isArray(e)?t.sectionCollectionPromise.resolve(e):(t.sectionCollectionPromise.resolve({}),c.errorLog("control::getSavedSectionCollection => collection is empty or invalid"))}).fail(function(e){c.errorLog("ajax sek_get_all_saved_section => error",e),c.previewer.trigger("sek-notify",{type:"error",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["Error when processing templates"]+"</strong>","</span>"].join("")}),t.sectionCollectionPromise.resolve({})}):t.sectionCollectionPromise.resolve(t.allSavedSections()),t.sectionCollectionPromise},preProcessSection:function(e){if(!_.isObject(e))return null;var t=l.extend({},!0,e);return _.has(t,"is_nested")&&(t=_.omit(t,"is_nested")),t}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(c,l){l.extend(CZRSeksPrototype,{setupSaveTmplUI:function(){var o=this;o.tmplDialogVisible=new c.Value(!1),sektionsLocalizedData.isTemplateSaveEnabled&&(o.tmplDialogVisible.bind(function(e){e&&(o.templateGalleryExpanded(!1),o.levelTreeExpanded(!1),o.saveSectionDialogVisible&&o.saveSectionDialogVisible(!1)),o.toggleSaveTmplUI(e)}),o.allSavedTemplates=new c.Value("_not_populated_"),o.allSavedTemplates.bind(function(e){_.isObject(e)?(e=_.isEmpty(e)?{}:e,o.refreshTmplPickerHtml(e)):c.errare("error setupSaveTmplUI => tmpl collection should be an object")}),o.tmplDialogMode=new c.Value("hidden"),o.tmplDialogMode.bind(function(e){_.contains(["hidden","save","update","remove"],e)||(c.errare("::setupSaveTmplUI => unknown tmpl dialog mode",e),e="save");var t=l("#nimble-top-tmpl-save-ui"),i=t.find("#sek-saved-tmpl-title"),n=t.find("#sek-saved-tmpl-description");switch(t.find("[data-tmpl-mode-switcher]").attr("aria-pressed",!1),t.find('[data-tmpl-mode-switcher="'+e+'"]').attr("aria-pressed",!0),l("#nimble-top-tmpl-save-ui").attr("data-sek-tmpl-dialog-mode",e),t.removeClass("sek-removal-confirmation-opened"),e){case"save":i.val(""),n.val("");break;case"update":case"remove":t.find(".sek-saved-tmpl-picker").val("none").trigger("change"),o.setSavedTmplCollection().done(function(e){o.refreshTmplPickerHtml()})}}))},refreshTmplPickerHtml:function(e){e=e||this.allSavedTemplates();var t=l("#nimble-top-tmpl-save-ui"),i=t.find(".sek-saved-tmpl-picker");i.val("none").trigger("change"),i.find("option").each(function(){"none"!==l(this).attr("value")&&l(this).remove()});var n,o,r="";_.each(e,function(e,t){_.isObject(e)&&(o=e.last_modified_date?e.last_modified_date:"",n=e.title?e.title:"template title not set",r+='<option value="'+t+'">'+[n,sektionsLocalizedData.i18n["Last modified"]+" : "+o].join(" | ")+"</option>")}),i.append(r),t.addClass("tmpl-collection-populated")},renderTmplUI:function(e){if(0<l("#nimble-top-tmpl-save-ui").length)return l("#nimble-top-tmpl-save-ui");try{_tmpl=wp.template("nimble-top-tmpl-save-ui")({})}catch(e){return c.errare("Error when parsing nimble-top-tmpl-save-ui template",e),!1}return l("#customize-preview").after(l(_tmpl)),l("#nimble-top-tmpl-save-ui")},scheduleTmplSaveDOMEvents:function(){var i=this,n=l("#nimble-top-tmpl-save-ui");n.data("nimble-tmpl-dom-events-scheduled")||(n.on("click","[data-tmpl-mode-switcher]",function(e){e.preventDefault(),i.tmplDialogMode(l(this).data("tmpl-mode-switcher"))}),n.on("change",".sek-saved-tmpl-picker",function(e){i.reactOnTemplateSelection(e,l(this))}),n.on("click",".sek-do-save-tmpl",function(e){n.addClass("nimble-tmpl-processing-ajax"),i.saveOrUpdateTemplate(e).done(function(e){n.removeClass("nimble-tmpl-processing-ajax"),e.success&&(i.tmplDialogVisible(!1),i.setSavedTmplCollection({refresh:!0}))})}),n.on("click",".sek-do-update-tmpl",function(e){var t=n.find(".sek-saved-tmpl-picker").val();"none"===t||_.isEmpty(t)||(n.addClass("nimble-tmpl-processing-ajax"),i.saveOrUpdateTemplate(e,t).done(function(e){n.removeClass("nimble-tmpl-processing-ajax"),e.success&&(i.tmplDialogVisible(!1),i.setSavedTmplCollection({refresh:!0}).done(function(e){i.refreshTmplPickerHtml()}))}))}),n.on("click",".sek-open-remove-confirmation",function(e){n.addClass("sek-removal-confirmation-opened")}),n.on("click",".sek-do-remove-tmpl",function(e){var t=n.find(".sek-saved-tmpl-picker").val();"none"===t||_.isEmpty(t)||(n.addClass("nimble-tmpl-processing-ajax"),i.removeTemplate(e,t).done(function(e){n.removeClass("nimble-tmpl-processing-ajax"),n.removeClass("sek-removal-confirmation-opened"),e.success&&i.setSavedTmplCollection({refresh:!0})}))}),n.on("click",".sek-cancel-remove-tmpl",function(e){n.removeClass("sek-removal-confirmation-opened")}),l(".sek-close-dialog",n).on("click",function(e){e.preventDefault(),i.tmplDialogVisible(!1)}),n.data("nimble-tmpl-dom-events-scheduled",!0))},reactOnTemplateSelection:function(e,t){var i=l("#nimble-top-tmpl-save-ui"),n=t.val(),o=i.find("#sek-saved-tmpl-title"),r=i.find("#sek-saved-tmpl-description"),s="update"===this.tmplDialogMode()?"sek-tmpl-update-selected":"sek-tmpl-remove-selected";if("none"===n)o.val(""),r.val(""),i.removeClass(s);else{var a=this.allSavedTemplates();(a=_.isObject(a)&&!_.isArray(a)?a:{})[n]=l.extend({title:"",description:"",last_modified_date:""},a[n]||{}),o.val(a[n].title),r.val(a[n].description),i.addClass(s)}},saveOrUpdateTemplate:function(e,t){var i=l.Deferred();e.preventDefault();var n=l("#sek-saved-tmpl-title"),o=n.val(),r=l("#sek-saved-tmpl-description").val(),s=this.localSectionsSettingId(),a=this.preProcessTmpl(c(s)());return _.isEmpty(o)?(n.addClass("error"),c.previewer.trigger("sek-notify",{type:"error",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["A title is required"]+"</strong>","</span>"].join("")}),i.resolve({success:!1})):(l("#sek-saved-tmpl-title").removeClass("error"),wp.ajax.post("sek_save_user_template",{nonce:c.settings.nonce.save,tmpl_data:JSON.stringify(a),tmpl_title:o,tmpl_description:r,tmpl_post_name:t||"",skope_id:c.czr_skopeBase.getSkopeProperty("skope_id"),active_locations:c.czr_sektions.activeLocations()}).done(function(e){i.resolve({success:!0}),c.previewer.trigger("sek-notify",{type:"success",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["Template saved"]+"</strong>","</span>"].join("")})}).fail(function(e){i.resolve({success:!1}),c.errorLog("ajax sek_save_template => error",e),c.previewer.trigger("sek-notify",{type:"error",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["Error when processing template"]+"</strong>","</span>"].join("")})}),i)},removeTemplate:function(e,t){var i=l.Deferred();return e.preventDefault(),wp.ajax.post("sek_remove_user_template",{nonce:c.settings.nonce.save,tmpl_post_name:t}).done(function(e){i.resolve({success:!0}),c.previewer.trigger("sek-notify",{type:"success",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["Template removed"]+"</strong>","</span>"].join("")})}).fail(function(e){i.resolve({success:!1}),c.errorLog("ajax sek_remove_template => error",e),c.previewer.trigger("sek-notify",{type:"error",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["Error when processing templates"]+"</strong>","</span>"].join("")})}),i},toggleSaveTmplUI:function(e){e=!!_.isUndefined(e)||e;var t,i=this;e?l.when(i.renderTmplUI({})).done(function(e){i.scheduleTmplSaveDOMEvents(),i.saveUIContainer=e,_.delay(function(){i.tmplDialogMode("save"),i.cachedElements.$body.addClass("sek-save-tmpl-ui-visible")},200)}):(t=l.Deferred(),i.cachedElements.$body.removeClass("sek-save-tmpl-ui-visible"),0<l("#nimble-top-tmpl-save-ui").length?_.delay(function(){i.tmplDialogMode=i.tmplDialogMode?i.tmplDialogMode:new c.Value,i.tmplDialogMode("hidden"),i.saveUIContainer.remove(),t.resolve()},250):t.resolve(),t.promise()).done(function(){i.tmplDialogVisible(!1)})},setSavedTmplCollection:function(e){var t=this,i=l.Deferred();return(e=e||{refresh:!1}).refresh||"_not_populated_"===t.allSavedTemplates()?((t.templateCollectionPromise&&"pending"===t.templateCollectionPromise.state()?t.templateCollectionPromise:t.getSavedTmplCollection()).done(function(e){t.allSavedTemplates(e),i.resolve(e)}),i.promise()):i.resolve(t.allSavedTemplates())},getSavedTmplCollection:function(){var t=this;return t.templateCollectionPromise=l.Deferred(),wp.ajax.post("sek_get_all_saved_tmpl",{nonce:c.settings.nonce.save}).done(function(e){_.isObject(e)&&!_.isArray(e)?t.templateCollectionPromise.resolve(e):(t.templateCollectionPromise.resolve({}),c.errare("control::getSavedTmplCollection => error => tmpl collection is invalid"))}).fail(function(e){c.errorLog("ajax sek_get_all_saved_tmpl => error",e),c.previewer.trigger("sek-notify",{type:"error",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["Error when processing templates"]+"</strong>","</span>"].join("")}),t.templateCollectionPromise.resolve({})}),t.templateCollectionPromise},preProcessTmpl:function(e){return console.log("TO DO => make sure template is ok to be saved"),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(r,e){jQuery.extend(CZRSeksPrototype,{getRevisionHistory:function(e){return wp.ajax.post("sek_get_revision_history",{nonce:r.settings.nonce.save,skope_id:e.is_local?r.czr_skopeBase.getSkopeProperty("skope_id"):sektionsLocalizedData.globalSkopeId})},setSingleRevision:function(i){var n=this,o=function(e,t){r.previewer.trigger("sek-notify",{notif_id:"restore-revision-error",type:t||"info",duration:1e4,message:['<span style="">',"<strong>",e||"","</strong>","</span>"].join("")})};wp.ajax.post("sek_get_single_revision",{nonce:r.settings.nonce.save,revision_post_id:i.revision_post_id}).done(function(e){var t=i.is_local?n.localSectionsSettingId():n.getGlobalSectionsSettingId();_.isEqual(r(t)(),e)?o(sektionsLocalizedData.i18n["This is the current version."],"info"):n.updateAPISetting({action:"sek-restore-revision",is_global_location:!i.is_local,revision_value:e}).done(function(){r.previewer.refresh()}).fail(function(e){r.errare("::setSingleRevision error when firing ::updateAPISetting",e),o(sektionsLocalizedData.i18n["The revision could not be restored."],"error")})}).fail(function(e){r.errare("::setSingleRevision ajax error",e),o(sektionsLocalizedData.i18n["The revision could not be restored."],"error")})}})}(wp.customize);CZRSeksPrototype=CZRSeksPrototype||{};!function(c,l){l.extend(CZRSeksPrototype,{setupSettingsToBeSaved:function(){var i,o=this,e={local:{collectionSettingId:o.localSectionsSettingId()},global:{collectionSettingId:o.getGlobalSectionsSettingId()}};_.each(e,function(e,t){if(i=c.czr_skopeBase.getSkopeProperty("sektions",t).db_values,_.isEmpty(e.collectionSettingId))throw new Error("setupSettingsToBeSaved => the collectionSettingId is invalid");if(!c.has(e.collectionSettingId)){c.CZR_Helpers.register({what:"setting",id:e.collectionSettingId,value:o.validateSettingValue(_.isObject(i)?i:o.getDefaultSektionSettingValue(t),t),transport:"postMessage",type:"option",track:!1,origin:"nimble"});c(e.collectionSettingId,function(n){n.bind(_.debounce(function(e,t,i){if(!_.isObject(i)||!0!==i.navigatingHistoryLogs)try{o.trackHistoryLog(n,i)}catch(e){c.errare("setupSettingsToBeSaved => trackHistoryLog",e)}},1e3))})}})},validateSettingValue:function(i,n){if(!_.isObject(i))return c.errare("::validateSettingValue => validation error => the setting should be an object",i),null;if(!_.isEmpty(n)&&_.contains(["local","global"],n)){var o={},r=!1,e=[],s=function(e){c.errare(e,i),sektionsLocalizedData.isDevMode&&c.previewer.trigger("sek-notify",{type:"error",duration:6e4,message:['<span style="font-size:0.95em">',"<strong>"+e+"</strong>","<br>",sektionsLocalizedData.i18n["If this problem locks Nimble Builder, you can try resetting the sections of this page."],"<br>",'<span style="text-align:center;display:block">','<button type="button" class="button" aria-label="'+sektionsLocalizedData.i18n.Reset+'" data-sek-reset="true">'+sektionsLocalizedData.i18n.Reset+"</button>","</span>","</span>"].join("")}),r=!0},a=function(t){if(!r)if(_.isUndefined(t)&&_.isEmpty(o)){if(t=l.extend(!0,{},i),_.isUndefined(t.id)||_.isUndefined(t.level)){if(_.isUndefined(t.collection))return void s("validation error => the root level is missing the collection of locations");if(!_.isEmpty(t.level)||!_.isEmpty(t.id))return void s('validation error => the root level should not have a "level" or an "id" property');_.each(t,function(e,t){switch(n){case"local":if(!_.contains(["collection","local_options","fonts"],t))return void s("validation error => unauthorized option group for local setting value => "+t);break;case"global":if(!_.contains(["collection","fonts"],t))return void s("validation error => unauthorized option group for global setting value => "+t)}}),_.each(i.collection,function(e){o=t,a(e)})}}else{if(_.isEmpty(t.id)||!_.isString(t.id))return void s("validation error => a "+t.level+" level must have a valid id");if(_.contains(e,t.id))return void s("validation error => duplicated level id : "+t.id);if(e.push(t.id),_.isEmpty(t.level)||!_.isString(t.level))return void s("validation error => a "+t.level+" level must have a level property");if(!_.contains(["location","section","column","module"],t.level))return void s('validation error => the level "'+t.level+'" is not authorized');if("module"==t.level){if(!_.isUndefined(t.collection))return void s("validation error => a module can not have a collection property")}else if(_.isUndefined(t.collection))return void s("validation error => missing collection property for level => "+t.level+" "+t.id);switch(_.isUndefined(t.ver_ini)&&c.errare("validateSettingValue() => validation error => a "+t.level+' should have a version property : "ver_ini"'),t.level){case"location":if(!_.isEmpty(o.level))return void s("validation error => the parent of location "+t.id+" should have no level set");break;case"section":if(t.is_nested&&"column"!=o.level)return void s("validation error => the nested section "+t.id+" must be child of a column");if(!t.is_nested&&"location"!=o.level)return void s("validation error => the section "+t.id+" must be child of a location");break;case"column":if("section"!=o.level)return void s("validation error => the column "+t.id+" must be child of a section");break;case"module":if("column"!=o.level)return void s("validation error => the module "+t.id+" must be child of a column")}"module"!=t.level&&_.each(t.collection,function(e){o=l.extend(!0,{},t),_.isUndefined(e)?s("validation error => undefined level "):a(e)})}};return a(),r?null:i}c.errare("::validateSettingValue => invalid scope provided.",n)},resetCollectionSetting:function(e){if(_.isEmpty(e)||!_.contains(["local","global"],e))throw new Error("resetCollectionSetting => invalid scope provided.",e);return l.extend(!0,{},this.getDefaultSektionSettingValue(e))}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(c,n){n.extend(CZRSeksPrototype,{reactToPreviewMsg:function(){var o=this,r={},s={},a=!0,e={"sek-add-section":{callback:function(e){return c.previewedDevice("desktop"),a=!!_.isUndefined(e.send_to_preview)||e.send_to_preview,s={},r={action:"sek-add-section",id:sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),location:e.location,in_sektion:e.in_sektion,in_column:e.in_column,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column),before_section:e.before_section,after_section:e.after_section,is_first_section:e.is_first_section},o.updateAPISetting(r)},complete:function(e){e.apiParams.is_first_section&&c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location}),c.previewer.trigger("sek-pick-content",{id:e.apiParams?e.apiParams.id:"",content_type:"section"}),c.previewer.send("sek-animate-to-level",{id:e.apiParams.id})}},"sek-add-column":{callback:function(e){return a=!0,s={},r={id:sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),action:"sek-add-column",in_sektion:e.in_sektion,autofocus:e.autofocus},o.updateAPISetting(r)},complete:function(e){!1!==e.apiParams.autofocus&&c.previewer.trigger("sek-pick-content",{})}},"sek-add-module":{callback:function(e){return a=!0,s={},r={id:sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),action:"sek-add-module",in_sektion:e.in_sektion,in_column:e.in_column,module_type:e.content_id,before_module_or_nested_section:e.before_module_or_nested_section,after_module_or_nested_section:e.after_module_or_nested_section},o.updateAPISetting(r)},complete:function(e){c.previewer.trigger("sek-edit-module",{id:e.apiParams.id,level:"module",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column}),o.updateAPISetting({action:"sek-update-fonts",is_global_location:o.isGlobalLocation(e.apiParams)}),c.previewer.trigger("sek-refresh-stylesheet",{id:e.apiParams.in_column,location_skope_id:c.czr_skopeBase.getSkopeProperty("skope_id")})}},"sek-remove":{callback:function(e){switch(a=!0,s={},e.level){case"section":var t=o.getLevelModel(e.id);if("no_match"===t){c.errare("reactToPreviewMsg => sek-remove-section => no sektionToRemove matched");break}r={action:"sek-remove-section",id:e.id,location:e.location,in_sektion:e.in_sektion,in_column:e.in_column,is_nested:t.is_nested};break;case"column":r={action:"sek-remove-column",id:e.id,in_sektion:e.in_sektion};break;case"module":r={action:"sek-remove-module",id:e.id,in_sektion:e.in_sektion,in_column:e.in_column};break;default:c.errare("::reactToPreviewMsg => sek-remove => missing level ",e)}return o.updateAPISetting(r)},complete:function(e){if(c.previewer.trigger("sek-pick-content",{}),o.updateAPISetting({action:"sek-update-fonts",is_global_location:o.isGlobalLocation(e.apiParams)}),"sek-remove-section"===e.apiParams.action){var t=o.getLevelModel(e.apiParams.location);_.isEmpty(t.collection)&&c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location})}}},"sek-move":{callback:function(e){switch(a=!0,s={},e.level){case"section":r={action:"sek-move-section",id:e.id,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column),newOrder:e.newOrder,from_location:e.from_location,to_location:e.to_location};break;case"column":r={action:"sek-move-column",id:e.id,newOrder:e.newOrder,from_sektion:e.from_sektion,to_sektion:e.to_sektion};break;case"module":r={action:"sek-move-module",id:e.id,newOrder:e.newOrder,from_column:e.from_column,to_column:e.to_column,from_sektion:e.from_sektion,to_sektion:e.to_sektion}}return o.updateAPISetting(r)},complete:function(e){switch(e.apiParams.action){case"sek-move-section":c.previewer.trigger("sek-edit-options",{id:e.apiParams.id,level:"section",in_sektion:e.apiParams.id}),e.apiParams.from_location!=e.apiParams.to_location&&(c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.to_location}),c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.from_location}));break;case"sek-move-column":c.previewer.trigger("sek-edit-options",{id:e.apiParams.id,level:"column",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column});break;case"sek-refresh-modules-in-column":c.previewer.trigger("sek-edit-module",{id:e.apiParams.id,level:"module",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column})}}},"sek-move-section-up":{callback:function(e){return a=!1,s={},r={action:"sek-move-section-up-down",direction:"up",id:e.id,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column),location:e.location,in_column:e.in_column},o.updateAPISetting(r)},complete:function(e){c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location,original_action:"sek-move-section-up",moved_level_id:e.apiParams.id}),e.apiParams.new_location&&c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.new_location,original_action:"sek-move-section-down",moved_level_id:e.apiParams.id})}},"sek-move-section-down":{callback:function(e){return a=!1,s={},r={action:"sek-move-section-up-down",direction:"down",id:e.id,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column),location:e.location,in_column:e.in_column},o.updateAPISetting(r)},complete:function(e){c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location,original_action:"sek-move-section-down",moved_level_id:e.apiParams.id}),e.apiParams.new_location&&c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.new_location,original_action:"sek-move-section-down",moved_level_id:e.apiParams.id})}},"sek-duplicate":{callback:function(e){switch(a=!0,s={},e.level){case"section":r={action:"sek-duplicate-section",id:e.id,location:e.location,in_sektion:e.in_sektion,in_column:e.in_column,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column)};break;case"column":r={action:"sek-duplicate-column",id:e.id,in_sektion:e.in_sektion,in_column:e.in_column};break;case"module":r={action:"sek-duplicate-module",id:e.id,in_sektion:e.in_sektion,in_column:e.in_column}}return o.updateAPISetting(r)},complete:function(e){var t;switch(e.apiParams.action){case"sek-duplicate-section":c.previewer.trigger("sek-edit-options",{id:e.apiParams.id,level:"section",in_sektion:e.apiParams.id}),t=e.apiParams.location,e.apiParams.is_nested&&c.previewer.refresh(),c.previewer.send("sek-animate-to-level",{id:e.apiParams.id});break;case"sek-duplicate-column":c.previewer.trigger("sek-edit-options",{id:e.apiParams.id,level:"column",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column}),t=e.apiParams.in_sektion;break;case"sek-duplicate-module":c.previewer.trigger("sek-edit-module",{id:e.apiParams.id,level:"module",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column}),t=e.apiParams.in_column}c.previewer.trigger("sek-refresh-stylesheet",{id:t,location_skope_id:c.czr_skopeBase.getSkopeProperty("skope_id")})}},"sek-resize-columns":function(e){return a=!0,s={},r=e,o.updateAPISetting(r)},"sek-add-content-in-new-sektion":{callback:function(e){switch(a=!!_.isUndefined(e.send_to_preview)||e.send_to_preview,s={},(r=e).action="sek-add-content-in-new-sektion",r.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),e.content_type){case"module":r.droppedModuleId=sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid();break;case"preset_section":c.previewer.send("sek-maybe-print-loader",{loader_located_in_level_id:e.location}),c.previewer.send("sek-maybe-print-loader",{fullPageLoader:!0})}return o.updateAPISetting(r)},complete:function(e){switch(e.apiParams.content_type){case"module":c.previewer.trigger("sek-edit-module",{level:"module",id:e.apiParams.droppedModuleId});break;case"preset_section":c.previewer.send("sek-clean-loader",{cleanFullPageLoader:!0})}o.updateAPISetting({action:"sek-update-fonts",is_global_location:o.isGlobalLocation(e.apiParams)});var t=e.location_skope_id;_.isUndefined(t)&&(t=!0===e.is_global_location?sektionsLocalizedData.globalSkopeId:c.czr_skopeBase.getSkopeProperty("skope_id")),c.previewer.trigger("sek-refresh-stylesheet",{location_skope_id:t,is_global_location:o.isGlobalLocation(e.apiParams)}),e.apiParams.is_first_section&&c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location}),e.apiParams.sektion_to_replace&&c.previewer.trigger("sek-remove",{id:e.apiParams.sektion_to_replace,location:e.apiParams.location,in_column:e.apiParams.in_column,level:"section"})}},"sek-add-preset-section-in-new-nested-sektion":{callback:function(e){return a=!1,s={},(r=e).action="sek-add-preset-section-in-new-nested-sektion",c.previewer.send("sek-maybe-print-loader",{loader_located_in_level_id:e.location}),o.updateAPISetting(r)},complete:function(e){o.updateAPISetting({action:"sek-update-fonts",is_global_location:o.isGlobalLocation(e.apiParams)}),c.previewer.trigger("sek-refresh-stylesheet",{id:e.apiParams.in_sektion,location_skope_id:c.czr_skopeBase.getSkopeProperty("skope_id")}),c.previewer.trigger("sek-refresh-level",{level:"section",id:e.apiParams.in_sektion})}},"sek-pick-content":function(e){return e=_.isObject(e)?e:{},c.czr_sektions.currentContentPickerType=c.czr_sektions.currentContentPickerType||new c.Value,_.isObject(e)&&e.id&&o.lastClickedTargetInPreview({id:e.id}),a=!0,r={},s={action:"sek-generate-draggable-candidates-picker-ui",content_type:(e=e||{}).content_type||"module",was_triggered:!_.has(e,"was_triggered")||e.was_triggered,focus:!_.has(e,"focus")||e.focus},o.generateUI(s)},"sek-edit-options":function(e){return a=!0,r={},_.isEmpty(e.id)?n.Deferred(function(){this.reject("missing id")}):(s={action:"sek-generate-level-options-ui",location:e.location,level:e.level,id:e.id,in_sektion:e.in_sektion,in_column:e.in_column,options:e.options||[]},o.generateUI(s))},"sek-edit-module":function(e){return a=!0,r={},s={action:"sek-generate-module-ui",level:e.level,id:e.id,in_sektion:e.in_sektion,in_column:e.in_column,options:e.options||[]},o.generateUI(s)},"sek-notify":function(t){a=!1;var i=t.notif_id||"sek-notify";return o.lastNimbleNotificationId&&c.notifications.remove(o.lastNimbleNotificationId),n.Deferred(function(){c.panel(sektionsLocalizedData.sektionsPanelId,function(e){c.notifications.add(new c.Notification(i,{type:t.type||"info",message:t.message,dismissible:!0})),o.lastNimbleNotificationId=i,_.delay(function(){c.notifications.remove(i)},t.duration||5e3)}),this.resolve({is_global_location:o.isGlobalLocation(t)})})},"sek-refresh-level":function(t){return a=!0,n.Deferred(function(e){r={action:"sek-refresh-level",level:t.level,id:t.id,original_action:t.original_action,moved_level_id:t.moved_level_id},s={},e.resolve({is_global_location:o.isGlobalLocation(t)})})},"sek-refresh-stylesheet":function(t){return a=!0,t=t||{},n.Deferred(function(e){r={id:t.id},s={},e.resolve({is_global_location:o.isGlobalLocation(t)})})},"sek-toggle-save-section-ui":function(t){return a=!1,o.idOfSectionToSave=t.id,o.saveSectionDialogVisible(!0),n.Deferred(function(e){r={},s={},e.resolve({is_global_location:o.isGlobalLocation(t)})})},"sek-reset-collection":{callback:function(e){return a=!1,s={},(r=e).action="sek-reset-collection",r.scope=e.scope,o.updateAPISetting(r)},complete:function(e){c.previewer.refresh(),c.previewer.trigger("sek-notify",{notif_id:"reset-success",type:"success",duration:8e3,message:["<span>","<strong>",sektionsLocalizedData.i18n["Reset complete"],"</strong>","</span>"].join("")})}}};_.each(e,function(i,n){c.previewer.bind(n,function(t){var e;if(_.isFunction(i))e=i;else{if(!_.isFunction(i.callback))return void c.errare("::reactToPreviewMsg => invalid callback for action "+n);e=i.callback}"sek-notify"!==n&&(o.templateGalleryExpanded(!1),o.tmplDialogVisible(!1));try{e(t).done(function(e){e=e||{},a?c.previewer.send(n,{location_skope_id:!0===e.is_global_location?sektionsLocalizedData.globalSkopeId:c.czr_skopeBase.getSkopeProperty("skope_id"),local_skope_id:c.czr_skopeBase.getSkopeProperty("skope_id"),apiParams:r,uiParams:s,cloneId:!_.isEmpty(e.cloneId)&&e.cloneId,all_params:t}):c.previewer.trigger([n,"done"].join("_"),{apiParams:r,uiParams:s}),o.trigger([n,"done"].join("_"),t)}).fail(function(e){c.errare("reactToPreviewMsg => problem or error when running action "+n,e),!_.isEmpty(e)&&sektionsLocalizedData.isDevMode&&c.previewer.trigger("sek-notify",{type:"error",duration:3e4,message:['<span style="font-size:0.95em">',"<strong>"+e+"</strong>","<br>",sektionsLocalizedData.i18n["If this problem locks Nimble Builder, you can try resetting the sections of this page."],"<br>",'<span style="text-align:center;display:block">','<button type="button" class="button" aria-label="'+sektionsLocalizedData.i18n.Reset+'" data-sek-reset="true">'+sektionsLocalizedData.i18n.Reset+"</button>","</span>","</span>"].join("")})})}catch(e){c.errare("reactToPreviewMsg => error when receiving "+n,e)}})}),_.each(e,function(t,i){c.previewer.bind([i,"done"].join("_"),function(e){if(_.isFunction(t.complete))try{t.complete(e)}catch(e){c.errare("reactToPreviewMsg done => error when receiving "+[i,"done"].join("_"),e)}})})},schedulePrintSectionJson:function(){var i=this;c.previewer.bind("sek-to-json",function(e){var t=n.extend(!0,{},i.getLevelModel(e.id));console.log(JSON.stringify(i.cleanIds(t)))})}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(k,y){y.extend(CZRSeksPrototype,{generateUI:function(e){var t=this,i=y.Deferred();switch(_.isEmpty(e.action)&&i.reject("generateUI => missing action"),e.action){case"sek-generate-module-ui":try{i=t.generateUIforFrontModules(e,i)}catch(e){k.errare("::generateUI() => error",e),i=y.Deferred()}break;case"sek-generate-level-options-ui":try{i=t.generateUIforLevelOptions(e,i)}catch(e){k.errare("::generateUI() => error",e),i=y.Deferred()}break;case"sek-generate-draggable-candidates-picker-ui":t.cleanRegistered();try{i=t.generateUIforDraggableContent(e,i)}catch(e){k.errare("::generateUI() => error",e),i=y.Deferred()}k.czr_sektions.currentContentPickerType(e.content_type||"module");break;case"sek-generate-local-skope-options-ui":t.cleanRegistered();try{i=t.generateUIforLocalSkopeOptions(e,i)}catch(e){k.errare("::generateUI() => error",e),i=y.Deferred()}break;case"sek-generate-global-options-ui":t.cleanRegistered();try{i=t.generateUIforGlobalOptions(e,i)}catch(e){k.errare("::generateUI() => error",e),i=y.Deferred()}}return"pending"==i.state()?i.resolve().promise():i.promise()},updateAPISettingAndExecutePreviewActions:function(o){if(!_.isEmpty(o.settingParams)&&_.has(o.settingParams,"to")){var r,s=this,e=o.settingParams.to,t=null,a=!1;if(!_.isEmpty(o.settingParams.args)&&_.has(o.settingParams.args,"moduleRegistrationParams")){var c=o.settingParams.args.moduleRegistrationParams.control,i=o.settingParams.args.moduleRegistrationParams.id,n=c.czr_Module(i);if(_.isEmpty(n)?k.errare("updateAPISettingAndExecutePreviewActions => missing parentModuleInstance",o):(t=n.module_type,a=n.isMultiItem()),!a&&_.isObject(e)?r=s.normalizeAndSanitizeSingleItemInputValues({item_value:e,parent_module_type:t,is_multi_items:!1}):(r=[],_.each(e,function(e){r.push(s.normalizeAndSanitizeSingleItemInputValues({item_value:e,parent_module_type:t,is_multi_items:!0}))})),_.isEmpty(o.defaultPreviewAction))k.errare("updateAPISettingAndExecutePreviewActions => missing defaultPreviewAction in passed params. No action can be triggered to the api.previewer.",o);else{var l,d="refresh_stylesheet"===o.defaultPreviewAction,u="refresh_markup"===o.defaultPreviewAction,p="refresh_fonts"===o.defaultPreviewAction,m="refresh_preview"===o.defaultPreviewAction,f=o.settingParams.args.input_changed,g=function(){return l&&_.isString(l.refresh_markup)&&"true"!==l.refresh_markup&&"false"!==l.refresh_markup};_.isUndefined(f)||(l=s.getInputRegistrationParams(f,t),_.isUndefined(l.refresh_stylesheet)||(d=Boolean(l.refresh_stylesheet)),_.isUndefined(l.refresh_markup)||(u=g()?l.refresh_markup:Boolean(l.refresh_markup)),_.isUndefined(l.refresh_fonts)||(p=Boolean(l.refresh_fonts)),_.isUndefined(l.refresh_preview)||(m=Boolean(l.refresh_preview)));var h=function(){if(!0!==o.isGlobalOptions)return s.updateAPISetting({action:o.uiParams.action,id:o.uiParams.id,value:r,in_column:o.uiParams.in_column,in_sektion:o.uiParams.in_sektion,options_type:o.options_type,settingParams:o.settingParams}).done(function(e){var t;!0===d&&k.previewer.send("sek-refresh-stylesheet",{location_skope_id:!0===e.is_global_location?sektionsLocalizedData.globalSkopeId:k.czr_skopeBase.getSkopeProperty("skope_id"),local_skope_id:k.czr_skopeBase.getSkopeProperty("skope_id"),apiParams:{action:"sek-refresh-stylesheet",id:o.uiParams.id,level:o.uiParams.level}}),a&&o.settingParams.args.inputRegistrationParams&&_.isFunction(o.settingParams.args.inputRegistrationParams.input_parent)&&(t=o.settingParams.args.inputRegistrationParams.input_parent.id);var i=function(){k.previewer.send("sek-refresh-level",{location_skope_id:!0===e.is_global_location?sektionsLocalizedData.globalSkopeId:k.czr_skopeBase.getSkopeProperty("skope_id"),local_skope_id:k.czr_skopeBase.getSkopeProperty("skope_id"),apiParams:{action:"sek-refresh-level",id:o.uiParams.id,level:o.uiParams.level,changed_item_id:t,control_id:c.id,is_multi_items:a},skope_id:k.czr_skopeBase.getSkopeProperty("skope_id")})};if(!0===u&&i(),g()){var n=o.settingParams.args.input_value;if(!_.isString(n))throw new Error("::updateAPISettingAndExecutePreviewActions => _doUpdateWithRequestedAction => refreshMarkupWhenNeededForInput => html content is not a string.");s.htmlIncludesElementsThatNeedAnAjaxRefresh(n)?i():k.previewer.send("sek-update-html-in-selector",{selector:l.refresh_markup,changed_item_id:t,is_multi_items:a,html:n,id:o.uiParams.id,location_skope_id:!0===e.is_global_location?sektionsLocalizedData.globalSkopeId:k.czr_skopeBase.getSkopeProperty("skope_id"),local_skope_id:k.czr_skopeBase.getSkopeProperty("skope_id"),apiParams:{action:"sek-update-html-in-selector",id:o.uiParams.id,level:o.uiParams.level},skope_id:k.czr_skopeBase.getSkopeProperty("skope_id")})}!0===m&&k.previewer.refresh()}).fail(function(e){k.errare("::updateAPISettingAndExecutePreviewActions=> api setting not updated",e),k.errare("::updateAPISettingAndExecutePreviewActions=> api setting not updated => params ",o)});if(_.isEmpty(o.options_type))k.errare("updateAPISettingAndExecutePreviewActions => error when updating the global options => missing options_type");else{var e=k(sektionsLocalizedData.optNameForGlobalOptions)(),t=y.extend(!0,{},_.isObject(e)?e:{}),i={};if(_.each(r||{},function(e,t){!_.isBoolean(e)&&_.isEmpty(e+"")||(i[t]=e)}),t[o.options_type]=i,k(sektionsLocalizedData.optNameForGlobalOptions)(t),!1!==m&&k.previewer.refresh(),!0===p){var n=o.settingParams.args.input_value;if(!_.isString(n))return void k.errare("updateAPISettingAndExecutePreviewActions => font-family must be a string",n);s.updateGlobalGFonts(n)}!0===d&&k.previewer.send("sek-refresh-stylesheet",{local_skope_id:k.czr_skopeBase.getSkopeProperty("skope_id"),location_skope_id:sektionsLocalizedData.globalSkopeId})}};if(!0===p){var v=o.settingParams.args.input_value;if(!_.isString(v))return void k.errare("updateAPISettingAndExecutePreviewActions => font-family must be a string",v);!0===o.isGlobalOptions?h():s.updateAPISetting({action:"sek-update-fonts",font_family:v,is_global_location:s.isGlobalLocation(o.uiParams)}).always(function(){h().then(function(){s.updateAPISetting({action:"sek-update-fonts",is_global_location:s.isGlobalLocation(o.uiParams)})})})}else h()}}else k.errare("updateAPISettingAndExecutePreviewActions => missing params.settingParams.args.moduleRegistrationParams The api main setting can not be updated",o)}else k.errare("updateAPISettingAndExecutePreviewActions => missing params.settingParams.to. The api main setting can not be updated",o)},updateGlobalGFonts:function(e){var t=k(sektionsLocalizedData.optNameForGlobalOptions)(),i=y.extend(!0,{},_.isObject(t)?t:{}),n=this.sniffGlobalGFonts(i);!_.isEmpty(e)&&_.isString(e)&&-1<e.indexOf("gfont")&&!_.contains(n,e)&&n.push(e),i.fonts=n,k(sektionsLocalizedData.optNameForGlobalOptions)(i)},sniffGlobalGFonts:function(e){var i=[],n=function(e){_.each(e,function(e,t){"fonts"!==t&&(_.isString(t)&&-1<t.indexOf("font_family")&&-1<e.indexOf("gfont")&&!_.contains(i,e)&&i.push(e),(_.isArray(e)||_.isObject(e))&&n(e))})};return(_.isArray(e)||_.isObject(e))&&n(e),i},normalizeAndSanitizeSingleItemInputValues:function(o){var i,r={},n={},s=null,a=this;return _.each(o.item_value,function(e,t){var i,n;"title"!==t&&((o.is_multi_items||"id"!==t)&&(null!==o.parent_module_type&&"id"!==t&&"no_default_value_specified"===(s=a.getInputDefaultValue(t,o.parent_module_type))&&k.infoLog("::normalizeAndSanitizeSingleItemInputValues => missing default value for input "+t+" in module "+o.parent_module_type),i=e,n=s,(_.isBoolean(i)||_.isBoolean(n)?Boolean(i)===Boolean(n):_.isNumber(i)||_.isNumber(n)?Number(i)===Number(n):_.isString(i)||_.isString(n)?i+""==n+"":_.isObject(i)&&_.isObject(n)?_.isEqual(i,n):_.isArray(i)&&_.isArray(n)?JSON.stringify(i.sort())===JSON.stringify(n.sort()):i===n)||(_.isString(e)||_.isObject(e))&&_.isEmpty(e)||(r[t]=e)))}),_.each(r,function(e,t){switch(a.getInputType(t,o.parent_module_type)){case"text":case"textarea":case"check":case"gutencheck":case"select":case"radio":case"number":case"upload":case"upload_url":case"color":case"wp_color_alpha":case"wp_color":case"content_picker":case"detached_tinymce_editor":case"nimble_tinymce_editor":case"password":case"range":case"range_slider":case"hidden":case"h_alignment":case"h_text_alignment":case"spacing":case"bg_position":case"v_alignment":case"font_size":case"line_height":case"font_picker":default:i=e}n[t]=i}),n},isUIControlAlreadyRegistered:function(t){var e=_.filter(this.registered(),function(e){return e.id==t&&"control"===e.what}),i=!1;return _.isEmpty(e)?i=k.control.has(t):(i=!0,1<e.length&&k.errare("isUIControlAlreadyRegistered => why is this control registered more than once ? => "+t)),i},htmlIncludesElementsThatNeedAnAjaxRefresh:function(e){var t=e.match(/\[+([\w_-])+/g),i=e.match(/\{\{+([\w_-])+/g),n=e.match(/<script[\s\S]*?>[\s\S]*?<\/script>/gi),o=[],r=[];if(t)for(var s=0;s<t.length;s++){var a=t[s].replace(/^\[+/g,"");-1===o.indexOf(a)&&o.push(a)}if(i)for(var c=0;c<i.length;c++){var l=i[c].replace(/^\[+/g,"");-1===r.indexOf(l)&&r.push(l)}return!_.isEmpty(o)||!_.isEmpty(r)||!_.isEmpty(n)}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(s,a){a.extend(CZRSeksPrototype,{generateUIforDraggableContent:function(r,e){var n=this,i={};a.extend(i,{sek_content_type_switcher_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+"_sek_content_type_switcher_ui",module_type:"sek_content_type_switcher_module",controlLabel:n.getRegisteredModuleProperty("sek_content_type_switcher_module","name"),priority:10,settingValue:{content_type:r.content_type}},sek_module_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+"_sek_draggable_modules_ui",module_type:"sek_module_picker_module",controlLabel:n.getRegisteredModuleProperty("sek_module_picker_module","name"),content_type:"module",priority:20,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'},sek_my_sections_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+n.guid()+"_sek_draggable_sections_ui",module_type:"sek_my_sections_sec_picker_module",controlLabel:n.getRegisteredModuleProperty("sek_my_sections_sec_picker_module","name"),content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>',is_new:!0}}),_.each(["sek_intro_sec_picker_module","sek_features_sec_picker_module","sek_about_sec_picker_module","sek_contact_sec_picker_module","sek_team_sec_picker_module","sek_column_layouts_sec_picker_module","sek_header_sec_picker_module","sek_footer_sec_picker_module"],function(e,t){i[e]={settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+n.guid()+"_sek_draggable_sections_ui",module_type:e,controlLabel:n.getRegisteredModuleProperty(e,"name"),content_type:"section",expandAndFocusOnInit:0===t,priority:30,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'}});var t=_.keys(i)[0],o=i[t].settingControlId;return n.isUIControlAlreadyRegistered(o)?s.control(o,function(t){t.focus({completeCallback:function(){var e=t.container;e.hasClass("button-see-me")||(e.addClass("button-see-me"),_.delay(function(){e.removeClass("button-see-me")},800))}})}):(_do_register_=function(){_.each(i,function(o,e){s.has(o.settingControlId)||(s(o.settingControlId,function(e){e.bind(function(e,t){s.errare("generateUIforDraggableContent => the setting() should not changed")})}),s.CZR_Helpers.register({origin:"nimble",level:r.level,what:"setting",id:o.settingControlId,dirty:!1,value:o.settingValue||{},transport:"postMessage",type:"_nimble_ui_"})),s.CZR_Helpers.register({origin:"nimble",level:r.level,what:"control",id:o.settingControlId,label:o.controlLabel,type:"czr_module",module_type:o.module_type,section:n.SECTION_ID_FOR_CONTENT_PICKER,priority:o.priority||10,settings:{default:o.settingControlId},track:!1}).done(function(){s.control(o.settingControlId,function(e){e.content_type=o.content_type,!0===r.focus&&e.focus({completeCallback:function(){}});var t=e.container.find("label > .customize-control-title"),i=t.html();if(t.html(['<span class="sek-ctrl-accordion-title">',i,"</span>"].join("")),o.is_new){var n=t.html();t.html(n+' <span class="sek-new-label">New!</span>')}_.isUndefined(o.icon)||t.addClass("sek-flex-vertical-center").prepend(o.icon),"section"===e.content_type?(e.container.attr("data-sek-expanded","false"),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false"),!0===o.expandAndFocusOnInit&&"false"==e.container.attr("data-sek-expanded")&&e.container.addClass("sek-expand-on-init")):e.container.attr("data-sek-accordion","no")})})}),s.trigger("nimble-modules-and-sections-controls-registered")},s.section(n.SECTION_ID_FOR_CONTENT_PICKER,function(e){_do_register_();var t=e.container.find(".accordion-section-title"),i=e.container.find(".customize-section-title h3");0<t.length&&t.find(".sek-level-option-icon").length<1&&t.prepend('<i class="fas fa-grip-vertical sek-level-option-icon"></i>'),0<i.length&&i.find(".sek-level-option-icon").length<1&&i.find(".customize-action").after('<i class="fas fa-grip-vertical sek-level-option-icon"></i>'),n.scheduleModuleAccordion.call(e,{expand_first_control:!1}),e.container.find(".customize-control.sek-expand-on-init").find("label > .customize-control-title").trigger("click")})),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(d,u){u.extend(CZRSeksPrototype,{generateUIforFrontModules:function(r,e){var s=this;_.isEmpty(r.id)&&e.reject("generateUI => missing id");var i=s.getLevelProperty({property:"value",id:r.id}),t=s.getLevelProperty({property:"module_type",id:r.id}),n=s.getRegisteredModuleProperty(t,"name");_.isEmpty(t)&&e.reject("generateUI => module => invalid module_type");var o={};if(!0===s.getRegisteredModuleProperty(t,"is_father")){var a=s.getRegisteredModuleProperty(t,"children");if(_.isEmpty(a))throw new Error("::generateUIforFrontModules => a father module "+t+" is missing children modules ");_.each(a,function(e,t){o[t]={settingControlId:r.id+"__"+t,module_type:e,controlLabel:s.getRegisteredModuleProperty(e,"name")}})}else o.__no_option_group_to_be_updated_by_children_modules__={settingControlId:r.id,module_type:t,controlLabel:n};var c=_.keys(o)[0],l=o[c].settingControlId;return s.isUIControlAlreadyRegistered(l)?d.control(l).focus({completeCallback:function(){var e=d.control(l).container;e.hasClass("button-see-me")||(e.addClass("button-see-me"),_.delay(function(){e.removeClass("button-see-me")},800))}}):(s.cleanRegistered(),_do_register_=function(){_.each(o,function(n,o){if(!d.has(n.settingControlId)){var t=function(e,t,i){try{s.updateAPISettingAndExecutePreviewActions({defaultPreviewAction:"refresh_markup",uiParams:_.extend(r,{action:"sek-set-module-value"}),options_type:o,settingParams:{to:e,from:t,args:i}})}catch(e){d.errare("::generateUIforFrontModules => Error in updateAPISettingAndExecutePreviewActions",e)}};d(n.settingControlId,function(e){e.bind(_.debounce(t,s.SETTING_UPDATE_BUFFER))});var e=u.extend(!0,{},i);"__no_option_group_to_be_updated_by_children_modules__"!==o&&(e=!_.isEmpty(e)&&_.isObject(e)&&_.isObject(e[o])?e[o]:{}),d.CZR_Helpers.register({origin:"nimble",level:r.level,what:"setting",id:n.settingControlId,dirty:!1,value:e,transport:"postMessage",type:"_nimble_ui_"})}d.CZR_Helpers.register({origin:"nimble",level:r.level,what:"control",module_id:r.id,id:n.settingControlId,label:n.controlLabel,type:"czr_module",module_type:n.module_type,section:r.id,priority:20,settings:{default:n.settingControlId}}).done(function(){}),d.control(n.settingControlId,function(e){d.control(n.settingControlId).focus({completeCallback:function(){}}),e.container.attr("data-sek-expanded","false");var t=e.container.find("label > .customize-control-title"),i=u("<div/>").html(t.html()).text();t.html(['<span class="sek-ctrl-accordion-title">',i,"</span>"].join("")),_.isUndefined(n.icon)||t.addClass("sek-flex-vertical-center").prepend(n.icon),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false")})})},d.section(r.id,function(e){d.section(r.id).focus(),s.generateModuleOptionSwitcherUI(r.id,r.action),_do_register_(),e.container.find(".accordion-section-title").first().hide();var t=e.container.find(".customize-section-title h3");0<t.length&&t.find(".customize-action").after('<i class="fas fa-pencil-alt sek-level-option-icon"></i>'),s.scheduleModuleAccordion.call(e,{expand_first_control:!0})}),d.CZR_Helpers.register({origin:"nimble",what:"section",id:r.id,title:sektionsLocalizedData.i18n["Content for"]+" "+n,panel:sektionsLocalizedData.sektionsPanelId,priority:1e3}).done(function(){})),e},generateModuleOptionSwitcherUI:function(e,t){var i=e+"__option_switcher";d.has(i)||(d(i,function(e){e.bind(function(e,t){d.errare("generateUIforDraggableContent => the setting() should not changed")})}),d.CZR_Helpers.register({origin:"nimble",level:"module",what:"setting",id:i,dirty:!1,value:"",transport:"postMessage",type:"_nimble_ui_"})),d.CZR_Helpers.register({origin:"nimble",level:"module",what:"control",module_id:e,id:i,label:"",type:"czr_module",module_type:"sek_mod_option_switcher_module",section:e,priority:10,settings:{default:i},has_accordion:!1,ui_action:t}).done(function(){d.control(i,function(e){e.deferred.embedded.done(function(){e.container.find(".customize-control-title").hide(),e.container.attr("data-sek-accordion","no")})})})}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{generateUIforLevelOptions:function(s,e){var a=this,c=a.getLevelProperty({property:"options",id:s.id});c=_.isObject(c)?c:{};var t={};l.trigger("nb_setup_level_ui_registration_params",{params:s,modulesRegistrationParams:t}),d.extend(t,{bg:{settingControlId:s.id+"__bg_options",module_type:"sek_level_bg_module",controlLabel:sektionsLocalizedData.i18n["Background settings for the"]+" "+sektionsLocalizedData.i18n[s.level],expandAndFocusOnInit:!0,icon:'<i class="material-icons sek-level-option-icon">gradient</i>'}}),"section"===s.level&&d.extend(t,{level_text:{settingControlId:s.id+"__text_options",module_type:"sek_level_text_module",controlLabel:sektionsLocalizedData.i18n["Text settings for the"]+" "+sektionsLocalizedData.i18n[s.level],expandAndFocusOnInit:!0,icon:'<i class="material-icons sek-level-option-icon">text_format</i>'}}),d.extend(t,{border:{settingControlId:s.id+"__border_options",module_type:"sek_level_border_module",controlLabel:sektionsLocalizedData.i18n["Borders settings for the"]+" "+sektionsLocalizedData.i18n[s.level],icon:'<i class="material-icons sek-level-option-icon">rounded_corner</i>'},spacing:{settingControlId:s.id+"__spacing_options",module_type:"sek_level_spacing_module",controlLabel:sektionsLocalizedData.i18n["Padding and margin settings for the"]+" "+sektionsLocalizedData.i18n[s.level],icon:'<i class="material-icons sek-level-option-icon">center_focus_weak</i>'},anchor:{settingControlId:s.id+"__anchor_options",module_type:"sek_level_anchor_module",controlLabel:sektionsLocalizedData.i18n["Custom anchor ( CSS ID ) and CSS classes for the"]+" "+sektionsLocalizedData.i18n[s.level],icon:'<i class="fas fa-anchor sek-level-option-icon"></i>'},visibility:{settingControlId:s.id+"__visibility_options",module_type:"sek_level_visibility_module",controlLabel:sektionsLocalizedData.i18n["Device visibility settings for the"]+" "+sektionsLocalizedData.i18n[s.level],icon:'<i class="far fa-eye sek-level-option-icon"></i>'},height:{settingControlId:s.id+"__height_options",module_type:"sek_level_height_module",controlLabel:sektionsLocalizedData.i18n["Height, vertical alignment, z-index for the"]+" "+sektionsLocalizedData.i18n[s.level],icon:'<i class="fas fa-ruler-vertical sek-level-option-icon"></i>'}}),(sektionsLocalizedData.isUpsellEnabled||sektionsLocalizedData.isPro)&&d.extend(t,{animation:{settingControlId:s.id+"__animate_options",module_type:"sek_level_animation_module",controlLabel:sektionsLocalizedData.i18n["Animation settings for the"]+" "+sektionsLocalizedData.i18n[s.level],icon:'<i class="material-icons sek-level-option-icon">movie_filter</i>',isPro:!0}}),"section"===s.level&&(d.extend(t,{width:{settingControlId:s.id+"__width_options",module_type:"sek_level_width_section",controlLabel:sektionsLocalizedData.i18n["Width settings for the"]+" "+sektionsLocalizedData.i18n[s.level],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'}}),d.extend(t,{breakpoint:{settingControlId:s.id+"__breakpoint_options",module_type:"sek_level_breakpoint_module",controlLabel:sektionsLocalizedData.i18n["Responsive settings : breakpoint, column direction"],icon:'<i class="material-icons sek-level-option-icon">devices</i>'}}),(sektionsLocalizedData.isUpsellEnabled||sektionsLocalizedData.isPro)&&d.extend(t,{sec_custom_css:{settingControlId:s.id+"__sec_custom_css",module_type:"sek_level_cust_css_section",controlLabel:sektionsLocalizedData.i18n["Custom CSS"],icon:'<i class="material-icons sek-level-option-icon">code</i>',isPro:!0}})),"column"===s.level&&d.extend(t,{width:{settingControlId:s.id+"__width_options",module_type:"sek_level_width_column",controlLabel:sektionsLocalizedData.i18n["Width settings for the"]+" "+sektionsLocalizedData.i18n[s.level],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'}}),"module"===s.level&&d.extend(t,{width:{settingControlId:s.id+"__width_options",module_type:"sek_level_width_module",controlLabel:sektionsLocalizedData.i18n["Width and horizontal alignment for the"]+" "+sektionsLocalizedData.i18n[s.level],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'}});var i=_.keys(t)[0],n=t[i].settingControlId;return a.isUIControlAlreadyRegistered(n)?l.control(n).focus({completeCallback:function(){var e=l.control(n).container;e.hasClass("button-see-me")||(e.addClass("button-see-me"),_.delay(function(){e.removeClass("button-see-me")},800))}}):(a.cleanRegistered(),_do_register_=function(){_.each(t,function(n,o){if(a.isUIControlAlreadyRegistered(n.settingControlId))l.section(l.control(n.settingControlId).section()).expanded(!0);else{if(!l.has(n.settingControlId)){var t=function(e,t,i){try{a.updateAPISettingAndExecutePreviewActions({defaultPreviewAction:"refresh_stylesheet",uiParams:s,options_type:o,settingParams:{to:e,from:t,args:i}})}catch(e){l.errare("::generateUIforLevelOptions => Error in updateAPISettingAndExecutePreviewActions",e)}};l(n.settingControlId,function(e){e.bind(_.debounce(t,a.SETTING_UPDATE_BUFFER))});var e=c[o]||{},i=a.getModuleStartingValue(n.module_type);if("no_starting_value"!==i&&_.isObject(i)){var r=d.extend(!0,{},i);e=d.extend(r,e)}l.CZR_Helpers.register({origin:"nimble",level:s.level,what:"setting",id:n.settingControlId,dirty:!1,value:e,transport:"postMessage",type:"_nimble_ui_"})}l.CZR_Helpers.register({origin:"nimble",level:s.level,level_id:s.id,what:"control",id:n.settingControlId,label:n.controlLabel,type:"czr_module",module_type:n.module_type,section:s.id,priority:20,settings:{default:n.settingControlId}}).done(function(){}),l.control(n.settingControlId,function(e){!0===n.expandAndFocusOnInit&&e.focus({completeCallback:function(){}}),e.container.attr("data-sek-expanded","false");var t=e.container.find("label > .customize-control-title"),i=t.html();t.html(['<span class="sek-ctrl-accordion-title">',i,"</span>"].join("")),_.isUndefined(n.icon)||t.addClass("sek-flex-vertical-center").prepend(n.icon),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),n.isPro&&!sektionsLocalizedData.isPro&&t.append(['<img class="sek-pro-icon-next-title" src="',sektionsLocalizedData.baseUrl,"/assets/czr/sek/img/pro_orange.svg?ver="+sektionsLocalizedData.nimbleVersion,'"/>'].join("")),e.container.attr("data-sek-expanded","false"),!0===n.expandAndFocusOnInit&&"false"==e.container.attr("data-sek-expanded")&&t.trigger("click")})}})},l.section(s.id,function(e){_do_register_(),"module"===s.level&&a.generateModuleOptionSwitcherUI(s.id,s.action),e.container.find(".accordion-section-title").first().hide();var t=e.container.find(".customize-section-title h3");0<t.length&&t.find(".sek-level-option-icon").length<1&&t.find(".customize-action").after('<i class="fas fa-sliders-h sek-level-option-icon"></i>'),a.scheduleModuleAccordion.call(e,{expand_first_control:!1})}),l.CZR_Helpers.register({origin:"nimble",what:"section",id:s.id,title:sektionsLocalizedData.i18n["Settings for the"]+" "+s.level,panel:sektionsLocalizedData.sektionsPanelId,priority:10}).done(function(){})),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{getLocalSkopeOptionId:function(){var e=l.czr_skopeBase.getSkopeProperty("skope_id");return _.isEmpty(e)?(l.errare("czr_sektions::getLocalSkopeOptionId => empty skope_id "),""):sektionsLocalizedData.optPrefixForSektionsNotSaved+e+"__localSkopeOptions"},generateUIforLocalSkopeOptions:function(s,e){var a=this,i=a.getLocalSkopeOptionId();if(a.isUIControlAlreadyRegistered(i))return e;if(a.localOptionsRegistrationParams={},_.isUndefined(sektionsLocalizedData.localOptionsMap)||!_.isObject(sektionsLocalizedData.localOptionsMap))return l.errare("::generateUIforGlobalOptions => missing or invalid localOptionsMap"),e;!0===s.clean_settings&&a.cleanRegisteredLocalOptionSettings(),_.each(sektionsLocalizedData.localOptionsMap,function(e,t){switch(t){case"template":a.localOptionsRegistrationParams[t]={settingControlId:i+"__template",module_type:e,controlLabel:sektionsLocalizedData.i18n["Page template"],expandAndFocusOnInit:!1,icon:'<i class="material-icons sek-level-option-icon">check_box_outline_blank</i>'};break;case"local_header_footer":a.localOptionsRegistrationParams[t]={settingControlId:i+"__local_header_footer",module_type:e,controlLabel:sektionsLocalizedData.i18n["Page header and footer"],icon:'<i class="material-icons sek-level-option-icon">web</i>'};break;case"widths":a.localOptionsRegistrationParams[t]={settingControlId:i+"__widths",module_type:e,controlLabel:sektionsLocalizedData.i18n["Inner and outer widths"],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'};break;case"custom_css":a.localOptionsRegistrationParams[t]={settingControlId:i+"__custom_css",module_type:e,controlLabel:sektionsLocalizedData.i18n["Custom CSS"],icon:'<i class="material-icons sek-level-option-icon">code</i>'};break;case"local_performances":a.localOptionsRegistrationParams[t]={settingControlId:i+"__local_performances",module_type:e,controlLabel:sektionsLocalizedData.i18n["Page speed optimizations"],icon:'<i class="material-icons sek-level-option-icon">network_check</i>'};break;case"local_reset":a.localOptionsRegistrationParams[t]={settingControlId:i+"__local_reset",module_type:e,controlLabel:sektionsLocalizedData.i18n["Reset the sections in this page"],icon:'<i class="material-icons sek-level-option-icon">cached</i>'};break;case"local_revisions":a.localOptionsRegistrationParams[t]={settingControlId:i+"__local_revisions",module_type:e,controlLabel:sektionsLocalizedData.i18n["Revision history of local sections"],icon:'<i class="material-icons sek-level-option-icon">history</i>'};break;case"import_export":a.localOptionsRegistrationParams[t]={settingControlId:i+"__local_imp_exp",module_type:e,controlLabel:sektionsLocalizedData.i18n["Export / Import"],icon:'<i class="material-icons sek-level-option-icon">import_export</i>'};break;default:l.errare("::generateUIforLocalOptions => an option group could not be registered => "+e,t)}});var t=l(a.localSectionsSettingId())(),c=d.extend(!0,{},_.isObject(t.local_options)?t.local_options:{});return _do_register_=function(){_.each(a.localOptionsRegistrationParams,function(n,o){var e=a.getModuleStartingValue(n.module_type),t=_.isObject(c[o])?c[o]:{};if(!l.has(n.settingControlId)){var i=function(e,t,i){try{a.updateAPISettingAndExecutePreviewActions({defaultPreviewAction:"refresh_preview",uiParams:s,options_type:o,settingParams:{to:e,from:t,args:i}})}catch(e){l.errare("::generateUIforLocalSkopeOptions => Error in updateAPISettingAndExecutePreviewActions",e)}};if(l(n.settingControlId,function(e){e.bind(_.debounce(i,a.SETTING_UPDATE_BUFFER))}),"no_starting_value"!==e&&_.isObject(e)){var r=d.extend(!0,{},e);t=d.extend(r,t)}l.CZR_Helpers.register({origin:"nimble",level:s.level,what:"setting",id:n.settingControlId,dirty:!1,value:t,transport:"postMessage",type:"_nimble_ui_"})}l.CZR_Helpers.register({origin:"nimble",level:s.level,what:"control",id:n.settingControlId,label:n.controlLabel,type:"czr_module",module_type:n.module_type,section:a.SECTION_ID_FOR_LOCAL_OPTIONS,priority:10,settings:{default:n.settingControlId}}).done(function(){l.control(n.settingControlId,function(e){e.container.attr("data-sek-expanded","false");var t=e.container.find("label > .customize-control-title"),i=t.html();t.html(['<span class="sek-ctrl-accordion-title">',i,"</span>"].join("")),_.isUndefined(n.icon)||t.addClass("sek-flex-vertical-center").prepend(n.icon),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false"),!0===n.expandAndFocusOnInit&&"false"==e.container.attr("data-sek-expanded")&&t.trigger("click")})})})},_do_register_(),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{generateUIforGlobalOptions:function(s,e){var a=this,i=sektionsLocalizedData.optPrefixForSektionsNotSaved+sektionsLocalizedData.optNameForGlobalOptions;if(a.isUIControlAlreadyRegistered(i))return e;var n={};if(_.isUndefined(sektionsLocalizedData.globalOptionsMap)||!_.isObject(sektionsLocalizedData.globalOptionsMap))return l.errare("::generateUIforGlobalOptions => missing or invalid globalOptionsMap"),e;_.each(sektionsLocalizedData.globalOptionsMap,function(e,t){switch(t){case"global_text":n[t]={settingControlId:i+"__global_text",module_type:e,controlLabel:sektionsLocalizedData.i18n["Global text options for Nimble sections"],icon:'<i class="material-icons sek-level-option-icon">text_format</i>'};break;case"widths":n[t]={settingControlId:i+"__widths",module_type:e,controlLabel:sektionsLocalizedData.i18n["Site wide inner and outer sections widths"],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'};break;case"breakpoint":n[t]={settingControlId:i+"__breakpoint",module_type:e,controlLabel:sektionsLocalizedData.i18n["Site wide breakpoint for Nimble sections"],expandAndFocusOnInit:!1,icon:'<i class="material-icons sek-level-option-icon">devices</i>'};break;case"global_header_footer":n[t]={settingControlId:i+"__header_footer",module_type:e,controlLabel:sektionsLocalizedData.i18n["Site wide header and footer"],icon:'<i class="material-icons sek-level-option-icon">web</i>'};break;case"performances":n[t]={settingControlId:i+"__performances",module_type:e,controlLabel:sektionsLocalizedData.i18n["Site wide page speed optimizations"],icon:'<i class="material-icons sek-level-option-icon">network_check</i>'};break;case"recaptcha":n[t]={settingControlId:i+"__recaptcha",module_type:e,controlLabel:sektionsLocalizedData.i18n["Protect your contact forms with Google reCAPTCHA"],icon:'<i class="material-icons sek-level-option-icon">security</i>'};break;case"global_revisions":n[t]={settingControlId:i+"__global_revisions",module_type:e,controlLabel:sektionsLocalizedData.i18n["Revision history of global sections"],icon:'<i class="material-icons sek-level-option-icon">history</i>'};break;case"global_imp_exp":n[t]={settingControlId:i+"__global_imp_exp",module_type:e,controlLabel:sektionsLocalizedData.i18n["Export / Import global sections"],icon:'<i class="material-icons sek-level-option-icon">import_export</i>'};break;case"global_reset":n[t]={settingControlId:i+"__global_reset",module_type:e,controlLabel:sektionsLocalizedData.i18n["Reset the sections displayed in global locations"],icon:'<i class="material-icons sek-level-option-icon">cached</i>'};break;case"beta_features":n[t]={settingControlId:i+"__beta_features",module_type:e,controlLabel:sektionsLocalizedData.i18n["Beta features"],icon:'<i class="material-icons sek-level-option-icon">widgets</i>'};break;default:l.errare("::generateUIforGlobalOptions => an option group could not be registered => "+e,t)}});var c=sektionsLocalizedData.globalOptionDBValues;return _do_register_=function(){_.each(n,function(n,o){if(!l.has(n.settingControlId)){var t=function(e,t,i){try{a.updateAPISettingAndExecutePreviewActions({isGlobalOptions:!0,defaultPreviewAction:"refresh_preview",uiParams:s,options_type:o,settingParams:{to:e,from:t,args:i}})}catch(e){l.errare("::generateUIforGlobalOptions => Error in updateAPISettingAndExecutePreviewActions",e)}};l(n.settingControlId,function(e){e.bind(_.debounce(t,a.SETTING_UPDATE_BUFFER))});var e=a.getModuleStartingValue(n.module_type),i=_.isObject(c)&&!_.isEmpty(c[o])?c[o]:{};if("no_starting_value"!==e&&_.isObject(e)){var r=d.extend(!0,{},e);i=d.extend(r,i)}l.CZR_Helpers.register({origin:"nimble",level:s.level,what:"setting",id:n.settingControlId,dirty:!1,value:i,transport:"postMessage",type:"_nimble_ui_"})}l.CZR_Helpers.register({origin:"nimble",level:s.level,what:"control",id:n.settingControlId,label:n.controlLabel,type:"czr_module",module_type:n.module_type,section:a.SECTION_ID_FOR_GLOBAL_OPTIONS,priority:20,settings:{default:n.settingControlId},track:!1}).done(function(){l.control(n.settingControlId,function(e){e.container.attr("data-sek-expanded","false");var t=e.container.find("label > .customize-control-title"),i=t.html();t.html(['<span class="sek-ctrl-accordion-title">',i,"</span>"].join("")),_.isUndefined(n.icon)||t.addClass("sek-flex-vertical-center").prepend(n.icon),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false"),!0===n.expandAndFocusOnInit&&"false"==e.container.attr("data-sek-expanded")&&t.trigger("click")})})})},_do_register_(),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(Se,Ce){Ce.extend(CZRSeksPrototype,{updateAPISetting:function(Ie){var we=this,Me=Ce.Deferred();(Ie=Ie||{}).is_global_location="global"===Ie.scope||we.isGlobalLocation(Ie);var De=Ie.is_global_location?we.getGlobalSectionsSettingId():we.localSectionsSettingId(),t=function(){var r,t,s,i,n,o,a,e,c,l,d=Se(De)(),u=_.isObject(d)?Ce.extend(!0,{},d):we.getDefaultSektionSettingValue(Ie.is_global_location?"global":"local"),p="_not_injection_scenario_";switch(u.collection=_.isArray(u.collection)?u.collection:we.getDefaultSektionSettingValue(Ie.is_global_location?"global":"local").collection,Ie.action){case"sek-add-section":if(_.isEmpty(Ie.id))throw new Error("updateAPISetting => "+Ie.action+" => missing id");if(_.isEmpty(Ie.location))throw new Error("updateAPISetting => "+Ie.action+" => missing location");if(!0===Ie.is_nested){if(s=we.getLevelModel(Ie.in_column,u.collection),"no_match"==(c=we.getLevelModel(Ie.in_sektion,u.collection))){Me.reject("updateAPISetting => "+Ie.action+" => no grand parent sektion found");break}if(!0===c.is_nested){Me.reject(""),Se.previewer.trigger("sek-notify",{type:"info",duration:3e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["You've reached the maximum number of allowed nested sections."]+"</strong>","</span>"].join("")});break}if("no_match"==s){Se.errare("updateAPISetting => "+Ie.action+" => no parent column matched"),Me.reject("updateAPISetting => "+Ie.action+" => no parent column matched");break}s.collection=_.isArray(s.collection)?s.collection:[],s.collection.push({id:Ie.id,level:"section",collection:[{id:sektionsLocalizedData.optPrefixForSektionsNotSaved+we.guid(),level:"column",collection:[],ver_ini:sektionsLocalizedData.nimbleVersion}],is_nested:!0,ver_ini:sektionsLocalizedData.nimbleVersion})}else{if("no_match"==(r=we.getLevelModel(Ie.location,u.collection))){Se.errare("updateAPISetting => "+Ie.action+" => no location matched"),Me.reject("updateAPISetting => "+Ie.action+" => no location matched");break}r.collection=_.isArray(r.collection)?r.collection:[],_.each(r.collection,function(e,t){Ie.before_section===e.id&&(l=t),Ie.after_section===e.id&&(l=t+1)}),r.collection=_.isArray(r.collection)?r.collection:[],r.collection.splice(l,0,{id:Ie.id,level:"section",collection:[{id:sektionsLocalizedData.optPrefixForSektionsNotSaved+we.guid(),level:"column",collection:[],ver_ini:sektionsLocalizedData.nimbleVersion}],ver_ini:sektionsLocalizedData.nimbleVersion})}break;case"sek-duplicate-section":if(_.isEmpty(Ie.id))throw new Error("updateAPISetting => "+Ie.action+" => missing id");if(_.isEmpty(Ie.location))throw new Error("updateAPISetting => "+Ie.action+" => missing location");var m;try{m=we.cloneLevel(Ie.id)}catch(e){Se.errare("updateAPISetting => "+Ie.action,e);break}we.maybeGenerateNewItemIdsForCrudModules(m);var f=we.getLevelPositionInCollection(Ie.id,u.collection);if(!0===Ie.is_nested){if("no_match"==(s=we.getLevelModel(Ie.in_column,u.collection))){Se.errare("updateAPISetting => "+Ie.action+" => no parent column matched"),Me.reject("updateAPISetting => "+Ie.action+" => no parent column matched");break}s.collection=_.isArray(s.collection)?s.collection:[],s.collection.splice(parseInt(f+1,10),0,m)}else{if("no_match"==(r=we.getLevelModel(Ie.location,u.collection))){Se.errare("updateAPISetting => "+Ie.action+" => no location matched"),Me.reject("updateAPISetting => "+Ie.action+" => no location matched");break}r.collection=_.isArray(r.collection)?r.collection:[],r.collection.splice(parseInt(f+1,10),0,m)}a=m.id;break;case"sek-remove-section":if(!0===Ie.is_nested)"no_match"!=(s=we.getLevelModel(Ie.in_column,u.collection))?(s.collection=_.isArray(s.collection)?s.collection:[],s.collection=_.filter(s.collection,function(e){return e.id!=Ie.id})):Se.errare("updateAPISetting => "+Ie.action+" => no parent column matched");else{if("no_match"==(r=we.getLevelModel(Ie.location,u.collection))){Se.errare("updateAPISetting => "+Ie.action+" => no location matched"),Me.reject("updateAPISetting => "+Ie.action+" => no location matched");break}r.collection=_.filter(r.collection,function(e){return e.id!=Ie.id})}break;case"sek-move-section":var g,h,v=we.getLevelModel(Ie.to_location,u.collection);if(_.isEmpty(v)||"no_match"==v)throw new Error("updateAPISetting => "+Ie.action+" => missing target location");if(Ie.from_location!=Ie.to_location){var k=we.getLevelModel(Ie.from_location,u.collection);if(_.isEmpty(k)||"no_match"==k)throw new Error("updateAPISetting => "+Ie.action+" => missing source location");k.collection=_.isArray(k.collection)?k.collection:[],g=we.getLevelModel(Ie.id,k.collection),h=Ce.extend(!0,{},g),k.collection=_.filter(k.collection,function(e){return e.id!=Ie.id})}v.collection=_.isArray(v.collection)?v.collection:[],n=Ce.extend(!0,[],v.collection),o=[],_.each(Ie.newOrder,function(e){if(Ie.from_location!=Ie.to_location&&e==h.id)o.push(h);else{if(t=we.getLevelModel(e,n),_.isEmpty(t)||"no_match"==t)throw new Error("updateAPISetting => "+Ie.action+" => missing section candidate");o.push(t)}}),v.collection=o;break;case"sek-move-section-up-down":if(parentCandidate=we.getLevelModel(Ie.is_nested?Ie.in_column:Ie.location,u.collection),_.isEmpty(parentCandidate)||"no_match"==parentCandidate)throw new Error("updateAPISetting => "+Ie.action+" => missing target location");parentCandidate.collection=_.isArray(parentCandidate.collection)?parentCandidate.collection:[],n=Ce.extend(!0,[],parentCandidate.collection),o=Ce.extend(!0,[],parentCandidate.collection);var y=_.findIndex(n,function(e){return e.id===Ie.id});if(-1===y)throw new Error("updateAPISetting => "+Ie.action+" => invalid index");var b,z,I=Ie.direction||"up",w=n.length===y+1,M=0===y,D=we.activeLocationsInfo(),S=_.isArray(D)?_.findWhere(D,{id:Ie.location}):{};b=_.isObject(S)&&S.is_global,z=_.isObject(S)&&S.is_header_footer;var C=[];_.isArray(D)&&_.each(we.activeLocationsInfo(),function(e){e.is_global||e.is_header_footer||C.push(e.id)});var x,P=_.findIndex(C,function(e){return e===Ie.location}),E=!Ie.is_nested&&!b&&!z,R=0===P,L=C.length===P+1;E&&w&&"up"!==I&&!L?(x=C[P+1],we.getLevelModel(x,u.collection).collection.unshift(n[y]),parentCandidate.collection.pop(),Ie.new_location=x):E&&M&&"up"===I&&!R?(x=C[P-1],we.getLevelModel(x,u.collection).collection.push(n[y]),parentCandidate.collection.shift(),Ie.new_location=x):"up"!==I&&n.length===y+1?Se.previewer.trigger("sek-notify",{type:"info",duration:3e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["The section cannot be moved lower."]+"</strong>","</span>"].join("")}):"up"===I&&0===y?Se.previewer.trigger("sek-notify",{type:"info",duration:3e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["The section cannot be moved higher."]+"</strong>","</span>"].join("")}):(o[y]=n["up"===I?y-1:y+1],o["up"===I?y-1:y+1]=n[y],parentCandidate.collection=o);break;case"sek-add-column":if(_.isEmpty(Ie.id))throw new Error("updateAPISetting => "+Ie.action+" => missing id");if("no_match"==(t=we.getLevelModel(Ie.in_sektion,u.collection))){Se.errare("updateAPISetting => "+Ie.action+" => no parent sektion matched"),Me.reject("updateAPISetting => "+Ie.action+" => no parent sektion matched");break}if(t.collection=_.isArray(t.collection)?t.collection:[],we.MAX_NUMBER_OF_COLUMNS-1<_.size(t.collection)){Me.reject(sektionsLocalizedData.i18n["You've reached the maximum number of columns allowed in this section."]);break}we.resetColumnsWidthInSection(t),t.collection.push({id:Ie.id,level:"column",collection:[],ver_ini:sektionsLocalizedData.nimbleVersion});break;case"sek-remove-column":if("no_match"!=(t=we.getLevelModel(Ie.in_sektion,u.collection))){if(1===_.size(t.collection)){Me.reject(sektionsLocalizedData.i18n["A section must have at least one column."]);break}t.collection=_.isArray(t.collection)?t.collection:[],t.collection=_.filter(t.collection,function(e){return e.id!=Ie.id}),we.resetColumnsWidthInSection(t)}else Se.errare("updateAPISetting => "+Ie.action+" => no parent sektion matched");break;case"sek-duplicate-column":if(_.isEmpty(Ie.id))throw new Error("updateAPISetting => "+Ie.action+" => missing id");if("no_match"==(t=we.getLevelModel(Ie.in_sektion,u.collection))){Se.errare("updateAPISetting => "+Ie.action+" => no parent sektion matched"),Me.reject("updateAPISetting => "+Ie.action+" => no parent sektion matched");break}if(t.collection=_.isArray(t.collection)?t.collection:[],we.MAX_NUMBER_OF_COLUMNS-1<_.size(t.collection)){Me.reject(sektionsLocalizedData.i18n["You've reached the maximum number of columns allowed in this section."]);break}var O;try{O=we.cloneLevel(Ie.id)}catch(e){Se.errare("updateAPISetting => "+Ie.action,e);break}we.maybeGenerateNewItemIdsForCrudModules(O);var j=we.getLevelPositionInCollection(Ie.id,u.collection);a=O.id,t.collection.splice(parseInt(j+1,10),0,O),we.resetColumnsWidthInSection(t);break;case"sek-resize-columns":if(Ie.col_number<2)break;var A=we.getLevelModel(Ie.resized_column,u.collection),T=we.getLevelModel(Ie.sister_column,u.collection);if("no_match"==A){Se.errare("updateAPISetting => "+Ie.action+" => no resized column matched"),Me.reject("updateAPISetting => "+Ie.action+" => no resized column matched");break}var V=function(e,t){var i=Ce.extend(!0,{},e.options||{});return i.width=_.isObject(i.width)&&i.width["custom-width"]?i.width:{},i.width["custom-width"]=t,e.options=i,we.cachedElements.$body.find('[data-sek-width-range-column-id="'+e.id+'"]').val(t).trigger("input",{is_resize_column_trigger:!0}),t},Z=V(A,parseFloat(Ie.resizedColumnWidthInPercent));Z=parseFloat(Z);var F=we.getLevelModel(Ie.in_sektion,u.collection),U=_.filter(F.collection,function(e){return e.id!=A.id&&e.id!=T.id}),N=parseFloat(Z.toFixed(3));_.isEmpty(U)||_.each(U,function(e){var t,i,n;currentColWidth=(t=e,i="_not_set_",n=_.isObject(t.options)?t.options:{},!_.isEmpty(n)&&n.width&&n.width["custom-width"]&&(i=parseFloat(1*n.width["custom-width"])),i),("_not_set_"===currentColWidth||!_.isNumber(1*currentColWidth)||_.isEmpty(currentColWidth+"")||currentColWidth<1)&&(currentColWidth=V(e,parseFloat((100/Ie.col_number).toFixed(3)))),N=parseFloat((N+currentColWidth).toFixed(3))}),V(T,parseFloat((100-N).toFixed(3)));break;case"sek-move-column":var Q,B,G=we.getLevelModel(Ie.to_sektion,u.collection);if(_.isEmpty(G)||"no_match"==G)throw new Error("updateAPISetting => "+Ie.action+" => missing target sektion");if(Ie.from_sektion!=Ie.to_sektion){var H=we.getLevelModel(Ie.from_sektion,u.collection);if(_.isEmpty(H)||"no_match"==H)throw new Error("updateAPISetting => "+Ie.action+" => missing source column");H.collection=_.isArray(H.collection)?H.collection:[],Q=we.getLevelModel(Ie.id,H.collection),B=Ce.extend(!0,{},Q),H.collection=_.filter(H.collection,function(e){return e.id!=Ie.id}),we.resetColumnsWidthInSection(H)}G.collection=_.isArray(G.collection)?G.collection:[],n=Ce.extend(!0,[],G.collection),o=[],_.each(Ie.newOrder,function(e){if(Ie.from_sektion!=Ie.to_sektion&&e==B.id)o.push(B);else{if(s=we.getLevelModel(e,n),_.isEmpty(s)||"no_match"==s)throw new Error("updateAPISetting => moveColumn => missing columnCandidate");o.push(s)}}),G.collection=o,we.resetColumnsWidthInSection(G);break;case"sek-add-module":if(_.isEmpty(Ie.id))throw new Error("updateAPISetting => "+Ie.action+" => missing id");if(_.isEmpty(Ie.module_type))throw new Error("updateAPISetting => "+Ie.action+" => missing module_type");if("no_match"===(s=we.getLevelModel(Ie.in_column,u.collection))){Se.errare("updateAPISetting => "+Ie.action+" => no parent column matched"),Me.reject("updateAPISetting => "+Ie.action+" => no parent column matched");break}l=0,s.collection=_.isArray(s.collection)?s.collection:[],_.each(s.collection,function(e,t){Ie.before_module_or_nested_section===e.id&&(l=t),Ie.after_module_or_nested_section===e.id&&(l=t+1)});var W={id:Ie.id,level:"module",module_type:Ie.module_type,ver_ini:sektionsLocalizedData.nimbleVersion};"no_starting_value"!==(e=we.getModuleStartingValue(Ie.module_type))&&(W.value=e),s.collection.splice(l,0,W);break;case"sek-duplicate-module":if(_.isEmpty(Ie.id))throw new Error("updateAPISetting => "+Ie.action+" => missing id");if("no_match"==(s=we.getLevelModel(Ie.in_column,u.collection))){Se.errare("updateAPISetting => "+Ie.action+" => no parent column matched"),Me.reject("updateAPISetting => "+Ie.action+" => no parent column matched");break}var $;s.collection=_.isArray(s.collection)?s.collection:[];try{$=we.cloneLevel(Ie.id)}catch(e){Se.errare("updateAPISetting => "+Ie.action,e),Me.reject("updateAPISetting => "+Ie.action+" => error when cloning the level");break}we.maybeGenerateNewItemIdsForCrudModules($);var q=we.getLevelPositionInCollection(Ie.id,u.collection);a=$.id,s.collection.splice(parseInt(q+1,10),0,$);break;case"sek-remove-module":if(_.isEmpty(Ie.id))throw new Error("updateAPISetting => "+Ie.action+" => missing id");"no_match"!=(s=we.getLevelModel(Ie.in_column,u.collection))?(s.collection=_.isArray(s.collection)?s.collection:[],s.collection=_.filter(s.collection,function(e){return e.id!=Ie.id})):Se.errare("updateAPISetting => "+Ie.action+" => no parent column matched");break;case"sek-move-module":var Y,J,K;if(Y=we.getLevelModel(Ie.to_column,u.collection),_.isEmpty(Y)||"no_match"==Y)throw new Error("updateAPISetting => "+Ie.action+" => missing target column");if(Ie.from_column!=Ie.to_column){var X;if(X=we.getLevelModel(Ie.from_column,u.collection),_.isEmpty(X)||"no_match"==X)throw new Error("updateAPISetting => "+Ie.action+" => missing source column");X.collection=_.isArray(X.collection)?X.collection:[],J=we.getLevelModel(Ie.id,u.collection),K=Ce.extend(!0,{},J),X.collection=_.filter(X.collection,function(e){return e.id!=Ie.id})}if(Y.collection=_.isArray(Y.collection)?Y.collection:[],n=Ce.extend(!0,[],Y.collection),o=[],_.each(Ie.newOrder,function(e){if(Ie.from_column!=Ie.to_column&&e==K.id)o.push(K);else{if(i=we.getLevelModel(e,u.collection),_.isEmpty(i)||"no_match"==i)throw new Error("updateAPISetting => "+Ie.action+" => missing moduleCandidate");o.push(i)}}),o.length!=_.uniq(o).length)throw new Error("updateAPISetting => "+Ie.action+" => there are duplicated modules in column : "+Y.id);Y.collection=o;break;case"sek-set-module-value":i=we.getLevelModel(Ie.id,u.collection);var ee=Ie.settingParams.args.moduleRegistrationParams.control,te=Ie.settingParams.args.moduleRegistrationParams.id,ie=ee.czr_Module(te);_.isEmpty(ie)?Se.errare("updateAPISetting => missing parentModuleInstance",Ie):isMultiItemModule=ie.isMultiItem();var ne=isMultiItemModule?[]:{};if(_.each(Ie.value||(isMultiItemModule?[]:{}),function(e,t){!_.isBoolean(e)&&_.isEmpty(e+"")||(ne[t]=e)}),"no_match"==i){Se.errare("updateAPISetting => "+Ie.action+" => no module matched",Ie),Me.reject("updateAPISetting => "+Ie.action+" => error no module matched");break}if(_.isEmpty(Ie.options_type)){Se.errare("updateAPISetting => "+Ie.action+" => missing options_type"),Me.reject("updateAPISetting => "+Ie.action+" => missing options_type");break}if("__no_option_group_to_be_updated_by_children_modules__"===Ie.options_type)i.value=ne;else{var oe=Ce.extend(!0,{},_.isEmpty(i.value)?{}:i.value);oe[Ie.options_type]=ne,i.value=oe}break;case"sek-generate-level-options-ui":var re=we.getLevelModel(Ie.id,u.collection),se={};if("no_match"===re){Se.errare("updateAPISetting => "+Ie.action+" => no parent sektion matched"),Me.reject("updateAPISetting => "+Ie.action+" => no parent sektion matched");break}var ae=Ce.extend(!0,{},re.options||{});_.each(Ie.value||{},function(e,t){!_.isBoolean(e)&&_.isEmpty(e+"")||(se[t]=e)}),_.isEmpty(Ie.options_type)&&Se.errare("updateAPISetting => "+Ie.action+" => missing options_type"),ae[Ie.options_type]=se,re.options=ae;break;case"sek-generate-local-skope-options-ui":se={};var ce=Ce.extend(!0,{},_.isObject(u.local_options)?u.local_options:{});if(_.each(Ie.value||{},function(e,t){!_.isBoolean(e)&&_.isEmpty(e+"")||(se[t]=e)}),_.isEmpty(Ie.options_type)||!_.isString(Ie.options_type))Se.errare("updateAPISetting => "+Ie.action+" => missing options_type");else{var le={};le[Ie.options_type]=se,u.local_options=Ce.extend(ce,le)}break;case"sek-add-content-in-new-sektion":var de=0;if("no_match"==(r=we.getLevelModel(Ie.location,u.collection))){Se.errare("updateAPISetting => "+Ie.action+" => no location matched"),Me.reject("updateAPISetting => "+Ie.action+" => no location matched");break}switch(r.collection=_.isArray(r.collection)?r.collection:[],_.each(r.collection,function(e,t){Ie.before_section===e.id&&(de=t),Ie.after_section===e.id&&(de=t+1)}),Ie.content_type){case"module":e=we.getModuleStartingValue(Ie.content_id),r.collection.splice(de,0,{id:Ie.id,level:"section",collection:[{id:sektionsLocalizedData.optPrefixForSektionsNotSaved+we.guid(),level:"column",collection:[{id:Ie.droppedModuleId,level:"module",module_type:Ie.content_id,value:"no_starting_value"!==e?e:null,ver_ini:sektionsLocalizedData.nimbleVersion}],ver_ini:sektionsLocalizedData.nimbleVersion}],ver_ini:sektionsLocalizedData.nimbleVersion});break;case"preset_section":p=Ce.Deferred();var ue=function(e,i){var t=!1;if(!_.isEmpty(Ie.sektion_to_replace)){var n=we.getLevelModel(Ie.sektion_to_replace,u.collection);"no_match"===n&&(Se.errare("updateAPISetting => "+Ie.action+" => no sektionToReplace matched"),Me.reject("updateAPISetting => "+Ie.action+" => no sektionToReplace matched")),t=!0===n.is_nested}var o=sektionsLocalizedData.optPrefixForSektionsNotSaved+we.guid();Ie.collection_of_preset_section_id=Ie.collection_of_preset_section_id||[],Ie.collection_of_preset_section_id.push(o),t?("no_match"===(s=we.getLevelModel(Ie.in_column,u.collection))&&(Se.errare("updateAPISetting => "+Ie.action+" => no parent column matched"),Me.reject("updateAPISetting => "+Ie.action+" => no parent column matched")),s.collection=_.isArray(s.collection)?s.collection:[],_.each(s.collection,function(e,t){Ie.before_section===e.id&&(i=t),Ie.after_section===e.id&&(i=t+1)}),s.collection.splice(i,0,{id:o,is_nested:!0,level:"section",collection:e.collection,options:e.options||{},ver_ini:sektionsLocalizedData.nimbleVersion})):r.collection.splice(i,0,{id:o,level:"section",collection:e.collection,options:e.options||{},ver_ini:sektionsLocalizedData.nimbleVersion})};we.getPresetSectionCollection({is_user_section:Ie.is_user_section,presetSectionId:Ie.content_id}).fail(function(e){Se.errare("updateAPISetting => "+Ie.action+" => Error with self.getPresetSectionCollection()",e),Me.reject("updateAPISetting => "+Ie.action+" => Error with self.getPresetSectionCollection()")}).done(function(e){var t;_.isObject(e)&&!_.isEmpty(e)||(Se.errare("updateAPISetting => "+Ie.action+" => preset section type not found or empty : "+Ie.content_id,e),Me.reject("updateAPISetting => "+Ie.action+" => preset section type not found or empty")),t=e,we.preparePresetSectionForInjection(t).fail(function(e){Me.reject("updateAPISetting => error when preparePresetSectionForInjection => "+Ie.action+" => "+e),p.reject(e)}).done(function(e){"section"===e.collection[0].level?_.each(e.collection,function(e){ue(e,de),de++}):ue(e,de),p.resolve()})})}break;case"sek-add-preset-section-in-new-nested-sektion":if("no_match"===(s=we.getLevelModel(Ie.in_column,u.collection))){Se.errare("updateAPISetting => "+Ie.action+" => no parent column matched"),Me.reject("updateAPISetting => "+Ie.action+" => no parent column matched");break}var pe=0;if(s.collection=_.isArray(s.collection)?s.collection:[],_.each(s.collection,function(e,t){Ie.before_module_or_nested_section===e.id&&(pe=t),Ie.after_module_or_nested_section===e.id&&(pe=t+1)}),"no_match"==(c=we.getLevelModel(Ie.in_sektion,u.collection))){Me.reject("updateAPISetting => "+Ie.action+" => no grand parent sektion found");break}if(!0===c.is_nested){Me.reject(""),Se.previewer.trigger("sek-notify",{type:"info",duration:3e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["You've reached the maximum number of allowed nested sections."]+"</strong>","</span>"].join("")});break}p=Ce.Deferred();we.getPresetSectionCollection({is_user_section:Ie.is_user_section,presetSectionId:Ie.content_id}).fail(function(){Se.errare("updateAPISetting => "+Ie.action+" => Error with self.getPresetSectionCollection()",_er_),Me.reject("updateAPISetting => "+Ie.action+" => Error with self.getPresetSectionCollection()")}).done(function(e){var t;_.isObject(e)&&!_.isEmpty(e)||(Se.errare("updateAPISetting => "+Ie.action+" => preset section type not found or empty : "+Ie.content_id,e),Me.reject("updateAPISetting => "+Ie.action+" => preset section type not found or empty")),t=e,we.preparePresetSectionForInjection(t).fail(function(e){Me.reject("updateAPISetting => error when preparePresetSectionForInjection => "+Ie.action+" => "+e),p.reject(e)}).done(function(e){var t=function(e,t){t=t||0;var i=sektionsLocalizedData.optPrefixForSektionsNotSaved+we.guid();Ie.collection_of_preset_section_id=Ie.collection_of_preset_section_id||[],Ie.collection_of_preset_section_id.push(i),s.collection.splice(t,0,{id:i,level:"section",collection:e.collection,options:e.options||{},is_nested:!0,ver_ini:sektionsLocalizedData.nimbleVersion})};"section"===e.collection[0].level?_.each(e.collection,function(e){t(e,pe),pe++}):t(e,pe),p.resolve()})});break;case"sek-update-fonts":var _e=we.sniffGFonts({is_global_location:Ie&&!0===Ie.is_global_location});!_.isEmpty(Ie.font_family)&&_.isString(Ie.font_family)&&-1<Ie.font_family.indexOf("gfont")&&!_.contains(_e,Ie.font_family)&&_e.push(Ie.font_family),u.fonts=_e;break;case"sek-restore-revision":u=Ie.revision_value;break;case"sek-import-from-file":if(Se.infoLog("sek-import-from-file",Ie),_.isUndefined(Ie.imported_content.data)||_.isUndefined(Ie.imported_content.metas)){Se.errare("updateAPISetting::sek-import-from-file => invalid imported content",imported_content);break}var me=_.isArray(Ie.imported_content.data.collection)?Ce.extend(!0,[],Ie.imported_content.data.collection):[];if(!0===Ie.assign_missing_locations){var fe=Ie.imported_content.metas.active_locations,ge=Se.czr_sektions.activeLocations(),he=_.first(ge);if(!_.isEmpty(he)&&!_.isEmpty(fe)&&_.isArray(fe)){var ve=Ce(fe).not(ge).get(),ke=we.getLevelModel(he,u.collection),ye=we.getLevelModel(he,Ie.imported_content.data.collection),be=[];ke.collection=_.isArray(ke.collection)?ke.collection:[],ye.collection=_.isArray(ye.collection)?ye.collection:[],_.each(fe,function(e){var t=we.getLevelModel(e,me);_.isEmpty(t.collection)||(be=_.union(be,t.collection))}),ye.collection=be,Ie.imported_content.data.collection=_.filter(Ie.imported_content.data.collection,function(e){return!_.contains(ve,e.id)})}}!0===Ie.keep_existing_sections&&(_.each(me,function(e){var t=we.getLevelModel(e.id,u.collection);if(!_.isEmpty(t.collection)){var i=we.getLevelModel(e.id,Ie.imported_content.data.collection);i.collection=_.union(t.collection,i.collection)}}),u.fonts&&!_.isEmpty(u.fonts)&&_.isArray(u.fonts)&&(Ie.imported_content.data.fonts=_.isArray(Ie.imported_content.data.fonts)?Ie.imported_content.data.fonts:[],Ie.imported_content.data.fonts=_.uniq(_.union(u.fonts,Ie.imported_content.data.fonts)))),u=Ie.imported_content.data;break;case"sek-reset-collection":try{u=Se.czr_sektions.resetCollectionSetting(Ie.scope)}catch(e){Se.errare("sek-reset-collection => error when firing resetCollectionSetting()",e)}}if("pending"==Me.state()){var ze=function(){var e=Ie.settingParams&&Ie.settingParams.from&&Ie.settingParams.to;e&&_.isEqual(Ie.settingParams.from,Ie.settingParams.to)?Me.reject("updateAPISetting => main sektion setting change => the new setting value is unchanged when firing action : "+Ie.action):!e&&_.isEqual(d,u)?Me.reject("updateAPISetting => the new setting value is unchanged when firing action : "+Ie.action):null!==we.validateSettingValue(u,Ie.is_global_location?"global":"local")?(Se(De)(u,Ie),Ie.cloneId=a,Me.resolve(Ie)):Me.reject("Validation problem for action "+Ie.action)};"_not_injection_scenario_"===p?(ze(),"pending"===Me.state()&&Se.errare("::updateAPISetting => The __updateAPISettingDeferred__ promise has not been resolved properly.")):p.done(function(){ze(),"pending"===Me.state()&&Se.errare("::updateAPISetting => The __updateAPISettingDeferred__ promise has not been resolved properly.")}).fail(function(e){Se.errare("updateAPISetting => __presetSectionInjected__ failed",e)})}};return Se(De,function(e){t()}),Me.promise()},resetColumnsWidthInSection:function(e){_.each(e.collection,function(e){e.options&&e.options.width&&e.options.width["custom-width"]&&(e.options.width=_.omit(e.options.width,"custom-width")),e.width=""})},_maybeFetchSectionsFromServer:function(){var e,t=Ce.Deferred();return _.isEmpty(Se.sek_presetSections)?(_.isUndefined(Se.sek_fetchingPresetSections)||"pending"!=Se.sek_fetchingPresetSections.state()?(e=wp.ajax.post("sek_get_preset_sections",{nonce:Se.settings.nonce.save}),Se.sek_fetchingPresetSections=e):e=Se.sek_fetchingPresetSections,e.done(function(e){Se.sek_presetSections=e,t.resolve(Se.sek_presetSections)}).fail(function(e){t.reject(e)})):t.resolve(Se.sek_presetSections),t.promise()},getPresetSectionCollection:function(n){var o=this,r=Ce.Deferred();return n.is_user_section?wp.ajax.post("sek_get_user_section_json",{nonce:Se.settings.nonce.save,section_post_name:n.presetSectionId}).done(function(e){if(!_.isObject(e)||_.isEmpty(e)||_.isUndefined(e.data))throw Se.errare("getPresetSectionCollection => preset section type not found or empty : "+n.presetSectionId,e),new Error("getPresetSectionCollection => preset section type not found or empty");var t=Ce.extend({},!0,e.data);t.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),t.collection=o.setPresetOrUserSectionIds(t.collection),t.ver_ini=sektionsLocalizedData.nimbleVersion,t.collection=o.setPresetSectionVersion(t.collection),r.resolve(t)}).fail(function(e){r.reject(e)}):o._maybeFetchSectionsFromServer().fail(function(e){r.reject(e)}).done(function(e){var t=Ce.extend(!0,{},_.isObject(e)?e:{});if(_.isEmpty(t))throw new Error("getPresetSectionCollection => Invalid collection");if(_.isEmpty(t[n.presetSectionId]))throw new Error('getPresetSectionCollection => the preset section : "'+n.presetSectionId+'" has not been found in the collection');var i=t[n.presetSectionId];i.collection=o.setPresetOrUserSectionIds(i.collection),i.ver_ini=sektionsLocalizedData.nimbleVersion,i.collection=o.setPresetSectionVersion(i.collection),r.resolve(i)}),r.promise()},setPresetOrUserSectionIds:function(e){var t=this;return _.isArray(e)&&_.each(e,function(e){e.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+t.guid(),_.isArray(e.collection)&&t.setPresetOrUserSectionIds(e.collection)}),e},setPresetSectionVersion:function(e){var t=this;return _.each(e,function(e){e.ver_ini=sektionsLocalizedData.nimbleVersion,_.isArray(e.collection)&&t.setPresetSectionVersion(e.collection)}),e},preparePresetSectionForInjection:function(o){var i=this,n={},r=Ce.Deferred();i.maybeGenerateNewItemIdsForCrudModules(o);var s=function(e){return _.each(e,function(e,t){_.isObject(e)||_.isArray(e)?s(e):_.isString(e)&&-1!=e.indexOf("__img_url__")&&(_.has(n,e)||(n[e]=i.importAttachment(e.replace("__img_url__",""))))}),n},a=function(i,n){return _.each(i,function(e,t){_.isObject(e)||_.isArray(e)?a(e,n):_.isString(e)&&-1!=e.indexOf("__img_url__")&&_.has(n,e)&&_.isObject(n[e])&&(i[t]=n[e].id)}),o};return i.whenAllPromisesInParallel(s(o)).done(function(e){var t=a(o,e);r.resolve(t)}).fail(function(e){r.reject(e)}),r.promise()}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(n,o){o.extend(CZRSeksPrototype,{cleanRegistered:function(t){var i=this,e=o.extend(!0,[],i.registered()||[]);n.trigger("sek-before-clean-registered"),e=_.filter(e,function(e){if("setting"!==e.what&&n[e.what].has(e.id)){if(!_.isEmpty(t)&&e.id!==t)return;_.isFunction(n[e.what](e.id).trigger)&&i.trigger("sek-ui-pre-removal",{what:e.what,id:e.id}),o.when(n[e.what](e.id).container.remove()).done(function(){n[e.what].remove(e.id),i.trigger("sek-ui-removed",{what:e.what,id:e.id})})}return"setting"===e.what}),i.registered(e)},cleanRegisteredLocalOptionSettings:function(){var t=this.getLocalSkopeOptionId(),e=o.extend(!0,[],this.registered()||[]);e=_.filter(e,function(e){return e.id&&-1!==e.id.indexOf(t)&&n.has(e.id)&&n.remove(e.id),e.id&&-1===e.id.indexOf(t)}),this.registered(e)},cleanRegisteredLevelSettingsAfterHistoryNavigation:function(){var e=o.extend(!0,[],this.registered()||[]);e=_.filter(e,function(e){return!_.isEmpty(e.level)&&"setting"===e.what&&n.has(e.id)&&n.remove(e.id),_.isEmpty(e.level)&&"setting"===e.what}),this.registered(e)}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(u,p){p.extend(CZRSeksPrototype,{rootPanelFocus:function(){u.section.has(u.czr_activeSectionId())?u.section(u.czr_activeSectionId()).expanded(!1):u.section.each(function(e){e.expanded(!1)}),u.panel.each(function(e){e.expanded(!1)})},guid:function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+e()},getGlobalSectionsSettingId:function(){return sektionsLocalizedData.settingIdForGlobalSections},getParentSectionFromColumnId:function(i,n){var s=this,a="no_match",c=function(i,e,n,o){if(_.isUndefined(e)){var t=u(n)(),r=_.isObject(t)?p.extend(!0,{},t):p.extend(!0,{},s.getDefaultSektionSettingValue(o));e=_.isArray(r.collection)?r.collection:[]}return _.each(e,function(e){var t;"no_match"==a&&("section"==e.level&&(t=_.findWhere(e.collection,{id:i})),_.isEmpty(t)?_.isArray(e.collection)&&c(i,e.collection,n,o):a=e)}),a};return _.isEmpty(n)?_.each({local:s.localSectionsSettingId(),global:s.getGlobalSectionsSettingId()},function(e,t){"no_match"===a&&c(i,n,e,t)}):c(i,n),a},isGlobalLocation:function(e){var t=!1;return e=e||{},_.has(e,"is_global_location")?t=e.is_global_location:_.has(e,"scope")?t="global"===e.scope:_.isEmpty(e.location)?_.isEmpty(e.in_sektion)?_.isEmpty(e.id)||(t=this.isChildOfAGlobalLocation(e.id)):t=this.isChildOfAGlobalLocation(e.in_sektion):t=this.isChildOfAGlobalLocation(e.location),t},isChildOfAGlobalLocation:function(e){var r=this,s=function(t,e){var i="no_match";if(_.isUndefined(e)){var n=u(r.getGlobalSectionsSettingId())(),o=_.isObject(n)?p.extend(!0,{},n):r.getDefaultSektionSettingValue("global");e=_.isArray(o.collection)?o.collection:[]}return _.each(e,function(e){"no_match"==i&&(t===e.id?i=e:_.isArray(e.collection)&&(i=s(t,e.collection)))}),i};return"no_match"!==s(e)},isHeaderLocation:function(e){var t=this.activeLocationsInfo(),i=_.isArray(t)?_.findWhere(t,{id:e}):{};return _.isObject(i)&&i.is_header},isFooterLocation:function(e){var t=self.activeLocationsInfo(),i=_.isArray(t)?_.findWhere(t,{id:e}):{};return _.isObject(i)&&i.is_footer},getLevelModel:function(i,n){var s=this,a="no_match",c=function(t,e,i,n){if(_.isUndefined(e)){var o=u(i)(),r=_.isObject(o)?p.extend(!0,{},o):p.extend(!0,{},s.getDefaultSektionSettingValue(n));e=_.isArray(r.collection)?r.collection:[]}return _.each(e,function(e){"no_match"==a&&(t===e.id?a=e:_.isArray(e.collection)&&c(t,e.collection,i,n))}),a};return _.isEmpty(n)?_.each({local:s.localSectionsSettingId(),global:s.getGlobalSectionsSettingId()},function(e,t){"no_match"===a&&c(i,n,e,t)}):c(i,n),a},getLevelPositionInCollection:function(i,n){var s=this,a="no_match",c=function(i,e,n,o){if(_.isUndefined(e)){var t=u(n)(),r=_.isObject(t)?p.extend(!0,{},t):p.extend(!0,{},s.getDefaultSektionSettingValue(o));e=_.isArray(r.collection)?r.collection:[]}_.each(e,function(e,t){"no_match"==a&&(i===e.id?a=t:_.isArray(e.collection)&&c(i,e.collection,n,o))})};return _.isEmpty(n)?_.each({local:s.localSectionsSettingId(),global:s.getGlobalSectionsSettingId()},function(e,t){"no_match"===a&&c(i,e,t,n)}):c(i,n),a},getLevelProperty:function(e){if(e=_.extend({id:"",property:""},e),_.isEmpty(e.id))u.errare("getLevelProperty => invalid id provided");else{var t=this.getLevelModel(e.id);if("no_match"!=t){if(_.isObject(t))return t[e.property];u.errare("getLevelProperty => invalid model for id : "+e.id,t)}else u.errare("getLevelProperty => no level model found for id : "+e.id)}},cloneLevel:function(e){var t=this,i=t.getLevelModel(e);if("no_match"==i)throw new Error("cloneLevel => no match for level id : "+e);var n=p.extend(!0,{},i),o=function(e){if(_.isEmpty(e.id))throw new Error("cloneLevel => missing level id");if(e.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+t.guid(),!_.isEmpty(e.collection)){if(!_.isArray(e.collection))throw new Error("cloneLevel => the collection must be an array for level id : "+e.id);_.each(e.collection,function(e){e.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+t.guid(),o(e)})}return e};return o(n)},getDefaultItemModelFromRegisteredModuleData:function(e){if(!this.isModuleRegistered(e))return{};if(sektionsLocalizedData.registeredModules[e].is_father)return u.errare("getDefaultItemModelFromRegisteredModuleData => Father modules should be treated specifically"),{};var t=sektionsLocalizedData.registeredModules[e].tmpl["item-inputs"],i={id:"",title:""};return _.each(t,function(e,t){switch(t){case"tabs":_.each(e,function(e){_.each(e.inputs,function(e,t){i[t]=e.default||""})});break;default:i[t]=e.default||""}}),i},getRegisteredModuleProperty:function(e,t){return this.isModuleRegistered(e)?sektionsLocalizedData.registeredModules[e][t]:"not_set"},isModuleRegistered:function(e){return sektionsLocalizedData.registeredModules&&!_.isUndefined(sektionsLocalizedData.registeredModules[e])},isMultiItemsModule:function(e){return sektionsLocalizedData.registeredModules[e]&&!0===sektionsLocalizedData.registeredModules[e].is_crud},maybeGenerateNewItemIdsForCrudModules:function(t){var i=this;return(_.isArray(t)||_.isObject(t))&&_.each(t,function(e){_.isArray(t)&&_.isObject(e)&&e.id&&!_.has(e,"level")?-1===e.id.indexOf(sektionsLocalizedData.optPrefixForSektionsNotSaved)&&(e.id=i.guid()):(_.isArray(e)||_.isObject(e))&&i.maybeGenerateNewItemIdsForCrudModules(e)}),t},sniffGFonts:function(e){var o=this,r=[],s=function(i,n,e){if(_.isUndefined(e)){var t=u(i)();e=_.isObject(t)?p.extend(!0,{},t):p.extend(!0,{},o.getDefaultSektionSettingValue(n))}_.each(e,function(e,t){_.isString(t)&&"_css"===t.substr(t.length-4)&&!0===o.inputIsAFontFamilyModifier(t)&&-1<e.indexOf("gfont")&&!_.contains(r,e)&&r.push(e),(_.isArray(e)||_.isObject(e))&&s(i,n,e)})};return(e=e||{is_global_location:!1}).is_global_location?s(o.getGlobalSectionsSettingId(),"global"):s(o.localSectionsSettingId(),"local"),r},sniffAllFonts:function(){var o=this,r=[],s=function(i,n,e){if(_.isUndefined(e)){var t=u(i)();e=_.isObject(t)?p.extend(!0,{},t):p.extend(!0,{},o.getDefaultSektionSettingValue(n))}_.each(e,function(e,t){_.isString(t)&&_.isString(e)&&(-1<e.indexOf("[gfont]")||-1<e.indexOf("[cfont]"))&&r.push(e),(_.isArray(e)||_.isObject(e))&&s(i,n,e)})};return _.each([{id:o.localSectionsSettingId(),scope:"local"},{id:o.getGlobalSectionsSettingId(),scope:"global"},{id:sektionsLocalizedData.optNameForGlobalOptions,scope:"global"}],function(e){s(e.id,e.scope)}),r},getInputDefaultValue:function(i,n,e){var o=this;if(o.cachedDefaultInputValues=o.cachedDefaultInputValues||{},o.cachedDefaultInputValues[n]=o.cachedDefaultInputValues[n]||{},_.has(o.cachedDefaultInputValues[n],i))return o.cachedDefaultInputValues[n][i];if(_.isUndefined(sektionsLocalizedData.registeredModules))u.errare("getInputDefaultValue => missing sektionsLocalizedData.registeredModules");else if(_.isUndefined(sektionsLocalizedData.registeredModules[n]))u.errare("getInputDefaultValue => missing "+n+" in sektionsLocalizedData.registeredModules");else{if(!sektionsLocalizedData.registeredModules[n].is_father){_.isUndefined(e)&&(e=sektionsLocalizedData.registeredModules[n].tmpl);var r="no_default_value_specified";return _.each(e,function(e,t){"no_default_value_specified"===r&&(i!==t||_.isUndefined(e.default)||(r=e.default),"no_default_value_specified"===r&&(_.isArray(e)||_.isObject(e))&&(r=o.getInputDefaultValue(i,n,e)),"no_default_value_specified"!==r&&(o.cachedDefaultInputValues[n][i]=r))}),r}u.errare("getInputDefaultValue => Father modules should be treated specifically")}},getInputType:function(i,n,e){var o=this;if(o.cachedInputTypes=o.cachedInputTypes||{},o.cachedInputTypes[n]=o.cachedInputTypes[n]||{},_.has(o.cachedInputTypes[n],i))return o.cachedInputTypes[n][i];if(_.isUndefined(sektionsLocalizedData.registeredModules))u.errare("getInputType => missing sektionsLocalizedData.registeredModules");else if(_.isUndefined(sektionsLocalizedData.registeredModules[n]))u.errare("getInputType => missing "+n+" in sektionsLocalizedData.registeredModules");else{if(!sektionsLocalizedData.registeredModules[n].is_father){_.isUndefined(e)&&(e=sektionsLocalizedData.registeredModules[n].tmpl);var r="no_input_type_specified";return _.each(e,function(e,t){"no_input_type_specified"===r&&(i!==t||_.isUndefined(e.input_type)||(r=e.input_type),"no_input_type_specified"===r&&(_.isArray(e)||_.isObject(e))&&(r=o.getInputType(i,n,e)),"no_input_type_specified"!==r&&(o.cachedInputTypes[n][i]=r))}),r}u.errare("getInputType => Father modules should be treated specifically")}},getInputRegistrationParams:function(i,n,e){var o=this;if(o.cachedInputRegistrationParams=o.cachedInputRegistrationParams||{},o.cachedInputRegistrationParams[n]=o.cachedInputRegistrationParams[n]||{},_.has(o.cachedInputRegistrationParams[n],i))return o.cachedInputRegistrationParams[n][i];if(_.isUndefined(sektionsLocalizedData.registeredModules))u.errare("getInputRegistrationParams => missing sektionsLocalizedData.registeredModules");else if(_.isUndefined(sektionsLocalizedData.registeredModules[n]))u.errare("getInputRegistrationParams => missing "+n+" in sektionsLocalizedData.registeredModules");else{if(!sektionsLocalizedData.registeredModules[n].is_father){_.isUndefined(e)&&(e=sektionsLocalizedData.registeredModules[n].tmpl);var r={};return _.each(e,function(e,t){_.isEmpty(r)&&(i!==t||_.isUndefined(e.input_type)||(r=e),_.isEmpty(r)&&(_.isArray(e)||_.isObject(e))&&(r=o.getInputRegistrationParams(i,n,e)),_.isEmpty(r)||(o.cachedInputRegistrationParams[n][i]=r))}),r}u.errare("getInputRegistrationParams => Father modules should be treated specifically")}},inputIsAFontFamilyModifier:function(i,e){var n=this;if(n.cachedFontFamilyModifier=n.cachedFontFamilyModifier||{},_.has(n.cachedFontFamilyModifier,i))return n.cachedFontFamilyModifier[i];if(!_.isUndefined(sektionsLocalizedData.registeredModules)){_.isUndefined(e)&&(e=sektionsLocalizedData.registeredModules);var o="not_set";return _.each(e,function(e,t){"not_set"===o&&(i!==t||_.isUndefined(e.input_type)||(o=!_.isUndefined(e.refresh_fonts)&&e.refresh_fonts),"not_set"===o&&(_.isArray(e)||_.isObject(e))&&(o=n.inputIsAFontFamilyModifier(i,e)),"not_set"!==o&&(n.cachedFontFamilyModifier[i]=o))}),o}u.errare("inputIsAFontFamilyModifier => missing sektionsLocalizedData.registeredModules")},getModuleStartingValue:function(e){var a=this;if(!sektionsLocalizedData.registeredModules)return u.errare("getModuleStartingValue => missing sektionsLocalizedData.registeredModules"),"no_starting_value";if(_.isUndefined(sektionsLocalizedData.registeredModules[e]))return u.errare("getModuleStartingValue => the module type "+e+" is not registered"),"no_starting_value";var t,i,n,c=function(e){return readyStartValues=[],_.each(e,function(e){if(_.isObject(e)){var t=p.extend(!0,{},e);t.id=u.czr_sektions.guid(),readyStartValues.push(t)}else u.errare("getModuleStartingValue => multi-item module => items should be objects for module "+mod_type)}),readyStartValues},l={},d=(t=e,sektionsLocalizedData.registeredModules[t]&&sektionsLocalizedData.registeredModules[t].starting_value?sektionsLocalizedData.registeredModules[t].starting_value:{});return n=e,sektionsLocalizedData.registeredModules[n]&&!0===sektionsLocalizedData.registeredModules[n].is_father?_.each((i=e,sektionsLocalizedData.registeredModules[i]&&sektionsLocalizedData.registeredModules[i].children?sektionsLocalizedData.registeredModules[i].children:{}),function(e,t){var i,n,o,r,s=(i=e,r=(o=d)[n=t]?o[n]:{},a.isMultiItemsModule(i)&&_.isArray(r)?c(r):r);_.isEmpty(s)||(l[t]=s)}):l=a.isMultiItemsModule(e)&&_.isArray(d)?c(d):d,_.isEmpty(l)?"no_starting_value":l},selectNextTabbableOrFocusable:function(e){var t=p(e),i=p(":focus"),n=0;if(1===i.length){var o=t.index(i);o+1<t.length&&(n=o+1)}t.eq(n).focus()},selectPrevTabbableOrFocusable:function(e){var t=p(e),i=p(":focus"),n=t.length-1;if(1===i.length){var o=t.index(i);0<o&&(n=o-1)}t.eq(n).focus()},setupSelectInput:function(e){var n=this,t=(n.input_parent,n.module,u.czr_sektions.getInputRegistrationParams(n.id,n.module.module_type)),i={params:e=_.isEmpty(e)?t.choices:e};if(n.module.trigger("nimble-set-select-input-options",i),e=i.params,!_.isEmpty(e)&&_.isObject(e))switch(n.type){case"simpleselect":_.each(e,function(e,t){var i={value:t,html:e};t==n()?p.extend(i,{selected:"selected"}):"px"===t&&p.extend(i,{selected:"selected"}),p("select[data-czrtype]",n.container).append(p("<option>",i))}),p("select[data-czrtype]",n.container).selecter();break;case"multiselect":var o=n();o=_.isString(o)?[o]:o,o=_.isArray(o)?o:[],_.each(e,function(e,t){var i={value:t,html:e};_.contains(o,t)&&p.extend(i,{selected:"selected"}),p("select[data-czrtype]",n.container).append(p("<option>",i))}),p("select[data-czrtype]",n.container).czrSelect2({closeOnSelect:!0,templateSelection:function(e){return e.text.replace(/\u2013|\u2014/g,"")}}),p("select[data-czrtype]",n.container).on("change",function(){0===p(this).find("option:selected").length&&n([])});break;default:u.errare("::setupSelectInput => invalid input type => "+n.type)}else u.errare("api.czr_sektions.setupSelectInput => missing select options for input id => "+n.id+" in module "+n.module.module_type)},maybeSetupDeviceSwitcherForInput:function(){var n=this;if(!n.previewedDevice){var e=['<span class="sek-input-device-switcher">','<i data-sek-device="desktop" class="sek-switcher preview-desktop active" title="'+sektionsLocalizedData.i18n["Settings on desktops"]+'"></i>','<i data-sek-device="tablet" class="sek-switcher preview-tablet" title="'+sektionsLocalizedData.i18n["Settings on tablets"]+'"></i>','<i data-sek-device="mobile" class="sek-switcher preview-mobile" title="'+sektionsLocalizedData.i18n["Settings on mobiles"]+'"></i>',"</span>"].join(" ");n.container.find(".customize-control-title").first().prepend(e),n.previewedDevice=new u.Value(u.previewedDevice()),syncWithPreviewedDevice=function(e){e.stopPropagation(),n.container.find("[data-sek-device]").removeClass("active"),p(this).addClass("active");var t,i="desktop";try{i=p(this).data("sek-device")}catch(e){u.errare("maybeSetupDeviceSwitcherForInput => error when binding sek-switcher",e)}try{u.previewedDevice(i)}catch(e){u.errare("maybeSetupDeviceSwitcherForInput => error when setting the previewed device",e)}n.previewedDevice(i),_.isUndefined(e.isTrigger)&&n.module&&n.module.control&&n.module.control.params.section&&(t=n.module.control.params.section,_.delay(function(){u.previewer.send("sek-animate-to-level",{id:t})},600))},n.container.on("click","[data-sek-device]",syncWithPreviewedDevice);var t=n.container.find('[data-sek-device="'+u.previewedDevice()+'"]');0<t.length&&t.trigger("click")}},scheduleModuleAccordion:function(e){e=e||{expand_first_control:!0};var i=this;if(!0!==i.container.data("sek-module-accordion-has-been-setup")&&(p(i.container).on("click",".customize-control label > .customize-control-title",function(e){e.stopPropagation();var t=p(this).closest(".customize-control");"no"!==t.attr("data-sek-accordion")&&(i.container.find(".customize-control").not(t).each(function(){p(this).attr("data-sek-accordion")||p(this).attr("data-sek-expanded","false")}),t.attr("data-sek-expanded","false"==t.attr("data-sek-expanded")?"true":"false"),t.trigger("true"==t.attr("data-sek-expanded")?"sek-accordion-expanded":"sek-accordion-collapsed"))}),i.container.data("sek-module-accordion-has-been-setup",!0),e.expand_first_control)){var t=_.filter(i.controls(),function(e){return!e.params||!e.params.sek_registration_params||!1!==e.params.sek_registration_params.has_accordion}),n=_.first(t);_.isObject(n)&&!_.isEmpty(n.id)&&u.control(n.id,function(e){e.container.one("items-collection-populated",function(){p(this).find("label > .customize-control-title").trigger("click")}),e.module_ready_on_custom_control_event_is_setup?e.container.trigger("sek-accordion-expanded"):e.container.one("module_ready_on_custom_control_event_is_setup",function(){e.container.trigger("sek-accordion-expanded")})})}},isPromise:function(e){return e&&"function"==typeof e.then&&String(p.Deferred().then)===String(e.then)},whenAllPromisesInParallel:function(e){var i=this,t=p.Deferred(),n=[],o=_.keys(e);return _.each(e,function(e,t){n.push(p.Deferred(function(t){(i.isPromise(e)?e:p.Deferred()).done(t.resolve).fail(function(e){t.reject(e)})}))}),p.when.apply(this,n).done(function(){var i={},e=Array.prototype.slice.call(arguments);_.each(e,function(e,t){i[o[t]]=e}),t.resolve(i)}).fail(t.reject),t},whenAllPromisesInSerie:function(t,i,n,o){i=i||0,n=n||{},o=o||p.Deferred();var r=this;if(_.isArray(t)){var e=t[i];(r.isPromise(e)?e:p.Deferred(function(e){e.resolve()})).always(function(e){n[i]=e,i+1==t.length?o.resolve(n):i+1<t.length&&r.whenAllPromisesInSerie(t,i+1,n,o)})}return o},importAttachment:function(t){return wp.ajax.post("sek_import_attachment",{img_url:t,nonce:u.settings.nonce.save}).fail(function(e){u.errare("sek_import_attachment ajax action failed for image "+t,e)})},cleanIds:function(e){e.id="";var t=this;return _.each(e.collection,function(e){e.id="",_.isArray(e.collection)&&t.cleanIds(e)}),e},getDefaultSektionSettingValue:function(e){return!_.isUndefined(e)&&_.contains(["local","global"],e)||u.errare("getDefaultSektionSettingValue => the skope should be set to local or global"),"global"===e?sektionsLocalizedData.defaultGlobalSektionSettingValue:sektionsLocalizedData.defaultLocalSektionSettingValue},scheduleVisibilityOfInputId:function(t,i){var n=this.input_parent;if(!_.isFunction(i)||_.isEmpty(t))throw new Error("::scheduleVisibilityOfInputId => error when firing for input id : "+this.id);if(!n.czr_Input.has(t))throw new Error("::scheduleVisibilityOfInputId => missing input id : "+t);n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(c,m){m.extend(CZRSeksPrototype,{setupDnd:function(){var t=this;t.bind("sek-refresh-dragzones",function(e){!0!="draggable"in document.createElement("span")&&c.panel(sektionsLocalizedData.sektionsPanelId,function(e){c.notifications.add(new c.Notification("drag-drop-support",{type:"error",message:sektionsLocalizedData.i18n["This browser does not support drag and drop. You might need to update your browser or use another one."],dismissible:!0})),_.delay(function(){c.notifications.remove("drag-drop-support")},1e4)}),t.setupNimbleDragZones(e.input_container)}),c.previewer.bind("ready",function(){try{t.setupNimbleDropZones()}catch(e){c.errare("::setupDnd => error on self.setupNimbleDropZones()",e)}_.isUndefined(_.findWhere(t.registered(),{module_type:"sek_intro_sec_picker_module"}))&&_.isUndefined(_.findWhere(t.registered(),{module_type:"sek_module_picker_module"}))||t.rootPanelFocus()}),t.reactToDrop()},setupNimbleDragZones:function(e){var n=this,o=function(){c.notifications.add(new c.Notification("missing-injection-target",{type:"info",message:sektionsLocalizedData.i18n["You first need to click on a target ( with a + icon ) in the preview."],dismissible:!0})),_.delay(function(){c.notifications.remove("missing-injection-target")},3e4)};e.find('[draggable="true"]').each(function(){m(this).on("dragstart",function(e){(function(e){n.lastClickedTargetInPreview({}),e.originalEvent.dataTransfer.setData("sek-content-type",m(this).data("sek-content-type")),e.originalEvent.dataTransfer.setData("sek-eligible-for-module-dropzones",m(this).data("sek-eligible-for-module-dropzones")),e.originalEvent.dataTransfer.setData("sek-content-id",m(this).data("sek-content-id")),e.originalEvent.dataTransfer.setData("sek-section-type",m(this).data("sek-section-type")),e.originalEvent.dataTransfer.setData("sek-is-user-section",m(this).data("sek-is-user-section")),n.dndData={content_type:e.originalEvent.dataTransfer.getData("sek-content-type"),eligible_for_module_dropzones:"true"===e.originalEvent.dataTransfer.getData("sek-eligible-for-module-dropzones"),content_id:e.originalEvent.dataTransfer.getData("sek-content-id"),section_type:e.originalEvent.dataTransfer.getData("sek-section-type"),is_user_section:"true"===e.originalEvent.dataTransfer.getData("sek-is-user-section")};try{e.originalEvent.dataTransfer.setData("browserSupport","browserSupport"),e.originalEvent.dataTransfer.clearData("browserSupport")}catch(e){c.panel(sektionsLocalizedData.sektionsPanelId,function(e){c.notifications.add(new c.Notification("drag-drop-support",{type:"error",message:sektionsLocalizedData.i18n["This browser does not support drag and drop. You might need to update your browser or use another one."],dismissible:!0})),_.delay(function(){c.notifications.remove("drag-drop-support")},1e4)})}m(this).addClass("sek-dragged"),n.cachedElements.$body.addClass("sek-dragging"),c.previewer.send("sek-drag-start",{content_type:n.dndData.content_type,eligible_for_module_dropzones:n.dndData.eligible_for_module_dropzones})}).call(m(this),e)}).on("dragend",function(e){(function(e){n.cachedElements.$body.removeClass("sek-dragging"),m(this).removeClass("sek-dragged"),c.previewer.send("sek-drag-stop")}).call(m(this),e)}).on("dblclick",function(e){(function(e){var t,i=n.lastClickedTargetInPreview();!_.isEmpty(i)&&i.id?t=n.dnd_getDropZonesElements().find('[data-sek-id="'+i.id+'"]').find(".sek-module-drop-zone-for-first-module").first():o(),t&&0<t.length?(c.czr_sektions.trigger("sek-content-dropped",{drop_target_element:t,location:t.closest('[data-sek-level="location"]').data("sek-id"),before_module_or_nested_section:t.data("drop-zone-before-module-or-nested-section"),after_module_or_nested_section:t.data("drop-zone-after-module-or-nested-section"),before_section:t.data("drop-zone-before-section"),after_section:t.data("drop-zone-after-section"),content_type:m(this).attr("data-sek-content-type"),content_id:m(this).attr("data-sek-content-id"),section_type:m(this).attr("data-sek-section-type"),is_user_section:"true"===m(this).attr("data-sek-is-user-section")}),n.lastClickedTargetInPreview({})):(o(),c.errare("Double click insertion => the target zone was not found"))}).call(m(this),e)})})},setupNimbleDropZones:function(){var t=this;if(this.$dropZones=this.dnd_getDropZonesElements(),this.preDropElement=m("<div>",{class:sektionsLocalizedData.preDropElementClass,html:""}),this.$dropZones.length<1)throw new Error("::setupNimbleDropZones => invalid Dom element");this.$dropZones.each(function(){var e=m(this);!0!==e.data("zone-droppable-setup")&&(t.enterOverTimer=null,e.on("dragenter dragover",sektionsLocalizedData.dropSelectors,function(e){_.isNull(t.enterOverTimer)&&(t.enterOverTimer=!0,_.delay(function(){t.currentMousePosition&&t.currentMousePosition+""==e.clientY+""+e.clientX?t.enterOverTimer=null:(t.currentMousePosition=e.clientY+""+e.clientX,t.dnd_toggleDragApproachClassesToDropZones(e))},100)),t.dnd_canDrop({targetEl:m(this),evt:e})&&(e.stopPropagation(),t.dnd_OnEnterOver(m(this),e))}).on("dragleave drop",sektionsLocalizedData.dropSelectors,function(e){switch(e.type){case"dragleave":t.dnd_isOveringDropTarget(m(this),e)||t.dnd_cleanOnLeaveDrop(m(this),e);break;case"drop":this.$cachedDropZoneCandidates=null,t.dnd_canDrop({targetEl:m(this),evt:e})&&(e.preventDefault(),t.dnd_onDrop(m(this),e),t.dnd_cleanOnLeaveDrop(m(this),e),c.previewer.send("sek-drag-stop"))}}).data("zone-droppable-setup",!0))})},dnd_isInTarget:function(e,t){var i=t.clientY,n=t.clientX,o=e[0].getBoundingClientRect(),r=n<=o.right&&o.left<=n;return i>=o.top&&o.bottom>=i&&r},dnd_toggleDragApproachClassesToDropZones:function(u){var p=this;this.$dropZones=this.$dropZones||this.dnd_getDropZonesElements(),this.$cachedDropZoneCandidates=_.isEmpty(this.$cachedDropZoneCandidates)?this.$dropZones.find(".sek-drop-zone"):this.$cachedDropZoneCandidates,this.distanceTable=[],this.$dropZones.find(".sek-drop-zone").each(function(){var e,t,i=u.clientY,n=u.clientX,o=m(this)[0].getBoundingClientRect(),r=Math.abs(i-(o.bottom-(o.bottom-o.top)/2)),s=(Math.abs(o.top-i),Math.abs(n-(o.right-(o.right-o.left)/2))),a=(o.right,o.left,r<50),c=s<50,l=n<=o.right&&o.left<=n,d=i>=o.top&&o.bottom>=i;p.distanceTable.push({el:m(this),dist:d&&l?0:(e=s,t=r,Math.sqrt(e*e+t*t))}),m(this).removeClass("sek-drag-is-in"),(a||d)&&(c||l)?(m(this).removeClass("sek-drag-is-approaching"),m(this).removeClass("sek-drag-is-close"),m(this).addClass("sek-drag-is-very-close")):(m(this).removeClass("sek-drag-is-approaching"),m(this).removeClass("sek-drag-is-close"),m(this).removeClass("sek-drag-is-very-close")),m(this).removeClass("sek-drag-is-in")});var t=_.min(_.pluck(p.distanceTable,"dist"));p.$dropTargetCandidate=null,_.each(p.distanceTable,function(e){_.isNull(p.$dropTargetCandidate)&&t===e.dist&&(p.$dropTargetCandidate=e.el)}),p.$dropTargetCandidate&&0<p.$dropTargetCandidate.length&&p.dnd_isInTarget(p.$dropTargetCandidate,u)&&p.$dropTargetCandidate.addClass("sek-drag-is-in"),p.enterOverTimer=null},dnd_getPreDropElementContent:function(e){var t,i,n=m(e.currentTarget);switch(this.dndData.content_type){case"module":t=sektionsLocalizedData.i18n["Insert here"],0<n.length&&("between-sections"!==n.data("sek-location")&&"in-empty-location"!==n.data("sek-location")||(t=sektionsLocalizedData.i18n["Insert in a new section"])),i='<div class="sek-module-placeholder-content"><p>'+t+"</p></div>";break;case"preset_section":i='<div class="sek-module-placeholder-content"><p>'+(t=sektionsLocalizedData.i18n["Insert a new section here"])+"</p></div>";break;default:c.errare("::dnd_getPreDropElementContent => invalid content type provided")}return i},dnd_getDropZonesElements:function(){return m(c.previewer.targetWindow().document)},dnd_canDrop:function(e){var t=this,i=(e=_.extend({targetEl:{},evt:{}},e||{})).targetEl;if(!_.isObject(i)||i.length<1)return!1;if(i.closest('[data-sek-level="location"]').length<1)return!1;var n=i.hasClass("sek-content-preset_section-drop-zone"),o=i.hasClass("sek-module-drop-zone-for-first-module"),r=!0===i.closest('[data-sek-level="location"]').data("sek-is-header-location"),s=!0===i.closest('[data-sek-level="location"]').data("sek-is-footer-location"),a="preset_section"===t.dndData.content_type&&"content"===t.dndData.section_type,c=function(e){m(".sek-no-drop-possible-message",i).length<1&&i.append(['<div class="sek-no-drop-possible-message">','<i class="material-icons">not_interested</i>',e,"</div>"].join(""))};return!!i.hasClass("sek-drop-zone")&&(!t.dndData.is_user_section&&(r||s)&&a?(c(r?sektionsLocalizedData.i18n["Header location only accepts modules and pre-built header sections"]:sektionsLocalizedData.i18n["Footer location only accepts modules and pre-built footer sections"]),!1):s&&"preset_section"===t.dndData.content_type&&"header"===t.dndData.section_type?(c(sektionsLocalizedData.i18n["You can't drop a header section in the footer location"]),!1):r&&"preset_section"===t.dndData.content_type&&"footer"===t.dndData.section_type?(c(sektionsLocalizedData.i18n["You can't drop a footer section in the header location"]),!1):"preset_section"===t.dndData.content_type&&!0===t.dndData.eligible_for_module_dropzones&&!n||("preset_section"===t.dndData.content_type&&n||"module"===t.dndData.content_type&&!n||"preset_section"===t.dndData.content_type&&o))},dnd_OnEnterOver:function(e,t){t.preventDefault(),!0!==e.data("is-drag-entered")&&(e.data("is-drag-entered",!0),e.addClass("sek-active-drop-zone"),this.$dropZones.addClass("sek-is-dragging"));try{this.dnd_mayBePrintPreDropElement(e,t)}catch(e){c.errare("Error when trying to insert the preDrop content",e)}},dnd_cleanOnLeaveDrop:function(e,t){var i=this;this.$dropZones=this.$dropZones||this.dnd_getDropZonesElements(),this.preDropElement.remove(),this.$dropZones.removeClass("sek-is-dragging"),m(sektionsLocalizedData.dropSelectors,this.$dropZones).each(function(){i.dnd_cleanSingleDropTarget(m(this))})},dnd_cleanSingleDropTarget:function(e){_.isEmpty(e)||e.length<1||(e.data("is-drag-entered",!1),e.data("preDrop-position",!1),e.removeClass("sek-active-drop-zone"),e.find(".sek-drop-zone").removeClass("sek-drag-is-close"),e.find(".sek-drop-zone").removeClass("sek-drag-is-approaching"),e.removeClass("sek-feed-me-seymore"),e.find(".sek-no-drop-possible-message").remove())},dnd_getPosition:function(e,t){var i=e[0].getBoundingClientRect(),n=i.height;return"before"===e.data("preDrop-position")?n+=this.preDropElement.outerHeight():"after"===e.data("preDrop-position")&&(n-=this.preDropElement.outerHeight()),0<t.originalEvent.clientY-i.top-n/2?"after":"before"},dnd_mayBePrintPreDropElement:function(e,t){var i=this,n=e.data("preDrop-position"),o=this.dnd_getPosition(e,t);if(n!==o&&!0!==i.isPrintingPreDrop){i.isPrintingPreDrop=!0,this.dnd_cleanSingleDropTarget(this.$currentPreDropTarget);var r="between-sections"===e.data("sek-location")||"in-empty-location"===e.data("sek-location");m.when(i.preDropElement.remove()).done(function(){e["before"===o?"prepend":"append"](i.preDropElement).find("."+sektionsLocalizedData.preDropElementClass).html(i.dnd_getPreDropElementContent(t)),e.find("."+sektionsLocalizedData.preDropElementClass).toggleClass("in-new-sektion",r),e.data("preDrop-position",o),e.addClass("sek-feed-me-seymore"),i.isPrintingPreDrop=!1,i.$currentPreDropTarget=e})}},dnd_isOveringDropTarget:function(e,t){var i=e[0].getBoundingClientRect(),n=t.clientX,o=t.clientY,r=i.left,s=i.right,a=i.top,c=i.bottom;return r<=n&&n-r<=s-r&&(a<=o&&o-a<=c-a)},dnd_onDrop:function(e,t){t.stopPropagation();this.dnd_getPosition(e,t),e.index();c.czr_sektions.trigger("sek-content-dropped",{drop_target_element:e,location:e.closest('[data-sek-level="location"]').data("sek-id"),before_module_or_nested_section:e.data("drop-zone-before-module-or-nested-section"),after_module_or_nested_section:e.data("drop-zone-after-module-or-nested-section"),before_section:e.data("drop-zone-before-section"),after_section:e.data("drop-zone-after-section"),content_type:t.originalEvent.dataTransfer.getData("sek-content-type"),eligible_for_module_dropzones:"true"===t.originalEvent.dataTransfer.getData("sek-eligible-for-module-dropzones"),content_id:t.originalEvent.dataTransfer.getData("sek-content-id"),section_type:t.originalEvent.dataTransfer.getData("sek-section-type"),is_user_section:"true"===t.originalEvent.dataTransfer.getData("sek-is-user-section")})},reactToDrop:function(){this.bind("sek-content-dropped",function(e){try{!function(e){if(!_.isObject(e))throw new Error("Invalid params provided");if(e.drop_target_element.length<1)throw new Error("Invalid drop_target_element");var t,i=e.drop_target_element,n="content-in-column";switch(i.data("sek-location")){case"between-sections":n="content-in-a-section-to-create";break;case"in-empty-location":e.is_first_section=!0,e.send_to_preview=!1,n="content-in-empty-location";break;case"between-columns":n="content-in-new-column"}"preset_section"===e.content_type&&(i.hasClass("sek-module-drop-zone-for-first-module")?1<(t=i.closest('div[data-sek-level="section"]')).find(".sek-sektion-inner").first().children('[data-sek-level="column"]').length?(n="preset-section-in-a-nested-section-to-create",e.is_nested=!0,e.in_column=i.closest('[data-sek-level="column"]').data("sek-id"),e.in_sektion=t.data("sek-id")):(e.sektion_to_replace=t.data("sek-id"),e.after_section=e.sektion_to_replace,e.in_column=t.closest('[data-sek-level="column"]').data("sek-id"),n="content-in-a-section-to-replace"):("between-sections"===i.data("sek-location")&&(n="content-in-a-section-to-create"),"between-modules-and-nested-sections"===i.data("sek-location")&&e.eligible_for_module_dropzones&&(n="preset-section-eligible-for-module-dropzones-in-new-nested-sektion",e.is_nested=!0,e.in_column=i.closest('[data-sek-level="column"]').data("sek-id"),t=i.closest('div[data-sek-level="section"]'),e.in_sektion=t.data("sek-id"))));switch(n){case"content-in-column":var o=i.closest("div[data-sek-level]");if(o.length<1)throw new Error("No valid level dom element found");var r=o.data("sek-level"),s=o.data("sek-id");if(_.isEmpty(r)||_.isEmpty(s))throw new Error("No valid level id found");c.previewer.trigger("sek-add-module",{level:r,id:s,in_column:i.closest('div[data-sek-level="column"]').data("sek-id"),in_sektion:i.closest('div[data-sek-level="section"]').data("sek-id"),before_module_or_nested_section:e.before_module_or_nested_section,after_module_or_nested_section:e.after_module_or_nested_section,content_type:e.content_type,content_id:e.content_id});break;case"content-in-a-section-to-create":case"content-in-a-section-to-replace":case"content-in-empty-location":c.previewer.trigger("sek-add-content-in-new-sektion",e);break;case"preset-section-in-a-nested-section-to-create":c.previewer.trigger("sek-add-preset-section-in-new-nested-sektion",e);break;case"preset-section-eligible-for-module-dropzones-in-new-nested-sektion":var a=m.extend(!0,{},e);a=m.extend(a,{before_module_or_nested_section:e.before_module_or_nested_section,after_module_or_nested_section:e.after_module_or_nested_section}),c.previewer.trigger("sek-add-preset-section-in-new-nested-sektion",a);break;default:c.errare("sek control panel => ::reactToDrop => invalid drop case : "+n)}}(e)}catch(e){c.errare("error when reactToDrop",e)}})}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{setupTinyMceEditor:function(){var n=this;l.sekEditorExpanded=new l.Value(!1),n.editorEventsListenerSetup=!1,n.$editorPane=d("#czr-customize-content_editor-pane"),n.$editorDragbar=d("#czr-customize-content_editor-dragbar"),n.$preview=d("#customize-preview"),n.$collapseSidebar=d(".collapse-sidebar"),n.attachResizeEventsToEditor();d("#customize-theme-controls").on("click",'[data-czr-action="open-tinymce-editor"]',function(){var e=d(this).data("czr-control-id"),t=d(this).data("czr-input-id");_.isEmpty(e)||_.isEmpty(t)?l.errare("toggle-tinymce-editor => missing input or control id"):l.sekEditorExpanded(!0)}),l.sekEditorExpanded.bind(function(e,t,i){!function(){l.sekTinyMceEditor=tinyMCE.get(sektionsLocalizedData.idOfDetachedTinyMceTextArea);var e=function(){!1===n.editorEventsListenerSetup&&(n.editorEventsListenerSetup=!0,n.trigger("sek-tiny-mce-editor-bound-and-instantiated"))};l.sekTinyMceEditor&&(l.sekTinyMceEditor.initialized?e():l.sekTinyMceEditor.on("init",function(){e()}))}(),e&&l.sekTinyMceEditor&&l.sekTinyMceEditor.focus(),d(document.body).toggleClass("czr-customize-content_editor-pane-open",e),n.cachedElements.$window[e?"on":"off"]("resize",function(){l.sekEditorExpanded()&&_.delay(function(){n.czrResizeEditor(window.innerHeight-n.$editorPane.height())},50)}),e?(n.czrResizeEditor(window.innerHeight-n.$editorPane.height()),_.delay(function(){n.cachedElements.$window.trigger("resize")},100)):(n.$preview.css("bottom",""),n.$collapseSidebar.css("bottom",""))}),d("#czr-customize-content_editor-pane").on("click",'[data-czr-action="close-tinymce-editor"]',function(){l.sekEditorExpanded(!1)}),d("#customize-controls").on("click",function(e){"open-tinymce-editor"!=d(e.target).data("czr-action")&&l.sekEditorExpanded(!1,{context:"clicked anywhere"})}),d(document).on("keydown",_.throttle(function(e){27===e.keyCode&&l.sekEditorExpanded(!1)},50)),n.bind("sek-tiny-mce-editor-bound-and-instantiated",function(){var e=d(l.sekTinyMceEditor.iframeElement).contents().get(0);d(e).on("keydown",_.throttle(function(e){27===e.keyCode&&l.sekEditorExpanded(!1)},50))}),_.each(["sek-click-on-inactive-zone","sek-add-section","sek-add-column","sek-add-module","sek-remove","sek-move","sek-duplicate","sek-resize-columns","sek-add-content-in-new-sektion","sek-pick-content","sek-edit-options","sek-edit-module","sek-notify"],function(e){"sek-edit-module"!=e?l.previewer.bind(e,function(){l.sekEditorExpanded(!1)}):l.previewer.bind(e,function(e){l.sekEditorExpanded("czr_tiny_mce_editor_module"===e.module_type)})})},attachResizeEventsToEditor:function(){var t=this;d("#czr-customize-content_editor-pane").on("mousedown mouseup",function(e){if(("mousedown"!==e.type||"czr-customize-content_editor-dragbar"===d(e.target).attr("id")||d(e.target).hasClass("czr-resize-handle"))&&l.sekEditorExpanded())switch(e.type){case"mousedown":d(document).on("mousemove."+sektionsLocalizedData.idOfDetachedTinyMceTextArea,function(e){e.preventDefault(),d(document.body).addClass("czr-customize-content_editor-pane-resize"),d("#czr-customize-content_editor_ifr").css("pointer-events","none"),t.czrResizeEditor(e.pageY)});break;case"mouseup":d(document).off("mousemove."+sektionsLocalizedData.idOfDetachedTinyMceTextArea),d(document.body).removeClass("czr-customize-content_editor-pane-resize"),d("#czr-customize-content_editor_ifr").css("pointer-events","")}})},czrResizeEditor:function(e){var t,i=this,n=window.innerHeight,o=(window.innerWidth,{}),r=d("#czr-customize-content_editor_ifr"),s=d("#wp-czr-customize-content_editor-tools"),a=i.$editorPane.find(".mce-toolbar-grp"),c=i.$editorPane.find(".mce-statusbar");l.sekEditorExpanded()&&(_.isNaN(e)||(t=n-e),o.height=t,o.components=s.outerHeight()+a.outerHeight()+c.outerHeight(),t<40&&(o.height=40),n-1<t&&(o.height=n-1),n<i.$editorPane.outerHeight()&&(o.height=n),i.$preview.css("bottom",o.height),i.$editorPane.css("height",o.height),r.css("height",o.height-o.components))}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(d,a){a.extend(CZRSeksPrototype,{export_template:function(e){e=e||{},e=a.extend({scope:"local"},e);var i=[],t={sek_export_nonce:d.settings.nonce.save,skope_id:"local"===e.scope?d.czr_skopeBase.getSkopeProperty("skope_id"):sektionsLocalizedData.globalSkopeId,active_locations:d.czr_sektions.activeLocations()};_.each(t,function(e,t){i.push(encodeURIComponent(t)+"="+encodeURIComponent(e))}),wp.ajax.post("sek_pre_export_checks",{nonce:d.settings.nonce.save,sek_export_nonce:d.settings.nonce.save,skope_id:"local"===e.scope?d.czr_skopeBase.getSkopeProperty("skope_id"):sektionsLocalizedData.globalSkopeId,active_locations:d.czr_sektions.activeLocations()}).done(function(){a(window).off("beforeunload"),window.location.href=[sektionsLocalizedData.customizerURL,"?",i.join("&")].join(""),a(window).on("beforeunload")}).fail(function(e){d.previewer.trigger("sek-notify",{notif_id:"import-failed",type:"error",duration:3e4,message:["<span>","<strong>",[sektionsLocalizedData.i18n["Export failed"],encodeURIComponent(e)].join(" "),"</strong>","</span>"].join("")})})},getTmplJsonFromUserTmpl:function(e){var t=a.Deferred();return wp.ajax.post("sek_get_user_tmpl_json",{nonce:d.settings.nonce.save,tmpl_post_name:e}).done(function(e){t.resolve({success:!0,tmpl_json:e})}).fail(function(e){t.resolve({success:!1}),d.errorLog("ajax getTmplJsonFromUserTmpl => error",e),d.previewer.trigger("sek-notify",{type:"error",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>@missi18n error when fetching the template</strong>","</span>"].join("")})}),t},getTmplJsonFromApi:function(i){var n=a.Deferred();return a.getJSON("https://api.nimblebuilder.com/wp-json/nimble/v2/cravan").done(function(e){_.isObject(e)&&e.lib&&e.lib.templates||(d.errare("::import_nimble_template success but invalid response => ",e),n.resolve({success:!1}));var t=e.lib.templates[i];t||(d.errare("::import_nimble_template => the requested template is not available",e.lib.templates),d.previewer.trigger("sek-notify",{notif_id:"missing-tmpl",type:"info",duration:1e4,message:['<span style="color:#0075a2">',"<strong>","@missi18n the requested template is not available","</strong>","</span>"].join("")}),n.resolve({success:!1})),n.resolve({success:!0,tmpl_json:t})}).fail(function(e){d.errare("::import_nimble_template failed => ",e),n.resolve({success:!1})}),n.promise()},import_nimble_template:function(e){var t=this,i=(e=a.extend({template_name:"",from:"user"},e||{})).template_name;!_.isEmpty(i)&&_.isString(i)||d.errare("::import => error => invalid template name"),console.log("import_nimble_template params ?",e),("nimble_api"===e.from?t.getTmplJsonFromApi(i):t.getTmplJsonFromUserTmpl(i)).done(function(e){console.log("SO IMPORT ??",e),e.success&&t.import_template_from_user_collection_or_remote_api({pre_import_check:!1,template_name:i,template_data:e.tmpl_json})})},import_template_from_user_collection_or_remote_api:function(t){console.log("import_template_from_user_collection_or_remote_api",t);var i=this;t=t||{};var e;if(!(t=a.extend({is_file_import:!1,pre_import_check:!1,assign_missing_locations:!1},t)).template_data)throw new Error("::import_template => missing remote template data");e=wp.ajax.post("sek_process_template_json",{nonce:d.settings.nonce.save,template_data:JSON.stringify(t.template_data),pre_import_check:!1}).done(function(e){d.infoLog("TEMPLATE PRE PROCESS DONE",e)}).fail(function(e){d.previewer.trigger("sek-notify",{notif_id:"import-failed",type:"error",duration:3e4,message:["<span>","<strong>",[sektionsLocalizedData.i18n["Export failed"],encodeURIComponent(e)].join(" "),"</strong>","</span>"].join("")})}),d.previewer.send("sek-maybe-print-loader",{fullPageLoader:!0,duration:3e4}),_.delay(function(){"pending"===e.state()&&d.previewer.trigger("sek-notify",{notif_id:"import-too-long",type:"error",duration:2e4,message:["<span>","<strong>",sektionsLocalizedData.i18n['Import exceeds server response time, try to uncheck "import images" option.'],"</strong>","</span>"].join("")})},3e4),e.done(function(e){_.isObject(e)&&(e={success:!0,data:e}),d.czr_sektions.isImportedContentEligibleForAPI(e,t)?(e.data.data.collection=i.setIdsForImportedTmpl(e.data.data.collection),d.czr_sektions.doUpdateApiSettingAfterTmplImport(e,t)):d.infoLog("::import_template problem => !api.czr_sektions.isImportedContentEligibleForAPI",e,t)}).fail(function(e){d.errare("::import_template => ajax error",e),d.previewer.trigger("sek-notify",{notif_id:"import-failed",type:"error",duration:3e4,message:["<span>","<strong>",sektionsLocalizedData.i18n["Import failed, file problem"],"</strong>","</span>"].join("")})})},import_template_from_file:function(i){console.log("import_template_from_file",i),i=i||{};var e,t,n=(i=a.extend({is_file_import:!0,pre_import_check:!1,assign_missing_locations:!1,input:"",file_input:""},i)).input;if(_.isEmpty(n))throw new Error("::import_template => missing file_input param");if(_.isEmpty(i.file_input))throw new Error("::import_template => missing file_input param");if(i.file_input.length<1||_.isUndefined(i.file_input[0])||!i.file_input[0].files||_.isEmpty(i.file_input.val()))d.previewer.trigger("sek-notify",{notif_id:"missing-import-file",type:"info",duration:3e4,message:['<span style="color:#0075a2">',"<strong>",sektionsLocalizedData.i18n["Missing file"],"</strong>","</span>"].join("")});else{t=d.czr_sektions.getInputRegistrationParams(n.id,n.module.module_type).scope,n.container.find(".sek-uploading").show(),d.notifications.remove("missing-import-file"),d.notifications.remove("import-success"),d.notifications.remove("import-failed"),d.notifications.remove("img-import-errors");var o=new FormData;if(o.append("file_candidate",i.file_input[0].files[0]),o.append("action","sek_get_manually_imported_file_content"),o.append("nonce",d.settings.nonce.save),_.contains(["local","global"],t)){if(o.append("skope",t),i.pre_import_check&&o.append("pre_import_check",i.pre_import_check),o.append("import_img",n.input_parent.czr_Input("import_img")()),n.container.find(".sek-uploading").show(),e=a.ajax({url:wp.ajax.settings.url,data:o,processData:!1,contentType:!1,type:"POST"}),i.pre_import_check)return a.Deferred(function(){var t=this;e.done(function(e){e.success||t.reject(e),d.czr_sektions.isImportedContentEligibleForAPI(e,i)||t.reject(e),t.resolve(e)}).fail(function(e){t.reject(e)})});d.previewer.send("sek-maybe-print-loader",{fullPageLoader:!0,duration:3e4}),_.delay(function(){"pending"===e.state()&&d.previewer.trigger("sek-notify",{notif_id:"import-too-long",type:"error",duration:2e4,message:["<span>","<strong>",sektionsLocalizedData.i18n['Import exceeds server response time, try to uncheck "import images" option.'],"</strong>","</span>"].join("")})},3e4),e.done(function(e){d.czr_sektions.isImportedContentEligibleForAPI(e,i)?(e.data.data.collection=d.czr_sektions.setIdsForImportedTmpl(e.data.data.collection),d.czr_sektions.doUpdateApiSettingAfterTmplImport(e,i)):d.infoLog("::import_template problem => !api.czr_sektions.isImportedContentEligibleForAPI",e,i)}).fail(function(e){d.errare("::import_template => ajax error",e),d.previewer.trigger("sek-notify",{notif_id:"import-failed",type:"error",duration:3e4,message:["<span>","<strong>",sektionsLocalizedData.i18n["Import failed, file problem"],"</strong>","</span>"].join("")})}).always(function(){d.czr_sektions.doAlwaysAfterManualImportAndApiSettingUpdate(i)})}else d.errare("::import_template => invalid scope provided",t)}},pre_checks_from_file_import:function(e,t){if(t=t||{},(t=a.extend({is_file_import:!0,pre_import_check:!1,assign_missing_locations:!1,input:"",file_input:""},t)).is_file_import&&_.isEmpty(t.input))throw new Error("::pre_checks_from_file_import => missing file_input param");var i=d.czr_sektions.activeLocations(),n=a.extend(!0,[],_.isArray(e.data.metas.active_locations)?e.data.metas.active_locations:[]),o=t.input,r=d.czr_sektions.getInputRegistrationParams(o.id,o.module.module_type);if(n=_.filter(n,function(e){return!_.contains(["nimble_local_header","nimble_local_footer"],e)}),_.isArray(n)&&_.isArray(i)){var s=a(n).not(i).get();_.isEmpty(s)?d.czr_sektions.import_template_from_file(t):(t.is_file_import&&(o.container.find('button[data-czr-action="sek-pre-import"]').hide(),"local"===r.scope?o.container.find(".czr-import-dialog.czr-local-import").slideToggle():o.container.find(".czr-import-dialog.czr-global-import").slideToggle()),d.infoLog("sek-pre-import => imported locations missing in current page.",s))}else d.previewer.trigger("sek-notify",{notif_id:"import-failed",type:"info",duration:3e4,message:['<span style="color:#0075a2">',"<strong>",sektionsLocalizedData.i18n["Import failed"],"</strong>","</span>"].join("")}),t.is_file_import&&d.czr_sektions.doAlwaysAfterManualImportAndApiSettingUpdate(t)},setIdsForImportedTmpl:function(i){var n=this;return(_.isObject(i)||_.isArray(i))&&_.each(i,function(e,t){(_.isObject(e)||_.isArray(e))&&(i[t]=n.setIdsForImportedTmpl(e)),"id"!==t||!_.isString(e)||0!==e.indexOf("__rep__me__")&&0!==e.indexOf("__nimble__")||(i[t]=sektionsLocalizedData.optPrefixForSektionsNotSaved+d.czr_sektions.guid())}),i},isImportedContentEligibleForAPI:function(e,t){var i=!0,n=e.data,o=null;e.success||(o=[sektionsLocalizedData.i18n["Import failed"],n].join(" : ")),_.isNull(o)&&!_.isObject(n)&&(o=sektionsLocalizedData.i18n["Import failed, invalid file content"]);var r=n.data,s=n.metas,a=n.img_errors;_.isNull(o)&&!_.isObject(r)&&(o=sektionsLocalizedData.i18n["Import failed, invalid file content"]),_.isNull(o)&&!_.isObject(s)&&(o=sektionsLocalizedData.i18n["Import failed, invalid file content"]);var c=d.czr_sektions.localSectionsSettingId();if(t.is_file_import){var l=t.input;c="local"===d.czr_sektions.getInputRegistrationParams(l.id,l.module.module_type).scope?c:d.czr_sektions.getGlobalSectionsSettingId()}return _.isNull(o)&&_.isEqual(d(c)(),r)&&(d.infoLog("::isImportedContentEligibleForAPI => Setting unchanged"),i=!1),_.isNull(o)||(d.errare("::isImportedContentEligibleForAPI => invalid data sent from server",n),d.errare("::isImportedContentEligibleForAPI => importErrorMsg",o),d.previewer.trigger("sek-notify",{notif_id:"import-failed",type:"error",duration:3e4,message:["<span>","<strong>",o,"</strong>","</span>"].join("")}),i=!1),_.isEmpty(a)||d.previewer.trigger("sek-notify",{notif_id:"img-import-errors",type:"info",duration:6e4,message:['<span style="color:#0075a2">',["<strong>"+sektionsLocalizedData.i18n["Some image(s) could not be imported"]+"</strong><br/>",'<span style="font-size:11px">'+a+"</span>"].join(" : "),"</span>"].join("")}),i},doUpdateApiSettingAfterTmplImport:function(e,t){if(t=t||{},d.czr_sektions.isImportedContentEligibleForAPI(e,t)||!t.is_file_import){var i="local",n=!1;if(t.is_file_import){var o=t.input,r=d.czr_sektions.getInputRegistrationParams(o.id,o.module.module_type);i=r.scope,n="local"===r.scope&&o.input_parent.czr_Input("keep_existing_sections")()}d.czr_sektions.updateAPISetting({action:"sek-import-from-file",scope:i,imported_content:e.data,assign_missing_locations:t.assign_missing_locations,keep_existing_sections:n}).done(function(){"local"===i&&d.czr_sektions.generateUI({action:"sek-generate-local-skope-options-ui",clean_settings:!0}),d.previewer.refresh(),d.previewer.trigger("sek-notify",{notif_id:"import-success",type:"success",duration:3e4,message:["<span>","<strong>",sektionsLocalizedData.i18n["File successfully imported"],"</strong>","</span>"].join("")})}).fail(function(e){d.errare("::doUpdateApiSettingAfterTmplImport => error when firing ::updateAPISetting",e),d.previewer.trigger("sek-notify",{notif_id:"import-failed",type:"error",duration:3e4,message:["<span>","<strong>",[sektionsLocalizedData.i18n["Import failed"],e].join(" : "),"</strong>","</span>"].join("")})}),d.previewer.refresh()}else d.czr_sektions.doAlwaysAfterManualImportAndApiSettingUpdate(t)},doAlwaysAfterManualImportAndApiSettingUpdate:function(e){if(d.previewer.send("sek-clean-loader",{cleanFullPageLoader:!0}),e=e||{},(e=a.extend({is_file_import:!0,pre_import_check:!1,assign_missing_locations:!1,input:"",file_input:""},e)).is_file_import){var t=e.input;t.container.find(".sek-uploading").hide(),e.file_input.val("").trigger("change"),t.container.find(".czr-import-dialog").hide(),t.container.find('button[data-czr-action="sek-pre-import"]').show()}}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(n,d){d.extend(CZRSeksPrototype,{setupTemplateGallery:function(){var t=this;t.templateGalleryExpanded=new n.Value(!1),sektionsLocalizedData.isTemplateGalleryEnabled&&(t.templateGalleryExpanded.bind(function(e){t.cachedElements.$body.toggleClass("sek-template-gallery-expanded",e),e?(t.tmplDialogVisible(!1),t.levelTreeExpanded(!1),d("#customize-preview iframe").css("z-index",1),t.renderOrRefreshTempGallery()):d("#customize-preview iframe").css("z-index","")}),n.previewer.bind("ready",function(){t.templateGalleryExpanded(!1)}))},renderTmplGalleryUI:function(){if(0<d("#nimble-tmpl-gallery").length)return d("#nimble-tmpl-gallery");try{_tmpl=wp.template("nimble-top-tmpl-gallery")({})}catch(e){return n.errare("Error when parsing nimble-top-tmpl-gallery template",e),!1}return d("#customize-preview").after(d(_tmpl)),d("#nimble-tmpl-gallery")},renderOrRefreshTempGallery:function(){var e=this;d("#nimble-tmpl-gallery").length<1&&d.when(e.renderTmplGalleryUI({})).done(function(){e.setupTmplGalleryDOMEvents()});var t=d("#nimble-tmpl-gallery").find(".sek-tmpl-gallery-inner");t.html(""),e.getTemplateGalleryHtml().done(function(e){t.html(e)})},setupTmplGalleryDOMEvents:function(){var l=d("#nimble-tmpl-gallery"),i=this;l.on("click",".sek-tmpl-item .use-tmpl",function(e){e.preventDefault(),e.stopPropagation();var t=d(this).closest(".sek-tmpl-item").data("sek-tmpl-item-id");_.isEmpty(t)&&n.errare("::setupTmplGalleryDOMEvents => error => invalid template id"),n.czr_sektions.import_nimble_template({template_name:t,from:"user"}),i.templateGalleryExpanded(!1)}).on("propertychange change click keyup input paste",".sek-filter-tmpl",_.debounce(function(e){e.preventDefault();var t=d(this).val();console.log("searched string ??",t);var i,n,o,r,s,a,c=function(){l.removeClass("search-active"),l.find(".sek-tmpl-item").each(function(){d(this).removeClass("search-match")})};_.isString(t)?(t=t.trim().toLowerCase(),_.isEmpty(t.replace(/\s/g,""))?c():(l.addClass("search-active"),l.find(".sek-tmpl-item").each(function(){i=(d(this).find(".tmpl-title").html()+"").toLowerCase(),n=(d(this).find(".tmpl-desc").html()+"").toLowerCase(),o=(d(this).find(".tmpl-date").html()+"").toLowerCase(),r=-1!=i.indexOf(t),s=-1!=n.indexOf(t),a=-1!=o.indexOf(t),d(this).toggleClass("search-match",r||s||a)}))):c()},100)).on("click",".sek-tmpl-info .remove-tmpl",function(e){e.preventDefault();var t=function(e){i.tmplDialogMode("remove"),i.tmplDialogMode.unbind(t)};i.tmplDialogMode.bind(t),i.tmplDialogVisible(!0)}).on("click",".sek-close-dialog",function(e){e.preventDefault(),i.templateGalleryExpanded(!1)})},getTemplateGalleryHtml:function(){var i,n="",o=[sektionsLocalizedData.baseUrl,"/assets/admin/img/wire_frame.png","?ver=",sektionsLocalizedData.nimbleVersion].join(""),r=d.Deferred();return this.getSavedTmplCollection().done(function(e){_.each(e,function(e,t){i=_.isEmpty(e.description)?[e.title,e.last_modified_date].join(" | "):[e.title,e.last_modified_date,e.description].join(" | "),n+='<div class="sek-tmpl-item" data-sek-tmpl-item-id="'+t+'">',n+='<div class="sek-tmpl-thumb"><img src="'+o+'"/></div>',n+='<div class="sek-tmpl-info" title="'+i+'">',n+='<h3 class="tmpl-title">'+e.title+"</h3>",n+='<p class="tmpl-date"><i>'+[sektionsLocalizedData.i18n["Last modified"]," : ",e.last_modified_date].join(" ")+"</i></p>",n+='<p class="tmpl-desc">'+e.description+"</p>",n+='<i class="material-icons use-tmpl" title="'+sektionsLocalizedData.i18n["Use this template"]+'">add_circle_outline</i>',n+='<i class="material-icons remove-tmpl" title="'+sektionsLocalizedData.i18n["Remove this template"]+'">delete_forever</i>',n+="</div>",n+="</div>"});var t=d("#nimble-tmpl-gallery").find(".czr-css-loader");0<t.length?t.hide({duration:300,complete:function(){d(this).remove(),r.resolve(n)}}):r.resolve(n)}),r.promise()}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(t,e){jQuery.extend(CZRSeksPrototype,t.Events);var i=t.Class.extend(CZRSeksPrototype);try{t.czr_sektions=new i}catch(e){t.errare("api.czr_sektions => problem on instantiation",e)}}(wp.customize),function(r,s,a){r.czrInputMap=r.czrInputMap||{},s.extend(r.czrInputMap,{content_type_switcher:function(e){var i,n=this,o=r.czr_sektions;if(!r.section.has(n.module.control.section()))throw new Error("api.czrInputMap.content_type_switcher => section not registered");i=r.section(n.module.control.section());var t=function(t){n.container.find('[data-sek-content-type="'+(t||"module")+'"]').trigger("click"),a.each(i.controls(),function(e){a.isUndefined(e.content_type)||e.active(t===e.content_type)})};r.czr_sektions.currentContentPickerType=r.czr_sektions.currentContentPickerType||new r.Value,r.bind("nimble-modules-and-sections-controls-registered",function(){t(r.czr_sektions.currentContentPickerType())}),r.czr_sektions.currentContentPickerType.bind(function(e){t(e)}),r.czr_sektions.currentContentPickerType(n()),n.container.on("click","[data-sek-content-type]",function(e){e.preventDefault();var t=s(this).data("sek-content-type");if(n.container.find("[data-sek-content-type]").attr("aria-pressed",!1),o.templateGalleryExpanded(!1),o.levelTreeExpanded(!1),o.tmplDialogVisible&&o.tmplDialogVisible(!1),o.saveSectionDialogVisible&&o.saveSectionDialogVisible(!1),"template"===t){var i=r.czr_sektions.templateGalleryExpanded();s(this).attr("aria-pressed",!i),r.czr_sektions.templateGalleryExpanded(!i)}else r.czr_sektions.templateGalleryExpanded(!1),s(this).attr("aria-pressed",!0),r.czr_sektions.currentContentPickerType(t)}),t(r.czr_sektions.currentContentPickerType())}})}(wp.customize,jQuery,_),function(t,e,i){t.czrInputMap=t.czrInputMap||{},e.extend(t.czrInputMap,{module_picker:function(e){t.czr_sektions.trigger("sek-refresh-dragzones",{type:"module",input_container:this.container})},section_picker:function(e){t.czr_sektions.trigger("sek-refresh-dragzones",{type:"preset_section",input_container:this.container})}})}(wp.customize,jQuery,_),function(s,a,c){s.czrInputMap=s.czrInputMap||{},a.extend(s.czrInputMap,{module_option_switcher:function(e){var t=this;if(!s.section.has(t.module.control.section()))throw new Error(t.input_type+" => section not registered");s.section(t.module.control.section());var i,n="",o=t.module.control.params.sek_registration_params;if(c.isUndefined(o))throw new Error(t.input_type+" => missing registration params");if(o&&o.module_id&&(n=o.module_id,i=o.ui_action),c.isEmpty(n))throw new Error(t.input_type+" => missing module id");t.container.on("click","[data-sek-option-type]",function(e){e.preventDefault(),t.container.find("[data-sek-option-type]").removeClass("is-selected").attr("aria-pressed",!1),a(this).addClass("is-selected").attr("aria-pressed",!0),s.previewer.trigger("settings"===a(this).data("sek-option-type")?"sek-edit-options":"sek-edit-module",{id:n,level:"module"})});var r="sek-generate-level-options-ui"===i?"settings":"content";t.container.find("[data-sek-option-type]").removeClass("is-selected").attr("aria-pressed",!1),t.container.find('[data-sek-option-type="'+r+'"]').addClass("is-selected").attr("aria-pressed",!0)}})}(wp.customize,jQuery,_),function(l,d,u){l.czrInputMap=l.czrInputMap||{};var p=function(e){return u.contains(["px","em","%"],e)||(l.errare("error : invalid unit for input "+this.id,e),e="px"),e},_=function(i){var n=this;i.on("click",".sek-ui-button",function(e,t){e.preventDefault(),i.find(".sek-ui-button").removeClass("is-selected").attr("aria-pressed",!1),d(this).addClass("is-selected").attr("aria-pressed",!0),n.css_unit(d(this).data("sek-unit"),t)}),i.find('.sek-ui-button[data-sek-unit="'+(n.initial_unit||"px")+'"]').addClass("is-selected").attr("aria-pressed",!0)},m=function(t,i){var n=this;t.on("click",".reset-spacing-wrap",function(e){e.preventDefault(),t.find('input[type="number"]').each(function(){d(this).val("")}),n(i),d(".sek-unit-wrapper",t).find('[data-sek-unit="px"]').trigger("click")})};d.extend(l.czrInputMap,{spacing:function(e){var o=this,i=d(".sek-spacing-wrapper",o.container),t=l.czr_sektions.getInputRegistrationParams(o.id,o.module.module_type),n=u.isEmpty(t)||u.isEmpty(t.default)?[]:t.default;if(i.on("input",'input[type="number"]',function(e){var t=d(this).closest("[data-sek-spacing]").data("sek-spacing"),i=d.extend(!0,{},u.isObject(o())?o():{}),n=d(this).val();u.isString(n)&&!u.isEmpty(n)||u.isNumber(n)?i[t]=n:i=u.omit(i,t),o(i)}),m.call(o,i,n),u.isObject(o())){u.each(o(),function(e,t){d('[data-sek-spacing="'+t+'"]',i).find('input[type="number"]').val(e)});var r="px";d(".sek-unit-wrapper .sek-ui-button",o.container).each(function(){var e=d(this).data("sek-unit");u.isEmpty(o())||u.isEmpty(o().unit)||e===o().unit&&(r=e)}),d(".sek-unit-wrapper",o.container).find('[data-sek-unit="'+p.call(o,r)+'"]').trigger("click")}var s=o();o.initial_unit="px",u.isEmpty(s)||(o.initial_unit=u.isEmpty(s.unit)?"px":s.unit),o.css_unit=new l.Value(p.call(o,o.initial_unit)),o.css_unit.bind(function(e){var t;e=u.isEmpty(e)?"px":e,(t=d.extend(!0,{},u.isObject(o())?o():{})).unit=e,o(t)}),_.call(o,i)}}),d.extend(l.czrInputMap,{spacingWithDeviceSwitcher:function(e){var r=this,s=d(".sek-spacing-wrapper",r.container),t=l.czr_sektions.getInputRegistrationParams(r.id,r.module.module_type),a=u.isEmpty(t)||u.isEmpty(t.default)?{}:t.default,c=function(e,t){var i=["mobile","tablet","desktop"];if(u.has(e,t))return e[t];var n=u.findIndex(i,function(e){return t===e});return!u.isEmpty(t)&&n<i.length?c(e,i[n+1]):{}},i=function(e){var t=d.extend(!0,{},u.isObject(r())?r():{}),i=d.extend(!0,{},a);t=u.isObject(t)?d.extend(i,t):i;var n=c(t,e);d("[data-sek-spacing]",s).each(function(){var e=d(this).data("sek-spacing"),t="";u.isEmpty(n)||u.isEmpty(n[e])||(t=n[e]),d(this).find('input[type="number"]').val(t)});var o="px";d(".sek-unit-wrapper .sek-ui-button",r.container).each(function(){var e=d(this).data("sek-unit");u.isEmpty(n)||u.isEmpty(n.unit)||e===n.unit&&(o=e)}),d(".sek-unit-wrapper",r.container).find('[data-sek-unit="'+p.call(r,o)+'"]').trigger("click",{previewed_device_switched:!0})};l.czr_sektions.maybeSetupDeviceSwitcherForInput.call(r);var n=r();r.initial_unit="px",u.isEmpty(n)||u.isEmpty(n[r.previewedDevice()])||(r.initial_unit=u.isEmpty(n[r.previewedDevice()].unit)?"px":n[r.previewedDevice()].unit),r.css_unit=new l.Value(p.call(r,r.initial_unit)),s.on("input",'input[type="number"]',function(e){var t,i=d(this).closest("[data-sek-spacing]").data("sek-spacing"),n=d(this).val(),o=l.previewedDevice()||"desktop";(t=d.extend(!0,{},u.isObject(r())?r():{}))[o]=d.extend(!0,{},t[o]||{}),u.isString(n)&&!u.isEmpty(n)||u.isNumber(n)?t[o][i]=n:t[o]=u.omit(t[o],i),t[o].unit&&r.css_unit()==t[o].unit||(t[o].unit=r.css_unit()),r(t)}),m.call(r,s,a),r.previewedDevice.bind(function(e){try{i(e)}catch(e){l.errare("Error when firing syncWithPreviewedDevice for input type spacingWithDeviceSwitcher for input id "+r.id,e)}}),r.css_unit.bind(function(e,t,i){if(!u.isObject(i)||!0!==i.previewed_device_switched){e=u.isEmpty(e)?"px":e;var n,o=r.previewedDevice()||"desktop";(n=d.extend(!0,{},u.isObject(r())?r():{}))[o]=d.extend(!0,{},n[o]||{}),n[o].unit=e,r(n)}}),_.call(r,s);try{i(l.previewedDevice())}catch(e){l.errare("Error when firing syncWithPreviewedDevice for input type spacingWithDeviceSwitcher for input id "+r.id,e)}}})}(wp.customize,jQuery,_),function(n,a,c){n.czrInputMap=n.czrInputMap||{},a.extend(n.czrInputMap,{bg_position:function(e){var t=this;a(".sek-bg-pos-wrapper",t.container).on("change",'input[type="radio"]',function(e){t(a(this).val())}),c.isEmpty(t())||t.container.find('input[value="'+t()+'"]').attr("checked",!0).trigger("click")},bgPositionWithDeviceSwitcher:function(e){var o=this,t=n.czr_sektions.getInputRegistrationParams(o.id,o.module.module_type),r=c.isEmpty(t)||c.isEmpty(t.default)?{}:t.default;n.czr_sektions.maybeSetupDeviceSwitcherForInput.call(o);var s=function(e,t){var i=["mobile","tablet","desktop"];if(c.has(e,t))return e[t];var n=c.findIndex(i,function(e){return t===e});return!c.isEmpty(t)&&n<i.length?s(e,i[n+1]):{}},i=function(e){var t=a.extend(!0,{},c.isObject(o())?o():{}),i=a.extend(!0,{},r);t=c.isObject(t)?a.extend(i,t):i;var n=s(t,e);o.container.find('input[value="'+n+'"]').attr("checked",!0).trigger("click",{previewed_device_switched:!0})};a(".sek-bg-pos-wrapper",o.container).on("change",'input[type="radio"]',function(e){var t,i=a(this).val();(t=a.extend(!0,{},c.isObject(o())?o():{}))[n.previewedDevice()||"desktop"]=i,o(t)}),o.previewedDevice.bind(function(e){try{i(e)}catch(e){n.errare("Error when firing syncWithPreviewedDevice for input type spacingWithDeviceSwitcher for input id "+o.id,e)}});try{i(n.previewedDevice())}catch(e){n.errare("Error when firing syncWithPreviewedDevice for input type bgPositionWithDeviceSwitcher for input id "+o.id,e)}}})}(wp.customize,jQuery,_),function(c,l,d){c.czrInputMap=c.czrInputMap||{};var e=function(e){var o=this,t=c.czr_sektions.getInputRegistrationParams(o.id,o.module.module_type),r=d.isEmpty(t)||d.isEmpty(t.default)?{}:t.default,i="verticalAlignWithDeviceSwitcher"===o.type?".sek-v-align-wrapper":".sek-h-align-wrapper",s=l(i,o.container);c.czr_sektions.maybeSetupDeviceSwitcherForInput.call(o);var a=function(e,t){var i=["mobile","tablet","desktop"];if(d.has(e,t))return e[t];var n=d.findIndex(i,function(e){return t===e});return!d.isEmpty(t)&&n<i.length?a(e,i[n+1]):{}},n=function(e){var t=l.extend(!0,{},d.isObject(o())?o():{}),i=l.extend(!0,{},r);t=d.isObject(t)?l.extend(i,t):i;var n=a(t,e);s.find(".selected").removeClass("selected"),s.find('div[data-sek-align="'+n+'"]').addClass("selected")};s.on("click","[data-sek-align]",function(e){var t;e.preventDefault(),(t=l.extend(!0,{},d.isObject(o())?o():{}))[c.previewedDevice()||"desktop"]=l(this).data("sek-align"),s.find(".selected").removeClass("selected"),l.when(l(this).addClass("selected")).done(function(){o(t)})}),o.previewedDevice.bind(function(e){try{n(e)}catch(e){c.errare("Error when firing syncWithPreviewedDevice for input type : "+o.type+" for input id "+o.id,e)}});try{n(c.previewedDevice())}catch(e){c.errare("Error when firing syncWithPreviewedDevice for input type : "+o.type+" for input id "+o.id,e)}};l.extend(c.czrInputMap,{horizTextAlignmentWithDeviceSwitcher:e,horizAlignmentWithDeviceSwitcher:e,verticalAlignWithDeviceSwitcher:e})}(wp.customize,jQuery,_),function(f,g,h){f.czrInputMap=f.czrInputMap||{},g.extend(f.czrInputMap,{font_picker:function(e){var p=this,_=p.input_parent,n=function(e,t){_();var n=g('select[data-czrtype="'+p.id+'"]',p.container);h.isNull(p())||h.isEmpty(p())?n.append('<option value="none" selected="selected">'+sektionsLocalizedData.i18n["Select a font family"]+"</option>"):n.append('<option value="none">'+sektionsLocalizedData.i18n["Select a font family"]+"</option>");var i=[{title:sektionsLocalizedData.i18n["Web safe fonts"],type:"cfont",list:t.cfonts},{title:sektionsLocalizedData.i18n["Google fonts"],type:"gfont",list:t.gfonts}],o=f.czr_sektions.sniffAllFonts(),r=sektionsLocalizedData.alreadyUsedFonts,s=[],a=[];if(!h.isEmpty(r)&&h.isObject(r)&&h.each(r,function(e){a.push(e)}),h.isArray(o)&&h.each(o,function(e){a.push(e)}),!h.isEmpty(a)){var c={},l=[];a.forEach(function(e){c[e]=(c[e]||0)+1});var d=h.sortBy(c,function(e){return e});h.each(d,function(i){h.each(c,function(e,t){i!==e||h.contains(l,t)||l.unshift(t)})}),h.each(l,function(e){s.push({name:e})}),i.unshift({title:sektionsLocalizedData.i18n["Already used fonts"],type:null,list:s})}h.each(i,function(e){var t,r,s,i=g("<optgroup>",{label:e.title,html:(t=e.list,r=e.type,s="",h.each(t,function(e){var t,i,n=h.isString(e.name)?e.name:"Undefined Font Family",o=n.replace(/[+|:]/g," ");t=n,i=r,n=h.isEmpty(i)?t:h.isString(t)?["[",i,"]",t].join(""):"",o=o.replace("[cfont]","").replace("[gfont]",""),n==p()?s+='<option selected="selected" value="'+n+'">'+o+"</option>":s+='<option value="'+n+'">'+o+"</option>"}),s)});n.append(i)});var u={escapeMarkup:function(e){return e}};e&&g.extend(u,{resultsAdapter:e,closeOnSelect:!1}),n.czrSelect2(u),g(".czrSelect2-selection__rendered",p.container).css(m(p()))},m=function(e){if(!h.isString(e)||h.isEmpty(e))return{};var t,i,n,o=(e=e.replace("[gfont]","").replace("[cfont]","")).split(":");return t=r(e),i=o[1]?o[1].replace(/[^0-9.]+/g,""):400,i=h.isNumber(i)?i:400,n=o[1]&&-1!=o[1].indexOf("italic")?"italic":"",{"font-family":"none"==t?"inherit":t.replace(/[+|:]/g," "),"font-weight":i||400,"font-style":n||"normal"}},r=function(e){if(!h.isString(e)||h.isEmpty(e))return e;var t=(e=e.replace("[gfont]","").replace("[cfont]","")).split(":");return h.isString(t[0])?t[0].replace(/[+|:]/g," "):""};g.when(function(){var e,t=g.Deferred();h.isEmpty(f.sek_fontCollections)?(h.isUndefined(f.sek_fetchingFontCollection)||"pending"!=f.sek_fetchingFontCollection.state()?(e=f.CZR_Helpers.getModuleTmpl({tmpl:"font_list",module_type:"font_picker_input",module_id:p.module.id}),f.sek_fetchingFontCollection=e):e=f.sek_fetchingFontCollection,e.done(function(e){if("string"!=typeof e||"{"!==e[0])throw new Error("font_picker => server list is not JSON.parse-able");f.sek_fontCollections=JSON.parse(e),t.resolve(f.sek_fontCollections)}).fail(function(e){t.reject(e)})):t.resolve(f.sek_fontCollections);return t.promise()}()).done(function(t){var i;(i=g.Deferred(),void 0!==g.fn.czrSelect2&&void 0!==g.fn.czrSelect2.amd&&"function"==typeof g.fn.czrSelect2.amd.require?g.fn.czrSelect2.amd.require(["czrSelect2/results","czrSelect2/utils"],function(e,t){var n=function(e,t,i){n.__super__.constructor.call(this,e,t,i)};t.Extend(n,e),n.prototype.bind=function(e,t){var i=this;e.on("results:focus",function(e){"true"!=e.element.attr("aria-selected")&&i.trigger("select",{data:e.data})}),n.__super__.bind.call(this,e,t)},i.resolve(n)}):i.resolve(!1),i.promise()).done(function(e){n(e,t)})}).fail(function(e){f.errare("font_picker => fail response =>",e)})}})}(wp.customize,jQuery,_),function(r,s,a){r.czrInputMap=r.czrInputMap||{},s.extend(r.czrInputMap,{fa_icon_picker:function(){var n=this,o=!1,e=function(t){!0!==n.iconCollectionSet&&(s.when(s.Deferred(function(t){a.isEmpty(n.sek_faIconCollection)?r.CZR_Helpers.getModuleTmpl({tmpl:"icon_list",module_type:"fa_icon_picker_input",module_id:n.module.id}).done(function(e){if("string"!=typeof e||"["!==e[0])throw new Error("fa_icon_picker => server list is not JSON.parse-able");n.sek_faIconCollection=JSON.parse(e),t.resolve(n.sek_faIconCollection)}).fail(function(e){t.reject(e)}):t.resolve(n.sek_faIconCollection)})).done(function(e){!function(e){a.each(e,function(e){var t={value:e,html:r.CZR_Helpers.capitalize(e.substring(7))};t.value==n()&&(s.extend(t,{selected:"selected"}),o=!0),s("select[data-czrtype]",n.container).append(s("<option>",t))});var t,i=function(e){return e.id?s('<span class="'+e.element.value+'"></span><span class="social-name">&nbsp;&nbsp;'+e.text+"</span>"):e.text};t=o?s("<option>"):s("<option>",{selected:"selected"}),s("select[data-czrtype]",n.container).prepend(t).czrSelect2({templateResult:i,templateSelection:i,placeholder:sektionsLocalizedData.i18n["Select an icon"],allowClear:!0})}(e),t&&!0===t.open_on_init&&a.delay(function(){try{s("select[data-czrtype]",n.container).czrSelect2("open")}catch(e){}},100)}).fail(function(e){r.errare("fa_icon_picker => fail response =>",e)}),n.iconCollectionSet=!0)};n.container.on("click",function(){e()}),a.delay(function(){e({open_on_init:!1})},1e3)}})}(wp.customize,jQuery,_),function(u,p,_){u.czrInputMap=u.czrInputMap||{},p.extend(u.czrInputMap,{code_editor:function(e){var n=this,i=this.module.control,o=(n.input_parent(),!1),r=n.container.find("textarea"),s=n.container.find(".customize-control-title"),a=function(){return p.Deferred(function(t){var i=_.isEmpty(r.data("editor-code-type"))?"text/html":r.data("editor-code-type");u.czr_sektions.code_editor_params&&u.czr_sektions.code_editor_params[i]?t.resolve(u.czr_sektions.code_editor_params[i]):wp.ajax.post("sek_get_code_editor_params",{nonce:u.settings.nonce.save,code_type:i}).done(function(e){_.isObject(e)||u.errare(n.id+" => error => invalid code editor params sent by server",e),u.czr_sektions.code_editor_params={},u.czr_sektions.code_editor_params[i]=e,t.resolve(u.czr_sektions.code_editor_params[i])}).fail(function(e){t.reject(e)})})};n.isReady.done(function(){var t=function(e){_.isEmpty(this.editor)&&(_.isEmpty(this.module.control.container.attr("data-sek-expanded"))||"false"==this.module.control.container.attr("data-sek-expanded")||setTimeout(function(){if(o)try{c(o)}catch(e){u.errare("error in sek_control => code_editor() input",e),l()}else l();s.trigger("click")},10))};r.html(n()),p.when(a()).done(function(e){wp.codeEditor&&(_.isUndefined(e)||!1!==e)&&(o=e),t.call(n),n.module.control.container.on("sek-accordion-expanded",function(){t.call(n)})}).fail(function(e){u.errare(n.id+" => error when getting the editor params from server")})});var c=function(e){var t,i=!1;t=_.extend({},e,{onTabNext:CZRSeksPrototype.selectNextTabbableOrFocusable(":tabbable"),onTabPrevious:CZRSeksPrototype.selectPrevTabbableOrFocusable(":tabbable"),onUpdateErrorNotice:d}),n.editor=wp.codeEditor.initialize(r,t),p(n.editor.codemirror.display.lineDiv).attr({role:"textbox","aria-multiline":"true","aria-label":s.html(),"aria-describedby":"editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4"}),s.on("click",function(e){e.stopPropagation(),n.editor.codemirror.focus()}),n.editor.codemirror.on("change",function(e){i=!0,r.val(e.getValue()).trigger("change"),i=!1}),n.editor.codemirror.setValue(n()),n.bind(n.id+":changed",function(e){i||n.editor.codemirror.setValue(e)}),n.editor.codemirror.on("keydown",function(e,t){27===t.keyCode&&t.stopPropagation()})},l=function(){var o=r[0];n.editor=o,r.on("blur",function(){r.data("next-tab-blurs",!1)}),r.on("keydown",function(e){var t,i,n;27!==e.keyCode?9!==e.keyCode||e.ctrlKey||e.altKey||e.shiftKey||r.data("next-tab-blurs")||(t=o.selectionStart,i=o.selectionEnd,n=o.value,0<=t&&(o.value=n.substring(0,t).concat("\t",n.substring(i)),r.selectionStart=o.selectionEnd=t+1),e.stopPropagation(),e.preventDefault()):r.data("next-tab-blurs")||(r.data("next-tab-blurs",!0),e.stopPropagation())})},d=function(e){var t;i.setting.notifications.remove(n.id),0!==e.length&&(t=1===e.length?sektionsLocalizedData.i18n.codeEditorSingular.replace("%d","1").replace("%s",s.html()):sektionsLocalizedData.i18n.codeEditorPlural.replace("%d",String(e.length)).replace("%s",s.html()),i.setting.notifications.add(n.id,new u.Notification(n.id,{message:t,type:"warning"})))}}})}(wp.customize,jQuery,_),function(e,r,t){e.czrInputMap=e.czrInputMap||{},r.extend(e.czrInputMap,{range_simple:function(e){var t=this,i=r(".sek-range-with-unit-picker-wrapper",t.container),n=i.find('input[type="number"]'),o=i.find('input[type="range"]');o.on("input",function(e){n.val(r(this).val()).trigger("input")}),n.on("input",function(e){t(r(this).val()),o.val(r(this).val())}),o.val(n.val()||0)},number_simple:function(e){var t=this;t.container.find('input[type="number"]').on("input",function(e){t(r(this).val())})}})}(wp.customize,jQuery,_),function(d,u,p){d.czrInputMap=d.czrInputMap||{},u.extend(d.czrInputMap,{range_simple_device_switcher:function(e){var s=this,t=u(".sek-range-with-unit-picker-wrapper",s.container),a=t.find('input[type="number"]'),r=t.find('input[type="range"]'),i=d.czr_sektions.getInputRegistrationParams(s.id,s.module.module_type),c=p.isEmpty(i)||p.isEmpty(i.default)?{}:i.default,l=function(e,t){var i=["mobile","tablet","desktop"];if(p.has(e,t))return e[t];var n=p.findIndex(i,function(e){return t===e});return!p.isEmpty(t)&&n<i.length?l(e,i[n+1]):u.extend(!0,{desktop:""},c).desktop},n=function(e){var t=s(),i={};i=u.extend(!0,{},c),p.isObject(t)?i=u.extend(!0,{},t):p.isString(t)&&!p.isEmpty(t)&&(i={desktop:t});var n,o=l(i,e),r=(n=o,p.isEmpty(n)||!p.isString(n)?"16":n.replace(/px|em|%/g,""));a.val(r).trigger("input",{previewed_device_switched:!0})};d.czr_sektions.maybeSetupDeviceSwitcherForInput.call(s),r.on("input",function(e){a.val(u(this).val()).trigger("input")}),a.on("input",function(e,t){var i,n=d.previewedDevice()||"desktop",o=u(this).val();(i=u.extend(!0,{},p.isObject(s())?s():{}))[n]=u.extend(!0,{},i[n]||{}),p.isString(o)&&!p.isEmpty(o)&&(i[n]=o),(p.isEmpty(t)||p.isObject(t)&&!0!==t.previewed_device_switched)&&s(i),r.val(u(this).val())}),s.previewedDevice.bind(function(e){try{n(e)}catch(e){d.errare("Error when firing syncWithPreviewedDevice for input type "+s.type+" for input id "+s.id,e)}}),r.val(a.val()||0);try{n(d.previewedDevice())}catch(e){d.errare("Error when firing syncWithPreviewedDevice for input type "+s.type+" for input id "+s.id,e)}}})}(wp.customize,jQuery,_),function(a,c,l){a.czrInputMap=a.czrInputMap||{},c.extend(a.czrInputMap,{range_with_unit_picker:function(e){var t=this,i=c(".sek-range-with-unit-picker-wrapper",t.container),n=i.find('input[type="number"]'),o=i.find('input[type="range"]'),r=i.find("input[data-czrtype]").data("sek-unit"),s=function(e){return l.contains(["px","em","%"],e)||(a.errare("error : invalid unit for input "+t.id,e),e="px"),e};t.css_unit=new a.Value(l.isEmpty(r)?"px":s(r)),t.css_unit.bind(function(e){e=l.isEmpty(e)?"px":e,i.find('input[type="number"]').trigger("input")}),o.on("input",function(e){n.val(c(this).val()).trigger("input")}),n.on("input",function(e){t(c(this).val()+s(t.css_unit())),o.val(c(this).val())}),o.val(n.val()||0),i.on("click",".sek-ui-button",function(e){e.preventDefault(),i.find(".sek-ui-button").removeClass("is-selected").attr("aria-pressed",!1),c(this).addClass("is-selected").attr("aria-pressed",!0),i.find("input[data-czrtype]").data("sek-unit",c(this).data("sek-unit")),t.css_unit(c(this).data("sek-unit"))}),i.find('.sek-ui-button[data-sek-unit="'+r+'"]').addClass("is-selected").attr("aria-pressed",!0)}})}(wp.customize,jQuery,_),function(a,_,m){a.czrInputMap=a.czrInputMap||{},_.extend(a.czrInputMap,{range_with_unit_picker_device_switcher:function(e){var c=this,l=_(".sek-range-with-unit-picker-wrapper",c.container),d=l.find('input[type="number"]'),r=l.find('input[type="range"]'),s=function(e){return m.contains(["px","em","%"],e)||(a.errare("range_with_unit_picker_device_switcher => error : invalid unit for input "+c.id,e),e="px"),e},t=a.czr_sektions.getInputRegistrationParams(c.id,c.module.module_type),u=m.isEmpty(t)||m.isEmpty(t.default)?{}:t.default,i=function(){return l.find("input[data-czrtype]").data("sek-unit")||"px"},p=function(e,t){var i=["mobile","tablet","desktop"];if(m.has(e,t))return e[t];var n=m.findIndex(i,function(e){return t===e});return!m.isEmpty(t)&&n<i.length?p(e,i[n+1]):_.extend(!0,{desktop:""},u).desktop},n=function(e){var t=c(),i={};i=_.extend(!0,{},u),m.isObject(t)?i=_.extend(!0,{},t):m.isString(t)&&!m.isEmpty(t)&&(i={desktop:t});var n,o,r=p(i,e),s=(o=r,m.isEmpty(o)||!m.isString(o)?"px":o.replace(/[0-9]|\.|,/g,"")),a=(n=r,m.isEmpty(n)||!m.isString(n)?"16":n.replace(/px|em|%/g,""));_(".sek-unit-wrapper",l).find('[data-sek-unit="'+s+'"]').trigger("click",{previewed_device_switched:!0}),l.find('.sek-ui-button[data-sek-unit="'+s+'"]').addClass("is-selected").attr("aria-pressed",!0),d.val(a).trigger("input",{previewed_device_switched:!0})};a.czr_sektions.maybeSetupDeviceSwitcherForInput.call(c),c.css_unit=new a.Value(m.isEmpty(i())?"px":s(i()));var o='<button type="button" class="button sek-reset-button sek-float-right">'+sektionsLocalizedData.i18n.Reset+"</button>";c.container.find(".customize-control-title").append(o),c.css_unit.bind(function(e,t,i){m.isObject(i)&&!0===i.previewed_device_switched||d.trigger("input")}),r.on("input",function(e){d.val(_(this).val()).trigger("input")}),d.on("input",function(e,t){var i,n=a.previewedDevice()||"desktop",o=_(this).val()+s(c.css_unit());(i=_.extend(!0,{},m.isObject(c())?c():{}))[n]=_.extend(!0,{},i[n]||{}),m.isString(o)&&!m.isEmpty(o)&&(i[n]=o),(m.isEmpty(t)||m.isObject(t)&&!0!==t.previewed_device_switched)&&c(i),r.val(_(this).val())}),l.on("click",".sek-ui-button",function(e,t){e.stopPropagation(),l.find(".sek-ui-button").removeClass("is-selected").attr("aria-pressed",!1),_(this).addClass("is-selected").attr("aria-pressed",!0),l.find("input[data-czrtype]").data("sek-unit",_(this).data("sek-unit")),c.css_unit(_(this).data("sek-unit"),t)}),c.previewedDevice.bind(function(e){try{n(e)}catch(e){a.errare("Error when firing syncWithPreviewedDevice for input type range_with_unit_picker_device_switcher for input id "+c.id,e)}}),c.container.on("click",".sek-reset-button",function(e){var t=a.previewedDevice(),i=_.extend(!0,{},m.isObject(c())?c():{});m.isEmpty(i[t])||(i=m.omit(i,t),c(i),n(a.previewedDevice()))}),r.val(d.val()||0);try{n(a.previewedDevice())}catch(e){a.errare("Error when firing syncWithPreviewedDevice for input type range_with_unit_picker_device_switcher for input id "+c.id,e)}}})}(wp.customize,jQuery,_),function(g,h,v){g.czrInputMap=g.czrInputMap||{},h.extend(g.czrInputMap,{borders:function(e){var a=this,c=h(".sek-borders",a.container),l=c.find('input[type="number"]'),d=c.find('input[type="range"]'),u=c.find(".sek-alpha-color-input"),p=function(e){return v.contains(["px","em","%"],e)||(g.errare("borders => error : invalid unit for input "+a.id,e),e="px"),e},_=function(e){return v.isEmpty(e)||!v.isString(e)?"16":e.replace(/px|em|%/g,"")},m=function(e){return v.isEmpty(e)||!v.isString(e)?"px":e.replace(/[0-9]|\.|,/g,"")},t=g.czr_sektions.getInputRegistrationParams(a.id,a.module.module_type),f=v.isEmpty(t)||v.isEmpty(t.default)?{}:t.default;a.cssBorderTypes=["top","left","right","bottom"];var i,n,o=function(){var e=a(),t="px";return v.isObject(e)&&v.has(e,"_all_")&&v.isObject(e._all_)&&!v.isEmpty(e._all_.wght)&&(t=p(m(e._all_.wght))),t},r=function(){var e=a(),t="#000000";return v.isObject(e)&&v.has(e,"_all_")&&v.isObject(e._all_)&&!v.isEmpty(e._all_.col)&&(t=e._all_.col),t},s=function(e){if(!v.contains(v.union(a.cssBorderTypes,["_all_"]),e))throw new Error("Error in syncWithBorderType : the border type must be one of those values '_all_', 'top', 'left', 'right', 'bottom'");var t=a(),i={},n=h.extend(!0,{},f);v.isObject(t)?i=h.extend(!0,{},t):v.isString(t)&&(i={_all_:{wght:t}});var o,r,s=function(e,t){var i,n=h.extend(!0,{},f);if(!v.has(n,"_all_"))throw new Error("Error when firing getCurrentBorderTypeOrAllValue : the default value of the borders input must be php registered as an array formed : array( 'wght' => '1px', 'col' => '#000000' )");return i=v.isObject(e)&&v.has(e,"_all_")?v.extend(n._all_,e._all_):n._all_,v.has(e,t)&&v.isObject(e[t])?v.extend(i,e[t]):n._all_}(i=h.extend(n,i),e);if(v.isEmpty(s)||!v.isObject(s)||v.isEmpty(s.wght)||v.isEmpty(s.col))throw new Error("Error in syncWithBorderType : getCurrentBorderTypeOrAllValue must return an object formed : array( 'wght' => '1px', 'col' => '#000000' )");o=m(s.wght),r=_(s.wght),h(".sek-unit-wrapper",c).find('[data-sek-unit="'+o+'"]').trigger("click",{border_type_switched:!0}),c.find('.sek-ui-button[data-sek-unit="'+o+'"]').addClass("is-selected").attr("aria-pressed",!0),l.val(r).trigger("input",{border_type_switched:!0}),u.data("border_type_switched",!0),u.val(s.col).trigger("change"),u.data("border_type_switched",!1)};a.borderColor=new g.Value(v.isEmpty(r())?"#000000":r()),a.css_unit=new g.Value(v.isEmpty(o())?"px":p(o())),a.borderType=new g.Value("_all_"),l.val((i=a(),n=1,v.isObject(i)&&v.has(i,"_all_")&&v.isObject(i._all_)&&!v.isEmpty(i._all_.wght)&&(n=_(i._all_.wght)),n=parseInt(n,10),(!v.isNumber(n)||n<0)&&(g.errare("Error in borders input type for module : "+a.module.module_type+" the initial border width is invalid : "+n),n=1),n)),u.val(a.borderColor()),u.wpColorPicker({palettes:!0,width:1440<=window.innerWidth?271:251,change:function(e,t){h(this).val(t.color.toString()).trigger("colorpickerchange"),a.borderColor(t.color.toString(),{border_type_switched:!0===h(this).data("border_type_switched")})},clear:function(e,t){h(this).val("").trigger("colorpickerchange"),a.borderColor("")}}),a.css_unit.bind(function(e,t,i){(!v.isObject(i)||!0!==i.border_type_switched&&!0!==i.initializing_the_unit)&&l.trigger("input",i)}),a.borderColor.bind(function(e,t,i){(!v.isObject(i)||!0!==i.border_type_switched&&!0!==i.initializing_the_color)&&l.trigger("input",i)}),a.borderType.bind(function(e){try{s(e)}catch(e){g.errare("Error when firing syncWithBorderType for input type borders for module type "+a.module.module_type,e)}}),d.on("input",function(e){l.val(h(this).val()).trigger("input")}),l.on("input",function(e,t){var i,n=a.borderType()||"_all_",o=a.borderColor(),r=h(this).val()+p(a.css_unit()),s=h.extend(!0,{},f);(i=h.extend(!0,{},v.isObject(a())?a():s))[n]=h.extend(!0,{},i[n]||s[n]),v.isString(r)&&!v.isEmpty(r)&&(i[n].wght=r),i[n].col=o,(v.isEmpty(t)||v.isObject(t)&&!0!==t.border_type_switched)&&("_all_"===n&&v.each(a.cssBorderTypes,function(e){i=v.omit(i,e)}),a(i)),d.val(h(this).val())}),c.on("click","[data-sek-unit]",function(e,t){e.preventDefault(),c.find("[data-sek-unit]").removeClass("is-selected").attr("aria-pressed",!1),h(this).addClass("is-selected").attr("aria-pressed",!0),c.find("input[data-czrtype]").data("sek-unit",h(this).data("sek-unit")),a.css_unit(h(this).data("sek-unit"),t)}),c.on("click","[data-sek-border-type]",function(e,t){e.preventDefault(),c.find("[data-sek-border-type]").removeClass("is-selected").attr("aria-pressed",!1),h(this).addClass("is-selected").attr("aria-pressed",!0);var i="_all_";try{i=h(this).data("sek-border-type")}catch(e){g.errare("borders input type => error when attaching click event",e)}a.borderType(i,t)}),a.container.on("click",".sek-reset-button",function(e){var t=a.borderType()||"_all_",i=h.extend(!0,{},v.isObject(a())?a():{});v.isEmpty(i[t])||(i=v.omit(i,t),a(i),s(t))}),d.val(l.val()||0);try{s(a.borderType())}catch(e){g.errare("Error when firing syncWithBorderType for input type borders for module type "+a.module.module_type,e)}h('[data-sek-unit="'+a.css_unit()+'"]',c).trigger("click",{initializing_the_unit:!0})}})}(wp.customize,jQuery,_),function(m,f,g){m.czrInputMap=m.czrInputMap||{},f.extend(m.czrInputMap,{border_radius:function(e){var a=this,c=f(".sek-borders",a.container),l=c.find('input[type="number"]'),s=c.find('input[type="range"]'),d=function(e){return g.contains(["px","em","%"],e)||(m.errare("border_radius => error : invalid unit for input "+a.id,e),e="px"),e},u=function(e){return g.isEmpty(e)||!g.isString(e)?"16":e.replace(/px|em|%/g,"")},p=function(e){return g.isEmpty(e)||!g.isString(e)?"px":e.replace(/[0-9]|\.|,/g,"")},t=m.czr_sektions.getInputRegistrationParams(a.id,a.module.module_type),_=g.isEmpty(t)||g.isEmpty(t.default)?{}:t.default;a.cssRadiusTypes=["top_left","top_right","bottom_right","bottom_left"];var i,n,o=function(){var e=a(),t="px";return g.isObject(e)&&g.has(e,"_all_")&&(t=d(p(e._all_))),t},r=function(e){if(!g.contains(["_all_","top_left","top_right","bottom_right","bottom_left"],e))throw new Error("Error in syncWithRadiusType : the radius type must be one of those values '_all_', 'top_left', 'top_right', 'bottom_right', 'bottom_left', => radius type => "+e);var t=a(),i={},n=f.extend(!0,{},_);g.isObject(t)?i=f.extend(!0,{},t):g.isString(t)&&(i={_all_:"0px"});var o,r,s=function(e,t){var i,n=f.extend(!0,{},_);if(!g.has(n,"_all_"))throw new Error("Error when firing getCurrentRadiusTypeOrAllValue : the default value of the border_radius input must be php registered as an array");return i=g.isObject(e)&&g.has(e,"_all_")?e._all_:n._all_,g.has(e,t)?e[t]:i}(i=f.extend(n,i),e);if(g.isEmpty(s)||!g.isString(s))throw new Error("Error in syncWithRadiusType : getCurrentRadiusTypeOrAllValue must return a string like 3em");o=p(s),r=u(s),f(".sek-unit-wrapper",c).find('[data-sek-unit="'+o+'"]').trigger("click",{radius_type_switched:!0}),c.find('.sek-ui-button[data-sek-unit="'+o+'"]').addClass("is-selected").attr("aria-pressed",!0),l.val(r).trigger("input",{radius_type_switched:!0})};a.css_unit=new m.Value(g.isEmpty(o())?"px":d(o())),a.radiusType=new m.Value("_all_"),l.val((i=a(),n=0,g.isObject(i)&&g.has(i,"_all_")&&(n=u(i._all_)),n=parseInt(n,10),(!g.isNumber(n)||n<0)&&(m.errare("Error in border_radius input type for module : "+a.module.module_type+" the initial radius is invalid : "+n),n=0),n)),a.css_unit.bind(function(e,t,i){(!g.isObject(i)||!0!==i.radius_type_switched&&!0!==i.initializing_the_unit)&&l.trigger("input",i)}),a.radiusType.bind(function(e){try{r(e)}catch(e){m.errare("Error when firing syncWithRadiusType for input type border_radius for module type "+a.module.module_type,e)}}),s.on("input",function(e){l.val(f(this).val()).trigger("input")}),l.on("input",function(e,t){var i,n=a.radiusType()||"_all_",o=f(this).val()+d(a.css_unit()),r=f.extend(!0,{},_);(i=f.extend(!0,{},g.isObject(a())?a():r))[n]=f.extend(!0,{},i[n]||r[n]),g.isString(o)&&!g.isEmpty(o)&&(i[n]=o),(g.isEmpty(t)||g.isObject(t)&&!0!==t.radius_type_switched)&&("_all_"===n&&g.each(a.cssRadiusTypes,function(e){i=g.omit(i,e)}),a(i)),s.val(f(this).val())}),c.on("click","[data-sek-unit]",function(e,t){e.preventDefault(),c.find("[data-sek-unit]").removeClass("is-selected").attr("aria-pressed",!1),f(this).addClass("is-selected").attr("aria-pressed",!0),c.find("input[data-czrtype]").data("sek-unit",f(this).data("sek-unit")),a.css_unit(f(this).data("sek-unit"),t)}),c.on("click","[data-sek-radius-type]",function(e,t){e.preventDefault(),c.find("[data-sek-radius-type]").removeClass("is-selected").attr("aria-pressed",!1),f(this).addClass("is-selected").attr("aria-pressed",!0);var i="_all_";try{i=f(this).data("sek-radius-type")}catch(e){m.errare("border_radius input type => error when attaching click event",e)}a.radiusType(i,t)}),a.container.on("click",".sek-reset-button",function(e){var t=a.radiusType()||"_all_",i=f.extend(!0,{},g.isObject(a())?a():{});g.isEmpty(i[t])||(i=g.omit(i,t),a(i),r(t))}),s.val(l.val()||0);try{r(a.radiusType())}catch(e){m.errare("Error when firing syncWithRadiusType for input type border_radius for module type "+a.module.module_type,e)}f('[data-sek-unit="'+a.css_unit()+'"]',c).trigger("click",{initializing_the_unit:!0})}})}(wp.customize,jQuery,_),function(r,s,a){r.czrInputMap=r.czrInputMap||{},s.extend(r.czrInputMap,{buttons_choice:function(e){var n=this,o=s(".sek-button-choice-wrapper",n.container),t=o.find('input[type="number"]'),i=r.czr_sektions.getInputRegistrationParams(n.id,n.module.module_type);a.isEmpty(i)||a.isEmpty(i.default)||i.default;t.val(n()),o.on("click","[data-sek-choice]",function(e,t){var i;e.stopPropagation(),o.find("[data-sek-choice]").removeClass("is-selected").attr("aria-pressed",!1),s(this).addClass("is-selected").attr("aria-pressed",!0);try{i=s(this).data("sek-choice")}catch(e){r.errare("buttons_choice input type => error when attaching click event",e)}n(i)}),s('[data-sek-choice="'+n()+'"]',o).trigger("click",{initializing_the_unit:!0})}})}(wp.customize,jQuery,_),function(n,o,r){n.czrInputMap=n.czrInputMap||{},o.extend(n.czrInputMap,{reset_button:function(e){this.container.on("click","[data-sek-reset-scope]",function(e,t){e.stopPropagation();var i=o(this).data("sek-reset-scope");!r.isEmpty(i)&&r.contains(["local","global"],i)?n.czr_sektions.updateAPISetting({action:"sek-reset-collection",scope:i}).done(function(e){n.previewer.refresh(),n.previewer.trigger("sek-notify",{notif_id:"reset-success",type:"success",duration:8e3,message:["<span>","<strong>",sektionsLocalizedData.i18n["Reset complete"],"</strong>","</span>"].join("")})}).fail(function(e){n.errare("reset_button input => error when firing ::updateAPISetting",e),n.previewer.trigger("sek-notify",{notif_id:"reset-failed",type:"error",duration:8e3,message:["<span>","<strong>",sektionsLocalizedData.i18n["Reset failed"],"<br/>","<i>"+e+"</i>","</strong>","</span>"].join("")})}):n.errare("reset_button input => invalid scope provided.",i)})}})}(wp.customize,jQuery,_),function(i,r,s){i.czrInputMap=i.czrInputMap||{},r.extend(i.czrInputMap,{revision_history:function(e){var o=this;_selected_found=!1;var t=function(t){!0!==o.revisionHistorySet&&(r.when(r.Deferred(function(t){s.isEmpty(o.sek_revisionHistory)?i.czr_sektions.getRevisionHistory({is_local:"local_revisions"===o.id}).done(function(e){if(!s.isObject(e))throw new Error("_getRevisionHistory => server list is not a object");o.sek_revisionHistory=e,t.resolve(o.sek_revisionHistory)}).fail(function(e){t.reject(e)}):t.resolve(o.sek_revisionHistory)})).done(function(e){!function(e){if(!(0<o.container.find(".sek-revision-history").length))if(s.isEmpty(e))o.container.append(["<i>",sektionsLocalizedData.i18n["No revision history available for the moment."],"</i>"].join(""));else{o.container.append(r("<select/>",{class:"sek-revision-history",html:['<option value="_select_">'," -",sektionsLocalizedData.i18n.Select,"- ","</option>"].join("")}));var n=[];s.each(e,function(e,t){var i={value:t,html:e};i.value==o()&&(r.extend(i,{selected:"selected"}),_selected_found=!0),n.unshift(r("<option>",i))}),n[0].html([n[0].html(),sektionsLocalizedData.i18n["(currently published version)"]].join(" ")),s.each(n,function(e){r("select.sek-revision-history",o.container).append(e)}),r("select.sek-revision-history",o.container).selecter()}}(e),t&&!0===t.open_on_init&&s.delay(function(){try{r("select[data-czrtype]",o.container).czrSelect2("open")}catch(e){}},100)}).fail(function(e){i.errare("_getRevisionHistory => fail response =>",e)}),o.revisionHistorySet=!0)};o.container.on("change",".sek-revision-history",function(){var e=r(this).val();"_select_"!==e&&i.czr_sektions.setSingleRevision({revision_post_id:e,is_local:"local_revisions"===o.id})}),s.delay(function(){t({open_on_init:!1})},1e3)}})}(wp.customize,jQuery,_),function(p,_,m){p.czrInputMap=p.czrInputMap||{},_.extend(p.czrInputMap,{nimble_tinymce_editor:function(){var t=this,e=t.container.find("textarea").first(),i=0<e.length?e.attr("id"):null,n=p.czr_sektions.getInputRegistrationParams(t.id,t.module.module_type),o=sektionsLocalizedData.defaultToolbarBtns;if(m.isNull(i))throw new Error("api.czrInputMap.nimble_tinymce_editor => missing textarea for module :"+t.module.id);if(tinyMCE.get(i))throw new Error("api.czrInputMap.nimble_tinymce_editor => duplicate editor id.");var r,s,a=function(){return n&&n.editor_params&&!0===n.editor_params.autop},c={tinymce:{toolbar1:function(){var e=o.split(",");if(n.editor_params&&m.isArray(n.editor_params.excludedBtns)){var t=n.editor_params.excludedBtns;e=m.filter(e,function(e){return!m.contains(t,e)})}if(n.editor_params&&m.isString(n.editor_params.includedBtns)){var i=n.editor_params.includedBtns;m.isEmpty(i)||!m.isArray(sektionsLocalizedData[i])?p.errare("nimble_tinymce_editor input => invalid set of buttons provided",i):(i=sektionsLocalizedData[i],e=m.filter(e,function(e){return m.contains(i,e)}))}return e.join(",")}(),content_css:(r=wp.editor.getDefaultSettings(),s=[sektionsLocalizedData.tinyMceNimbleEditorStylesheetUrl],r&&r.tinymce&&r.tinymce.content_css&&(s=m.union(r.tinymce.content_css.split(","),s)),s.join(",")),min_height:40,height:n.editor_params&&m.isNumber(n.editor_params.height)?n.editor_params.height:p.czr_sektions.TINYMCE_EDITOR_HEIGHT},quicktags:{buttons:"strong,em,link,code"},mediaButtons:!n.editor_params||!1!==n.editor_params.media_button};c.tinymce.wpautop=a(),a()||(c.tinymce.forced_root_block=""),wp.editor.initialize(i,c);var l=tinyMCE.get(i);if(!l)throw new Error("setupTinyMceEditor => missing editor instance for module :"+t.module.id);p.czrActiveWPEditors=p.czrActiveWPEditors||[];var d=_.extend(!0,[],p.czrActiveWPEditors);d.push(i),p.czrActiveWPEditors=d;var u=function(){e.html(t()),l.setContent(t())};l.initialized?u():l.on("init",u),l.on("input change keyup",function(e){t(l.getContent())})},detached_tinymce_editor:function(){var e,t=this,i=_("textarea#"+sektionsLocalizedData.idOfDetachedTinyMceTextArea),n=p.czr_sektions.getInputRegistrationParams(t.id,t.module.module_type);if(!(0<i.length))throw new Error("api.czrInputMap::detached_tinymce_editor => missing textarea element");if(e=i.attr("id"),window.tinymce&&(mceInstance=window.tinymce.get(e),mceInstance&&mceInstance.remove()),!window.nimbleTinyMCEPreInit||!window.nimbleTinyMCEPreInit.mceInit||!window.nimbleTinyMCEPreInit.mceInit[e])throw new Error("setupDetachedTinyMceEditor => invalid nimbleTinyMCEPreInit global var");var o,r,s=nimbleTinyMCEPreInit.mceInit[e];s.content_css=(o=wp.editor.getDefaultSettings(),r=[sektionsLocalizedData.tinyMceNimbleEditorStylesheetUrl],o&&o.tinymce&&o.tinymce.content_css&&(r=m.union(o.tinymce.content_css.split(","),r)),r.join(","));var a=t.input_parent,c=function(){var e=a();return m.isUndefined(e.autop)?n&&n.editor_params&&!0===n.editor_params.autop:e.autop};s.wpautop=c(),c()||(s.forced_root_block=""),s.toolbar1=sektionsLocalizedData.defaultToolbarBtns,s.toolbar2="",window.tinymce.init(s),window.QTags.getInstance(e);var l=tinyMCE.get(e);if(!l)throw new Error("setupDetachedTinyMceEditor => missing editor instance for module :"+t.module.id);var d=function(){var e=c()&&m.isFunction(wp.editor.autop)?wp.editor.autop(t()):t();l.setContent(e),p.sekEditorExpanded(!0),_(window).trigger("resize")};l.initialized?d():l.on("init",d),l.on("input change keyup keydown click SetContent BeforeSetContent",function(e){t(c()?l.getContent():wp.editor.removep(l.getContent()))}),p.sekCurrentDetachedTinyMceInput=t,i.data("czr-bound-for-detached-editor")||(i.on("input",function(e,t){p.sekCurrentDetachedTinyMceInput(_(this).val())}),i.data("czr-bound-for-detached-editor",!0))}})}(wp.customize,jQuery,_),function(l,d,u){l.czrInputMap=l.czrInputMap||{},d.extend(l.czrInputMap,{import_export:function(){var r=this,t=r.container.find('button[data-czr-action="sek-pre-import"]'),s=r.container.find("input[name=sek-import-file]"),e=l.czr_sektions.getInputRegistrationParams(r.id,r.module.module_type),a=e.scope,c="local"===e.scope?l.czr_sektions.localSectionsSettingId():l.czr_sektions.getGlobalSectionsSettingId();u.contains(["local","global"],a)||l.errare("api.czrInputMap.import_export => invalid currentScope",a),s.on("change",function(e){t.toggleClass("disabled",u.isEmpty(d(this).val()))});r.container.on("click","[data-czr-action]",function(e){var i,t;switch(e.stopPropagation(),d(this).data("czr-action")){case"sek-export":if(i=!1,t=wp.customize.dirtyValues(),u.isEmpty(t)||u.each(t,function(e,t){i||(i=-1!==t.indexOf("nimble"))}),i){alert(sektionsLocalizedData.i18n["You need to publish before exporting."]);break}var n=l(c)(),o=!0;if(u.each(n.collection,function(e){o&&(u.isEmpty(e.collection)||(o=!1))}),o){alert(sektionsLocalizedData.i18n["Nothing to export."]);break}l.czr_sektions.export_template({scope:a});break;case"sek-pre-import":if(u.isEmpty(l.czr_sektions.activeLocations())){alert(sektionsLocalizedData.i18n["The current page has no available locations to import Nimble Builder sections."]);break}l.czr_sektions.import_template_from_file({pre_import_check:!0,input:r,file_input:s}).done(function(e){l.czr_sektions.pre_checks_from_file_import(e,{pre_import_check:!1,input:r,file_input:s})}).fail(function(e){l.errare("import_export_ input => pre_checks_from_file_import failed",e),l.czr_sektions.doAlwaysAfterManualImportAndApiSettingUpdate({input:r,file_input:s}),l.czr_sektions.import_template_from_file({input:r,file_input:s})});break;case"sek-import-as-is":l.czr_sektions.import_template_from_file({input:r,file_input:s});break;case"sek-import-assign":l.czr_sektions.import_template_from_file({assign_missing_locations:!0,input:r,file_input:s});break;case"sek-cancel-import":l.czr_sektions.doAlwaysAfterManualImportAndApiSettingUpdate({input:r,file_input:s})}})}})}(wp.customize,jQuery,_),function(c,l,d){c.czrInputMap=c.czrInputMap||{},l.extend(c.czrInputMap,{simpleselect:function(e){c.czr_sektions.setupSelectInput.call(this,e)},multiselect:function(e){c.czr_sektions.setupSelectInput.call(this,e)},simpleselectWithDeviceSwitcher:function(e){var r=this,t=(r.input_parent,r.module,c.czr_sektions.getInputRegistrationParams(r.id,r.module.module_type)),o=l("select",r.container),s=d.isEmpty(t)||d.isEmpty(t.default)?{}:t.default,i={params:e=d.isEmpty(e)?t.choices:e};if(r.module.trigger("nimble-set-select-input-options",i),e=i.params,!d.isEmpty(e)&&d.isObject(e)){d.each(e,function(e,t){var i={value:t,html:e};t==r()?l.extend(i,{selected:"selected"}):"px"===t&&l.extend(i,{selected:"selected"}),o.append(l("<option>",i))});var a=function(e,t){var i=["mobile","tablet","desktop"];if(d.has(e,t))return e[t];var n=d.findIndex(i,function(e){return t===e});return!d.isEmpty(t)&&n<i.length?a(e,i[n+1]):l.extend(!0,{desktop:""},s).desktop};c.czr_sektions.maybeSetupDeviceSwitcherForInput.call(r),o.on("change",function(e,t){var i,n=c.previewedDevice()||"desktop",o=l(this).val();(i=l.extend(!0,{},d.isObject(r())?r():{}))[n]=l.extend(!0,{},i[n]||{}),d.isString(o)&&!d.isEmpty(o)&&(i[n]=o),(d.isEmpty(t)||d.isObject(t)&&!0!==t.previewed_device_switched)&&r(i)}),r.previewedDevice.bind(function(e){try{!function(e){var t=r(),i={};i=l.extend(!0,{},s),d.isObject(t)?i=l.extend(!0,{},t):d.isString(t)&&!d.isEmpty(t)&&(i={desktop:t});var n=a(i,e);o.val(n).trigger("change",{previewed_device_switched:!0})}(e)}catch(e){c.errare("Error when firing syncWithPreviewedDevice for input type "+r.type+" for input id "+r.id,e)}})}else c.errare("api.czr_sektions.setupSelectInput => missing select options for input id => "+r.id+" in module "+r.module.module_type)}})}(wp.customize,jQuery,_),function(a,c,l){a.czrInputMap=a.czrInputMap||{},c.extend(a.czrInputMap,{category_picker:function(e){var n=this,o=c("select[data-czrtype]",n.container),r=function(){var e=n();return e=l.isString(e)?[e]:e,l.isArray(e)?e:[]},t=function(t){!0!==n.catCollectionSet&&(c.when(c.Deferred(function(i){l.isEmpty(a.czr_sektions.post_categories)?wp.ajax.post("sek_get_post_categories",{nonce:a.settings.nonce.save}).done(function(e){l.isArray(e)||a.errare(n.id+" => error => invalid category collection sent by server");var t={};l.each(e,function(e){l.isEmpty(e.slug)||l.isEmpty(e.name)?i.reject("missing slug or name for at least one category"):t[e.slug]=e.name}),a.czr_sektions.post_categories=t,i.resolve(a.czr_sektions.post_categories)}).fail(function(e){i.reject(e)}):i.resolve(a.czr_sektions.post_categories)})).done(function(e){i(e),t&&!0===t.open_on_init&&l.delay(function(){try{o.czrSelect2("open")}catch(e){}},100)}).fail(function(e){a.errare(n.id+" => fail response when _getCategoryCollection()",e)}),n.catCollectionSet=!0)},i=function(e){l.each(e,function(e,t){var i={value:t,html:e};l.contains(r(),t)&&c.extend(i,{selected:"selected"}),o.append(c("<option>",i))}),o.czrSelect2({closeOnSelect:!0,templateSelection:function(e){return e.text.replace(/\u2013|\u2014/g,"")}}),o.on("change",function(){0===c(this).find("option:selected").length&&n([])})},s={};l.each(r(),function(e){s[e]=(e+"").replace(/-/g," ")}),i(s),n.container.on("click",function(){!0!==n.catCollectionSet&&(o.czrSelect2("destroy"),c.when(o.find("option").remove()).done(function(){t({open_on_init:!0})}))})}})}(wp.customize,jQuery,_),function(r,s,e){r.czrInputMap=r.czrInputMap||{},s.extend(r.czrInputMap,{grid_layout:function(e){var n=this,o=s(".sek-grid-layout-wrapper",n.container);o.find('input[type="hidden"]').val(n()),o.on("click","[data-sek-grid-layout]",function(e,t){var i;e.stopPropagation(),o.find("[data-sek-grid-layout]").removeClass("selected").attr("aria-pressed",!1),s(this).addClass("selected").attr("aria-pressed",!0);try{i=s(this).data("sek-grid-layout")}catch(e){r.errare(n.type+" => error when attaching click event",e)}n(i)}),s('[data-sek-grid-layout="'+n()+'"]',o).trigger("click")}})}(wp.customize,jQuery,_),function(i,e,t){i.czrInputMap=i.czrInputMap||{},e.extend(i.czrInputMap,{refresh_preview_button:function(e){this.container.on("click",".sek-refresh-button",function(e,t){e.stopPropagation(),i.previewer.refresh()})}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_content_type_switcher_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_content_type_switcher_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_content_type_switcher_module"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_module_picker_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_module_picker_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_module_picker_module"))}})}(wp.customize,jQuery,_),function(t,e,i){t.czrModuleMap=t.czrModuleMap||{};var n=sektionsLocalizedData.presetSectionsModules;i.isArray(n)&&!i.isEmpty(n)?i.each(n,function(e){t.czrModuleMap[e]={crud:!1,name:t.czr_sektions.getRegisteredModuleProperty(e,"name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.extend({id:"",title:""},t.czr_sektions.getDefaultItemModelFromRegisteredModuleData(e))}}):t.errare("api.czrModuleMap => error when adding section modules")}(wp.customize,jQuery,_),function(s,i,a){var e={initialize:function(e,t){this.inputConstructor=s.CZRInput.extend({initialize:function(e,t){var i=this;s.CZRInput.prototype.initialize.call(i,e,t),i.isReady.then(function(){i.renderUserSavedSections(),i.attachDomEvents()})},getUserSavedSections:function(){var t=i.Deferred();return a.isEmpty(s.czr_sektions.userSavedSections)?s.czr_sektions.getSavedSectionCollection().done(function(e){t.resolve(e)}):t.resolve(s.czr_sektions.userSavedSections),t.promise()},renderUserSavedSections:function(){var n=this,o="",r=n.container.find(".sek-content-type-wrapper"),t=function(e){if(r.find(".sek-user-section-wrapper").remove(),a.isEmpty(e)){var t=[sektionsLocalizedData.baseUrl,"/assets/admin/img/save_section_notice.png","?ver=",sektionsLocalizedData.nimbleVersion].join("");doc_url="https://docs.presscustomizr.com/article/417-how-to-save-and-reuse-sections-with-nimble-builder",o=['<div class="sek-user-section-wrapper">','<img src="'+t+'" />','<br/><a href="'+doc_url+'" target="_blank" rel="noreferrer nofollow">'+doc_url+"</a>","</div>"].join(""),r.append(o),n.module.container.find(".czr-item-content .customize-control-title").html("You did not save any section yet.")}else{var i="background: url("+[sektionsLocalizedData.baseUrl,"/assets/admin/img/nb_sec_pholder.png","?ver=",sektionsLocalizedData.nimbleVersion].join("")+") 50% 50% / cover no-repeat;";a.each(e,function(e,t){a.isEmpty(e.description)?_titleAttr=[e.title,e.last_modified_date].join(" | "):_titleAttr=[e.title,e.last_modified_date,e.description].join(" | "),o=['<div class="sek-user-section-wrapper">','<div draggable="true" data-sek-is-user-section="true" data-sek-section-type="content" data-sek-content-type="preset_section" data-sek-content-id="'+t+'" style="" title="'+e.title+'">','<div class="sek-sec-thumb" style="'+i+'"></div>','<div class="sek-overlay"></div>','<div class="sek-sec-info" title="'+_titleAttr+'">','<h3 class="sec-title">'+e.title+"</h3>",'<p class="sec-date"><i>'+[sektionsLocalizedData.i18n["Last modified"]," : ",e.last_modified_date].join(" ")+"</i></p>",'<p class="sec-desc">'+e.description+"</p>",'<i class="material-icons remove-user-sec" title="'+sektionsLocalizedData.i18n["Remove this template"]+'">delete_forever</i>',"</div>","</div>","</div>"].join(""),r.append(o)})}s.czr_sektions.trigger("sek-refresh-dragzones",{type:"preset_section",input_container:n.container})};n.getUserSavedSections().done(function(e){t(e)}),s.czr_sektions.allSavedSections.bind(function(e){t(e)})},attachDomEvents:function(){this.container.on("click",".sek-sec-info .remove-user-sec",function(e){e.preventDefault();var t=s.czr_sektions,i=function(e){t.saveSectionDialogMode("remove"),t.saveSectionDialogMode.unbind(i)};t.saveSectionDialogMode.bind(i),t.saveSectionDialogVisible(!0)})}}),s.CZRDynModule.prototype.initialize.call(this,e,t)}};s.czrModuleMap=s.czrModuleMap||{},i.extend(s.czrModuleMap,{sek_my_sections_sec_picker_module:{mthds:e,crud:!1,name:s.czr_sektions.getRegisteredModuleProperty("sek_my_sections_sec_picker_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:s.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_my_sections_sec_picker_module")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_mod_option_switcher_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_mod_option_switcher_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_mod_option_switcher_module"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_level_anchor_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_level_anchor_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_anchor_module"))}})}(wp.customize,jQuery,_),function(r,e,s){var t={initialize:function(e,t){this.itemConstructor=r.CZRItem.extend(this.CZRItemConstructor||{}),r.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!s.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){r.errorLog("item.setInputVisibilityDeps() : "+e)}}),r.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,o=n.module;n.czr_Input.each(function(i){switch(i.id){case"bg-image":s.each(["bg-attachment","bg-scale","bg-repeat","bg-parallax","bg-parallax-force"],function(t){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"bg-parallax-force":e=!s.isEmpty(i()+"")&&r.CZR_Helpers.isChecked(n.czr_Input("bg-parallax")());break;case"bg-scale":case"bg-repeat":e=!s.isEmpty(i()+"")&&!r.CZR_Helpers.isChecked(n.czr_Input("bg-parallax")());break;default:e=!s.isEmpty(i()+"")}return e})}catch(e){r.errare(o.id+" => error in setInputVisibilityDeps",e)}});break;case"bg-apply-overlay":s.each(["bg-color-overlay","bg-opacity-overlay"],function(e){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return r.CZR_Helpers.isChecked(i())})}catch(e){r.errare(o.id+" => error in setInputVisibilityDeps",e)}});break;case"bg-parallax":s.each(["bg-parallax-force","bg-scale","bg-repeat"],function(t){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"bg-parallax-force":e=!s.isEmpty(n.czr_Input("bg-image")()+"")&&r.CZR_Helpers.isChecked(i());break;case"bg-repeat":case"bg-scale":e=!s.isEmpty(n.czr_Input("bg-image")()+"")&&!r.CZR_Helpers.isChecked(i())}return e})}catch(e){r.errare(o.id+" => error in setInputVisibilityDeps",e)}}),i.bind(function(e){r.CZR_Helpers.isChecked(i())&&r.CZR_Helpers.isChecked(n.czr_Input("bg-attachment")())&&n.czr_Input("bg-attachment").container.find("input[type=checkbox]").trigger("click")});break;case"bg-attachment":i.bind(function(e){r.CZR_Helpers.isChecked(i())&&r.CZR_Helpers.isChecked(n.czr_Input("bg-parallax")())&&n.czr_Input("bg-parallax").container.find("input[type=checkbox]").trigger("click")});break;case"bg-use-video":s.each(["bg-video","bg-video-loop","bg-video-delay-start","bg-video-on-mobile","bg-video-start-time","bg-video-end-time"],function(e){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return r.CZR_Helpers.isChecked(i())})}catch(e){r.errare(o.id+" => error in setInputVisibilityDeps",e)}})}}),o.control&&o.control.params&&o.control.params.sek_registration_params&&(s.contains(["section","column"],o.control.params.sek_registration_params.level)||s.each(["bg-use-video","bg-video","bg-video-loop","bg-video-on-mobile","bg-video-start-time","bg-video-end-time"],function(e){n.czr_Input(e).visible(!1)}))}}};r.czrModuleMap=r.czrModuleMap||{},e.extend(r.czrModuleMap,{sek_level_bg_module:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("sek_level_bg_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:s.extend({id:"",title:""},r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_bg_module"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_level_text_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_level_text_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_text_module")}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var i=this.module;this.czr_Input.each(function(t){switch(t.id){case"border-type":o.each(["borders"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{sek_level_border_module:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("sek_level_border_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.extend({id:"",title:""},n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_border_module"))}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var i=this.module;this.czr_Input.each(function(t){switch(t.id){case"use-custom-breakpoint":o.each(["custom-breakpoint","apply-to-all"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){n.errare(i.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{sek_level_breakpoint_module:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("sek_level_breakpoint_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.extend({id:"",title:""},n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_breakpoint_module"))}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var i=this.module;this.czr_Input.each(function(t){switch(t.id){case"height-type":o.each(["custom-height","overflow_hidden"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"custom"===t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{sek_level_height_module:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("sek_level_height_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.extend({id:"",title:""},n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_height_module"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_level_visibility_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_level_visibility_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_visibility_module"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"width-type":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"custom-width",function(){return"custom"===e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_level_width_module:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_level_width_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_width_module"))}})}(wp.customize,jQuery,_),function(d,u,p){var e={initialize:function(e,t){var i=this;i.inputConstructor=d.CZRInput.extend(i.CZRInputConstructor||{}),i.itemConstructor=d.CZRItem.extend(i.CZRItemConstructor||{}),d.CZRDynModule.prototype.initialize.call(i,e,t)},CZRInputConstructor:{range_simple:function(e){var t,i=this,n=u(".sek-range-with-unit-picker-wrapper",i.container),o=n.find('input[type="number"]'),r=n.find('input[type="range"]');try{t=i.module.control.params.sek_registration_params}catch(e){return void d.errare("Error when getting the module registration params",e)}if(p.isUndefined(t.level_id))d.errare("Error : missing column id",er);else if(i.columnId=t.level_id,i.columnModel=u.extend(!0,{},d.czr_sektions.getLevelModel(i.columnId)),i.parentSectionModel=d.czr_sektions.getParentSectionFromColumnId(i.columnId),"no_match"!=i.columnModel)if("no_match"!=i.parentSectionModel){i.colNb=p.size(i.parentSectionModel.collection),o.attr("data-sek-width-range-column-id",i.columnId),1===i.colNb?i.container.html(["<p>",sektionsLocalizedData.i18n["This is a single-column section with a width of 100%. You can act on the internal width of the parent section, or adjust padding and margin."]].join("")):i.container.show();var s,a=d.czr_sektions.getLevelModel(i.columnId),c="_not_set_";if("no_match"!=a){var l=a.options&&a.options.width&&a.options.width["custom-width"]&&p.isNumber(+a.options.width["custom-width"]);l?c=a.options.width["custom-width"]:!l&&a.width&&p.isNumber(+a.width)&&(c=a.width),s="_not_set_"!==c?c:"_not_set_"===i()?Math.floor(100/i.colNb):i(),s=1*+parseFloat(s).toFixed(3),(!p.isNumber(s)||100<s||s<0)&&(d.errare("Error => invalid column width",s),s=50),r.on("input",function(e,t){o.val(u(this).val()).trigger("input",t)}),o.on("input",p.debounce(function(e,t){r.val(u(this).val()),t&&t.is_init||i(+parseFloat(u(this).val()).toFixed(3))},300)),o.on("input",p.debounce(function(e,t){t&&(t.is_init||t.is_resize_column_trigger)||i.sayItToApi(u(this).val())},300)),r.val(s).trigger("input",{is_init:!0})}else d.errare("sek_level_width_column module => invalid column model")}else d.errare("sek_level_width_column module => invalid parent section model");else d.errare("sek_level_width_column module => invalid column model")},sayItToApi:function(e,t){var i=this,n=p.findIndex(i.parentSectionModel.collection,{id:i.columnId}),o=n+1==i.colNb?n-1:n+1,r=p.find(i.parentSectionModel.collection,function(e,t){return o===t});"no_match"===r&&d.errare("sek_level_width_column module => invalid sister column model"),d.previewer.trigger("sek-resize-columns",{action:"sek-resize-columns",level:"column",in_sektion:i.parentSectionModel.id,id:i.columnId,resized_column:i.columnId,sister_column:r.id,resizedColumnWidthInPercent:e,col_number:i.colNb})}}};d.czrModuleMap=d.czrModuleMap||{},u.extend(d.czrModuleMap,{sek_level_width_column:{mthds:e,crud:!1,name:d.czr_sektions.getRegisteredModuleProperty("sek_level_width_column","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:p.extend({id:"",title:""},d.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_width_column"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"use-custom-outer-width":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"outer-section-width",function(){return e()});break;case"use-custom-inner-width":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"inner-section-width",function(){return e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_level_width_section:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_level_width_section","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_width_section"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_level_spacing_module:{mthds:"",crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_level_spacing_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_spacing_module"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_level_cust_css_section:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_level_cust_css_section","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_cust_css_section"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var e=this.module;i.trigger("nb_setup_visibility_deps_for_animation_module",{item:this,module:e})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_level_animation_module:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_level_animation_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_animation_module"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_template:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_template","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_template"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"use-custom-outer-width":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"outer-section-width",function(){return e()});break;case"use-custom-inner-width":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"inner-section-width",function(){return e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_local_widths:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_local_widths","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_widths"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_custom_css:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_custom_css","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_custom_css"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_reset:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_reset","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_reset"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_performances:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_performances","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_performances"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_header_footer:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_header_footer","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_header_footer"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_revisions:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_revisions","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_revisions"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_imp_exp:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_imp_exp","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_imp_exp"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"links_underline":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"links_underline_hover",function(){return!e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_global_text:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_global_text","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_text"))}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var i=this.module;this.czr_Input.each(function(t){switch(t.id){case"use-custom-breakpoint":o.each(["global-custom-breakpoint","apply-to-all"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){n.errare(i.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{sek_global_breakpoint:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("sek_global_breakpoint","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:o.extend({id:"",title:""},n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_breakpoint"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"use-custom-outer-width":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"outer-section-width",function(){return e()});break;case"use-custom-inner-width":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"inner-section-width",function(){return e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_global_widths:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_global_widths","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_widths"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_global_performances:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_global_performances","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_performances"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_global_header_footer:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_global_header_footer","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_header_footer"))}})}(wp.customize,jQuery,_),function(r,e,s){var t={initialize:function(e,t){this.itemConstructor=r.CZRItem.extend(this.CZRItemConstructor||{}),r.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!s.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){r.errorLog("item.setInputVisibilityDeps() : "+e)}}),r.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,o=n.module;n.czr_Input.each(function(i){switch(i.id){case"enable":s.each(["public_key","private_key","badge","show_failure_message","failure_message","score"],function(t){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"failure_message":e=i()&&n.czr_Input("show_failure_message")();break;default:e=i()}return e})}catch(e){r.errare(o.module_type+" => error in setInputVisibilityDeps",e)}});break;case"show_failure_message":s.each(["failure_message"],function(e){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()&&n.czr_Input("enable")()})}catch(e){r.errare(o.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};r.czrModuleMap=r.czrModuleMap||{},e.extend(r.czrModuleMap,{sek_global_recaptcha:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("sek_global_recaptcha","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:s.extend({id:"",title:""},r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_recaptcha"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_global_revisions:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_global_revisions","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_revisions"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_global_reset:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_global_reset","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_reset"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_global_imp_exp:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_global_imp_exp","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_imp_exp"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_global_beta_features:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_global_beta_features","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_beta_features"))}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){this.itemConstructor=o.CZRItem.extend(this.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(this,e,t),this.bind("set_default_content_picker_options",function(e){return e.defaultContentPickerOption.defaultOption={title:'<span style="font-weight:bold">'+sektionsLocalizedData.i18n["Set a custom url"]+"</span>",type:"",type_label:"",object:"",id:"_custom_",url:""},e})},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,t=n.module;n.czr_Input.each(function(i){switch(i.id){case"img":o.czr_sektions.scheduleVisibilityOfInputId.call(i,"img-size",function(){return!r.isEmpty(i()+"")&&r.isNumber(i())});break;case"link-to":r.each(["link-pick-url","link-custom-url","link-target"],function(t){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e="url"===i()&&"_custom_"==n.czr_Input("link-pick-url")().id;break;case"link-pick-url":e="url"===i();break;case"link-target":e=!r.contains(["no-link","img-lightbox"],i())}return e})}catch(e){o.errare("Image module => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":o.czr_sektions.scheduleVisibilityOfInputId.call(i,"link-custom-url",function(){return"_custom_"==i().id&&"url"==n.czr_Input("link-to")()});break;case"border-type":r.each(["borders"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return"none"!==i()})}catch(e){o.errare(t.id+" => error in setInputVisibilityDeps",e)}});break;case"use_custom_width":r.each(["custom_width"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){o.errare("Image module => error in setInputVisibilityDeps",e)}});break;case"use_custom_height":r.each(["custom_height"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){o.errare("Image module => error in setInputVisibilityDeps",e)}});break;case"use_custom_title_attr":r.each(["heading_title"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){o.errare("Image module => error in setInputVisibilityDeps",e)}})}}),o.trigger("nb_setup_visibility_deps_for_img_module",{item:n,module:t})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_image_main_settings_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_image_main_settings_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_image_main_settings_child")}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var e=this,i=e.module;e.czr_Input.each(function(t){switch(t.id){case"border-type":o.each(["borders"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_image_borders_corners_child:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_image_borders_corners_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_image_borders_corners_child")}})}(wp.customize,jQuery,_),function(n,e,t){var i={initialize:function(e,t){this.inputConstructor=n.CZRInput.extend(this.CZRTextEditorInputMths||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRTextEditorInputMths:{initialize:function(e,t){var i=this;"detached_tinymce_editor"==i.type&&i.isReady.then(function(){i.container.find('[data-czr-action="open-tinymce-editor"]').trigger("click")}),n.CZRInput.prototype.initialize.call(i,e,t)}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_tinymce_child:{mthds:i,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_tinymce_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_tinymce_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_simple_html_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_simple_html_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_html_module")}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(i){switch(i.id){case"img-type":o.each(["img-id","img-size"],function(t){try{n.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"img-id":e="custom"===i();break;default:e="none"!==i()}return e})}catch(e){n.errare("Featured pages module => error in setInputVisibilityDeps",e)}});break;case"content-type":o.each(["content-custom-text"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return"custom"===i()})}catch(e){n.errare("Featured pages module => error in setInputVisibilityDeps",e)}});break;case"btn-display":o.each(["btn-custom-text"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){n.errare("Featured pages module => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_featured_pages_module:{mthds:t,crud:n.czr_sektions.getRegisteredModuleProperty("czr_featured_pages_module","is_crud"),hasPreItem:!1,refresh_on_add_item:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_featured_pages_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_featured_pages_module")}})}(wp.customize,jQuery,_),function(r,e,s){var t={initialize:function(e,t){this.itemConstructor=r.CZRItem.extend(this.CZRItemConstructor||{}),this.bind("set_default_content_picker_options",function(e){return e.defaultContentPickerOption.defaultOption={title:'<span style="font-weight:bold">'+sektionsLocalizedData.i18n["Set a custom url"]+"</span>",type:"",type_label:"",object:"",id:"_custom_",url:""},e}),r.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!s.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){r.errorLog("item.setInputVisibilityDeps() : "+e)}}),r.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,o=n.module;n.czr_Input.each(function(i){switch(i.id){case"link-to":s.each(["link-pick-url","link-custom-url","link-target"],function(t){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e="url"==i()&&"_custom_"==n.czr_Input("link-pick-url")().id;break;default:e="url"==i()}return e})}catch(e){r.errare(o.module_type+" => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":r.czr_sektions.scheduleVisibilityOfInputId.call(i,"link-custom-url",function(){return"_custom_"==i().id&&"url"==n.czr_Input("link-to")()});break;case"use_custom_color_on_hover":s.each(["color_hover"],function(e){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){r.errare(o.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};r.czrModuleMap=r.czrModuleMap||{},e.extend(r.czrModuleMap,{czr_icon_settings_child:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("czr_icon_settings_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_icon_settings_child")}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var e=this,i=e.module;e.czr_Input.each(function(t){switch(t.id){case"border-type":o.each(["borders"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_icon_spacing_border_child:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_icon_spacing_border_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_icon_spacing_border_child")}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){this.itemConstructor=o.CZRItem.extend(this.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(this,e,t),this.bind("set_default_content_picker_options",function(e){return e.defaultContentPickerOption.defaultOption={title:'<span style="font-weight:bold">'+sektionsLocalizedData.i18n["Set a custom url"]+"</span>",type:"",type_label:"",object:"",id:"_custom_",url:""},e})},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this;n.module;n.czr_Input.each(function(i){switch(i.id){case"link-to":r.each(["link-pick-url","link-custom-url","link-target"],function(t){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e=i()&&"_custom_"==n.czr_Input("link-pick-url")().id;break;case"link-pick-url":case"link-target":e=i()}return e})}catch(e){o.errare("Heading module => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":o.czr_sektions.scheduleVisibilityOfInputId.call(i,"link-custom-url",function(){return"_custom_"==i().id&&!0===n.czr_Input("link-to")()})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_heading_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_heading_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_heading_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_heading_spacing_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_heading_spacing_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_heading_spacing_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_divider_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_divider_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_divider_module")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_spacer_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_spacer_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_spacer_module")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_map_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_map_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_map_module")}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRButtonItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRButtonItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(t){switch(t.id){case"quote_design":n.each(["border_width_css","border_color_css"],function(e){try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"border-before"==t()})}catch(e){i.errare("Quote module => error in setInputVisibilityDeps",e)}}),n.each(["icon_color_css","icon_size_css"],function(e){try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"quote-icon-before"==t()})}catch(e){i.errare("Quote module => error in setInputVisibilityDeps",e)}})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_quote_design_child:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_quote_design_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_quote_design_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_quote_quote_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_quote_quote_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_quote_quote_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_quote_cite_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_quote_cite_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_quote_cite_child")}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){this.itemConstructor=o.CZRItem.extend(this.CZRItemConstructor||{}),this.bind("set_default_content_picker_options",function(e){return e.defaultContentPickerOption.defaultOption={title:'<span style="font-weight:bold">'+sektionsLocalizedData.i18n["Set a custom url"]+"</span>",type:"",type_label:"",object:"",id:"_custom_",url:""},e}),o.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this;n.module;n.czr_Input.each(function(i){switch(i.id){case"link-to":r.each(["link-pick-url","link-custom-url","link-target"],function(t){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e="url"==i()&&"_custom_"==n.czr_Input("link-pick-url")().id;break;default:e="url"==i()}return e})}catch(e){o.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":o.czr_sektions.scheduleVisibilityOfInputId.call(i,"link-custom-url",function(){return"_custom_"==i().id&&"url"==n.czr_Input("link-to")()});break;case"icon":o.czr_sektions.scheduleVisibilityOfInputId.call(i,"icon-side",function(){return!r.isEmpty(i())})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_btn_content_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_btn_content_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_btn_content_child")}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var e=this,i=e.module;e.czr_Input.each(function(t){switch(t.id){case"use_custom_bg_color_on_hover":o.each(["bg_color_hover"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){n.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"border-type":o.each(["borders"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}});break;case"use_box_shadow":o.each(["push_effect"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){n.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"width-type":n.czr_sektions.scheduleVisibilityOfInputId.call(t,"custom-width",function(){return"custom"===t()}),o.each(["custom-width","h_inner_align_css"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"custom"===t()})}catch(e){n.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"height-type":n.czr_sektions.scheduleVisibilityOfInputId.call(t,"custom-height",function(){return"custom"===t()})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_btn_design_child:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_btn_design_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_btn_design_child")}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){this.itemConstructor=o.CZRItem.extend(this.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this.module;this.czr_Input.each(function(i){switch(i.id){case"layout":r.each(["columns","img_column_width","has_tablet_breakpoint","has_mobile_breakpoint"],function(t){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"columns":e="grid"===i();break;case"has_tablet_breakpoint":case"has_mobile_breakpoint":case"img_column_width":e="list"===i()}return e})}catch(e){o.errare(n.module_type+" => error in setInputVisibilityDeps",e)}});break;case"categories":r.each(["must_have_all_cats"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){var e=i();return r.isArray(e)&&1<e.length})}catch(e){o.errare(n.module_type+" => error in setInputVisibilityDeps",e)}});break;case"display_pagination":r.each(["posts_per_page","post_number"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return"posts_per_page"===e?i():!i()})}catch(e){o.errare(n.module_type+" => error in setInputVisibilityDeps",e)}});break;case"custom_grid_spaces":r.each(["column_gap","row_gap"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){o.errare(n.module_type+" => error in setInputVisibilityDeps",e)}});break;case"show_excerpt":r.each(["excerpt_length"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){o.errare(n.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_post_grid_main_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_post_grid_main_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_post_grid_main_child")}})}(wp.customize,jQuery,_),function(r,e,s){var t={initialize:function(e,t){this.itemConstructor=r.CZRItem.extend(this.CZRItemConstructor||{}),r.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!s.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){r.errorLog("item.setInputVisibilityDeps() : "+e)}}),r.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,o=n.module;n.czr_Input.each(function(i){switch(i.id){case"show_thumb":s.each(["img_size","img_has_custom_height","img_height","border_radius_css","use_post_thumb_placeholder"],function(t){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"img_height":e=i()&&n.czr_Input("img_has_custom_height")();break;default:e=i()}return e})}catch(e){r.errare(o.module_type+" => error in setInputVisibilityDeps",e)}});break;case"img_has_custom_height":s.each(["img_height"],function(e){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()&&n.czr_Input("show_thumb")()})}catch(e){r.errare(o.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};r.czrModuleMap=r.czrModuleMap||{},e.extend(r.czrModuleMap,{czr_post_grid_thumb_child:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("czr_post_grid_thumb_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_post_grid_thumb_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_post_grid_metas_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_post_grid_metas_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_post_grid_metas_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_post_grid_fonts_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_post_grid_fonts_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_post_grid_fonts_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_menu_content_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_menu_content_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_menu_content_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_menu_mobile_options:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_menu_mobile_options","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_menu_mobile_options")}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(t){switch(t.id){case"show_name_field":n.each(["name_field_label","name_field_required"],function(e){try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){i.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"show_subject_field":n.each(["subject_field_label","subject_field_required"],function(e){try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){i.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"show_message_field":n.each(["message_field_label","message_field_required"],function(e){try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){i.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"show_privacy_field":n.each(["privacy_field_label","privacy_field_required"],function(e){try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){i.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,"link-custom-url",function(){return t()})}catch(e){i.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_simple_form_fields_child:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_simple_form_fields_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_fields_child")}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var i=this.module;this.czr_Input.each(function(t){switch(t.id){case"border-type":o.each(["borders"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_simple_form_design_child:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_simple_form_design_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_design_child")}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var i=this.module;this.czr_Input.each(function(t){switch(t.id){case"use_custom_bg_color_on_hover":o.each(["bg_color_hover"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){n.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"border-type":o.each(["borders"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}});break;case"use_box_shadow":o.each(["push_effect"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){n.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_simple_form_button_child:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_simple_form_button_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_button_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_simple_form_fonts_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_simple_form_fonts_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_fonts_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_simple_form_submission_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_simple_form_submission_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_submission_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_font_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_font_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_font_child")}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.bind("nimble-set-select-input-options",function(e){e.params=sektionsLocalizedData.registeredWidgetZones}),i.CZRDynModule.prototype.initialize.call(this,e,t)}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_widget_area_module:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_widget_area_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_widget_area_module")}})}(wp.customize,jQuery,_),function(s,a,c){var e={initialize:function(e,t){var i=this;i.crudModulePart="nimble-crud-module-part",i.rudItemPart="nimble-rud-item-part",i.itemConstructor=s.CZRItem.extend(i.CZRItemConstructor||{}),s.CZRDynModule.prototype.initialize.call(i,e,t)},generateItemId:function(){return s.czr_sektions.guid()},_makeItemsSortable:function(e){if(!wp.media.isTouchDevice&&a.fn.sortable){var i=this;a("."+i.control.css_attr.items_wrapper,i.container).sortable({handle:"."+i.control.css_attr.item_sort_handle,start:function(){},update:function(e,t){i._getSortedDOMItemCollection().done(function(e){i.itemCollection.set(e)}).then(function(){c.has(i,"preItem")&&i.preItemExpanded.set(!1),i.closeAllItems().closeRemoveDialogs(),i.trigger("item-collection-sorted")})}})}},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!c.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){s.errorLog("item.setInputVisibilityDeps() : "+e)}}),s.CZRItem.prototype.ready.call(t)},_buildTitle:function(e,t,i){var n=this.module;return e=e||("string"==typeof t?s.CZR_Helpers.capitalize(t.replace("fa-","")):""),e=s.CZR_Helpers.truncate(e,20),'<div><span class="'+t+'" style="color:'+(i=i||n.defaultSocialColor)+'"></span> '+e+"</div>"},writeItemViewTitle:function(e){var t=this.module,i=e||this(),n=(i.icon?i.icon:"").replace("fa-","").replace("envelope","email").replace("far","").replace("fab","").replace("fas","");a("."+t.control.css_attr.item_title,this.container).html(this._buildTitle(n,i.icon,i.color_css))},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(t){switch(t.id){case"use_custom_color_on_hover":c.each(["social_color_hover"],function(e){try{s.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){s.errare("Featured pages module => error in setInputVisibilityDeps",e)}})}})},toggleRemoveAlert:function(){this.removeItem()},removeItem:function(e){e=e||{};var t=this,i=this.module,n=c.clone(i.itemCollection());i.trigger("pre_item_dom_remove",t()),t._destroyView(),n=c.without(n,c.findWhere(n,{id:t.id})),i.itemCollection.set(n),i.trigger("pre_item_api_remove",t());var o=a.extend(!0,{},t());if(i.czr_Item.remove(t.id),"postMessage"!=s(i.control.id).transport||!c.has(e,"dom_event")||c.has(e.dom_event,"isTrigger")||s.CZR_Helpers.hasPartRefresh(i.control.id))i.trigger("item-removed",o),i.control.trigger("item-removed",o);else{var r=function(){s.previewer.unbind("ready",r),i.trigger("item-removed",o)};s.previewer.bind("ready",r)}}}};s.czrModuleMap=s.czrModuleMap||{},a.extend(s.czrModuleMap,{czr_social_icons_settings_child:{mthds:e,crud:!0,hasPreItem:!1,refresh_on_add_item:!1,name:s.czr_sektions.getRegisteredModuleProperty("czr_social_icons_settings_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:s.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_social_icons_settings_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_social_icons_style_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_social_icons_style_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_social_icons_style_child")}})}(wp.customize,jQuery,_),function(g,h,v){var e={initialize:function(e,t){var i=this;i.crudModulePart="nimble-crud-module-part",i.rudItemPart="nimble-rud-item-part",i.itemConstructor=g.CZRItem.extend(i.CZRItemConstructor||{}),g.CZRDynModule.prototype.initialize.call(i,e,t)},generateItemId:function(){return g.czr_sektions.guid()},_makeItemsSortable:function(e){if(!wp.media.isTouchDevice&&h.fn.sortable){var i=this;h("."+i.control.css_attr.items_wrapper,i.container).sortable({handle:"."+i.control.css_attr.item_sort_handle,start:function(){},update:function(e,t){i._getSortedDOMItemCollection().done(function(e){i.itemCollection.set(e)}).then(function(){v.has(i,"preItem")&&i.preItemExpanded.set(!1),i.closeAllItems().closeRemoveDialogs(),i.trigger("item-collection-sorted")})}})}},getPreItem:function(){var e=g.czr_sektions.getRegisteredModuleProperty("czr_img_slider_collection_child","starting_value"),t=h.extend(!0,{},this.preItem());if(v.isObject(e)){var i=h.extend(!0,{},e);return h.extend(t,i)}return this.preItem()},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!v.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){g.errorLog("item.setInputVisibilityDeps() : "+e)}}),g.CZRItem.prototype.ready.call(t);var i=function(){g.previewer.send("sek-item-focus",{control_id:t.module.control.id,item_id:t.id,item_value:t()})};t.viewState.callbacks.add(function(e,t){"expanded"===e&&i()}),t.callbacks.add(i),t.bind("sek-request-item-focus-in-preview",i)},writeItemViewTitle:function(e,t){var i=this,n=i.module,o=e||i(),r="",s="",a="not_set",c=!v.isUndefined(t)&&v.isObject(t);if(!c||!t.input_changed||v.contains(["img","text_content"],t.input_changed)){if(v.isEmpty(o.title)){var l=v.findIndex(n.itemCollection(),function(e){return e.id===i.id});l=v.isUndefined(l)?1:l+1}else r=o.title;r=g.CZR_Helpers.truncate(r,15),o.img&&(s=o.img,v.isString(o.img)&&(s=-1!==o.img.indexOf("http")?o.img:parseInt(o.img,10)));var d=function(){return h.Deferred(function(){var e=this;v.isUndefined(s)||v.isEmpty(""+s)?e.resolve(""):v.isString(s)&&-1!==s.indexOf("http")?e.resolve(s):wp.media.attachment(s).fetch().always(function(){if(v.isObject(this)&&v.has(this,"attributes")&&v.has(this.attributes,"sizes")){var i=this.get("sizes");i&&v.isObject(i)&&v.each(["thumbnail","medium","large","full"],function(e,t){"not_set"===a&&i[e]&&v.isObject(i[e])&&i[e].url&&(a=i[e].url)}),e.resolve(a)}})}).promise()},u=h("."+n.control.css_attr.item_title,i.container).find(".sek-slide-title"),p=h("."+n.control.css_attr.item_title,i.container).find(".sek-slide-thumb"),_=o.text_content?o.text_content:"";_=(_=h("<div>").html(_).text()).substring(0,60),u.length<1?(h("."+n.control.css_attr.item_title,i.container).html(""),h("."+n.control.css_attr.item_title,i.container).append(h("<div/>",{class:"sek-slide-title",html:_}))):u.html(_);var m=c&&t.input_changed&&"img"===t.input_changed,f=function(e){return v.isEmpty(""+e)||"not_set"===e?"":'<img src="'+e+'" width="32" alt="'+r+'" />'};h("."+n.control.css_attr.item_title,i.container).css("padding","0 4px"),p.length<1?d().done(function(e){h("."+n.control.css_attr.item_title,i.container).prepend(h("<div/>",{class:"sek-slide-thumb",html:f(e)}))}):!m&&c||d().done(function(e){p.html(f(e))})}},setInputVisibilityDeps:function(){var n=this,t=n.module;n.czr_Input.each(function(i){switch(i.id){case"link-to":v.each(["link-pick-url","link-custom-url","link-target"],function(t){try{g.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e="url"===i()&&"_custom_"==n.czr_Input("link-pick-url")().id;break;case"link-pick-url":e="url"===i();break;case"link-target":e=!v.contains(["no-link"],i())}return e})}catch(e){g.errare("Image module => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":g.czr_sektions.scheduleVisibilityOfInputId.call(i,"link-custom-url",function(){return"_custom_"==i().id&&"url"==n.czr_Input("link-to")()});break;case"apply-overlay":v.each(["color-overlay","opacity-overlay"],function(e){try{g.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return g.CZR_Helpers.isChecked(i())})}catch(e){g.errare(t.id+" => error in setInputVisibilityDeps",e)}});break;case"enable_text":v.each(["text_content","font_family_css","font_size_css","line_height_css","color_css","h_alignment_css","v_alignment","spacing_css"],function(e){try{g.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return g.CZR_Helpers.isChecked(i())})}catch(e){g.errare(t.id+" => error in setInputVisibilityDeps",e)}});break;case"apply_overlay":v.each(["color-overlay","opacity-overlay"],function(e){try{g.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return g.CZR_Helpers.isChecked(i())})}catch(e){g.errare(t.id+" => error in setInputVisibilityDeps",e)}})}})},toggleRemoveAlert:function(){this.removeItem()},removeItem:function(e){e=e||{};var t=this,i=this.module,n=v.clone(i.itemCollection());i.trigger("pre_item_dom_remove",t()),t._destroyView(),n=v.without(n,v.findWhere(n,{id:t.id})),i.itemCollection.set(n),i.trigger("pre_item_api_remove",t());var o=h.extend(!0,{},t());if(i.czr_Item.remove(t.id),"postMessage"!=g(i.control.id).transport||!v.has(e,"dom_event")||v.has(e.dom_event,"isTrigger")||g.CZR_Helpers.hasPartRefresh(i.control.id))i.trigger("item-removed",o),i.control.trigger("item-removed",o);else{var r=function(){g.previewer.unbind("ready",r),i.trigger("item-removed",o)};g.previewer.bind("ready",r)}}}};g.czrModuleMap=g.czrModuleMap||{},h.extend(g.czrModuleMap,{czr_img_slider_collection_child:{mthds:e,crud:!0,hasPreItem:!1,refresh_on_add_item:!1,name:g.czr_sektions.getRegisteredModuleProperty("czr_img_slider_collection_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:g.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_img_slider_collection_child")}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){var i=this;i.crudModulePart="nimble-crud-module-part",i.rudItemPart="nimble-rud-item-part",i.itemConstructor=n.CZRItem.extend(i.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(i,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var i=this.module;this.czr_Input.each(function(t){switch(t.id){case"height-type":o.each(["custom-height"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"custom"===t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}});break;case"autoplay":o.each(["autoplay_delay","pause_on_hover"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return n.CZR_Helpers.isChecked(t())})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_img_slider_opts_child:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_img_slider_opts_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_img_slider_opts_child")}})}(wp.customize,jQuery,_),function(d,u,p){var e={initialize:function(e,t){var i=this;i.crudModulePart="nimble-crud-module-part",i.rudItemPart="nimble-rud-item-part",i.itemConstructor=d.CZRItem.extend(i.CZRItemConstructor||{}),d.CZRDynModule.prototype.initialize.call(i,e,t)},generateItemId:function(){return d.czr_sektions.guid()},_makeItemsSortable:function(e){if(!wp.media.isTouchDevice&&u.fn.sortable){var i=this;u("."+i.control.css_attr.items_wrapper,i.container).sortable({handle:"."+i.control.css_attr.item_sort_handle,start:function(){},update:function(e,t){i._getSortedDOMItemCollection().done(function(e){i.itemCollection.set(e)}).then(function(){p.has(i,"preItem")&&i.preItemExpanded.set(!1),i.closeAllItems().closeRemoveDialogs(),i.trigger("item-collection-sorted")})}})}},getPreItem:function(){var e=d.czr_sektions.getRegisteredModuleProperty("czr_accordion_collection_child","starting_value"),t=u.extend(!0,{},this.preItem());if(p.isObject(e)){var i=u.extend(!0,{},e);return u.extend(t,i)}return this.preItem()},CZRItemConstructor:{ready:function(){var e=this;d.CZRItem.prototype.ready.call(e);var i=function(){d.previewer.send("sek-item-focus",{control_id:e.module.control.id,item_id:e.id,item_value:e()})};e.viewState.callbacks.add(function(e,t){"expanded"===e&&i()}),e.callbacks.add(i),e.bind("sek-request-item-focus-in-preview",i),e.module.bind("item-collection-sorted",function(){e.writeItemViewTitle(e(),{input_changed:"title_text"})})},writeItemViewTitle:function(e,t){var i=this,n=i.module,o=e||i(),r="";if(!(!p.isUndefined(t)&&p.isObject(t))||!t.input_changed||p.contains(["title_text"],t.input_changed)){if(p.isEmpty(o.title)){var s=p.findIndex(n.itemCollection(),function(e){return e.id===i.id});s=p.isUndefined(s)?1:s+1}else r=o.title;r=d.CZR_Helpers.truncate(r,25);var a=u("."+n.control.css_attr.item_title,i.container).find(".sek-accord-title"),c=o.title_text?o.title_text:"";c=u("<div>").html(c).text();var l=i.module.container.find(".czr-items-wrapper > li").index(i.container);c=(c=p.isEmpty(c)?sektionsLocalizedData.i18n["Accordion title"]+" #"+(+l+1):c).substring(0,60),a.length<1?(u("."+n.control.css_attr.item_title,i.container).html(""),u("."+n.control.css_attr.item_title,i.container).append(u("<div/>",{class:"sek-accord-title",html:c}))):a.html(c)}},toggleRemoveAlert:function(){this.removeItem()},removeItem:function(e){e=e||{};var t=this,i=this.module,n=p.clone(i.itemCollection());i.trigger("pre_item_dom_remove",t()),t._destroyView(),n=p.without(n,p.findWhere(n,{id:t.id})),i.itemCollection.set(n),i.trigger("pre_item_api_remove",t());var o=u.extend(!0,{},t());if(i.czr_Item.remove(t.id),"postMessage"!=d(i.control.id).transport||!p.has(e,"dom_event")||p.has(e.dom_event,"isTrigger")||d.CZR_Helpers.hasPartRefresh(i.control.id))i.trigger("item-removed",o),i.control.trigger("item-removed",o);else{var r=function(){d.previewer.unbind("ready",r),i.trigger("item-removed",o)};d.previewer.bind("ready",r)}}}};d.czrModuleMap=d.czrModuleMap||{},u.extend(d.czrModuleMap,{czr_accordion_collection_child:{mthds:e,crud:!0,hasPreItem:!1,refresh_on_add_item:!1,name:d.czr_sektions.getRegisteredModuleProperty("czr_accordion_collection_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:d.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_accordion_collection_child")}})}(wp.customize,jQuery,_),function(n,e,t){var i={initialize:function(e,t){var i=this;i.crudModulePart="nimble-crud-module-part",i.rudItemPart="nimble-rud-item-part",i.itemConstructor=n.CZRItem.extend(i.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(i,e,t)},CZRItemConstructor:{ready:function(){n.CZRItem.prototype.ready.call(this)}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_accordion_opts_child:{mthds:i,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_accordion_opts_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_accordion_opts_child")}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.itemConstructor=n.CZRItem.extend(this.CZRButtonItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRButtonItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var i=this.module;this.czr_Input.each(function(t){switch(t.id){case"use_flex":o.each(["h_alignment_css"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_shortcode_module:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_shortcode_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_shortcode_module")}})}(wp.customize,jQuery,_);
1
+ !function(p,m){p.CZR_Helpers.getInputSubTemplate=function(e){return 0<m("#tmpl-nimble-subtemplate___"+e).length?wp.template("nimble-subtemplate___"+e):(p.errare("problem in api.czr_sektions.getInputSubTemplate(), missing js template in the DOM for template_name : "+e),null)};var f=p.CZR_Helpers.getModuleTmpl;p.CZR_Helpers.getModuleTmpl=function(o){if(-1===(o=_.extend({tmpl:"",module_type:"",module_id:"",cache:!0,nonce:p.settings.nonce.save},o)).module_id.indexOf("__nimble__"))return f(o);var n=m.Deferred();if((_.isEmpty(o.tmpl)||_.isEmpty(o.module_type))&&n.reject("api.CZR_Helpers.getModuleTmpl => missing tmpl or module_type param"),!p.czr_sektions.isModuleRegistered(o.module_type))return n.reject("api.CZR_Helpers.getModuleTmpl => module type not registered"),n.resolve(),f(o);if(_.contains([],o.module_type))return n.resolve(),f(o);var e=p.czr_sektions.getRegisteredModuleProperty(o.module_type,"tmpl"),t=_.isObject(e)&&e[o.tmpl]?e[o.tmpl]:{};!_.isEmpty(t)&&_.isObject(t)||(p.errare("getModuleTmpl => Error empty or invalid input map for module : ",o.module_type),n.reject("getModuleTmpl => Error empty or invalid input map for module : ",o.module_type));var r=o.item_model,i=m.extend(!0,{},p.czr_sektions.getDefaultItemModelFromRegisteredModuleData(o.module_type)),s=m.extend(!0,{},i);r=m.extend(s,r),_.isEmpty(r)&&(p.errare("getModuleTmpl => Error invalid item model for module : ",o.module_type),n.reject("getModuleTmpl => Error invalid item model for module : ",o.module_type));var a,c="",l=function(e){var i="";return _.each(e,function(e,t){a=e.input_type;try{i+=wp.template("nimble-input-wrapper")({input_type:a,input_data:e,input_id:t,item_model:r,input_tmpl:function(e){var t=e;switch(e){case"czr_layouts":case"select":case"simpleselect":case"fa_icon_picker":case"font_picker":case"animation_picker":t="simpleselect";break;case"simpleselectWithDeviceSwitcher":t="simpleselect_deviceswitcher";break;case"multiselect":case"category_picker":t="multiselect";break;case"h_alignment":case"horizAlignmentWithDeviceSwitcher":t="h_alignment";break;case"h_text_alignment":case"horizTextAlignmentWithDeviceSwitcher":t="h_text_alignment";break;case"range_simple":case"range_simple_device_switcher":t="range_simple";break;case"number_simple":t="number_simple";break;case"font_size":case"line_height":case"range_with_unit_picker":case"range_with_unit_picker_device_switcher":t="range_with_unit_picker";break;case"spacing":case"spacingWithDeviceSwitcher":t="spacing";break;case"upload":case"upload_url":t="upload";break;case"bg_position":case"bgPositionWithDeviceSwitcher":t="bg_position";break;case"verticalAlignWithDeviceSwitcher":t="v_alignment"}return 0<m("#tmpl-nimble-input___"+t).length?wp.template("nimble-input___"+t):(p.errare("problem in getInputTemplate(), missing js template in the DOM for input_type : "+e),null)}(a),control_id:o.control_id})}catch(e){return p.errare("getModuleTmpl => Error when parsing the nimble-input-wrapper template",e),n.reject("getModuleTmpl => Error when parsing the nimble-input-wrapper template"),!1}}),i};if(t.tabs){var d="",u="";_.each(t.tabs,function(e,t){var i=m.extend(!0,{},e);i=m.extend({inputs:{},title:""},i);var o=_.isEmpty(i.attributes)?"":i.attributes;d+='<li data-tab-id="section-topline-'+(+t+1)+'" '+o+'><a href="#" title="'+i.title+'"><span>'+i.title+"</span></a></li>";var n=l(i.inputs);u+='<section id="section-topline-'+(+t+1)+'">'+n+"</section>"}),c+=['<div class="tabs tabs-style-topline">',"<nav>","<ul>",d,"</ul>","</nav>",'<div class="content-wrap">',u,"</div>","</div>"].join("")}else c=l(t);return n.resolve(c).promise()}}(wp.customize,jQuery);var CZRSeksPrototype=CZRSeksPrototype||{};!function(r,s){s.extend(CZRSeksPrototype,{cachedElements:{$body:s("body"),$window:s(window)},initialize:function(){var e=this;if(_.isUndefined(window.sektionsLocalizedData))throw new Error("CZRSeksPrototype => missing localized server params sektionsLocalizedData");if(!_.isFunction(r.czr_activeSkopes))throw new Error("CZRSeksPrototype => api.czr_activeSkopes");e.SECTION_ID_FOR_GLOBAL_OPTIONS="__globalOptionsSectionId",e.SECTION_ID_FOR_LOCAL_OPTIONS="__localOptionsSection",e.SECTION_ID_FOR_CONTENT_PICKER="__content_picker__",e.MAX_NUMBER_OF_COLUMNS=12,e.SETTING_UPDATE_BUFFER=100,e.TINYMCE_EDITOR_HEIGHT=100,e.defaultLocalSektionSettingValue=e.getDefaultSektionSettingValue("local"),e.localSectionsSettingId=new r.Value({}),e.registered=new r.Value([]),wp.customize.apiIsReady?e.doSektionThinksOnApiReady():r.bind("ready",function(){e.doSektionThinksOnApiReady()}),r.bind("save-request-params",function(e){s.extend(e,{local_skope_id:r.czr_skopeBase.getSkopeProperty("skope_id"),active_locations:r.czr_sektions.activeLocations()})});var t=function(){_.isArray(r.czrActiveWPEditors)&&(_.each(r.czrActiveWPEditors,function(e){wp.editor.remove(e)}),r.czrActiveWPEditors=[])};r.bind("sek-before-clean-registered",t),r.bind("czr-all-items-closed",t)},doSektionThinksOnApiReady:function(){var n=this;n.registerAndSetupDefaultPanelSectionOptions(),n.localSectionsSettingId.callbacks.add(function(e,t){try{n.setupSettingsToBeSaved()}catch(e){r.errare("Error in self.localSectionsSettingId.callbacks => self.setupSettingsToBeSaved()",e)}n.initializeHistoryLogWhenSettingsRegistered(),r.previewer.send("sek-request-active-locations")});var i=function(e,t){n.setContextualCollectionSettingIdWhenSkopeSet(e,t),r.section(n.SECTION_ID_FOR_LOCAL_OPTIONS,function(e){e.deferred.embedded.done(function(){!0!==e.boundForLocalOptionGeneration&&(e.boundForLocalOptionGeneration=!0,e.expanded.bind(function(e){!0===e&&n.generateUI({action:"sek-generate-local-skope-options-ui"})}))})}),r.section(n.SECTION_ID_FOR_GLOBAL_OPTIONS,function(e){!0!==e.nimbleGlobalOptionGenerated&&(n.generateUI({action:"sek-generate-global-options-ui"}),e.nimbleGlobalOptionGenerated=!0)}),n.nb_is_ready=!0,r.trigger("nimble-ready-for-current-skope")};_.isEmpty(r.czr_activeSkopes().local)||i(),r.czr_activeSkopes.callbacks.add(function(e,t){i(e,t)}),n.reactToPreviewMsg(),n.setupDnd(),n.setupTinyMceEditor(),n.schedulePrintSectionJson(),r.previewedDevice.bind(function(t){var e=_.filter(n.registered(),function(e){return"control"==e.what});_.each(e||[],function(e){r.control(e.id,function(e){e.container.find('[data-sek-device="'+t+'"]').each(function(){s(this).trigger("click")})})})}),s("#customize-notifications-area").on("click",'[data-sek-reset="true"]',function(){r.previewer.trigger("sek-reset-collection",{scope:"local"})}),n.bind("sek-ui-pre-removal",function(e){"control"==e.what&&-1<e.id.indexOf("draggable")&&r.control(e.id,function(e){e.container.find("[draggable]").each(function(){s(this).off("dragstart dragend")})}),"control"==e.what&&r.control(e.id,function(e){e.container.find("select").each(function(){_.isUndefined(s(this).data("czrSelect2"))||s(this).czrSelect2("destroy")})})}),r.bind("czr-new-registered",function(e){if(_.isUndefined(e.origin))throw new Error("czr-new-registered event => missing params.origin");if("nimble"===e.origin&&!1!==e.track){var t=n.registered(),i=s.extend(!0,[],t),o=_.findWhere(i,{id:e.id});if(!_.isEmpty(o)&&_.isEqual(o,e))throw new Error("register => duplicated element in self.registered() collection "+e.id);i.push(e),n.registered(i)}}),n.activeLocations=new r.Value([]),n.activeLocationsInfo=new r.Value([]),r.previewer.bind("sek-active-locations-in-preview",function(e){if(n.activeLocations(_.isObject(e)&&_.isArray(e.active_locations)?e.active_locations:[]),n.activeLocationsInfo(_.isObject(e)&&_.isArray(e.active_locs_info)?e.active_locs_info:[]),!_.isEmpty(r.dirtyValues()))try{n.updateAPISetting({action:"sek-maybe-add-missing-locations"})}catch(e){r.errare("::initialize => error with sek-maybe-add-missing-locations",e)}}),n.setupTopBar(),n.setupSaveSectionUI(),n.setupSaveTmplUI(),n.lastClickedTargetInPreview=new r.Value,n.lastClickedTargetInPreview.bind(function(e,t){_.isObject(e)&&e.id?r.previewer.send("sek-set-double-click-target",e):r.previewer.send("sek-reset-double-click-target"),clearTimeout(n.cachedElements.$window.data("_preview_target_timer_")),n.cachedElements.$window.data("_preview_target_timer_",setTimeout(function(){n.lastClickedTargetInPreview({}),r.previewer.send("sek-reset-double-click-target")},2e4))}),r.previewer.bind("sek-clean-target-drop-zone",function(){n.lastClickedTargetInPreview({})}),s(document).keydown(function(e){e&&27===e.keyCode&&n.lastClickedTargetInPreview({})}),sektionsLocalizedData.hasActiveCachePlugin&&_.delay(function(){r.previewer.trigger("sek-notify",{notif_id:"has-active-cache-plugin",type:"info",duration:2e4,message:['<span style="color:#0075a2">',sektionsLocalizedData.i18n["You seem to be using a cache plugin."],!_.isString(sektionsLocalizedData.hasActiveCachePlugin)||sektionsLocalizedData.hasActiveCachePlugin.length<2?"":"<strong> ("+sektionsLocalizedData.hasActiveCachePlugin+")</strong><br/>"," <strong>",sektionsLocalizedData.i18n["It is recommended to disable your cache plugin when customizing your website."],"</strong>","</span>"].join("")})},2e3),r.previewer.bind("multi-items-module-refreshed",function(t){_.isUndefined(t.apiParams.control_id)||r.control(t.apiParams.control_id,function(e){_.isUndefined(e.params.sek_registration_params)||r.control(e.id).params.sek_registration_params.module_id===t.apiParams.id&&e.czr_Module.each(function(e){e.czr_Item.each(function(e){"expanded"===e.viewState()&&e.trigger("sek-request-item-focus-in-preview")})})})}),n.setupTemplateGallery()},registerAndSetupDefaultPanelSectionOptions:function(){var o=this,e=r.Panel.extend({isContextuallyActive:function(){return this.active()},_toggleActive:function(){return!0}});r.panel(sektionsLocalizedData.sektionsPanelId,function(o){o.deferred.embedded.done(function(){var e=o.container.first().find("h3.accordion-section-title"),t=(o.container.first().find(".panel-meta .accordion-section-title"),['<img class="sek-nimble-logo" alt="'+o.params.title+'" src="',sektionsLocalizedData.baseUrl,"/assets/img/nimble/nimble_horizontal.svg?ver="+sektionsLocalizedData.nimbleVersion,'"/>'].join(""));if(sektionsLocalizedData.isPro&&(t+=['<img class="sek-nimble-logo sek-pro-pastil" src="',sektionsLocalizedData.baseUrl,"/assets/czr/sek/img/pro_white.svg?ver="+sektionsLocalizedData.nimbleVersion,'"/>'].join("")),0<e.length){var i=e.find("span");e.addClass("sek-side-nimble-logo-wrapper").html(t).append(i)}})}),r.CZR_Helpers.register({origin:"nimble",what:"panel",id:sektionsLocalizedData.sektionsPanelId,title:sektionsLocalizedData.i18n["Nimble Builder"],priority:-1e3,constructWith:e,track:!1}),r.CZR_Helpers.register({origin:"nimble",what:"section",id:o.SECTION_ID_FOR_GLOBAL_OPTIONS,title:sektionsLocalizedData.i18n["Site wide options"],panel:sektionsLocalizedData.sektionsPanelId,priority:20,track:!1,constructWith:r.Section.extend({isContextuallyActive:function(){return this.active()},_toggleActive:function(){return!0}})}).done(function(){r.section(o.SECTION_ID_FOR_GLOBAL_OPTIONS,function(e){var t=e.container.find(".accordion-section-title"),i=e.container.find(".customize-section-title h3");0<t.length&&t.prepend('<i class="fas fa-globe sek-level-option-icon"></i>'),0<i.length&&i.find(".customize-action").after('<i class="fas fa-globe sek-level-option-icon"></i>'),o.scheduleModuleAccordion.call(e)})}),r.CZR_Helpers.register({origin:"nimble",what:"section",id:o.SECTION_ID_FOR_LOCAL_OPTIONS,title:sektionsLocalizedData.i18n["Current page options"],panel:sektionsLocalizedData.sektionsPanelId,priority:10,track:!1,constructWith:r.Section.extend({isContextuallyActive:function(){return this.active()},_toggleActive:function(){return!0}})}).done(function(){r.section(o.SECTION_ID_FOR_LOCAL_OPTIONS,function(e){var t=e.container.find(".accordion-section-title"),i=e.container.find(".customize-section-title h3");0<t.length&&t.prepend('<i class="fas fa-map-marker-alt sek-level-option-icon"></i>'),0<i.length&&i.find(".customize-action").after('<i class="fas fa-map-marker-alt sek-level-option-icon"></i>'),o.scheduleModuleAccordion.call(e)})}),r.CZR_Helpers.register({origin:"nimble",what:"setting",id:sektionsLocalizedData.optNameForGlobalOptions,dirty:!1,value:sektionsLocalizedData.globalOptionDBValues,transport:"postMessage",type:"option"}),r.CZR_Helpers.register({origin:"nimble",what:"section",id:o.SECTION_ID_FOR_CONTENT_PICKER,title:sektionsLocalizedData.i18n["Content Picker"],panel:sektionsLocalizedData.sektionsPanelId,priority:30,track:!1,constructWith:r.Section.extend({isContextuallyActive:function(){return this.active()},_toggleActive:function(){return!0}})}).done(function(){r.section(o.SECTION_ID_FOR_CONTENT_PICKER,function(e){"resolved"!=r.czr_initialSkopeCollectionPopulated.state()?r.czr_initialSkopeCollectionPopulated.done(function(){r.previewer.trigger("sek-pick-content",{focus:!1})}):r.previewer.trigger("sek-pick-content",{focus:!1})})})},setContextualCollectionSettingIdWhenSkopeSet:function(e,t){t=t||{},!_.isEmpty(t.local)&&r.panel(sektionsLocalizedData.sektionsPanelId).expanded()&&r.previewer.trigger("sek-pick-content"),sektionsData=r.czr_skopeBase.getSkopeProperty("sektions","local"),sektionsLocalizedData.isDevMode&&r.infoLog("::setContextualCollectionSettingIdWhenSkopeSet => SEKTIONS DATA ? ",sektionsData),_.isEmpty(sektionsData)&&r.errare("::setContextualCollectionSettingIdWhenSkopeSet() => no sektionsData"),_.isEmpty(sektionsData.setting_id)&&r.errare("::setContextualCollectionSettingIdWhenSkopeSet() => missing setting_id"),this.localSectionsSettingId(sektionsData.setting_id)}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(r,s){s.extend(CZRSeksPrototype,{setupTopBar:function(){var t=this;t.topBarId="#nimble-top-bar",t.topBarVisible=new r.Value(!1),t.topBarVisible.bind(function(e){t.levelTreeExpanded()||t.toggleTopBar(e)}),t.mouseMovedRecently=new r.Value({}),t.mouseMovedRecently.bind(function(e){t.topBarVisible(!_.isEmpty(e))});var e=function(e){t.mouseMovedRecently({x:e.clientX,y:e.clientY}),clearTimeout(t.cachedElements.$window.data("_scroll_move_timer_")),t.cachedElements.$window.data("_scroll_move_timer_",setTimeout(function(){t.mouseMovedRecently.set({})},4e3))};t.cachedElements.$window.on("mousemove scroll,",_.throttle(e,50)),r.previewer.bind("ready",function(){s(r.previewer.targetWindow().document).on("mousemove scroll,",_.throttle(e,50))}),t.setupLevelTree()},toggleTopBar:function(e){e=!!_.isUndefined(e)||e;var t,i=this;e?s.when(i.renderAndSetupTopBarTmpl({})).done(function(e){i.topBarContainer=e,_.delay(function(){i.cachedElements.$body.addClass("nimble-top-bar-visible")},200)}):(t=s.Deferred(),i.cachedElements.$body.removeClass("nimble-top-bar-visible"),i.topBarContainer&&i.topBarContainer.length?_.delay(function(){t.resolve()},300):t.resolve(),t.promise()).done(function(){i.topBarVisible(!1)})},renderAndSetupTopBarTmpl:function(e){var t,i=this;if(0<s(i.topBarId).length)return s(i.topBarId);try{t=wp.template("nimble-top-bar")({})}catch(e){return r.errare("Error when parsing the the top note template",e),!1}s("#customize-preview").after(s(t)),s(document).keydown(function(e){if(e.ctrlKey&&_.contains([89,90],e.keyCode))try{i.navigateHistory(90===e.keyCode?"undo":"redo")}catch(e){r.errare("Error when firing self.navigateHistory",e)}}),s(".sek-add-content",i.topBarId).on("click",function(e){e.preventDefault(),r.previewer.trigger("sek-pick-content",{content_type:"module"})}),s(".sek-level-tree",i.topBarId).on("click",function(e){e.preventDefault(),i.levelTreeExpanded(!i.levelTreeExpanded())}),s("[data-nimble-history]",i.topBarId).on("click",function(e){try{i.navigateHistory(s(this).data("nimble-history"))}catch(e){r.errare("Error when firing self.navigateHistory",e)}}),s(".sek-settings",i.topBarId).on("click",function(e){r.panel(sektionsLocalizedData.sektionsPanelId,function(e){i.rootPanelFocus(),e.focus()})}),s(".sek-nimble-doc",i.topBarId).on("click",function(e){e.preventDefault(),window.open(s(this).data("doc-href"),"_blank")}),s(".sek-tmpl-saving",i.topBarId).on("click",function(e){e.preventDefault(),i.tmplDialogVisible(!i.tmplDialogVisible())});var o=function(e){s(i.topBarId).length<1||sektionsLocalizedData.isDebugMode||(_.isObject(e)&&e.local_template&&"default"!==e.local_template?s(i.topBarId).find(".sek-notifications").html(['<span class="fas fa-info-circle"></span>',sektionsLocalizedData.i18n["This page uses a custom template."]].join(" ")):s(i.topBarId).find(".sek-notifications").html(""))},n=function(){r(i.localSectionsSettingId(),function(e){var t=e(),i=_.isObject(t)&&t.local_options&&t.local_options.template?t.local_options.template:null;o(i)}),r(i.getLocalSkopeOptionId()+"__template",function(e){e.bind(function(e,t){o(e)})})};return n(),r.bind("nimble-ready-for-current-skope",function(){n()}),s(i.topBarId)}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{initializeHistoryLogWhenSettingsRegistered:function(){this.historyLog=new l.Value([{status:"current",value:{local:l(this.localSectionsSettingId())(),global:l(this.getGlobalSectionsSettingId())()},action:"initial"}]),this.historyLog.bind(function(e){if(!_.isEmpty(e)){var t=_.findKey(e,{status:"current"});t=Number(t),d("#nimble-top-bar").find("[data-nimble-history]").each(function(){"undo"===d(this).data("nimble-history")?d(this).attr("data-nimble-state",t<=0?"disabled":"enabled"):d(this).attr("data-nimble-state",e.length<=t+1?"disabled":"enabled")})}})},trackHistoryLog:function(e,t){var i=this,o=e.id===i.getGlobalSectionsSettingId();if(!_.isObject(t)||!_.isFunction(i.historyLog)||!_.isArray(i.historyLog()))throw l.errare("params, self.historyLog() ",t,i.historyLog()),new Error("trackHistoryLog => invalid params or historyLog value");var n,r=[],s=d.extend(!0,[],i.historyLog());_.isEmpty(t.in_sektion)?_.isEmpty(t.to_sektion)||(n=t.to_sektion):n=t.in_sektion,_.each(s,function(e){"future"!=e.status&&(d.extend(e,{status:"previous"}),r.push(e))}),r.push({status:"current",value:o?{global:e()}:{local:e()},action:_.isObject(t)&&t.action||"",sektionToRefresh:n}),i.historyLog(r)},navigateHistory:function(i){var t,o,n,r,e=this,s=d.extend(!0,[],e.historyLog()),a=[];if(_.each(s,function(e){if(_.isEmpty(r)){switch(e.status){case"previous":t=e;break;case"current":o=e;break;case"future":n=e}switch(i){case"undo":_.isEmpty(o)||_.isEmpty(t)||(r=t.value,o.sektionToRefresh,t.sektionToRefresh);break;case"redo":_.isEmpty(n)||(r=n.value,o.sektionToRefresh,n.sektionToRefresh)}}}),!_.isUndefined(r)){_.isEmpty(r.local)||(l(e.localSectionsSettingId())(e.validateSettingValue(r.local,"local"),{navigatingHistoryLogs:!0}),l.czr_sektions.generateUI({action:"sek-generate-local-skope-options-ui",clean_settings:!0})),_.isEmpty(r.global)||l(e.getGlobalSectionsSettingId())(e.validateSettingValue(r.global,"global"),{navigatingHistoryLogs:!0});l.previewer.refresh(),l.previewer.trigger("sek-pick-content",{}),e.cleanRegistered(),e.cleanRegisteredLevelSettingsAfterHistoryNavigation()}var c=_.findKey(s,{status:"current"});c=Number(c),_.isNumber(c)?(_.each(s,function(e,t){switch(newLog=d.extend(!0,{},e),t=Number(t),i){case"undo":0<c&&(t===c-1?newLog.status="current":t===c&&(newLog.status="future"));break;case"redo":s.length>c+1&&(t===c?newLog.status="previous":t===c+1&&(newLog.status="current"))}a.push(newLog)}),e.historyLog(a)):l.errare("Error when navigating the history log, the current key should be a number")}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(b,I){I.extend(CZRSeksPrototype,{setupLevelTree:function(){var i=this;i.levelTree=new b.Value([]),i.levelTree.bind(function(){i.levelTreeExpanded()&&i.renderOrRefreshTree()}),i.levelTreeExpanded=new b.Value(!1),i.levelTreeExpanded.bind(function(e){if(i.cachedElements.$body.toggleClass("sek-level-tree-expanded",e),e){if(i.templateGalleryExpanded(!1),i.tmplDialogVisible(!1),i.saveSectionDialogVisible&&i.saveSectionDialogVisible(!1),i.setLevelTreeValue(),_.isEmpty(i.levelTree()))return b.previewer.trigger("sek-notify",{type:"info",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["No sections to navigate"]+"</strong>","</span>"].join("")}),void i.levelTreeExpanded(!1);I("#customize-preview iframe").css("z-index",1),i.renderOrRefreshTree()}else 0<I("#nimble-level-tree").length&&_.delay(function(){I("#nimble-level-tree").remove(),I("#customize-preview iframe").css("z-index","")},300)}),i.activeLocations.bind(function(){_.isEmpty(i.levelTree())||i.renderOrRefreshTree()}),b.previewer.bind("ready",function(){i.localSectionsSettingId.callbacks.add(function(){i.levelTreeExpanded(!1),_.each([i.getGlobalSectionsSettingId(),i.localSectionsSettingId(),sektionsLocalizedData.optNameForGlobalOptions],function(e){b(e)._isBoundForNimbleLevelTree||(b(e).bind(function(e){i.setLevelTreeValue()}),b(e)._isBoundForNimbleLevelTree=!0)})})}),i.cachedElements.$body.on("click","#nimble-level-tree [data-nimb-level]",function(e){e.preventDefault(),e.stopPropagation();var i=I(e.target).closest("[data-nimb-level]");b.previewer.send("sek-animate-to-level",{id:i.data("nimb-id")}),b.previewer.send("sek-clean-level-uis"),_.delay(function(){b.previewer.send("sek-display-level-ui",{id:i.data("nimb-id")});var e=i.data("nimb-id"),t=i.data("nimb-level");"column"===t||"section"===t?b.previewer.trigger("sek-edit-options",{id:e,level:t}):"module"===t&&b.previewer.trigger("sek-edit-module",{id:e,level:t})},100)}),i.cachedElements.$body.on("click","#nimble-level-tree .sek-remove-level",function(e){e.preventDefault(),e.stopPropagation();var t=I(e.target).closest("[data-nimb-level]");b.previewer.trigger("sek-remove",{level:t.data("nimb-level"),id:t.data("nimb-id"),location:t.closest('[data-nimb-level="location"]').data("nimb-id"),in_sektion:t.closest('[data-nimb-level="section"]').data("nimb-id"),in_column:t.closest('[data-nimb-level="column"]').data("nimb-id")}),t.fadeOut("slow"),i.renderOrRefreshTree()}),i.cachedElements.$body.on("click",".sek-close-level-tree",function(e){e.preventDefault(),i.levelTreeExpanded(!1)})},setLevelTreeValue:function(){var e,t,i,o,n,r=this.getGlobalSectionsSettingId(),s=this.localSectionsSettingId(),a=sektionsLocalizedData.optNameForGlobalOptions,c=!1;if(_.each([r,s,a],function(e){b.has(e)||(c=e)}),!1===c){e=b(r)(),i=_.isObject(e)?I.extend(!0,{},e):{},i=_.isEmpty(i.collection)?[]:i.collection,i=_.isArray(i)?i:[],t=b(s)(),t=_.isObject(t)?t:{},o=I.extend(!0,{},t),o=_.isEmpty(o.collection)?[]:o.collection,o=_.isArray(o)?o:[];var l,d=_.union(i,o),u=!1,p=!1;n=b(a)(),n=_.isObject(n)?n:{},t.local_options&&t.local_options.local_header_footer&&(u="nimble_local"===(l=t.local_options.local_header_footer["header-footer"])),n.global_header_footer&&!u&&"theme"!==l&&(p="nimble_global"===n.global_header_footer["header-footer"]||"nimble_global"===l);var m,f,g=I.extend(!0,[],d);g=_.filter(g,function(e,t){return!_.contains(["nimble_global_header","nimble_global_footer","nimble_local_header","nimble_local_footer"],e.id)});var h=function(e){m=_.findWhere(d,{id:"nimble_"+e+"_header"}),f=_.findWhere(d,{id:"nimble_"+e+"_footer"}),g.unshift(m),g.push(f)};u?h("local"):p&&h("global");var v,k=this.activeLocations(),y=[];_.isEmpty(k)?y=g:_.each(k,function(e){v=_.findWhere(g,{id:e}),_.isUndefined(v)||y.push(v)}),this.levelTree(y)}else b.errare("::setLevelTreeValue => a setting id is not registered ")},renderOrRefreshTree:function(){var e;if(I("#nimble-level-tree").length<1){try{e=wp.template("nimble-level-tree")({})}catch(e){return b.errare("Error when parsing the nimble-level-tree template",e),!1}I("#customize-preview").after(I(e))}I("#nimble-level-tree").find(".sek-tree-wrap").html(this.getLevelTreeHtml())},getLevelTreeHtml:function(e,t){var i=this;e=e||i.levelTree();var o,n,r,s=!1;if(!_.isArray(e)||_.isEmpty(e))return b.errare("::buildLevelTree => invalid collection param",e),r;var a='<i class="material-icons sek-remove-level" title="'+sektionsLocalizedData.i18n["Remove this element"]+'">delete_forever</i>';return r="<ul>",_.each(e,function(e){_.isUndefined(e.level)?b.errare("::buildLevelTree => missing level property",e):_.isUndefined(e.id)?b.errare("::buildLevelTree => missing id property",e):(o=e.level,"location"===(n=o)&&(s=!_.contains(i.activeLocations(),e.id)),s||(sektionsLocalizedData.i18n[o]&&(n=sektionsLocalizedData.i18n[o]),!0===e.is_nested&&(n=sektionsLocalizedData.i18n["nested section"]),a="location"!==o?a:"",r+='<li data-nimb-level="'+o+'" data-nimb-id="'+e.id+'">',r+='<div class="sek-level-infos"><div class="sek-inner-level-infos">',"module"===o&&(r+=[i.getTreeModuleIcon(e.module_type),i.getTreeModuleTitle(e.module_type)].join(" ")),r+=[" ",n,"( id :",e.id,")",a].join(" "),r+="</div></div>",_.isArray(e.collection)&&!_.isEmpty(e.collection)&&(r+=i.getLevelTreeHtml(e.collection,t)),r+="</li>"))}),r+="</ul>"},getTreeModuleIcon:function(t){var i,o={};return _.each(sektionsLocalizedData.moduleCollection,function(e){_.isEmpty(o)&&t===e["content-id"]&&(_.isEmpty(e.icon)||(i="http"===e.icon.substring(0,4)?e.icon:sektionsLocalizedData.moduleIconPath+e.icon,o={svg:e.icon?i:"",font:e.font_icon?e.font_icon:""}))}),_.isEmpty(o.svg)?_.isEmpty(o.font)?void 0:o.font:'<img class="sek-svg-mod-icon" src="'+o.svg+'"/>'},getTreeModuleTitle:function(t){var i={};return _.each(sektionsLocalizedData.moduleCollection,function(e){_.isEmpty(i)&&t===e["content-id"]&&(i=e.title)}),i}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(c,l){l.extend(CZRSeksPrototype,{setupSaveSectionUI:function(){var n=this;n.saveSectionDialogVisible=new c.Value(!1),n.saveSectionDialogVisible.bind(function(e){e&&(n.templateGalleryExpanded(!1),n.levelTreeExpanded(!1),n.tmplDialogVisible&&n.tmplDialogVisible(!1)),n.toggleSaveSectionUI(e)}),n.allSavedSections=new c.Value("_not_populated_"),n.allSavedSections.bind(function(e){_.isObject(e)?(e=_.isEmpty(e)?{}:e,n.refreshSectionPickerHtml(e)):c.errare("error setupSaveSectionUI => section collection should be an object")}),n.saveSectionDialogMode=new c.Value("hidden"),n.saveSectionDialogMode.bind(function(e){_.contains(["hidden","save","update","remove"],e)||(c.errare("error setupSaveSectionUI => unknown section dialog mode",e),e="save");var t=l("#nimble-top-section-save-ui"),i=t.find("#sek-saved-section-title"),o=t.find("#sek-saved-section-description");switch(t.find("[data-section-mode-switcher]").attr("aria-pressed",!1),t.find('[data-section-mode-switcher="'+e+'"]').attr("aria-pressed",!0),l("#nimble-top-section-save-ui").attr("data-sek-section-dialog-mode",e),t.removeClass("sek-removal-confirmation-opened"),e){case"save":i.val(""),o.val("");break;case"update":case"remove":t.find(".sek-saved-section-picker").val("none").trigger("change"),n.setSavedSectionCollection().done(function(e){n.refreshSectionPickerHtml()})}"remove"===e&&_.isEmpty(n.idOfSectionToSave)?t.addClass("sek-is-removal-only"):t.removeClass("sek-is-removal-only")})},refreshSectionPickerHtml:function(e){e=e||this.allSavedSections();var t=l("#nimble-top-section-save-ui"),i=t.find(".sek-saved-section-picker");i.val("none").trigger("change"),i.find("option").each(function(){"none"!==l(this).attr("value")&&l(this).remove()});var o,n,r="";_.each(e,function(e,t){_.isObject(e)&&(n=e.last_modified_date?e.last_modified_date:"",o=e.title?e.title:"section title not set",r+='<option value="'+t+'">'+[o,sektionsLocalizedData.i18n["Last modified"]+" : "+n].join(" | ")+"</option>")}),i.append(r),t.addClass("section-collection-populated")},renderSectionSaveUI:function(e){if(0<l("#nimble-top-section-save-ui").length)return l("#nimble-top-section-save-ui");try{_tmpl=wp.template("nimble-top-section-save-ui")({})}catch(e){return c.errare("Error when parsing nimble-top-section-save-ui template",e),!1}return l("#customize-preview").after(l(_tmpl)),l("#nimble-top-section-save-ui")},maybeScheduleSectionSaveDOMEvents:function(){var i=this,o=l("#nimble-top-section-save-ui");o.data("nimble-sec-save-dom-events-scheduled")||(o.on("click","[data-section-mode-switcher]",function(e){e.preventDefault(),i.saveSectionDialogMode(l(this).data("section-mode-switcher"))}),o.on("change",".sek-saved-section-picker",function(e){i.reactOnSectionSelection(e,l(this))}),o.on("click",".sek-do-save-section",function(e){o.addClass("nimble-section-processing-ajax"),i.saveOrUpdateSavedSection(e).done(function(e){o.removeClass("nimble-section-processing-ajax"),e.success&&(i.saveSectionDialogVisible(!1),i.setSavedSectionCollection({refresh:!0}))})}),o.on("click",".sek-do-update-section",function(e){var t=o.find(".sek-saved-section-picker").val();"none"===t||_.isEmpty(t)||(o.addClass("nimble-section-processing-ajax"),i.saveOrUpdateSavedSection(e,t).done(function(e){o.removeClass("nimble-section-processing-ajax"),e.success&&(i.saveSectionDialogVisible(!1),i.setSavedSectionCollection({refresh:!0}).done(function(e){i.refreshSectionPickerHtml()}))}))}),o.on("click",".sek-open-remove-confirmation",function(e){o.addClass("sek-removal-confirmation-opened")}),o.on("click",".sek-do-remove-section",function(e){var t=o.find(".sek-saved-section-picker").val();"none"===t||_.isEmpty(t)||(o.addClass("nimble-section-processing-ajax"),i.removeSavedSection(e,t).done(function(e){o.removeClass("nimble-section-processing-ajax"),o.removeClass("sek-removal-confirmation-opened"),e.success&&i.setSavedSectionCollection({refresh:!0})}))}),o.on("click",".sek-cancel-remove-section",function(e){o.removeClass("sek-removal-confirmation-opened")}),l(".sek-close-dialog",o).on("click",function(e){e.preventDefault(),i.saveSectionDialogVisible(!1)}),o.data("nimble-sec-save-dom-events-scheduled",!0))},reactOnSectionSelection:function(e,t){var i=l("#nimble-top-section-save-ui"),o=t.val(),n=i.find("#sek-saved-section-title"),r=i.find("#sek-saved-section-description"),s="update"===this.saveSectionDialogMode()?"sek-section-update-selected":"sek-section-remove-selected";if("none"===o)n.val(""),r.val(""),i.removeClass(s);else{var a=this.allSavedSections();(a=_.isObject(a)&&!_.isArray(a)?a:{})[o]=l.extend({title:"",description:"",last_modified_date:""},a[o]||{}),n.val(a[o].title),r.val(a[o].description),i.addClass(s)}},saveOrUpdateSavedSection:function(e,t){var i=this,o=l.Deferred();if(!i.idOfSectionToSave||_.isEmpty(i.idOfSectionToSave))return c.errare("saveOrUpdateSavedSection => error => missing section id"),o.resolve({success:!1});e.preventDefault();var n=l("#sek-saved-section-title"),r=n.val(),s=l("#sek-saved-section-description").val(),a=l.extend(!0,{},i.getLevelModel(i.idOfSectionToSave));return"no_match"==a?(c.errare("saveOrUpdateSavedSection => error => no section model with id "+i.idOfSectionToSave),o.resolve({success:!1})):_.isEmpty(r)?(n.addClass("error"),c.previewer.trigger("sek-notify",{type:"error",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["A title is required"]+"</strong>","</span>"].join("")}),o.resolve({success:!1})):(l("#sek-saved-section-title").removeClass("error"),a=i.preProcessSection(a),_.isObject(a)||(c.errare("::saveOrUpdateSavedSection => error => invalid sectionModel"),o.resolve({success:!1})),wp.ajax.post("sek_save_user_section",{nonce:c.settings.nonce.save,section_data:JSON.stringify(a),section_title:r,section_description:s,section_post_name:t||"",skope_id:c.czr_skopeBase.getSkopeProperty("skope_id")}).done(function(e){o.resolve({success:!0}),c.previewer.trigger("sek-notify",{type:"success",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["Template saved"]+"</strong>","</span>"].join("")})}).fail(function(e){o.resolve({success:!1}),c.errorLog("ajax sek_save_section => error",e),c.previewer.trigger("sek-notify",{type:"error",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["Error when processing template"]+"</strong>","</span>"].join("")})}).always(function(){i.idOfSectionToSave=null}),o)},preProcessSection:function(e){if(!_.isObject(e))return null;var t=l.extend({},!0,e);return _.has(t,"is_nested")&&(t=_.omit(t,"is_nested")),t},removeSavedSection:function(e,t){var i=this,o=l.Deferred();return e.preventDefault(),wp.ajax.post("sek_remove_user_section",{nonce:c.settings.nonce.save,section_post_name:t}).done(function(e){o.resolve({success:!0}),c.previewer.trigger("sek-notify",{type:"success",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["Template removed"]+"</strong>","</span>"].join("")})}).fail(function(e){o.resolve({success:!1}),c.errorLog("ajax sek_remove_section => error",e),c.previewer.trigger("sek-notify",{type:"error",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["Error when processing templates"]+"</strong>","</span>"].join("")})}).always(function(){i.idOfSectionToSave=null}),o},toggleSaveSectionUI:function(e){e=!!_.isUndefined(e)||e;var t,i=this;e?l.when(i.renderSectionSaveUI({})).done(function(e){i.maybeScheduleSectionSaveDOMEvents(),i.saveUIContainer=e,_.delay(function(){i.saveSectionDialogMode("save"),i.cachedElements.$body.addClass("sek-save-section-ui-visible")},200)}):(t=l.Deferred(),i.cachedElements.$body.removeClass("sek-save-section-ui-visible"),0<l("#nimble-top-section-save-ui").length?_.delay(function(){i.saveSectionDialogMode=i.saveSectionDialogMode?i.saveSectionDialogMode:new c.Value,i.saveSectionDialogMode("hidden"),i.saveUIContainer.remove(),i.idOfSectionToSave=null,t.resolve()},250):t.resolve(),t.promise()).done(function(){i.saveSectionDialogVisible(!1)})},setSavedSectionCollection:function(e){var t=this,i=l.Deferred();return(e=e||{refresh:!1}).refresh||"_not_populated_"===t.allSavedSections()?((t.sectionCollectionPromise&&"pending"===t.sectionCollectionPromise.state()?t.sectionCollectionPromise:t.getSavedSectionCollection(e)).done(function(e){t.allSavedSections(e),i.resolve(e)}),i.promise()):i.resolve(t.allSavedSections())},getSavedSectionCollection:function(e){var t=this;return e=e||{refresh:!1},t.sectionCollectionPromise=l.Deferred(),e.refresh||"_not_populated_"===t.allSavedSections()?wp.ajax.post("sek_get_all_saved_sections",{nonce:c.settings.nonce.save}).done(function(e){_.isObject(e)&&!_.isArray(e)?t.sectionCollectionPromise.resolve(e):(t.sectionCollectionPromise.resolve({}),c.errorLog("control::getSavedSectionCollection => collection is empty or invalid"))}).fail(function(e){c.errorLog("ajax sek_get_all_saved_section => error",e),c.previewer.trigger("sek-notify",{type:"error",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["Error when processing templates"]+"</strong>","</span>"].join("")}),t.sectionCollectionPromise.resolve({})}):t.sectionCollectionPromise.resolve(t.allSavedSections()),t.sectionCollectionPromise}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{setupSaveTmplUI:function(){var n=this;n.tmplDialogVisible=new l.Value(!1),sektionsLocalizedData.isTemplateSaveEnabled&&(n.tmplDialogVisible.bind(function(e){e&&(n.templateGalleryExpanded(!1),n.levelTreeExpanded(!1),n.saveSectionDialogVisible&&n.saveSectionDialogVisible(!1)),n.toggleSaveTmplUI(e)}),n.allSavedTemplates=new l.Value("_not_populated_"),n.allSavedTemplates.bind(function(e){_.isObject(e)?(e=_.isEmpty(e)?{}:e,n.refreshTmplPickerHtml(e)):l.errare("error setupSaveTmplUI => tmpl collection should be an object")}),n.tmplDialogMode=new l.Value("hidden"),n.tmplDialogMode.bind(function(e){_.contains(["hidden","save","update","remove"],e)||(l.errare("::setupSaveTmplUI => unknown tmpl dialog mode",e),e="save");var t=d("#nimble-top-tmpl-save-ui"),i=t.find("#sek-saved-tmpl-title"),o=t.find("#sek-saved-tmpl-description");switch(t.find("[data-tmpl-mode-switcher]").attr("aria-pressed",!1),t.find('[data-tmpl-mode-switcher="'+e+'"]').attr("aria-pressed",!0),d("#nimble-top-tmpl-save-ui").attr("data-sek-tmpl-dialog-mode",e),t.removeClass("sek-removal-confirmation-opened"),e){case"save":i.val(""),o.val("");break;case"update":case"remove":t.find(".sek-saved-tmpl-picker").val("none").trigger("change"),n.setSavedTmplCollection().done(function(e){n.refreshTmplPickerHtml()})}}))},refreshTmplPickerHtml:function(e){e=e||this.allSavedTemplates();var t=d("#nimble-top-tmpl-save-ui"),i=t.find(".sek-saved-tmpl-picker");i.val("none").trigger("change"),i.find("option").each(function(){"none"!==d(this).attr("value")&&d(this).remove()});var o,n,r="";_.each(e,function(e,t){_.isObject(e)&&(n=e.last_modified_date?e.last_modified_date:"",o=e.title?e.title:"template title not set",r+='<option value="'+t+'">'+[o,sektionsLocalizedData.i18n["Last modified"]+" : "+n].join(" | ")+"</option>")}),i.append(r),t.addClass("tmpl-collection-populated")},renderTmplUI:function(e){if(0<d("#nimble-top-tmpl-save-ui").length)return d("#nimble-top-tmpl-save-ui");try{_tmpl=wp.template("nimble-top-tmpl-save-ui")({})}catch(e){return l.errare("Error when parsing nimble-top-tmpl-save-ui template",e),!1}return d("#customize-preview").after(d(_tmpl)),d("#nimble-top-tmpl-save-ui")},scheduleTmplSaveDOMEvents:function(){var i=this,o=d("#nimble-top-tmpl-save-ui");o.data("nimble-tmpl-dom-events-scheduled")||(o.on("click","[data-tmpl-mode-switcher]",function(e){e.preventDefault(),i.tmplDialogMode(d(this).data("tmpl-mode-switcher"))}),o.on("change",".sek-saved-tmpl-picker",function(e){i.reactOnTemplateSelection(e,d(this))}),o.on("click",".sek-do-save-tmpl",function(e){o.addClass("nimble-tmpl-processing-ajax"),i.saveOrUpdateTemplate(e).done(function(e){o.removeClass("nimble-tmpl-processing-ajax"),e.success&&(i.tmplDialogVisible(!1),i.setSavedTmplCollection({refresh:!0}))})}),o.on("click",".sek-do-update-tmpl",function(e){var t=o.find(".sek-saved-tmpl-picker").val();"none"===t||_.isEmpty(t)||(o.addClass("nimble-tmpl-processing-ajax"),i.saveOrUpdateTemplate(e,t).done(function(e){o.removeClass("nimble-tmpl-processing-ajax"),e.success&&(i.tmplDialogVisible(!1),i.setSavedTmplCollection({refresh:!0}).done(function(e){i.refreshTmplPickerHtml()}))}))}),o.on("click",".sek-open-remove-confirmation",function(e){o.addClass("sek-removal-confirmation-opened")}),o.on("click",".sek-do-remove-tmpl",function(e){var t=o.find(".sek-saved-tmpl-picker").val();"none"===t||_.isEmpty(t)||(o.addClass("nimble-tmpl-processing-ajax"),i.removeTemplate(e,t).done(function(e){o.removeClass("nimble-tmpl-processing-ajax"),o.removeClass("sek-removal-confirmation-opened"),e.success&&i.setSavedTmplCollection({refresh:!0})}))}),o.on("click",".sek-cancel-remove-tmpl",function(e){o.removeClass("sek-removal-confirmation-opened")}),d(".sek-close-dialog",o).on("click",function(e){e.preventDefault(),i.tmplDialogVisible(!1)}),o.data("nimble-tmpl-dom-events-scheduled",!0))},reactOnTemplateSelection:function(e,t){var i=d("#nimble-top-tmpl-save-ui"),o=t.val(),n=i.find("#sek-saved-tmpl-title"),r=i.find("#sek-saved-tmpl-description"),s="update"===this.tmplDialogMode()?"sek-tmpl-update-selected":"sek-tmpl-remove-selected";if("none"===o)n.val(""),r.val(""),i.removeClass(s);else{var a=this.allSavedTemplates();(a=_.isObject(a)&&!_.isArray(a)?a:{})[o]=d.extend({title:"",description:"",last_modified_date:""},a[o]||{}),n.val(a[o].title),r.val(a[o].description),i.addClass(s)}},saveOrUpdateTemplate:function(e,t){var i=this,o=d.Deferred();e.preventDefault();var n,r=d("#sek-saved-tmpl-title"),s=r.val(),a=d("#sek-saved-tmpl-description").val(),c=i.localSectionsSettingId();try{n=i.preProcessTmpl(l(c)())}catch(e){l.errorLog("error in ::saveOrUpdateTemplate",e),o.resolve({success:!1})}return _.isEmpty(s)?(r.addClass("error"),l.previewer.trigger("sek-notify",{type:"error",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["A title is required"]+"</strong>","</span>"].join("")}),o.resolve({success:!1})):(d("#sek-saved-tmpl-title").removeClass("error"),wp.ajax.post("sek_save_user_template",{nonce:l.settings.nonce.save,tmpl_data:JSON.stringify(n),tmpl_title:s,tmpl_description:a,tmpl_post_name:t||"",skope_id:l.czr_skopeBase.getSkopeProperty("skope_id"),tmpl_locations:i.getActiveLocationsForTmpl(n),tmpl_header_location:i.getHeaderOrFooterLocationIdForTmpl("header",n),tmpl_footer_location:i.getHeaderOrFooterLocationIdForTmpl("footer",n)}).done(function(e){o.resolve({success:!0}),l.previewer.trigger("sek-notify",{type:"success",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["Template saved"]+"</strong>","</span>"].join("")})}).fail(function(e){o.resolve({success:!1}),l.errorLog("ajax sek_save_template => error",e),l.previewer.trigger("sek-notify",{type:"error",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["Error when processing template"]+"</strong>","</span>"].join("")})}),o)},getActiveLocationsForTmpl:function(e){if(!_.isObject(e))throw new Error("preProcess Tmpl => error : tmpl_data must be an object");var t=[];return _.each(e.collection,function(e){_.isObject(e)&&e.id&&e.level&&"location"===e.level&&t.push(e.id)}),t},getHeaderOrFooterLocationIdForTmpl:function(t,e){var i=this;if(!_.isObject(e))throw new Error("preProcess Tmpl => error : tmpl_data must be an object");var o="";return _.each(e.collection,function(e){_.isObject(e)&&e.id&&e.level&&("header"===t&&i.isHeaderLocation(e.id)||"footer"===t&&i.isFooterLocation(e.id))&&(o=e.id)}),o},preProcessTmpl:function(e){var t,i;if(!_.isObject(e))throw new Error("preProcess Tmpl => error : tmpl_data must be an object");return(t=d.extend(!0,{},e)).collection=[],i=this.activeLocations(),_.each(e.collection,function(e){_.isObject(e)&&e.id&&e.collection&&_.contains(i,e.id)&&!_.isEmpty(e.collection)&&t.collection.push(e)}),t},removeTemplate:function(e,t){var i=d.Deferred();return e.preventDefault(),wp.ajax.post("sek_remove_user_template",{nonce:l.settings.nonce.save,tmpl_post_name:t}).done(function(e){i.resolve({success:!0}),l.previewer.trigger("sek-notify",{type:"success",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["Template removed"]+"</strong>","</span>"].join("")})}).fail(function(e){i.resolve({success:!1}),l.errorLog("ajax sek_remove_template => error",e),l.previewer.trigger("sek-notify",{type:"error",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["Error when processing templates"]+"</strong>","</span>"].join("")})}),i},toggleSaveTmplUI:function(e){e=!!_.isUndefined(e)||e;var t,i=this;e?d.when(i.renderTmplUI({})).done(function(e){i.scheduleTmplSaveDOMEvents(),i.saveUIContainer=e,_.delay(function(){i.tmplDialogMode("save"),i.cachedElements.$body.addClass("sek-save-tmpl-ui-visible")},200)}):(t=d.Deferred(),i.cachedElements.$body.removeClass("sek-save-tmpl-ui-visible"),0<d("#nimble-top-tmpl-save-ui").length?_.delay(function(){i.tmplDialogMode=i.tmplDialogMode?i.tmplDialogMode:new l.Value,i.tmplDialogMode("hidden"),i.saveUIContainer.remove(),t.resolve()},250):t.resolve(),t.promise()).done(function(){i.tmplDialogVisible(!1)})},setSavedTmplCollection:function(e){var t=this,i=d.Deferred();return(e=e||{refresh:!1}).refresh||"_not_populated_"===t.allSavedTemplates()?((t.templateCollectionPromise&&"pending"===t.templateCollectionPromise.state()?t.templateCollectionPromise:t.getSavedTmplCollection()).done(function(e){t.allSavedTemplates(e),i.resolve(e)}),i.promise()):i.resolve(t.allSavedTemplates())},getSavedTmplCollection:function(){var t=this;return t.templateCollectionPromise=d.Deferred(),wp.ajax.post("sek_get_all_saved_tmpl",{nonce:l.settings.nonce.save}).done(function(e){_.isObject(e)&&!_.isArray(e)?(t.templateCollectionPromise.resolve(e),console.log("GET SAVED TMPL COLLECTION",e)):(t.templateCollectionPromise.resolve({}),l.errare("control::getSavedTmplCollection => error => tmpl collection is invalid",e))}).fail(function(e){l.errorLog("ajax sek_get_all_saved_tmpl => error",e),l.previewer.trigger("sek-notify",{type:"error",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["Error when processing templates"]+"</strong>","</span>"].join("")}),t.templateCollectionPromise.resolve({})}),t.templateCollectionPromise}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(r,s){s.extend(CZRSeksPrototype,{getTmplJsonFromUserTmpl:function(e){var t=s.Deferred();return wp.ajax.post("sek_get_user_tmpl_json",{nonce:r.settings.nonce.save,tmpl_post_name:e}).done(function(e){t.resolve({success:!0,tmpl_json:e})}).fail(function(e){t.resolve({success:!1}),r.errorLog("ajax getTmplJsonFromUserTmpl => error",e),r.previewer.trigger("sek-notify",{type:"error",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>@missi18n error when fetching the template</strong>","</span>"].join("")})}),t},getTmplJsonFromApi:function(i){var o,n=s.Deferred();return o.apiTmplGalleryJson?(r.infoLog("cached api tmpl gallery json",o.apiTmplGalleryJson),n.resolve({success:!0,tmpl_json:o.apiTmplGalleryJson})):s.getJSON(sektionsLocalizedData.templateAPIUrl).done(function(e){if(!_.isObject(e)||!e.lib||!e.lib.templates)return r.errare("::get_gallery_tmpl_json_and_import success but invalid response => ",e),void n.resolve({success:!1});var t=e.lib.templates[i];if(!t)return r.errare("::get_gallery_tmpl_json_and_import => the requested template is not available",e.lib.templates),r.previewer.trigger("sek-notify",{notif_id:"missing-tmpl",type:"info",duration:1e4,message:['<span style="color:#0075a2">',"<strong>","@missi18n the requested template is not available","</strong>","</span>"].join("")}),void n.resolve({success:!1});o.apiTmplGalleryJson=t,n.resolve({success:!0,tmpl_json:o.apiTmplGalleryJson})}).fail(function(e){r.errare("::get_gallery_tmpl_json_and_import failed => ",e),n.resolve({success:!1})}),n.promise()},get_gallery_tmpl_json_and_import:function(t){var i=this,o=(t=s.extend({template_name:"",from:"user",tmpl_import_mode:"replace"},t||{})).template_name;!_.isEmpty(o)&&_.isString(o)||r.errare("::import => error => invalid template name"),("nimble_api"===t.from?i.getTmplJsonFromApi(o):i.getTmplJsonFromUserTmpl(o)).done(function(e){e.success&&i.import_tmpl_from_gallery({pre_import_check:!1,template_name:o,template_data:e.tmpl_json,tmpl_import_mode:t.tmpl_import_mode})})},import_tmpl_from_gallery:function(t){var i=this;t=t||{};var e;if(!(t=s.extend({is_file_import:!1,pre_import_check:!1,tmpl_import_mode:"replace"},t)).template_data)throw new Error("::import_template => missing remote template data");e=wp.ajax.post("sek_process_template_json",{nonce:r.settings.nonce.save,template_data:JSON.stringify(t.template_data),pre_import_check:!1}).done(function(e){}).fail(function(e){r.previewer.trigger("sek-notify",{notif_id:"import-failed",type:"error",duration:3e4,message:["<span>","<strong>",[sektionsLocalizedData.i18n["Export failed"],encodeURIComponent(e)].join(" "),"</strong>","</span>"].join("")})}),r.previewer.send("sek-maybe-print-loader",{fullPageLoader:!0,duration:3e4}),_.delay(function(){"pending"===e.state()&&r.previewer.trigger("sek-notify",{notif_id:"import-too-long",type:"error",duration:2e4,message:["<span>","<strong>",sektionsLocalizedData.i18n['Import exceeds server response time, try to uncheck "import images" option.'],"</strong>","</span>"].join("")})},3e4),e.done(function(e){_.isObject(e)&&(e={success:!0,data:e}),r.czr_sektions.isImportedContentEligibleForAPI(e,t)?(e.data.data.collection=i.setIdsForImportedTmpl(e.data.data.collection),r.czr_sektions.doUpdateApiSettingAfter_TmplGalleryImport(e,t)):r.infoLog("::import_template problem => !api.czr_sektions.isImportedContentEligibleForAPI",e,t)}).fail(function(e){r.errare("::import_template => ajax error",e),r.previewer.trigger("sek-notify",{notif_id:"import-failed",type:"error",duration:3e4,message:["<span>","<strong>",sektionsLocalizedData.i18n["Import failed, file problem"],"</strong>","</span>"].join("")})})},doUpdateApiSettingAfter_TmplGalleryImport:function(e,t){if(t=t||{},r.czr_sektions.isImportedContentEligibleForAPI(e,t)||!t.is_file_import){r.czr_sektions.updateAPISetting({action:"sek-import-tmpl-from-gallery",scope:"local",imported_content:e.data,tmpl_import_mode:t.tmpl_import_mode}).done(function(){r.czr_sektions.generateUI({action:"sek-generate-local-skope-options-ui",clean_settings:!0}),r.previewer.refresh(),r.previewer.trigger("sek-notify",{notif_id:"import-success",type:"success",duration:3e4,message:["<span>","<strong>",sektionsLocalizedData.i18n["Template successfully imported"],"</strong>","</span>"].join("")})}).fail(function(e){r.errare("::doUpdateApiSettingAfter_TmplGalleryImport => error when firing ::updateAPISetting",e),r.previewer.trigger("sek-notify",{notif_id:"import-failed",type:"error",duration:3e4,message:["<span>","<strong>",[sektionsLocalizedData.i18n["Import failed"],e].join(" : "),"</strong>","</span>"].join("")})}),r.previewer.refresh()}else r.previewer.send("sek-clean-loader",{cleanFullPageLoader:!0})}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(r,e){jQuery.extend(CZRSeksPrototype,{getRevisionHistory:function(e){return wp.ajax.post("sek_get_revision_history",{nonce:r.settings.nonce.save,skope_id:e.is_local?r.czr_skopeBase.getSkopeProperty("skope_id"):sektionsLocalizedData.globalSkopeId})},setSingleRevision:function(i){var o=this,n=function(e,t){r.previewer.trigger("sek-notify",{notif_id:"restore-revision-error",type:t||"info",duration:1e4,message:['<span style="">',"<strong>",e||"","</strong>","</span>"].join("")})};wp.ajax.post("sek_get_single_revision",{nonce:r.settings.nonce.save,revision_post_id:i.revision_post_id}).done(function(e){var t=i.is_local?o.localSectionsSettingId():o.getGlobalSectionsSettingId();_.isEqual(r(t)(),e)?n(sektionsLocalizedData.i18n["This is the current version."],"info"):o.updateAPISetting({action:"sek-restore-revision",is_global_location:!i.is_local,revision_value:e}).done(function(){r.previewer.refresh()}).fail(function(e){r.errare("::setSingleRevision error when firing ::updateAPISetting",e),n(sektionsLocalizedData.i18n["The revision could not be restored."],"error")})}).fail(function(e){r.errare("::setSingleRevision ajax error",e),n(sektionsLocalizedData.i18n["The revision could not be restored."],"error")})}})}(wp.customize);CZRSeksPrototype=CZRSeksPrototype||{};!function(c,l){l.extend(CZRSeksPrototype,{setupSettingsToBeSaved:function(){var i,n=this,e={local:{collectionSettingId:n.localSectionsSettingId()},global:{collectionSettingId:n.getGlobalSectionsSettingId()}};_.each(e,function(e,t){if(i=c.czr_skopeBase.getSkopeProperty("sektions",t).db_values,_.isEmpty(e.collectionSettingId))throw new Error("setupSettingsToBeSaved => the collectionSettingId is invalid");if(!c.has(e.collectionSettingId)){c.CZR_Helpers.register({what:"setting",id:e.collectionSettingId,value:n.validateSettingValue(_.isObject(i)?i:n.getDefaultSektionSettingValue(t),t),transport:"postMessage",type:"option",track:!1,origin:"nimble"});c(e.collectionSettingId,function(o){o.bind(_.debounce(function(e,t,i){if(!_.isObject(i)||!0!==i.navigatingHistoryLogs)try{n.trackHistoryLog(o,i)}catch(e){c.errare("setupSettingsToBeSaved => trackHistoryLog",e)}},1e3))})}})},validateSettingValue:function(i,o){if(!_.isObject(i))return c.errare("::validateSettingValue => validation error => the setting should be an object",i),null;if(!_.isEmpty(o)&&_.contains(["local","global"],o)){var n={},r=!1,e=[],s=function(e){c.errare(e,i),sektionsLocalizedData.isDevMode&&c.previewer.trigger("sek-notify",{type:"error",duration:6e4,message:['<span style="font-size:0.95em">',"<strong>"+e+"</strong>","<br>",sektionsLocalizedData.i18n["If this problem locks Nimble Builder, you can try resetting the sections of this page."],"<br>",'<span style="text-align:center;display:block">','<button type="button" class="button" aria-label="'+sektionsLocalizedData.i18n.Reset+'" data-sek-reset="true">'+sektionsLocalizedData.i18n.Reset+"</button>","</span>","</span>"].join("")}),r=!0},a=function(t){if(!r)if(_.isUndefined(t)&&_.isEmpty(n)){if(t=l.extend(!0,{},i),_.isUndefined(t.id)||_.isUndefined(t.level)){if(_.isUndefined(t.collection))return void s("validation error => the root level is missing the collection of locations");if(!_.isEmpty(t.level)||!_.isEmpty(t.id))return void s('validation error => the root level should not have a "level" or an "id" property');_.each(t,function(e,t){switch(o){case"local":if(!_.contains(["collection","local_options","fonts"],t))return void s("validation error => unauthorized option group for local setting value => "+t);break;case"global":if(!_.contains(["collection","fonts"],t))return void s("validation error => unauthorized option group for global setting value => "+t)}}),_.each(i.collection,function(e){n=t,a(e)})}}else{if(_.isUndefined(t)||!_.isObject(t))return void s("validation error => a level is invalid");if(_.isEmpty(t.id)||!_.isString(t.id))return void s("validation error => a "+t.level+" level must have a valid id");if(_.contains(e,t.id))return void s("validation error => duplicated level id : "+t.id);if(e.push(t.id),_.isEmpty(t.level)||!_.isString(t.level))return void s("validation error => a "+t.level+" level must have a level property");if(!_.contains(["location","section","column","module"],t.level))return void s('validation error => the level "'+t.level+'" is not authorized');if("module"==t.level){if(!_.isUndefined(t.collection))return void s("validation error => a module can not have a collection property")}else if(_.isUndefined(t.collection))return void s("validation error => missing collection property for level => "+t.level+" "+t.id);switch(_.isUndefined(t.ver_ini)&&c.errare("validateSettingValue() => validation error => a "+t.level+' should have a version property : "ver_ini"'),t.level){case"location":if(!_.isEmpty(n.level))return void s("validation error => the parent of location "+t.id+" should have no level set");break;case"section":if(t.is_nested&&"column"!=n.level)return void s("validation error => the nested section "+t.id+" must be child of a column");if(!t.is_nested&&"location"!=n.level)return void s("validation error => the section "+t.id+" must be child of a location");break;case"column":if("section"!=n.level)return void s("validation error => the column "+t.id+" must be child of a section");break;case"module":if("column"!=n.level)return void s("validation error => the module "+t.id+" must be child of a column")}"module"!=t.level&&_.each(t.collection,function(e){n=l.extend(!0,{},t),_.isUndefined(e)?s("validation error => undefined level "):a(e)})}};return a(),r?null:i}c.errare("::validateSettingValue => invalid scope provided.",o)},resetCollectionSetting:function(e){if(_.isEmpty(e)||!_.contains(["local","global"],e))throw new Error("resetCollectionSetting => invalid scope provided.",e);return l.extend(!0,{},this.getDefaultSektionSettingValue(e))}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(c,o){o.extend(CZRSeksPrototype,{reactToPreviewMsg:function(){var n=this,r={},s={},a=!0,e={"sek-add-section":{callback:function(e){return c.previewedDevice("desktop"),a=!!_.isUndefined(e.send_to_preview)||e.send_to_preview,s={},r={action:"sek-add-section",id:sektionsLocalizedData.optPrefixForSektionsNotSaved+n.guid(),location:e.location,in_sektion:e.in_sektion,in_column:e.in_column,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column),before_section:e.before_section,after_section:e.after_section,is_first_section:e.is_first_section},n.updateAPISetting(r)},complete:function(e){e.apiParams.is_first_section&&c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location}),c.previewer.trigger("sek-pick-content",{id:e.apiParams?e.apiParams.id:"",content_type:"section"}),c.previewer.send("sek-animate-to-level",{id:e.apiParams.id})}},"sek-add-column":{callback:function(e){return a=!0,s={},r={id:sektionsLocalizedData.optPrefixForSektionsNotSaved+n.guid(),action:"sek-add-column",in_sektion:e.in_sektion,autofocus:e.autofocus},n.updateAPISetting(r)},complete:function(e){!1!==e.apiParams.autofocus&&c.previewer.trigger("sek-pick-content",{})}},"sek-add-module":{callback:function(e){return a=!0,s={},r={id:sektionsLocalizedData.optPrefixForSektionsNotSaved+n.guid(),action:"sek-add-module",in_sektion:e.in_sektion,in_column:e.in_column,module_type:e.content_id,before_module_or_nested_section:e.before_module_or_nested_section,after_module_or_nested_section:e.after_module_or_nested_section},n.updateAPISetting(r)},complete:function(e){c.previewer.trigger("sek-edit-module",{id:e.apiParams.id,level:"module",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column}),n.updateAPISetting({action:"sek-update-fonts",is_global_location:n.isGlobalLocation(e.apiParams)}),c.previewer.trigger("sek-refresh-stylesheet",{id:e.apiParams.in_column,location_skope_id:c.czr_skopeBase.getSkopeProperty("skope_id")})}},"sek-remove":{callback:function(e){switch(a=!0,s={},e.level){case"section":var t=n.getLevelModel(e.id);if("no_match"===t){c.errare("reactToPreviewMsg => sek-remove-section => no sektionToRemove matched");break}r={action:"sek-remove-section",id:e.id,location:e.location,in_sektion:e.in_sektion,in_column:e.in_column,is_nested:t.is_nested};break;case"column":r={action:"sek-remove-column",id:e.id,in_sektion:e.in_sektion};break;case"module":r={action:"sek-remove-module",id:e.id,in_sektion:e.in_sektion,in_column:e.in_column};break;default:c.errare("::reactToPreviewMsg => sek-remove => missing level ",e)}return n.updateAPISetting(r)},complete:function(e){if(c.previewer.trigger("sek-pick-content",{}),n.updateAPISetting({action:"sek-update-fonts",is_global_location:n.isGlobalLocation(e.apiParams)}),"sek-remove-section"===e.apiParams.action){var t=n.getLevelModel(e.apiParams.location);_.isEmpty(t.collection)&&c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location})}}},"sek-move":{callback:function(e){switch(a=!0,s={},e.level){case"section":r={action:"sek-move-section",id:e.id,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column),newOrder:e.newOrder,from_location:e.from_location,to_location:e.to_location};break;case"column":r={action:"sek-move-column",id:e.id,newOrder:e.newOrder,from_sektion:e.from_sektion,to_sektion:e.to_sektion};break;case"module":r={action:"sek-move-module",id:e.id,newOrder:e.newOrder,from_column:e.from_column,to_column:e.to_column,from_sektion:e.from_sektion,to_sektion:e.to_sektion}}return n.updateAPISetting(r)},complete:function(e){switch(e.apiParams.action){case"sek-move-section":c.previewer.trigger("sek-edit-options",{id:e.apiParams.id,level:"section",in_sektion:e.apiParams.id}),e.apiParams.from_location!=e.apiParams.to_location&&(c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.to_location}),c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.from_location}));break;case"sek-move-column":c.previewer.trigger("sek-edit-options",{id:e.apiParams.id,level:"column",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column});break;case"sek-refresh-modules-in-column":c.previewer.trigger("sek-edit-module",{id:e.apiParams.id,level:"module",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column})}}},"sek-move-section-up":{callback:function(e){return a=!1,s={},r={action:"sek-move-section-up-down",direction:"up",id:e.id,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column),location:e.location,in_column:e.in_column},n.updateAPISetting(r)},complete:function(e){c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location,original_action:"sek-move-section-up",moved_level_id:e.apiParams.id}),e.apiParams.new_location&&c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.new_location,original_action:"sek-move-section-down",moved_level_id:e.apiParams.id})}},"sek-move-section-down":{callback:function(e){return a=!1,s={},r={action:"sek-move-section-up-down",direction:"down",id:e.id,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column),location:e.location,in_column:e.in_column},n.updateAPISetting(r)},complete:function(e){c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location,original_action:"sek-move-section-down",moved_level_id:e.apiParams.id}),e.apiParams.new_location&&c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.new_location,original_action:"sek-move-section-down",moved_level_id:e.apiParams.id})}},"sek-duplicate":{callback:function(e){switch(a=!0,s={},e.level){case"section":r={action:"sek-duplicate-section",id:e.id,location:e.location,in_sektion:e.in_sektion,in_column:e.in_column,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column)};break;case"column":r={action:"sek-duplicate-column",id:e.id,in_sektion:e.in_sektion,in_column:e.in_column};break;case"module":r={action:"sek-duplicate-module",id:e.id,in_sektion:e.in_sektion,in_column:e.in_column}}return n.updateAPISetting(r)},complete:function(e){var t;switch(e.apiParams.action){case"sek-duplicate-section":c.previewer.trigger("sek-edit-options",{id:e.apiParams.id,level:"section",in_sektion:e.apiParams.id}),t=e.apiParams.location,e.apiParams.is_nested&&c.previewer.refresh(),c.previewer.send("sek-animate-to-level",{id:e.apiParams.id});break;case"sek-duplicate-column":c.previewer.trigger("sek-edit-options",{id:e.apiParams.id,level:"column",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column}),t=e.apiParams.in_sektion;break;case"sek-duplicate-module":c.previewer.trigger("sek-edit-module",{id:e.apiParams.id,level:"module",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column}),t=e.apiParams.in_column}c.previewer.trigger("sek-refresh-stylesheet",{id:t,location_skope_id:c.czr_skopeBase.getSkopeProperty("skope_id")})}},"sek-resize-columns":function(e){return a=!0,s={},r=e,n.updateAPISetting(r)},"sek-add-content-in-new-sektion":{callback:function(e){switch(a=!!_.isUndefined(e.send_to_preview)||e.send_to_preview,s={},(r=e).action="sek-add-content-in-new-sektion",r.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+n.guid(),e.content_type){case"module":r.droppedModuleId=sektionsLocalizedData.optPrefixForSektionsNotSaved+n.guid();break;case"preset_section":c.previewer.send("sek-maybe-print-loader",{loader_located_in_level_id:e.location}),c.previewer.send("sek-maybe-print-loader",{fullPageLoader:!0})}return n.updateAPISetting(r)},complete:function(e){switch(e.apiParams.content_type){case"module":c.previewer.trigger("sek-edit-module",{level:"module",id:e.apiParams.droppedModuleId});break;case"preset_section":c.previewer.send("sek-clean-loader",{cleanFullPageLoader:!0})}n.updateAPISetting({action:"sek-update-fonts",is_global_location:n.isGlobalLocation(e.apiParams)});var t=e.location_skope_id;_.isUndefined(t)&&(t=!0===e.is_global_location?sektionsLocalizedData.globalSkopeId:c.czr_skopeBase.getSkopeProperty("skope_id")),c.previewer.trigger("sek-refresh-stylesheet",{location_skope_id:t,is_global_location:n.isGlobalLocation(e.apiParams)}),e.apiParams.is_first_section&&c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location}),e.apiParams.sektion_to_replace&&c.previewer.trigger("sek-remove",{id:e.apiParams.sektion_to_replace,location:e.apiParams.location,in_column:e.apiParams.in_column,level:"section"})}},"sek-add-preset-section-in-new-nested-sektion":{callback:function(e){return a=!1,s={},(r=e).action="sek-add-preset-section-in-new-nested-sektion",c.previewer.send("sek-maybe-print-loader",{loader_located_in_level_id:e.location}),n.updateAPISetting(r)},complete:function(e){n.updateAPISetting({action:"sek-update-fonts",is_global_location:n.isGlobalLocation(e.apiParams)}),c.previewer.trigger("sek-refresh-stylesheet",{id:e.apiParams.in_sektion,location_skope_id:c.czr_skopeBase.getSkopeProperty("skope_id")}),c.previewer.trigger("sek-refresh-level",{level:"section",id:e.apiParams.in_sektion})}},"sek-pick-content":function(e){return e=_.isObject(e)?e:{},c.czr_sektions.currentContentPickerType=c.czr_sektions.currentContentPickerType||new c.Value,_.isObject(e)&&e.id&&n.lastClickedTargetInPreview({id:e.id}),a=!0,r={},s={action:"sek-generate-draggable-candidates-picker-ui",content_type:(e=e||{}).content_type||"module",was_triggered:!_.has(e,"was_triggered")||e.was_triggered,focus:!_.has(e,"focus")||e.focus},n.generateUI(s)},"sek-edit-options":function(e){return a=!0,r={},_.isEmpty(e.id)?o.Deferred(function(){this.reject("missing id")}):(s={action:"sek-generate-level-options-ui",location:e.location,level:e.level,id:e.id,in_sektion:e.in_sektion,in_column:e.in_column,options:e.options||[]},n.generateUI(s))},"sek-edit-module":function(e){return a=!0,r={},s={action:"sek-generate-module-ui",level:e.level,id:e.id,in_sektion:e.in_sektion,in_column:e.in_column,options:e.options||[]},n.generateUI(s)},"sek-notify":function(t){a=!1;var i=t.notif_id||"sek-notify";return n.lastNimbleNotificationId&&c.notifications.remove(n.lastNimbleNotificationId),o.Deferred(function(){c.panel(sektionsLocalizedData.sektionsPanelId,function(e){c.notifications.add(new c.Notification(i,{type:t.type||"info",message:t.message,dismissible:!0})),n.lastNimbleNotificationId=i,_.delay(function(){c.notifications.remove(i)},t.duration||5e3)}),this.resolve({is_global_location:n.isGlobalLocation(t)})})},"sek-refresh-level":function(t){return a=!0,o.Deferred(function(e){r={action:"sek-refresh-level",level:t.level,id:t.id,original_action:t.original_action,moved_level_id:t.moved_level_id},s={},e.resolve({is_global_location:n.isGlobalLocation(t)})})},"sek-refresh-stylesheet":function(t){return a=!0,t=t||{},o.Deferred(function(e){r={id:t.id},s={},e.resolve({is_global_location:n.isGlobalLocation(t)})})},"sek-toggle-save-section-ui":function(t){return a=!1,n.idOfSectionToSave=t.id,n.saveSectionDialogVisible(!0),o.Deferred(function(e){r={},s={},e.resolve({is_global_location:n.isGlobalLocation(t)})})},"sek-reset-collection":{callback:function(e){return a=!1,s={},(r=e).action="sek-reset-collection",r.scope=e.scope,n.updateAPISetting(r)},complete:function(e){c.previewer.refresh(),c.previewer.trigger("sek-notify",{notif_id:"reset-success",type:"success",duration:8e3,message:["<span>","<strong>",sektionsLocalizedData.i18n["Reset complete"],"</strong>","</span>"].join("")})}}};_.each(e,function(i,o){c.previewer.bind(o,function(t){var e;if(_.isFunction(i))e=i;else{if(!_.isFunction(i.callback))return void c.errare("::reactToPreviewMsg => invalid callback for action "+o);e=i.callback}"sek-notify"!==o&&(n.templateGalleryExpanded(!1),n.tmplDialogVisible(!1));try{e(t).done(function(e){e=e||{},a?c.previewer.send(o,{location_skope_id:!0===e.is_global_location?sektionsLocalizedData.globalSkopeId:c.czr_skopeBase.getSkopeProperty("skope_id"),local_skope_id:c.czr_skopeBase.getSkopeProperty("skope_id"),apiParams:r,uiParams:s,cloneId:!_.isEmpty(e.cloneId)&&e.cloneId,all_params:t}):c.previewer.trigger([o,"done"].join("_"),{apiParams:r,uiParams:s}),n.trigger([o,"done"].join("_"),t)}).fail(function(e){c.errare("reactToPreviewMsg => problem or error when running action "+o,e),!_.isEmpty(e)&&sektionsLocalizedData.isDevMode&&c.previewer.trigger("sek-notify",{type:"error",duration:3e4,message:['<span style="font-size:0.95em">',"<strong>"+e+"</strong>","<br>",sektionsLocalizedData.i18n["If this problem locks Nimble Builder, you can try resetting the sections of this page."],"<br>",'<span style="text-align:center;display:block">','<button type="button" class="button" aria-label="'+sektionsLocalizedData.i18n.Reset+'" data-sek-reset="true">'+sektionsLocalizedData.i18n.Reset+"</button>","</span>","</span>"].join("")})})}catch(e){c.errare("reactToPreviewMsg => error when receiving "+o,e)}})}),_.each(e,function(t,i){c.previewer.bind([i,"done"].join("_"),function(e){if(_.isFunction(t.complete))try{t.complete(e)}catch(e){c.errare("reactToPreviewMsg done => error when receiving "+[i,"done"].join("_"),e)}})})},schedulePrintSectionJson:function(){var i=this;c.previewer.bind("sek-to-json",function(e){var t=o.extend(!0,{},i.getLevelModel(e.id));console.log(JSON.stringify(i.cleanIds(t)))})}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(k,y){y.extend(CZRSeksPrototype,{generateUI:function(e){var t=this,i=y.Deferred();switch(_.isEmpty(e.action)&&i.reject("generateUI => missing action"),e.action){case"sek-generate-module-ui":try{i=t.generateUIforFrontModules(e,i)}catch(e){k.errare("::generateUI() => error",e),i=y.Deferred()}break;case"sek-generate-level-options-ui":try{i=t.generateUIforLevelOptions(e,i)}catch(e){k.errare("::generateUI() => error",e),i=y.Deferred()}break;case"sek-generate-draggable-candidates-picker-ui":t.cleanRegistered();try{i=t.generateUIforDraggableContent(e,i)}catch(e){k.errare("::generateUI() => error",e),i=y.Deferred()}k.czr_sektions.currentContentPickerType(e.content_type||"module");break;case"sek-generate-local-skope-options-ui":t.cleanRegistered();try{i=t.generateUIforLocalSkopeOptions(e,i)}catch(e){k.errare("::generateUI() => error",e),i=y.Deferred()}break;case"sek-generate-global-options-ui":t.cleanRegistered();try{i=t.generateUIforGlobalOptions(e,i)}catch(e){k.errare("::generateUI() => error",e),i=y.Deferred()}}return"pending"==i.state()?i.resolve().promise():i.promise()},updateAPISettingAndExecutePreviewActions:function(n){if(!_.isEmpty(n.settingParams)&&_.has(n.settingParams,"to")){var r,s=this,e=n.settingParams.to,t=null,a=!1;if(!_.isEmpty(n.settingParams.args)&&_.has(n.settingParams.args,"moduleRegistrationParams")){var c=n.settingParams.args.moduleRegistrationParams.control,i=n.settingParams.args.moduleRegistrationParams.id,o=c.czr_Module(i);if(_.isEmpty(o)?k.errare("updateAPISettingAndExecutePreviewActions => missing parentModuleInstance",n):(t=o.module_type,a=o.isMultiItem()),!a&&_.isObject(e)?r=s.normalizeAndSanitizeSingleItemInputValues({item_value:e,parent_module_type:t,is_multi_items:!1}):(r=[],_.each(e,function(e){r.push(s.normalizeAndSanitizeSingleItemInputValues({item_value:e,parent_module_type:t,is_multi_items:!0}))})),_.isEmpty(n.defaultPreviewAction))k.errare("updateAPISettingAndExecutePreviewActions => missing defaultPreviewAction in passed params. No action can be triggered to the api.previewer.",n);else{var l,d="refresh_stylesheet"===n.defaultPreviewAction,u="refresh_markup"===n.defaultPreviewAction,p="refresh_fonts"===n.defaultPreviewAction,m="refresh_preview"===n.defaultPreviewAction,f=n.settingParams.args.input_changed,g=function(){return l&&_.isString(l.refresh_markup)&&"true"!==l.refresh_markup&&"false"!==l.refresh_markup};_.isUndefined(f)||(l=s.getInputRegistrationParams(f,t),_.isUndefined(l.refresh_stylesheet)||(d=Boolean(l.refresh_stylesheet)),_.isUndefined(l.refresh_markup)||(u=g()?l.refresh_markup:Boolean(l.refresh_markup)),_.isUndefined(l.refresh_fonts)||(p=Boolean(l.refresh_fonts)),_.isUndefined(l.refresh_preview)||(m=Boolean(l.refresh_preview)));var h=function(){if(!0!==n.isGlobalOptions)return s.updateAPISetting({action:n.uiParams.action,id:n.uiParams.id,value:r,in_column:n.uiParams.in_column,in_sektion:n.uiParams.in_sektion,options_type:n.options_type,settingParams:n.settingParams}).done(function(e){var t;!0===d&&k.previewer.send("sek-refresh-stylesheet",{location_skope_id:!0===e.is_global_location?sektionsLocalizedData.globalSkopeId:k.czr_skopeBase.getSkopeProperty("skope_id"),local_skope_id:k.czr_skopeBase.getSkopeProperty("skope_id"),apiParams:{action:"sek-refresh-stylesheet",id:n.uiParams.id,level:n.uiParams.level}}),a&&n.settingParams.args.inputRegistrationParams&&_.isFunction(n.settingParams.args.inputRegistrationParams.input_parent)&&(t=n.settingParams.args.inputRegistrationParams.input_parent.id);var i=function(){k.previewer.send("sek-refresh-level",{location_skope_id:!0===e.is_global_location?sektionsLocalizedData.globalSkopeId:k.czr_skopeBase.getSkopeProperty("skope_id"),local_skope_id:k.czr_skopeBase.getSkopeProperty("skope_id"),apiParams:{action:"sek-refresh-level",id:n.uiParams.id,level:n.uiParams.level,changed_item_id:t,control_id:c.id,is_multi_items:a},skope_id:k.czr_skopeBase.getSkopeProperty("skope_id")})};if(!0===u&&i(),g()){var o=n.settingParams.args.input_value;if(!_.isString(o))throw new Error("::updateAPISettingAndExecutePreviewActions => _doUpdateWithRequestedAction => refreshMarkupWhenNeededForInput => html content is not a string.");s.htmlIncludesElementsThatNeedAnAjaxRefresh(o)?i():k.previewer.send("sek-update-html-in-selector",{selector:l.refresh_markup,changed_item_id:t,is_multi_items:a,html:o,id:n.uiParams.id,location_skope_id:!0===e.is_global_location?sektionsLocalizedData.globalSkopeId:k.czr_skopeBase.getSkopeProperty("skope_id"),local_skope_id:k.czr_skopeBase.getSkopeProperty("skope_id"),apiParams:{action:"sek-update-html-in-selector",id:n.uiParams.id,level:n.uiParams.level},skope_id:k.czr_skopeBase.getSkopeProperty("skope_id")})}!0===m&&k.previewer.refresh()}).fail(function(e){k.errare("::updateAPISettingAndExecutePreviewActions=> api setting not updated",e),k.errare("::updateAPISettingAndExecutePreviewActions=> api setting not updated => params ",n)});if(_.isEmpty(n.options_type))k.errare("updateAPISettingAndExecutePreviewActions => error when updating the global options => missing options_type");else{var e=k(sektionsLocalizedData.optNameForGlobalOptions)(),t=y.extend(!0,{},_.isObject(e)?e:{}),i={};if(_.each(r||{},function(e,t){!_.isBoolean(e)&&_.isEmpty(e+"")||(i[t]=e)}),t[n.options_type]=i,k(sektionsLocalizedData.optNameForGlobalOptions)(t),!1!==m&&k.previewer.refresh(),!0===p){var o=n.settingParams.args.input_value;if(!_.isString(o))return void k.errare("updateAPISettingAndExecutePreviewActions => font-family must be a string",o);s.updateGlobalGFonts(o)}!0===d&&k.previewer.send("sek-refresh-stylesheet",{local_skope_id:k.czr_skopeBase.getSkopeProperty("skope_id"),location_skope_id:sektionsLocalizedData.globalSkopeId})}};if(!0===p){var v=n.settingParams.args.input_value;if(!_.isString(v))return void k.errare("updateAPISettingAndExecutePreviewActions => font-family must be a string",v);!0===n.isGlobalOptions?h():s.updateAPISetting({action:"sek-update-fonts",font_family:v,is_global_location:s.isGlobalLocation(n.uiParams)}).always(function(){h().then(function(){s.updateAPISetting({action:"sek-update-fonts",is_global_location:s.isGlobalLocation(n.uiParams)})})})}else h()}}else k.errare("updateAPISettingAndExecutePreviewActions => missing params.settingParams.args.moduleRegistrationParams The api main setting can not be updated",n)}else k.errare("updateAPISettingAndExecutePreviewActions => missing params.settingParams.to. The api main setting can not be updated",n)},updateGlobalGFonts:function(e){var t=k(sektionsLocalizedData.optNameForGlobalOptions)(),i=y.extend(!0,{},_.isObject(t)?t:{}),o=this.sniffGlobalGFonts(i);!_.isEmpty(e)&&_.isString(e)&&-1<e.indexOf("gfont")&&!_.contains(o,e)&&o.push(e),i.fonts=o,k(sektionsLocalizedData.optNameForGlobalOptions)(i)},sniffGlobalGFonts:function(e){var i=[],o=function(e){_.each(e,function(e,t){"fonts"!==t&&(_.isString(t)&&-1<t.indexOf("font_family")&&-1<e.indexOf("gfont")&&!_.contains(i,e)&&i.push(e),(_.isArray(e)||_.isObject(e))&&o(e))})};return(_.isArray(e)||_.isObject(e))&&o(e),i},normalizeAndSanitizeSingleItemInputValues:function(n){var i,r={},o={},s=null,a=this;return _.each(n.item_value,function(e,t){var i,o;"title"!==t&&((n.is_multi_items||"id"!==t)&&(null!==n.parent_module_type&&"id"!==t&&"no_default_value_specified"===(s=a.getInputDefaultValue(t,n.parent_module_type))&&k.infoLog("::normalizeAndSanitizeSingleItemInputValues => missing default value for input "+t+" in module "+n.parent_module_type),i=e,o=s,(_.isBoolean(i)||_.isBoolean(o)?Boolean(i)===Boolean(o):_.isNumber(i)||_.isNumber(o)?Number(i)===Number(o):_.isString(i)||_.isString(o)?i+""==o+"":_.isObject(i)&&_.isObject(o)?_.isEqual(i,o):_.isArray(i)&&_.isArray(o)?JSON.stringify(i.sort())===JSON.stringify(o.sort()):i===o)||(_.isString(e)||_.isObject(e))&&_.isEmpty(e)||(r[t]=e)))}),_.each(r,function(e,t){switch(a.getInputType(t,n.parent_module_type)){case"text":case"textarea":case"check":case"gutencheck":case"select":case"radio":case"number":case"upload":case"upload_url":case"color":case"wp_color_alpha":case"wp_color":case"content_picker":case"detached_tinymce_editor":case"nimble_tinymce_editor":case"password":case"range":case"range_slider":case"hidden":case"h_alignment":case"h_text_alignment":case"spacing":case"bg_position":case"v_alignment":case"font_size":case"line_height":case"font_picker":default:i=e}o[t]=i}),o},isUIControlAlreadyRegistered:function(t){var e=_.filter(this.registered(),function(e){return e.id==t&&"control"===e.what}),i=!1;return _.isEmpty(e)?i=k.control.has(t):(i=!0,1<e.length&&k.errare("isUIControlAlreadyRegistered => why is this control registered more than once ? => "+t)),i},htmlIncludesElementsThatNeedAnAjaxRefresh:function(e){var t=e.match(/\[+([\w_-])+/g),i=e.match(/\{\{+([\w_-])+/g),o=e.match(/<script[\s\S]*?>[\s\S]*?<\/script>/gi),n=[],r=[];if(t)for(var s=0;s<t.length;s++){var a=t[s].replace(/^\[+/g,"");-1===n.indexOf(a)&&n.push(a)}if(i)for(var c=0;c<i.length;c++){var l=i[c].replace(/^\[+/g,"");-1===r.indexOf(l)&&r.push(l)}return!_.isEmpty(n)||!_.isEmpty(r)||!_.isEmpty(o)}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(s,a){a.extend(CZRSeksPrototype,{generateUIforDraggableContent:function(r,e){var o=this,i={};a.extend(i,{sek_content_type_switcher_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+"_sek_content_type_switcher_ui",module_type:"sek_content_type_switcher_module",controlLabel:o.getRegisteredModuleProperty("sek_content_type_switcher_module","name"),priority:10,settingValue:{content_type:r.content_type}},sek_module_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+"_sek_draggable_modules_ui",module_type:"sek_module_picker_module",controlLabel:o.getRegisteredModuleProperty("sek_module_picker_module","name"),content_type:"module",priority:20,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'},sek_my_sections_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid()+"_sek_draggable_sections_ui",module_type:"sek_my_sections_sec_picker_module",controlLabel:o.getRegisteredModuleProperty("sek_my_sections_sec_picker_module","name"),content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>',is_new:!0}}),_.each(["sek_intro_sec_picker_module","sek_features_sec_picker_module","sek_about_sec_picker_module","sek_contact_sec_picker_module","sek_team_sec_picker_module","sek_column_layouts_sec_picker_module","sek_header_sec_picker_module","sek_footer_sec_picker_module"],function(e,t){i[e]={settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid()+"_sek_draggable_sections_ui",module_type:e,controlLabel:o.getRegisteredModuleProperty(e,"name"),content_type:"section",expandAndFocusOnInit:0===t,priority:30,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'}});var t=_.keys(i)[0],n=i[t].settingControlId;return o.isUIControlAlreadyRegistered(n)?s.control(n,function(t){t.focus({completeCallback:function(){var e=t.container;e.hasClass("button-see-me")||(e.addClass("button-see-me"),_.delay(function(){e.removeClass("button-see-me")},800))}})}):(_do_register_=function(){_.each(i,function(n,e){s.has(n.settingControlId)||(s(n.settingControlId,function(e){e.bind(function(e,t){s.errare("generateUIforDraggableContent => the setting() should not changed")})}),s.CZR_Helpers.register({origin:"nimble",level:r.level,what:"setting",id:n.settingControlId,dirty:!1,value:n.settingValue||{},transport:"postMessage",type:"_nimble_ui_"})),s.CZR_Helpers.register({origin:"nimble",level:r.level,what:"control",id:n.settingControlId,label:n.controlLabel,type:"czr_module",module_type:n.module_type,section:o.SECTION_ID_FOR_CONTENT_PICKER,priority:n.priority||10,settings:{default:n.settingControlId},track:!1}).done(function(){s.control(n.settingControlId,function(e){e.content_type=n.content_type,!0===r.focus&&e.focus({completeCallback:function(){}});var t=e.container.find("label > .customize-control-title"),i=t.html();if(t.html(['<span class="sek-ctrl-accordion-title">',i,"</span>"].join("")),n.is_new){var o=t.html();t.html(o+' <span class="sek-new-label">New!</span>')}_.isUndefined(n.icon)||t.addClass("sek-flex-vertical-center").prepend(n.icon),"section"===e.content_type?(e.container.attr("data-sek-expanded","false"),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false"),!0===n.expandAndFocusOnInit&&"false"==e.container.attr("data-sek-expanded")&&e.container.addClass("sek-expand-on-init")):e.container.attr("data-sek-accordion","no")})})}),s.trigger("nimble-modules-and-sections-controls-registered")},s.section(o.SECTION_ID_FOR_CONTENT_PICKER,function(e){_do_register_();var t=e.container.find(".accordion-section-title"),i=e.container.find(".customize-section-title h3");0<t.length&&t.find(".sek-level-option-icon").length<1&&t.prepend('<i class="fas fa-grip-vertical sek-level-option-icon"></i>'),0<i.length&&i.find(".sek-level-option-icon").length<1&&i.find(".customize-action").after('<i class="fas fa-grip-vertical sek-level-option-icon"></i>'),o.scheduleModuleAccordion.call(e,{expand_first_control:!1}),e.container.find(".customize-control.sek-expand-on-init").find("label > .customize-control-title").trigger("click")})),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(d,u){u.extend(CZRSeksPrototype,{generateUIforFrontModules:function(r,e){var s=this;_.isEmpty(r.id)&&e.reject("generateUI => missing id");var i=s.getLevelProperty({property:"value",id:r.id}),t=s.getLevelProperty({property:"module_type",id:r.id}),o=s.getRegisteredModuleProperty(t,"name");_.isEmpty(t)&&e.reject("generateUI => module => invalid module_type");var n={};if(!0===s.getRegisteredModuleProperty(t,"is_father")){var a=s.getRegisteredModuleProperty(t,"children");if(_.isEmpty(a))throw new Error("::generateUIforFrontModules => a father module "+t+" is missing children modules ");_.each(a,function(e,t){n[t]={settingControlId:r.id+"__"+t,module_type:e,controlLabel:s.getRegisteredModuleProperty(e,"name")}})}else n.__no_option_group_to_be_updated_by_children_modules__={settingControlId:r.id,module_type:t,controlLabel:o};var c=_.keys(n)[0],l=n[c].settingControlId;return s.isUIControlAlreadyRegistered(l)?d.control(l).focus({completeCallback:function(){var e=d.control(l).container;e.hasClass("button-see-me")||(e.addClass("button-see-me"),_.delay(function(){e.removeClass("button-see-me")},800))}}):(s.cleanRegistered(),_do_register_=function(){_.each(n,function(o,n){if(!d.has(o.settingControlId)){var t=function(e,t,i){try{s.updateAPISettingAndExecutePreviewActions({defaultPreviewAction:"refresh_markup",uiParams:_.extend(r,{action:"sek-set-module-value"}),options_type:n,settingParams:{to:e,from:t,args:i}})}catch(e){d.errare("::generateUIforFrontModules => Error in updateAPISettingAndExecutePreviewActions",e)}};d(o.settingControlId,function(e){e.bind(_.debounce(t,s.SETTING_UPDATE_BUFFER))});var e=u.extend(!0,{},i);"__no_option_group_to_be_updated_by_children_modules__"!==n&&(e=!_.isEmpty(e)&&_.isObject(e)&&_.isObject(e[n])?e[n]:{}),d.CZR_Helpers.register({origin:"nimble",level:r.level,what:"setting",id:o.settingControlId,dirty:!1,value:e,transport:"postMessage",type:"_nimble_ui_"})}d.CZR_Helpers.register({origin:"nimble",level:r.level,what:"control",module_id:r.id,id:o.settingControlId,label:o.controlLabel,type:"czr_module",module_type:o.module_type,section:r.id,priority:20,settings:{default:o.settingControlId}}).done(function(){}),d.control(o.settingControlId,function(e){d.control(o.settingControlId).focus({completeCallback:function(){}}),e.container.attr("data-sek-expanded","false");var t=e.container.find("label > .customize-control-title"),i=u("<div/>").html(t.html()).text();t.html(['<span class="sek-ctrl-accordion-title">',i,"</span>"].join("")),_.isUndefined(o.icon)||t.addClass("sek-flex-vertical-center").prepend(o.icon),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false")})})},d.section(r.id,function(e){d.section(r.id).focus(),s.generateModuleOptionSwitcherUI(r.id,r.action),_do_register_(),e.container.find(".accordion-section-title").first().hide();var t=e.container.find(".customize-section-title h3");0<t.length&&t.find(".customize-action").after('<i class="fas fa-pencil-alt sek-level-option-icon"></i>'),s.scheduleModuleAccordion.call(e,{expand_first_control:!0})}),d.CZR_Helpers.register({origin:"nimble",what:"section",id:r.id,title:sektionsLocalizedData.i18n["Content for"]+" "+o,panel:sektionsLocalizedData.sektionsPanelId,priority:1e3}).done(function(){})),e},generateModuleOptionSwitcherUI:function(e,t){var i=e+"__option_switcher";d.has(i)||(d(i,function(e){e.bind(function(e,t){d.errare("generateUIforDraggableContent => the setting() should not changed")})}),d.CZR_Helpers.register({origin:"nimble",level:"module",what:"setting",id:i,dirty:!1,value:"",transport:"postMessage",type:"_nimble_ui_"})),d.CZR_Helpers.register({origin:"nimble",level:"module",what:"control",module_id:e,id:i,label:"",type:"czr_module",module_type:"sek_mod_option_switcher_module",section:e,priority:10,settings:{default:i},has_accordion:!1,ui_action:t}).done(function(){d.control(i,function(e){e.deferred.embedded.done(function(){e.container.find(".customize-control-title").hide(),e.container.attr("data-sek-accordion","no")})})})}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{generateUIforLevelOptions:function(s,e){var a=this,c=a.getLevelProperty({property:"options",id:s.id});c=_.isObject(c)?c:{};var t={};l.trigger("nb_setup_level_ui_registration_params",{params:s,modulesRegistrationParams:t}),d.extend(t,{bg:{settingControlId:s.id+"__bg_options",module_type:"sek_level_bg_module",controlLabel:sektionsLocalizedData.i18n["Background settings for the"]+" "+sektionsLocalizedData.i18n[s.level],expandAndFocusOnInit:!0,icon:'<i class="material-icons sek-level-option-icon">gradient</i>'}}),"section"===s.level&&d.extend(t,{level_text:{settingControlId:s.id+"__text_options",module_type:"sek_level_text_module",controlLabel:sektionsLocalizedData.i18n["Text settings for the"]+" "+sektionsLocalizedData.i18n[s.level],expandAndFocusOnInit:!0,icon:'<i class="material-icons sek-level-option-icon">text_format</i>'}}),d.extend(t,{border:{settingControlId:s.id+"__border_options",module_type:"sek_level_border_module",controlLabel:sektionsLocalizedData.i18n["Borders settings for the"]+" "+sektionsLocalizedData.i18n[s.level],icon:'<i class="material-icons sek-level-option-icon">rounded_corner</i>'},spacing:{settingControlId:s.id+"__spacing_options",module_type:"sek_level_spacing_module",controlLabel:sektionsLocalizedData.i18n["Padding and margin settings for the"]+" "+sektionsLocalizedData.i18n[s.level],icon:'<i class="material-icons sek-level-option-icon">center_focus_weak</i>'},anchor:{settingControlId:s.id+"__anchor_options",module_type:"sek_level_anchor_module",controlLabel:sektionsLocalizedData.i18n["Custom anchor ( CSS ID ) and CSS classes for the"]+" "+sektionsLocalizedData.i18n[s.level],icon:'<i class="fas fa-anchor sek-level-option-icon"></i>'},visibility:{settingControlId:s.id+"__visibility_options",module_type:"sek_level_visibility_module",controlLabel:sektionsLocalizedData.i18n["Device visibility settings for the"]+" "+sektionsLocalizedData.i18n[s.level],icon:'<i class="far fa-eye sek-level-option-icon"></i>'},height:{settingControlId:s.id+"__height_options",module_type:"sek_level_height_module",controlLabel:sektionsLocalizedData.i18n["Height, vertical alignment, z-index for the"]+" "+sektionsLocalizedData.i18n[s.level],icon:'<i class="fas fa-ruler-vertical sek-level-option-icon"></i>'}}),(sektionsLocalizedData.isUpsellEnabled||sektionsLocalizedData.isPro)&&d.extend(t,{animation:{settingControlId:s.id+"__animate_options",module_type:"sek_level_animation_module",controlLabel:sektionsLocalizedData.i18n["Animation settings for the"]+" "+sektionsLocalizedData.i18n[s.level],icon:'<i class="material-icons sek-level-option-icon">movie_filter</i>',isPro:!0}}),"section"===s.level&&(d.extend(t,{width:{settingControlId:s.id+"__width_options",module_type:"sek_level_width_section",controlLabel:sektionsLocalizedData.i18n["Width settings for the"]+" "+sektionsLocalizedData.i18n[s.level],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'}}),d.extend(t,{breakpoint:{settingControlId:s.id+"__breakpoint_options",module_type:"sek_level_breakpoint_module",controlLabel:sektionsLocalizedData.i18n["Responsive settings : breakpoint, column direction"],icon:'<i class="material-icons sek-level-option-icon">devices</i>'}}),(sektionsLocalizedData.isUpsellEnabled||sektionsLocalizedData.isPro)&&d.extend(t,{sec_custom_css:{settingControlId:s.id+"__sec_custom_css",module_type:"sek_level_cust_css_section",controlLabel:sektionsLocalizedData.i18n["Custom CSS"],icon:'<i class="material-icons sek-level-option-icon">code</i>',isPro:!0}})),"column"===s.level&&d.extend(t,{width:{settingControlId:s.id+"__width_options",module_type:"sek_level_width_column",controlLabel:sektionsLocalizedData.i18n["Width settings for the"]+" "+sektionsLocalizedData.i18n[s.level],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'}}),"module"===s.level&&d.extend(t,{width:{settingControlId:s.id+"__width_options",module_type:"sek_level_width_module",controlLabel:sektionsLocalizedData.i18n["Width and horizontal alignment for the"]+" "+sektionsLocalizedData.i18n[s.level],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'}});var i=_.keys(t)[0],o=t[i].settingControlId;return a.isUIControlAlreadyRegistered(o)?l.control(o).focus({completeCallback:function(){var e=l.control(o).container;e.hasClass("button-see-me")||(e.addClass("button-see-me"),_.delay(function(){e.removeClass("button-see-me")},800))}}):(a.cleanRegistered(),_do_register_=function(){_.each(t,function(o,n){if(a.isUIControlAlreadyRegistered(o.settingControlId))l.section(l.control(o.settingControlId).section()).expanded(!0);else{if(!l.has(o.settingControlId)){var t=function(e,t,i){try{a.updateAPISettingAndExecutePreviewActions({defaultPreviewAction:"refresh_stylesheet",uiParams:s,options_type:n,settingParams:{to:e,from:t,args:i}})}catch(e){l.errare("::generateUIforLevelOptions => Error in updateAPISettingAndExecutePreviewActions",e)}};l(o.settingControlId,function(e){e.bind(_.debounce(t,a.SETTING_UPDATE_BUFFER))});var e=c[n]||{},i=a.getModuleStartingValue(o.module_type);if("no_starting_value"!==i&&_.isObject(i)){var r=d.extend(!0,{},i);e=d.extend(r,e)}l.CZR_Helpers.register({origin:"nimble",level:s.level,what:"setting",id:o.settingControlId,dirty:!1,value:e,transport:"postMessage",type:"_nimble_ui_"})}l.CZR_Helpers.register({origin:"nimble",level:s.level,level_id:s.id,what:"control",id:o.settingControlId,label:o.controlLabel,type:"czr_module",module_type:o.module_type,section:s.id,priority:20,settings:{default:o.settingControlId}}).done(function(){}),l.control(o.settingControlId,function(e){!0===o.expandAndFocusOnInit&&e.focus({completeCallback:function(){}}),e.container.attr("data-sek-expanded","false");var t=e.container.find("label > .customize-control-title"),i=t.html();t.html(['<span class="sek-ctrl-accordion-title">',i,"</span>"].join("")),_.isUndefined(o.icon)||t.addClass("sek-flex-vertical-center").prepend(o.icon),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),o.isPro&&!sektionsLocalizedData.isPro&&t.append(['<img class="sek-pro-icon-next-title" src="',sektionsLocalizedData.baseUrl,"/assets/czr/sek/img/pro_orange.svg?ver="+sektionsLocalizedData.nimbleVersion,'"/>'].join("")),e.container.attr("data-sek-expanded","false"),!0===o.expandAndFocusOnInit&&"false"==e.container.attr("data-sek-expanded")&&t.trigger("click")})}})},l.section(s.id,function(e){_do_register_(),"module"===s.level&&a.generateModuleOptionSwitcherUI(s.id,s.action),e.container.find(".accordion-section-title").first().hide();var t=e.container.find(".customize-section-title h3");0<t.length&&t.find(".sek-level-option-icon").length<1&&t.find(".customize-action").after('<i class="fas fa-sliders-h sek-level-option-icon"></i>'),a.scheduleModuleAccordion.call(e,{expand_first_control:!1})}),l.CZR_Helpers.register({origin:"nimble",what:"section",id:s.id,title:sektionsLocalizedData.i18n["Settings for the"]+" "+s.level,panel:sektionsLocalizedData.sektionsPanelId,priority:10}).done(function(){})),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{getLocalSkopeOptionId:function(){var e=l.czr_skopeBase.getSkopeProperty("skope_id");return _.isEmpty(e)?(l.errare("czr_sektions::getLocalSkopeOptionId => empty skope_id "),""):sektionsLocalizedData.optPrefixForSektionsNotSaved+e+"__localSkopeOptions"},generateUIforLocalSkopeOptions:function(s,e){var a=this,i=a.getLocalSkopeOptionId();if(a.isUIControlAlreadyRegistered(i))return e;if(a.localOptionsRegistrationParams={},_.isUndefined(sektionsLocalizedData.localOptionsMap)||!_.isObject(sektionsLocalizedData.localOptionsMap))return l.errare("::generateUIforGlobalOptions => missing or invalid localOptionsMap"),e;!0===s.clean_settings&&a.cleanRegisteredLocalOptionSettings(),_.each(sektionsLocalizedData.localOptionsMap,function(e,t){switch(t){case"template":a.localOptionsRegistrationParams[t]={settingControlId:i+"__template",module_type:e,controlLabel:sektionsLocalizedData.i18n["Page template"],expandAndFocusOnInit:!1,icon:'<i class="material-icons sek-level-option-icon">check_box_outline_blank</i>'};break;case"local_header_footer":a.localOptionsRegistrationParams[t]={settingControlId:i+"__local_header_footer",module_type:e,controlLabel:sektionsLocalizedData.i18n["Page header and footer"],icon:'<i class="material-icons sek-level-option-icon">web</i>'};break;case"widths":a.localOptionsRegistrationParams[t]={settingControlId:i+"__widths",module_type:e,controlLabel:sektionsLocalizedData.i18n["Inner and outer widths"],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'};break;case"custom_css":a.localOptionsRegistrationParams[t]={settingControlId:i+"__custom_css",module_type:e,controlLabel:sektionsLocalizedData.i18n["Custom CSS"],icon:'<i class="material-icons sek-level-option-icon">code</i>'};break;case"local_performances":a.localOptionsRegistrationParams[t]={settingControlId:i+"__local_performances",module_type:e,controlLabel:sektionsLocalizedData.i18n["Page speed optimizations"],icon:'<i class="material-icons sek-level-option-icon">network_check</i>'};break;case"local_reset":a.localOptionsRegistrationParams[t]={settingControlId:i+"__local_reset",module_type:e,controlLabel:sektionsLocalizedData.i18n["Reset the sections in this page"],icon:'<i class="material-icons sek-level-option-icon">cached</i>'};break;case"local_revisions":a.localOptionsRegistrationParams[t]={settingControlId:i+"__local_revisions",module_type:e,controlLabel:sektionsLocalizedData.i18n["Revision history of local sections"],icon:'<i class="material-icons sek-level-option-icon">history</i>'};break;case"import_export":a.localOptionsRegistrationParams[t]={settingControlId:i+"__local_imp_exp",module_type:e,controlLabel:sektionsLocalizedData.i18n["Export / Import"],icon:'<i class="material-icons sek-level-option-icon">import_export</i>'};break;default:l.errare("::generateUIforLocalOptions => an option group could not be registered => "+e,t)}});var t=l(a.localSectionsSettingId())(),c=d.extend(!0,{},_.isObject(t.local_options)?t.local_options:{});return _do_register_=function(){_.each(a.localOptionsRegistrationParams,function(o,n){var e=a.getModuleStartingValue(o.module_type),t=_.isObject(c[n])?c[n]:{};if(!l.has(o.settingControlId)){var i=function(e,t,i){try{a.updateAPISettingAndExecutePreviewActions({defaultPreviewAction:"refresh_preview",uiParams:s,options_type:n,settingParams:{to:e,from:t,args:i}})}catch(e){l.errare("::generateUIforLocalSkopeOptions => Error in updateAPISettingAndExecutePreviewActions",e)}};if(l(o.settingControlId,function(e){e.bind(_.debounce(i,a.SETTING_UPDATE_BUFFER))}),"no_starting_value"!==e&&_.isObject(e)){var r=d.extend(!0,{},e);t=d.extend(r,t)}l.CZR_Helpers.register({origin:"nimble",level:s.level,what:"setting",id:o.settingControlId,dirty:!1,value:t,transport:"postMessage",type:"_nimble_ui_"})}l.CZR_Helpers.register({origin:"nimble",level:s.level,what:"control",id:o.settingControlId,label:o.controlLabel,type:"czr_module",module_type:o.module_type,section:a.SECTION_ID_FOR_LOCAL_OPTIONS,priority:10,settings:{default:o.settingControlId}}).done(function(){l.control(o.settingControlId,function(e){e.container.attr("data-sek-expanded","false");var t=e.container.find("label > .customize-control-title"),i=t.html();t.html(['<span class="sek-ctrl-accordion-title">',i,"</span>"].join("")),_.isUndefined(o.icon)||t.addClass("sek-flex-vertical-center").prepend(o.icon),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false"),!0===o.expandAndFocusOnInit&&"false"==e.container.attr("data-sek-expanded")&&t.trigger("click")})})})},_do_register_(),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{generateUIforGlobalOptions:function(s,e){var a=this,i=sektionsLocalizedData.optPrefixForSektionsNotSaved+sektionsLocalizedData.optNameForGlobalOptions;if(a.isUIControlAlreadyRegistered(i))return e;var o={};if(_.isUndefined(sektionsLocalizedData.globalOptionsMap)||!_.isObject(sektionsLocalizedData.globalOptionsMap))return l.errare("::generateUIforGlobalOptions => missing or invalid globalOptionsMap"),e;_.each(sektionsLocalizedData.globalOptionsMap,function(e,t){switch(t){case"global_text":o[t]={settingControlId:i+"__global_text",module_type:e,controlLabel:sektionsLocalizedData.i18n["Global text options for Nimble sections"],icon:'<i class="material-icons sek-level-option-icon">text_format</i>'};break;case"widths":o[t]={settingControlId:i+"__widths",module_type:e,controlLabel:sektionsLocalizedData.i18n["Site wide inner and outer sections widths"],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'};break;case"breakpoint":o[t]={settingControlId:i+"__breakpoint",module_type:e,controlLabel:sektionsLocalizedData.i18n["Site wide breakpoint for Nimble sections"],expandAndFocusOnInit:!1,icon:'<i class="material-icons sek-level-option-icon">devices</i>'};break;case"global_header_footer":o[t]={settingControlId:i+"__header_footer",module_type:e,controlLabel:sektionsLocalizedData.i18n["Site wide header and footer"],icon:'<i class="material-icons sek-level-option-icon">web</i>'};break;case"performances":o[t]={settingControlId:i+"__performances",module_type:e,controlLabel:sektionsLocalizedData.i18n["Site wide page speed optimizations"],icon:'<i class="material-icons sek-level-option-icon">network_check</i>'};break;case"recaptcha":o[t]={settingControlId:i+"__recaptcha",module_type:e,controlLabel:sektionsLocalizedData.i18n["Protect your contact forms with Google reCAPTCHA"],icon:'<i class="material-icons sek-level-option-icon">security</i>'};break;case"global_revisions":o[t]={settingControlId:i+"__global_revisions",module_type:e,controlLabel:sektionsLocalizedData.i18n["Revision history of global sections"],icon:'<i class="material-icons sek-level-option-icon">history</i>'};break;case"global_imp_exp":o[t]={settingControlId:i+"__global_imp_exp",module_type:e,controlLabel:sektionsLocalizedData.i18n["Export / Import global sections"],icon:'<i class="material-icons sek-level-option-icon">import_export</i>'};break;case"global_reset":o[t]={settingControlId:i+"__global_reset",module_type:e,controlLabel:sektionsLocalizedData.i18n["Reset the sections displayed in global locations"],icon:'<i class="material-icons sek-level-option-icon">cached</i>'};break;case"beta_features":o[t]={settingControlId:i+"__beta_features",module_type:e,controlLabel:sektionsLocalizedData.i18n["Beta features"],icon:'<i class="material-icons sek-level-option-icon">widgets</i>'};break;default:l.errare("::generateUIforGlobalOptions => an option group could not be registered => "+e,t)}});var c=sektionsLocalizedData.globalOptionDBValues;return _do_register_=function(){_.each(o,function(o,n){if(!l.has(o.settingControlId)){var t=function(e,t,i){try{a.updateAPISettingAndExecutePreviewActions({isGlobalOptions:!0,defaultPreviewAction:"refresh_preview",uiParams:s,options_type:n,settingParams:{to:e,from:t,args:i}})}catch(e){l.errare("::generateUIforGlobalOptions => Error in updateAPISettingAndExecutePreviewActions",e)}};l(o.settingControlId,function(e){e.bind(_.debounce(t,a.SETTING_UPDATE_BUFFER))});var e=a.getModuleStartingValue(o.module_type),i=_.isObject(c)&&!_.isEmpty(c[n])?c[n]:{};if("no_starting_value"!==e&&_.isObject(e)){var r=d.extend(!0,{},e);i=d.extend(r,i)}l.CZR_Helpers.register({origin:"nimble",level:s.level,what:"setting",id:o.settingControlId,dirty:!1,value:i,transport:"postMessage",type:"_nimble_ui_"})}l.CZR_Helpers.register({origin:"nimble",level:s.level,what:"control",id:o.settingControlId,label:o.controlLabel,type:"czr_module",module_type:o.module_type,section:a.SECTION_ID_FOR_GLOBAL_OPTIONS,priority:20,settings:{default:o.settingControlId},track:!1}).done(function(){l.control(o.settingControlId,function(e){e.container.attr("data-sek-expanded","false");var t=e.container.find("label > .customize-control-title"),i=t.html();t.html(['<span class="sek-ctrl-accordion-title">',i,"</span>"].join("")),_.isUndefined(o.icon)||t.addClass("sek-flex-vertical-center").prepend(o.icon),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false"),!0===o.expandAndFocusOnInit&&"false"==e.container.attr("data-sek-expanded")&&t.trigger("click")})})})},_do_register_(),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(m,f){f.extend(CZRSeksPrototype,{updateAPISetting:function(l){var d=this;(l=l||{}).is_global_location="global"===l.scope||d.isGlobalLocation(l);var u=l.is_global_location?d.getGlobalSectionsSettingId():d.localSectionsSettingId(),p=m(u)();d.updAPISetParams={params:l,promise:f.Deferred(),newSetValue:_.isObject(p)?f.extend(!0,{},p):d.getDefaultSektionSettingValue(l.is_global_location?"global":"local"),cloneId:"",sectionInjectPromise:"_not_injection_scenario_"};return m(u,function(e){!function(){switch(d.updAPISetParams.newSetValue.collection=_.isArray(d.updAPISetParams.newSetValue.collection)?d.updAPISetParams.newSetValue.collection:d.getDefaultSektionSettingValue(l.is_global_location?"global":"local").collection,l.action){case"sek-maybe-add-missing-locations":var t,i;d.activeLocations(),f.extend(!0,[],d.updAPISetParams.newSetValue.collection),_.each(d.activeLocations(),function(e){t=_.findWhere(d.updAPISetParams.newSetValue.collection,{id:e}),_.isUndefined(t)&&((i=f.extend(!0,{},sektionsLocalizedData.defaultLocationModel)).id=e,m.infoLog("=> adding missing location to api setting value",i),d.updAPISetParams.newSetValue.collection.push(i))});break;case"sek-add-section":d._updAPISet_sek_add_sektion();break;case"sek-duplicate-section":d._updAPISet_sek_duplicate_sektion();break;case"sek-remove-section":d._updAPISet_sek_remove_sektion();break;case"sek-move-section":d._updAPISet_sek_move_sektion();break;case"sek-move-section-up-down":d._updAPISet_sek_move_sektion_up_down();break;case"sek-add-column":d._updAPISet_sek_add_column();break;case"sek-remove-column":d._updAPISet_sek_remove_column();break;case"sek-duplicate-column":d._updAPISet_sek_duplicate_column();break;case"sek-resize-columns":d._updAPISet_sek_resize_column();break;case"sek-move-column":d._updAPISet_sek_move_column();break;case"sek-add-module":d._updAPISet_sek_add_module();break;case"sek-duplicate-module":d._updAPISet_sek_duplicate_module();break;case"sek-remove-module":d._updAPISet_sek_remove_module();break;case"sek-move-module":d._updAPISet_sek_move_module();break;case"sek-set-module-value":d._updAPISet_sek_set_module_value();break;case"sek-add-content-in-new-sektion":d._updAPISet_sek_add_content_in_new_sektion();break;case"sek-add-preset-section-in-new-nested-sektion":d._updAPISet_sek_add_preset_sektion_in_new_nested_sektion();break;case"sek-import-from-file":d._updAPISet_sek_import_from_file();break;case"sek-import-tmpl-from-gallery":d._updAPISet_sek_import_tmpl_from_gallery();break;case"sek-generate-level-options-ui":var e=d.getLevelModel(l.id,d.updAPISetParams.newSetValue.collection),o={};if("no_match"===e){m.errare("updateAPISetting => "+l.action+" => no parent sektion matched"),d.updAPISetParams.promise.reject("updateAPISetting => "+l.action+" => no parent sektion matched");break}var n=f.extend(!0,{},e.options||{});_.each(l.value||{},function(e,t){!_.isBoolean(e)&&_.isEmpty(e+"")||(o[t]=e)}),_.isEmpty(l.options_type)&&m.errare("updateAPISetting => "+l.action+" => missing options_type"),n[l.options_type]=o,e.options=n;break;case"sek-generate-local-skope-options-ui":o={};var r=f.extend(!0,{},_.isObject(d.updAPISetParams.newSetValue.local_options)?d.updAPISetParams.newSetValue.local_options:{});if(_.each(l.value||{},function(e,t){!_.isBoolean(e)&&_.isEmpty(e+"")||(o[t]=e)}),_.isEmpty(l.options_type)||!_.isString(l.options_type))m.errare("updateAPISetting => "+l.action+" => missing options_type");else{var s={};s[l.options_type]=o,d.updAPISetParams.newSetValue.local_options=f.extend(r,s)}break;case"sek-update-fonts":var a=d.sniffGFonts({is_global_location:l&&!0===l.is_global_location});!_.isEmpty(l.font_family)&&_.isString(l.font_family)&&-1<l.font_family.indexOf("gfont")&&!_.contains(a,l.font_family)&&a.push(l.font_family),d.updAPISetParams.newSetValue.fonts=a;break;case"sek-restore-revision":d.updAPISetParams.newSetValue=l.revision_value;break;case"sek-reset-collection":try{d.updAPISetParams.newSetValue=m.czr_sektions.resetCollectionSetting(l.scope)}catch(e){m.errare("sek-reset-collection => error when firing resetCollectionSetting()",e)}}if("pending"==d.updAPISetParams.promise.state()){var c=function(){var e=l.settingParams&&l.settingParams.from&&l.settingParams.to;e&&_.isEqual(l.settingParams.from,l.settingParams.to)?d.updAPISetParams.promise.reject("updateAPISetting => main sektion setting change => the new setting value is unchanged when firing action : "+l.action):!e&&_.isEqual(p,d.updAPISetParams.newSetValue)?d.updAPISetParams.promise.reject("updateAPISetting => the new setting value is unchanged when firing action : "+l.action):null!==d.validateSettingValue(d.updAPISetParams.newSetValue,l.is_global_location?"global":"local")?(m(u)(d.updAPISetParams.newSetValue,l),l.cloneId=d.updAPISetParams.cloneId,d.updAPISetParams.promise.resolve(l)):d.updAPISetParams.promise.reject("Validation problem for action "+l.action)};"_not_injection_scenario_"===d.updAPISetParams.sectionInjectPromise?(c(),"pending"===d.updAPISetParams.promise.state()&&m.errare("::updateAPISetting => The self.updAPISetParams.promise has not been resolved properly.")):d.updAPISetParams.sectionInjectPromise.done(function(){c(),"pending"===d.updAPISetParams.promise.state()&&m.errare("::updateAPISetting => The self.updAPISetParams.promise has not been resolved properly.")}).fail(function(e){m.errare("updateAPISetting => self.updAPISetParams.sectionInjectPromise failed",e)})}}()}),d.updAPISetParams.promise.promise()},resetColumnsWidthInSection:function(e){_.each(e.collection,function(e){e.options&&e.options.width&&e.options.width["custom-width"]&&(e.options.width=_.omit(e.options.width,"custom-width")),e.width=""})},_maybeFetchSectionsFromServer:function(){var e,t=f.Deferred();return _.isEmpty(m.sek_presetSections)?(_.isUndefined(m.sek_fetchingPresetSections)||"pending"!=m.sek_fetchingPresetSections.state()?(e=wp.ajax.post("sek_get_preset_sections",{nonce:m.settings.nonce.save}),m.sek_fetchingPresetSections=e):e=m.sek_fetchingPresetSections,e.done(function(e){m.sek_presetSections=e,t.resolve(m.sek_presetSections)}).fail(function(e){t.reject(e)})):t.resolve(m.sek_presetSections),t.promise()},getPresetSectionCollection:function(o){var n=this,r=f.Deferred();return o.is_user_section?wp.ajax.post("sek_get_user_section_json",{nonce:m.settings.nonce.save,section_post_name:o.presetSectionId}).done(function(e){if(!_.isObject(e)||_.isEmpty(e)||_.isUndefined(e.data))throw m.errare("getPresetSectionCollection => preset section type not found or empty : "+o.presetSectionId,e),new Error("getPresetSectionCollection => preset section type not found or empty");var t=f.extend({},!0,e.data);t.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+n.guid(),t.collection=n.setPresetOrUserSectionIds(t.collection),t.ver_ini=sektionsLocalizedData.nimbleVersion,t.collection=n.setPresetSectionVersion(t.collection),r.resolve(t)}).fail(function(e){r.reject(e)}):n._maybeFetchSectionsFromServer().fail(function(e){r.reject(e)}).done(function(e){var t=f.extend(!0,{},_.isObject(e)?e:{});if(_.isEmpty(t))throw new Error("getPresetSectionCollection => Invalid collection");if(_.isEmpty(t[o.presetSectionId]))throw new Error('getPresetSectionCollection => the preset section : "'+o.presetSectionId+'" has not been found in the collection');var i=t[o.presetSectionId];i.collection=n.setPresetOrUserSectionIds(i.collection),i.ver_ini=sektionsLocalizedData.nimbleVersion,i.collection=n.setPresetSectionVersion(i.collection),r.resolve(i)}),r.promise()},setPresetOrUserSectionIds:function(e){var t=this;return _.isArray(e)&&_.each(e,function(e){e.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+t.guid(),_.isArray(e.collection)&&t.setPresetOrUserSectionIds(e.collection)}),e},setPresetSectionVersion:function(e){var t=this;return _.each(e,function(e){e.ver_ini=sektionsLocalizedData.nimbleVersion,_.isArray(e.collection)&&t.setPresetSectionVersion(e.collection)}),e},preparePresetSectionForInjection:function(n){var i=this,o={},r=f.Deferred();i.maybeGenerateNewItemIdsForCrudModules(n);var s=function(e){return _.each(e,function(e,t){_.isObject(e)||_.isArray(e)?s(e):_.isString(e)&&-1!=e.indexOf("__img_url__")&&(_.has(o,e)||(o[e]=i.importAttachment(e.replace("__img_url__",""))))}),o},a=function(i,o){return _.each(i,function(e,t){_.isObject(e)||_.isArray(e)?a(e,o):_.isString(e)&&-1!=e.indexOf("__img_url__")&&_.has(o,e)&&_.isObject(o[e])&&(i[t]=o[e].id)}),n};return i.whenAllPromisesInParallel(s(n)).done(function(e){var t=a(n,e);r.resolve(t)}).fail(function(e){r.reject(e)}),r.promise()}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(y,b){b.extend(CZRSeksPrototype,{_updAPISet_sek_add_sektion:function(){var i,e,t,o,n=this;if(i=n.updAPISetParams.params,_.isEmpty(i.id))throw new Error("updateAPISetting => "+i.action+" => missing id");if(_.isEmpty(i.location))throw new Error("updateAPISetting => "+i.action+" => missing location");if(!0===i.is_nested)e=n.getLevelModel(i.in_column,n.updAPISetParams.newSetValue.collection),"no_match"==(t=n.getLevelModel(i.in_sektion,n.updAPISetParams.newSetValue.collection))?n.updAPISetParams.promise.reject("updateAPISetting => "+i.action+" => no grand parent sektion found"):!0===t.is_nested?(n.updAPISetParams.promise.reject(""),y.previewer.trigger("sek-notify",{type:"info",duration:3e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["You've reached the maximum number of allowed nested sections."]+"</strong>","</span>"].join("")})):"no_match"==e?(y.errare("updateAPISetting => "+i.action+" => no parent column matched"),n.updAPISetParams.promise.reject("updateAPISetting => "+i.action+" => no parent column matched")):(e.collection=_.isArray(e.collection)?e.collection:[],e.collection.push({id:i.id,level:"section",collection:[{id:sektionsLocalizedData.optPrefixForSektionsNotSaved+n.guid(),level:"column",collection:[],ver_ini:sektionsLocalizedData.nimbleVersion}],is_nested:!0,ver_ini:sektionsLocalizedData.nimbleVersion}));else if("no_match"==(o=n.getLevelModel(i.location,n.updAPISetParams.newSetValue.collection)))y.errare("updateAPISetting => "+i.action+" => no location matched"),n.updAPISetParams.promise.reject("updateAPISetting => "+i.action+" => no location matched");else{var r=0;o.collection=_.isArray(o.collection)?o.collection:[],_.each(o.collection,function(e,t){i.before_section===e.id&&(r=t),i.after_section===e.id&&(r=t+1)}),o.collection=_.isArray(o.collection)?o.collection:[],o.collection.splice(r,0,{id:i.id,level:"section",collection:[{id:sektionsLocalizedData.optPrefixForSektionsNotSaved+n.guid(),level:"column",collection:[],ver_ini:sektionsLocalizedData.nimbleVersion}],ver_ini:sektionsLocalizedData.nimbleVersion})}},_updAPISet_sek_duplicate_sektion:function(){var t,e,i,o,n=this;if(t=n.updAPISetParams.params,_.isEmpty(t.id))throw new Error("updateAPISetting => "+t.action+" => missing id");if(_.isEmpty(t.location))throw new Error("updateAPISetting => "+t.action+" => missing location");try{o=n.cloneLevel(t.id)}catch(e){return void y.errare("updateAPISetting => "+t.action,e)}n.maybeGenerateNewItemIdsForCrudModules(o);var r=n.getLevelPositionInCollection(t.id,n.updAPISetParams.newSetValue.collection);if(!0===t.is_nested){if("no_match"==(e=n.getLevelModel(t.in_column,n.updAPISetParams.newSetValue.collection)))return y.errare("updateAPISetting => "+t.action+" => no parent column matched"),void n.updAPISetParams.promise.reject("updateAPISetting => "+t.action+" => no parent column matched");e.collection=_.isArray(e.collection)?e.collection:[],e.collection.splice(parseInt(r+1,10),0,o)}else{if("no_match"==(i=n.getLevelModel(t.location,n.updAPISetParams.newSetValue.collection)))return y.errare("updateAPISetting => "+t.action+" => no location matched"),void n.updAPISetParams.promise.reject("updateAPISetting => "+t.action+" => no location matched");i.collection=_.isArray(i.collection)?i.collection:[],i.collection.splice(parseInt(r+1,10),0,o)}n.updAPISetParams.cloneId=o.id},_updAPISet_sek_remove_sektion:function(){var t,e,i,o=this;if(!0===(t=o.updAPISetParams.params).is_nested)"no_match"!=(e=o.getLevelModel(t.in_column,o.updAPISetParams.newSetValue.collection))?(e.collection=_.isArray(e.collection)?e.collection:[],e.collection=_.filter(e.collection,function(e){return e.id!=t.id})):y.errare("updateAPISetting => "+t.action+" => no parent column matched");else{if("no_match"==(i=o.getLevelModel(t.location,o.updAPISetParams.newSetValue.collection)))return y.errare("updateAPISetting => "+t.action+" => no location matched"),void o.updAPISetParams.promise.reject("updateAPISetting => "+t.action+" => no location matched");i.collection=_.filter(i.collection,function(e){return e.id!=t.id})}},_updAPISet_sek_move_sektion:function(){var t,i,o,n=this;t=n.updAPISetParams.params;var e,r,s=n.getLevelModel(t.to_location,n.updAPISetParams.newSetValue.collection);if(_.isEmpty(s)||"no_match"==s)throw new Error("updateAPISetting => "+t.action+" => missing target location");if(t.from_location!=t.to_location){var a=n.getLevelModel(t.from_location,n.updAPISetParams.newSetValue.collection);if(_.isEmpty(a)||"no_match"==a)throw new Error("updateAPISetting => "+t.action+" => missing source location");a.collection=_.isArray(a.collection)?a.collection:[],e=n.getLevelModel(t.id,a.collection),r=b.extend(!0,{},e),a.collection=_.filter(a.collection,function(e){return e.id!=t.id})}s.collection=_.isArray(s.collection)?s.collection:[],i=b.extend(!0,[],s.collection),o=[],_.each(t.newOrder,function(e){if(t.from_location!=t.to_location&&e==r.id)o.push(r);else{if(sektionCandidate=n.getLevelModel(e,i),_.isEmpty(sektionCandidate)||"no_match"==sektionCandidate)throw new Error("updateAPISetting => "+t.action+" => missing section candidate");o.push(sektionCandidate)}}),s.collection=o},_updAPISet_sek_move_sektion_up_down:function(){var t,e,i,o,n=this;if(t=n.updAPISetParams.params,e=n.getLevelModel(t.is_nested?t.in_column:t.location,n.updAPISetParams.newSetValue.collection),_.isEmpty(e)||"no_match"==e)throw new Error("updateAPISetting => "+t.action+" => missing target location");e.collection=_.isArray(e.collection)?e.collection:[],i=b.extend(!0,[],e.collection),o=b.extend(!0,[],e.collection);var r=_.findIndex(i,function(e){return e.id===t.id});if(-1===r)throw new Error("updateAPISetting => "+t.action+" => invalid index");var s,a,c=t.direction||"up",l=i.length===r+1,d=0===r,u=n.activeLocationsInfo(),p=_.isArray(u)?_.findWhere(u,{id:t.location}):{};s=_.isObject(p)&&p.is_global,a=_.isObject(p)&&p.is_header_footer;var m=[];_.isArray(u)&&_.each(n.activeLocationsInfo(),function(e){e.is_global||e.is_header_footer||m.push(e.id)});var f,g=_.findIndex(m,function(e){return e===t.location}),h=!t.is_nested&&!s&&!a,v=0===g,k=m.length===g+1;h&&l&&"up"!==c&&!k?(f=m[g+1],n.getLevelModel(f,n.updAPISetParams.newSetValue.collection).collection.unshift(i[r]),e.collection.pop(),t.new_location=f):h&&d&&"up"===c&&!v?(f=m[g-1],n.getLevelModel(f,n.updAPISetParams.newSetValue.collection).collection.push(i[r]),e.collection.shift(),t.new_location=f):"up"!==c&&i.length===r+1?y.previewer.trigger("sek-notify",{type:"info",duration:3e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["The section cannot be moved lower."]+"</strong>","</span>"].join("")}):"up"===c&&0===r?y.previewer.trigger("sek-notify",{type:"info",duration:3e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["The section cannot be moved higher."]+"</strong>","</span>"].join("")}):(o[r]=i["up"===c?r-1:r+1],o["up"===c?r-1:r+1]=i[r],e.collection=o)}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,t){t.extend(CZRSeksPrototype,{_updAPISet_sek_add_content_in_new_sektion:function(){var r,s,a,c=this;r=c.updAPISetParams.params;var e,i=0;if("no_match"==(a=c.getLevelModel(r.location,c.updAPISetParams.newSetValue.collection)))return l.errare("updateAPISetting => "+r.action+" => no location matched"),void c.updAPISetParams.promise.reject("updateAPISetting => "+r.action+" => no location matched");switch(a.collection=_.isArray(a.collection)?a.collection:[],_.each(a.collection,function(e,t){r.before_section===e.id&&(i=t),r.after_section===e.id&&(i=t+1)}),r.content_type){case"module":e=c.getModuleStartingValue(r.content_id),a.collection.splice(i,0,{id:r.id,level:"section",collection:[{id:sektionsLocalizedData.optPrefixForSektionsNotSaved+c.guid(),level:"column",collection:[{id:r.droppedModuleId,level:"module",module_type:r.content_id,value:"no_starting_value"!==e?e:null,ver_ini:sektionsLocalizedData.nimbleVersion}],ver_ini:sektionsLocalizedData.nimbleVersion}],ver_ini:sektionsLocalizedData.nimbleVersion});break;case"preset_section":c.updAPISetParams.sectionInjectPromise=t.Deferred();var o=function(e,i){var t=!1;if(!_.isEmpty(r.sektion_to_replace)){var o=c.getLevelModel(r.sektion_to_replace,c.updAPISetParams.newSetValue.collection);"no_match"===o&&(l.errare("updateAPISetting => "+r.action+" => no sektionToReplace matched"),c.updAPISetParams.promise.reject("updateAPISetting => "+r.action+" => no sektionToReplace matched")),t=!0===o.is_nested}var n=sektionsLocalizedData.optPrefixForSektionsNotSaved+c.guid();r.collection_of_preset_section_id=r.collection_of_preset_section_id||[],r.collection_of_preset_section_id.push(n),t?("no_match"===(s=c.getLevelModel(r.in_column,c.updAPISetParams.newSetValue.collection))&&(l.errare("updateAPISetting => "+r.action+" => no parent column matched"),c.updAPISetParams.promise.reject("updateAPISetting => "+r.action+" => no parent column matched")),s.collection=_.isArray(s.collection)?s.collection:[],_.each(s.collection,function(e,t){r.before_section===e.id&&(i=t),r.after_section===e.id&&(i=t+1)}),s.collection.splice(i,0,{id:n,is_nested:!0,level:"section",collection:e.collection,options:e.options||{},ver_ini:sektionsLocalizedData.nimbleVersion})):a.collection.splice(i,0,{id:n,level:"section",collection:e.collection,options:e.options||{},ver_ini:sektionsLocalizedData.nimbleVersion})};c.getPresetSectionCollection({is_user_section:r.is_user_section,presetSectionId:r.content_id}).fail(function(e){l.errare("updateAPISetting => "+r.action+" => Error with self.getPresetSectionCollection()",e),c.updAPISetParams.promise.reject("updateAPISetting => "+r.action+" => Error with self.getPresetSectionCollection()")}).done(function(e){var t;_.isObject(e)&&!_.isEmpty(e)||(l.errare("updateAPISetting => "+r.action+" => preset section type not found or empty : "+r.content_id,e),c.updAPISetParams.promise.reject("updateAPISetting => "+r.action+" => preset section type not found or empty")),t=e,c.preparePresetSectionForInjection(t).fail(function(e){c.updAPISetParams.promise.reject("updateAPISetting => error when preparePresetSectionForInjection => "+r.action+" => "+e),c.updAPISetParams.sectionInjectPromise.reject(e)}).done(function(e){"section"===e.collection[0].level?_.each(e.collection,function(e){o(e,i),i++}):o(e,i),c.updAPISetParams.sectionInjectPromise.resolve()})})}},_updAPISet_sek_add_preset_sektion_in_new_nested_sektion:function(){var o,n,e,r=this;if(o=r.updAPISetParams.params,"no_match"===(n=r.getLevelModel(o.in_column,r.updAPISetParams.newSetValue.collection)))return l.errare("updateAPISetting => "+o.action+" => no parent column matched"),void r.updAPISetParams.promise.reject("updateAPISetting => "+o.action+" => no parent column matched");var i=0;if(n.collection=_.isArray(n.collection)?n.collection:[],_.each(n.collection,function(e,t){o.before_module_or_nested_section===e.id&&(i=t),o.after_module_or_nested_section===e.id&&(i=t+1)}),"no_match"!=(e=r.getLevelModel(o.in_sektion,r.updAPISetParams.newSetValue.collection))){if(!0===e.is_nested)return r.updAPISetParams.promise.reject(""),void l.previewer.trigger("sek-notify",{type:"info",duration:3e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["You've reached the maximum number of allowed nested sections."]+"</strong>","</span>"].join("")});r.updAPISetParams.sectionInjectPromise=t.Deferred();r.getPresetSectionCollection({is_user_section:o.is_user_section,presetSectionId:o.content_id}).fail(function(){l.errare("updateAPISetting => "+o.action+" => Error with self.getPresetSectionCollection()",_er_),r.updAPISetParams.promise.reject("updateAPISetting => "+o.action+" => Error with self.getPresetSectionCollection()")}).done(function(e){var t;_.isObject(e)&&!_.isEmpty(e)||(l.errare("updateAPISetting => "+o.action+" => preset section type not found or empty : "+o.content_id,e),r.updAPISetParams.promise.reject("updateAPISetting => "+o.action+" => preset section type not found or empty")),t=e,r.preparePresetSectionForInjection(t).fail(function(e){r.updAPISetParams.promise.reject("updateAPISetting => error when preparePresetSectionForInjection => "+o.action+" => "+e),r.updAPISetParams.sectionInjectPromise.reject(e)}).done(function(e){var t=function(e,t){t=t||0;var i=sektionsLocalizedData.optPrefixForSektionsNotSaved+r.guid();o.collection_of_preset_section_id=o.collection_of_preset_section_id||[],o.collection_of_preset_section_id.push(i),n.collection.splice(t,0,{id:i,level:"section",collection:e.collection,options:e.options||{},is_nested:!0,ver_ini:sektionsLocalizedData.nimbleVersion})};"section"===e.collection[0].level?_.each(e.collection,function(e){t(e,i),i++}):t(e,i),r.updAPISetParams.sectionInjectPromise.resolve()})})}else r.updAPISetParams.promise.reject("updateAPISetting => "+o.action+" => no grand parent sektion found")}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{_updAPISet_sek_add_column:function(){var e,t,i=this;if(e=i.updAPISetParams.params,_.isEmpty(e.id))throw new Error("updateAPISetting => "+e.action+" => missing id");if("no_match"==(t=i.getLevelModel(e.in_sektion,i.updAPISetParams.newSetValue.collection)))return l.errare("updateAPISetting => "+e.action+" => no parent sektion matched"),void i.updAPISetParams.promise.reject("updateAPISetting => "+e.action+" => no parent sektion matched");t.collection=_.isArray(t.collection)?t.collection:[],i.MAX_NUMBER_OF_COLUMNS-1<_.size(t.collection)?i.updAPISetParams.promise.reject(sektionsLocalizedData.i18n["You've reached the maximum number of columns allowed in this section."]):(i.resetColumnsWidthInSection(t),t.collection.push({id:e.id,level:"column",collection:[],ver_ini:sektionsLocalizedData.nimbleVersion}))},_updAPISet_sek_remove_column:function(){var t,e,i=this;if(t=i.updAPISetParams.params,"no_match"!=(e=i.getLevelModel(t.in_sektion,i.updAPISetParams.newSetValue.collection))){if(1===_.size(e.collection))return void i.updAPISetParams.promise.reject(sektionsLocalizedData.i18n["A section must have at least one column."]);e.collection=_.isArray(e.collection)?e.collection:[],e.collection=_.filter(e.collection,function(e){return e.id!=t.id}),i.resetColumnsWidthInSection(e)}else l.errare("updateAPISetting => "+t.action+" => no parent sektion matched")},_updAPISet_sek_duplicate_column:function(){var t,e,i=this;if(t=i.updAPISetParams.params,_.isEmpty(t.id))throw new Error("updateAPISetting => "+t.action+" => missing id");if("no_match"==(e=i.getLevelModel(t.in_sektion,i.updAPISetParams.newSetValue.collection)))return l.errare("updateAPISetting => "+t.action+" => no parent sektion matched"),void i.updAPISetParams.promise.reject("updateAPISetting => "+t.action+" => no parent sektion matched");if(e.collection=_.isArray(e.collection)?e.collection:[],i.MAX_NUMBER_OF_COLUMNS-1<_.size(e.collection))i.updAPISetParams.promise.reject(sektionsLocalizedData.i18n["You've reached the maximum number of columns allowed in this section."]);else{var o;try{o=i.cloneLevel(t.id)}catch(e){return void l.errare("updateAPISetting => "+t.action,e)}i.maybeGenerateNewItemIdsForCrudModules(o);var n=i.getLevelPositionInCollection(t.id,i.updAPISetParams.newSetValue.collection);i.updAPISetParams.cloneId=o.id,e.collection.splice(parseInt(n+1,10),0,o),i.resetColumnsWidthInSection(e)}},_updAPISet_sek_resize_column:function(){var n,o=this;if(!((n=o.updAPISetParams.params).col_number<2)){var t=o.getLevelModel(n.resized_column,o.updAPISetParams.newSetValue.collection),i=o.getLevelModel(n.sister_column,o.updAPISetParams.newSetValue.collection);if("no_match"==t)return l.errare("updateAPISetting => "+n.action+" => no resized column matched"),void o.updAPISetParams.promise.reject("updateAPISetting => "+n.action+" => no resized column matched");var r=function(e,t){var i=d.extend(!0,{},e.options||{});return i.width=_.isObject(i.width)&&i.width["custom-width"]?i.width:{},i.width["custom-width"]=t,e.options=i,o.cachedElements.$body.find('[data-sek-width-range-column-id="'+e.id+'"]').val(t).trigger("input",{is_resize_column_trigger:!0}),t},e=r(t,parseFloat(n.resizedColumnWidthInPercent));e=parseFloat(e);var s=o.getLevelModel(n.in_sektion,o.updAPISetParams.newSetValue.collection),a=_.filter(s.collection,function(e){return e.id!=t.id&&e.id!=i.id}),c=parseFloat(e.toFixed(3));_.isEmpty(a)||_.each(a,function(e){var t,i,o;currentColWidth=(t=e,i="_not_set_",o=_.isObject(t.options)?t.options:{},!_.isEmpty(o)&&o.width&&o.width["custom-width"]&&(i=parseFloat(1*o.width["custom-width"])),i),("_not_set_"===currentColWidth||!_.isNumber(1*currentColWidth)||_.isEmpty(currentColWidth+"")||currentColWidth<1)&&(currentColWidth=r(e,parseFloat((100/n.col_number).toFixed(3)))),c=parseFloat((c+currentColWidth).toFixed(3))}),r(i,parseFloat((100-c).toFixed(3)))}},_updAPISet_sek_move_column:function(){var t,i=this;t=i.updAPISetParams.params;var e,o,n=i.getLevelModel(t.to_sektion,i.updAPISetParams.newSetValue.collection);if(_.isEmpty(n)||"no_match"==n)throw new Error("updateAPISetting => "+t.action+" => missing target sektion");if(t.from_sektion!=t.to_sektion){var r=i.getLevelModel(t.from_sektion,i.updAPISetParams.newSetValue.collection);if(_.isEmpty(r)||"no_match"==r)throw new Error("updateAPISetting => "+t.action+" => missing source column");r.collection=_.isArray(r.collection)?r.collection:[],e=i.getLevelModel(t.id,r.collection),o=d.extend(!0,{},e),r.collection=_.filter(r.collection,function(e){return e.id!=t.id}),i.resetColumnsWidthInSection(r)}n.collection=_.isArray(n.collection)?n.collection:[],originalCollection=d.extend(!0,[],n.collection),reorderedCollection=[],_.each(t.newOrder,function(e){if(t.from_sektion!=t.to_sektion&&e==o.id)reorderedCollection.push(o);else{if(columnCandidate=i.getLevelModel(e,originalCollection),_.isEmpty(columnCandidate)||"no_match"==columnCandidate)throw new Error("updateAPISetting => moveColumn => missing columnCandidate");reorderedCollection.push(columnCandidate)}}),n.collection=reorderedCollection,i.resetColumnsWidthInSection(n)}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(c,l){l.extend(CZRSeksPrototype,{_updAPISet_sek_add_module:function(){var i,e,t,o,n=this;if(i=n.updAPISetParams.params,_.isEmpty(i.id))throw new Error("updateAPISetting => "+i.action+" => missing id");if(_.isEmpty(i.module_type))throw new Error("updateAPISetting => "+i.action+" => missing module_type");if("no_match"===(e=n.getLevelModel(i.in_column,n.updAPISetParams.newSetValue.collection)))return c.errare("updateAPISetting => "+i.action+" => no parent column matched"),void n.updAPISetParams.promise.reject("updateAPISetting => "+i.action+" => no parent column matched");o=0,e.collection=_.isArray(e.collection)?e.collection:[],_.each(e.collection,function(e,t){i.before_module_or_nested_section===e.id&&(o=t),i.after_module_or_nested_section===e.id&&(o=t+1)});var r={id:i.id,level:"module",module_type:i.module_type,ver_ini:sektionsLocalizedData.nimbleVersion};"no_starting_value"!==(t=n.getModuleStartingValue(i.module_type))&&(r.value=t),e.collection.splice(o,0,r)},_updAPISet_sek_duplicate_module:function(){var t,e,i,o=this;if(t=o.updAPISetParams.params,_.isEmpty(t.id))throw new Error("updateAPISetting => "+t.action+" => missing id");if("no_match"==(e=o.getLevelModel(t.in_column,o.updAPISetParams.newSetValue.collection)))return c.errare("updateAPISetting => "+t.action+" => no parent column matched"),void o.updAPISetParams.promise.reject("updateAPISetting => "+t.action+" => no parent column matched");e.collection=_.isArray(e.collection)?e.collection:[];try{i=o.cloneLevel(t.id)}catch(e){return c.errare("updateAPISetting => "+t.action,e),void o.updAPISetParams.promise.reject("updateAPISetting => "+t.action+" => error when cloning the level")}o.maybeGenerateNewItemIdsForCrudModules(i);var n=o.getLevelPositionInCollection(t.id,o.updAPISetParams.newSetValue.collection);o.updAPISetParams.cloneId=i.id,e.collection.splice(parseInt(n+1,10),0,i)},_updAPISet_sek_remove_module:function(){var t,e;if(t=this.updAPISetParams.params,_.isEmpty(t.id))throw new Error("updateAPISetting => "+t.action+" => missing id");"no_match"!=(e=this.getLevelModel(t.in_column,this.updAPISetParams.newSetValue.collection))?(e.collection=_.isArray(e.collection)?e.collection:[],e.collection=_.filter(e.collection,function(e){return e.id!=t.id})):c.errare("updateAPISetting => "+t.action+" => no parent column matched")},_updAPISet_sek_move_module:function(){var t,e,i,o,n=this;if(t=n.updAPISetParams.params,e=n.getLevelModel(t.to_column,n.updAPISetParams.newSetValue.collection),_.isEmpty(e)||"no_match"==e)throw new Error("updateAPISetting => "+t.action+" => missing target column");if(t.from_column!=t.to_column){var r;if(r=n.getLevelModel(t.from_column,n.updAPISetParams.newSetValue.collection),_.isEmpty(r)||"no_match"==r)throw new Error("updateAPISetting => "+t.action+" => missing source column");r.collection=_.isArray(r.collection)?r.collection:[],i=n.getLevelModel(t.id,n.updAPISetParams.newSetValue.collection),o=l.extend(!0,{},i),r.collection=_.filter(r.collection,function(e){return e.id!=t.id})}e.collection=_.isArray(e.collection)?e.collection:[],originalCollection=l.extend(!0,[],e.collection);var s=[];if(_.each(t.newOrder,function(e){if(t.from_column!=t.to_column&&e==o.id)s.push(o);else{if(moduleCandidate=n.getLevelModel(e,n.updAPISetParams.newSetValue.collection),_.isEmpty(moduleCandidate)||"no_match"==moduleCandidate)throw new Error("updateAPISetting => "+t.action+" => missing moduleCandidate");s.push(moduleCandidate)}}),s.length!=_.uniq(s).length)throw new Error("updateAPISetting => "+t.action+" => there are duplicated modules in column : "+e.id);e.collection=s},_updAPISet_sek_set_module_value:function(){var e,t,i=this;e=i.updAPISetParams.params,t=i.getLevelModel(e.id,i.updAPISetParams.newSetValue.collection);var o=e.settingParams.args.moduleRegistrationParams.control,n=e.settingParams.args.moduleRegistrationParams.id,r=o.czr_Module(n);_.isEmpty(r)?c.errare("updateAPISetting => missing parentModuleInstance",e):isMultiItemModule=r.isMultiItem();var s=isMultiItemModule?[]:{};if(_.each(e.value||(isMultiItemModule?[]:{}),function(e,t){!_.isBoolean(e)&&_.isEmpty(e+"")||(s[t]=e)}),"no_match"==t)return c.errare("updateAPISetting => "+e.action+" => no module matched",e),void i.updAPISetParams.promise.reject("updateAPISetting => "+e.action+" => error no module matched");if(_.isEmpty(e.options_type))return c.errare("updateAPISetting => "+e.action+" => missing options_type"),void i.updAPISetParams.promise.reject("updateAPISetting => "+e.action+" => missing options_type");if("__no_option_group_to_be_updated_by_children_modules__"===e.options_type)t.value=s;else{var a=l.extend(!0,{},_.isEmpty(t.value)?{}:t.value);a[e.options_type]=s,t.value=a}}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(z,w){w.extend(CZRSeksPrototype,{_updAPISet_sek_import_from_file:function(){var o,n=this;if(o=n.updAPISetParams.params,_.isUndefined(o.imported_content.data)||_.isUndefined(o.imported_content.metas))z.errare("updateAPISetting::sek-import-from-file => invalid imported content",imported_content);else{var i=_.isArray(o.imported_content.data.collection)?w.extend(!0,[],o.imported_content.data.collection):[];if(!0===o.assign_missing_locations){var t,e=o.imported_content.metas.active_locations,r=z.czr_sektions.activeLocations();_.each(r,function(e){n.isHeaderLocation(e)||n.isFooterLocation(e)||t.push(e)});var s=_.first(t);if(!_.isEmpty(s)&&!_.isEmpty(e)&&_.isArray(e)){var a=w(e).not(t).get(),c=n.getLevelModel(s,n.updAPISetParams.newSetValue.collection),l=n.getLevelModel(s,o.imported_content.data.collection),d=[];c.collection=_.isArray(c.collection)?c.collection:[],l.collection=_.isArray(l.collection)?l.collection:[],_.each(e,function(e){var t=n.getLevelModel(e,i);_.isEmpty(t.collection)||(d=_.union(d,t.collection))}),l.collection=d,o.imported_content.data.collection=_.filter(o.imported_content.data.collection,function(e){return!_.contains(a,e.id)})}}if(!0===o.keep_existing_sections){_.each(i,function(e){var t=n.getLevelModel(e.id,n.updAPISetParams.newSetValue.collection);if(!_.isEmpty(t.collection)){var i=n.getLevelModel(e.id,o.imported_content.data.collection);i.collection=_.union(t.collection,i.collection)}});var u=n.updAPISetParams.newSetValue.fonts,p=o.imported_content.data.fonts;u&&!_.isEmpty(u)&&_.isArray(u)&&(p=_.isArray(p)?p:[],o.imported_content.data.fonts=_.uniq(_.union(u,p)))}n.updAPISetParams.newSetValue=o.imported_content.data}},_updAPISet_sek_import_tmpl_from_gallery:function(){var t,i=this;if(t=i.updAPISetParams.params,z.infoLog("sek-import-tmpl-from-gallery",t),_.isUndefined(t.imported_content.data)||_.isUndefined(t.imported_content.metas))z.errare("updateAPISetting::sek-import-tmpl-from-gallery => invalid imported content",imported_content);else{var o=function(e){return t.imported_content&&t.imported_content.metas&&e===t.imported_content.metas.tmpl_header_location},n=function(e){return t.imported_content&&t.imported_content.metas&&e===t.imported_content.metas.tmpl_footer_location},r=function(){var t=!1;return _.each(e,function(e){t||(o(e)||n(e))&&(t="no_match"!=(t=i.getLevelModel(e,s)))}),t&&!_.isEmpty(l.local_header_footer)},s=_.isArray(t.imported_content.data.collection)?w.extend(!0,[],t.imported_content.data.collection):[],e=t.imported_content.metas.tmpl_locations,a=[],c=i.updAPISetParams.newSetValue.collection;if(_.each(z.czr_sektions.activeLocations(),function(e){i.isGlobalLocationId(e)||a.push(e)}),_.isArray(e)&&!_.isEmpty(e)){var l=t.imported_content.data.local_options;l=w.extend(!0,{},_.isObject(l)?l:{});var d=t.imported_content.data.fonts;d=_.isArray(d)?w.extend(!0,[],d):[];var u,p,m,f,g=w.extend(!0,[],c),h=[],v="__not_set__";switch(_.each(s,function(e){o(e.id)||n(e.id)||_.isEmpty(e.collection)||(h=_.union(h,e.collection))}),t.tmpl_import_mode){case"replace":if(f=!0,_.each(e,function(e){f&&(f=_.contains(a,e))}),f){var k,y;g=[],_.each(c,function(e){m=_.findWhere(s,{id:e.id})||{},_.isEmpty(m.collection)?i.isHeaderLocation(e.id)||i.isFooterLocation(e.id)?g.push(e):(k={collection:[],options:[]},y=w.extend(!0,{},e),y=w.extend(y,k),g.push(y)):g.push(m)})}else{if(l&&l.template&&"nimble_template"===l.template.local_template?v="loop_start":_.contains(a,"loop_start")?v="loop_start":_.each(a,function(e){i.isHeaderLocation(e)||i.isFooterLocation(e)||(v=e)}),"__not_set__"===v){z.errare("updateAPISetting::sek-import-tmpl-from-gallery => target location id is empty");break}if("no_match"===(p=i.getLevelModel(v,g))){z.errare("::_updAPISet_sek_import_tmpl_from_gallery => error => target location id "+v);break}(p=w.extend(!0,{},p)).collection=h,g=[],r()&&_.each(e,function(e){if(o(e)||n(e)){if("no_match"===(m=i.getLevelModel(e,s)))return void z.errare("::_updAPISet_sek_import_tmpl_from_gallery => error => location id "+e+" not found in template collection");g.push(m)}}),_.each(a,function(e){v===e&&g.push(p),localLocModel=i.getLevelModel(e,c),"no_match"!==localLocModel?r()||(i.isHeaderLocation(e)||i.isFooterLocation(e))&&g.push(localLocModel):z.errare("::_updAPISet_sek_import_tmpl_from_gallery => error => location id "+e+" not found in current setting collection")})}break;case"before":if(_.each(a,function(e){"__not_set__"==v&&("no_match"!==(u=i.getLevelModel(e,g))?i.isHeaderLocation(e)||i.isFooterLocation(e)||_.isEmpty(u.collection)||(v=e,p=u):z.errare("::_updAPISet_sek_import_tmpl_from_gallery => error => location id not found"+e))}),"__not_set__"===v){z.errare("updateAPISetting::sek-import-tmpl-from-gallery => target location id is empty");break}(p=w.extend(!0,{},p)).collection=_.union(h,p.collection),g=[],_.each(a,function(e){if(v===e)g.push(p);else{if("no_match"===u)return void z.errare("::_updAPISet_sek_import_tmpl_from_gallery => error => location id not found"+e);g.push(i.getLevelModel(e,c))}});break;case"after":if(_.each(a.reverse(),function(e){"__not_set__"==v&&("no_match"!==(u=i.getLevelModel(e,g))?i.isHeaderLocation(e)||i.isFooterLocation(e)||_.isEmpty(u.collection)||(v=e,p=u):z.errare("::_updAPISet_sek_import_tmpl_from_gallery => error => location id not found"+e))}),"__not_set__"===v){z.errare("updateAPISetting::sek-import-tmpl-from-gallery => target location id is empty");break}(p=w.extend(!0,{},p)).collection=_.union(p.collection,h),g=[],_.each(a,function(e){if(v===e)g.push(p);else{if("no_match"===(u=i.getLevelModel(e,c)))return void z.errare("::_updAPISet_sek_import_tmpl_from_gallery => error => loc id not found"+e);g.push(u)}})}if(i.updAPISetParams.newSetValue.collection=g,!_.isEmpty(l)&&"replace"===t.tmpl_import_mode){var b=i.updAPISetParams.newSetValue.local_options;b=w.extend(!0,{},_.isObject(b)?b:{}),i.updAPISetParams.newSetValue.local_options=_.extend(b,l)}if(_.isArray(d)&&!_.isEmpty(d))if("replace"!=t.tmpl_import_mode){var I=i.updAPISetParams.newSetValue.fonts;I=w.extend(!0,[],_.isArray(I)?I:[]),i.updAPISetParams.newSetValue.fonts=_.uniq(_.union(d,I))}else i.updAPISetParams.newSetValue.fonts=d}else z.errare("updateAPISetting::sek-import-tmpl-from-gallery => invalid imported template locations",t)}}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(o,n){n.extend(CZRSeksPrototype,{cleanRegistered:function(t){var i=this,e=n.extend(!0,[],i.registered()||[]);o.trigger("sek-before-clean-registered"),e=_.filter(e,function(e){if("setting"!==e.what&&o[e.what].has(e.id)){if(!_.isEmpty(t)&&e.id!==t)return;_.isFunction(o[e.what](e.id).trigger)&&i.trigger("sek-ui-pre-removal",{what:e.what,id:e.id}),n.when(o[e.what](e.id).container.remove()).done(function(){o[e.what].remove(e.id),i.trigger("sek-ui-removed",{what:e.what,id:e.id})})}return"setting"===e.what}),i.registered(e)},cleanRegisteredLocalOptionSettings:function(){var t=this.getLocalSkopeOptionId(),e=n.extend(!0,[],this.registered()||[]);e=_.filter(e,function(e){return e.id&&-1!==e.id.indexOf(t)&&o.has(e.id)&&o.remove(e.id),e.id&&-1===e.id.indexOf(t)}),this.registered(e)},cleanRegisteredLevelSettingsAfterHistoryNavigation:function(){var e=n.extend(!0,[],this.registered()||[]);e=_.filter(e,function(e){return!_.isEmpty(e.level)&&"setting"===e.what&&o.has(e.id)&&o.remove(e.id),_.isEmpty(e.level)&&"setting"===e.what}),this.registered(e)}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(u,p){p.extend(CZRSeksPrototype,{rootPanelFocus:function(){u.section.has(u.czr_activeSectionId())?u.section(u.czr_activeSectionId()).expanded(!1):u.section.each(function(e){e.expanded(!1)}),u.panel.each(function(e){e.expanded(!1)})},guid:function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+e()},getGlobalSectionsSettingId:function(){return sektionsLocalizedData.settingIdForGlobalSections},getParentSectionFromColumnId:function(i,o){var s=this,a="no_match",c=function(i,e,o,n){if(_.isUndefined(e)){var t=u(o)(),r=_.isObject(t)?p.extend(!0,{},t):p.extend(!0,{},s.getDefaultSektionSettingValue(n));e=_.isArray(r.collection)?r.collection:[]}return _.each(e,function(e){var t;"no_match"==a&&("section"==e.level&&(t=_.findWhere(e.collection,{id:i})),_.isEmpty(t)?_.isArray(e.collection)&&c(i,e.collection,o,n):a=e)}),a};return _.isEmpty(o)?_.each({local:s.localSectionsSettingId(),global:s.getGlobalSectionsSettingId()},function(e,t){"no_match"===a&&c(i,o,e,t)}):c(i,o),a},isGlobalLocation:function(e){var t=!1;return e=e||{},_.has(e,"is_global_location")?t=e.is_global_location:_.has(e,"scope")?t="global"===e.scope:_.isEmpty(e.location)?_.isEmpty(e.in_sektion)?_.isEmpty(e.id)||(t=this.isChildOfAGlobalLocation(e.id)):t=this.isChildOfAGlobalLocation(e.in_sektion):t=this.isChildOfAGlobalLocation(e.location),t},isChildOfAGlobalLocation:function(e){var r=this,s=function(t,e){var i="no_match";if(_.isUndefined(e)){var o=u(r.getGlobalSectionsSettingId())(),n=_.isObject(o)?p.extend(!0,{},o):r.getDefaultSektionSettingValue("global");e=_.isArray(n.collection)?n.collection:[]}return _.each(e,function(e){"no_match"==i&&(t===e.id?i=e:_.isArray(e.collection)&&(i=s(t,e.collection)))}),i};return"no_match"!==s(e)},isGlobalLocationId:function(e){var t=this.activeLocationsInfo(),i=_.isArray(t)?_.findWhere(t,{id:e}):{};return _.isObject(i)&&i.is_global},isHeaderLocation:function(e){var t=this.activeLocationsInfo(),i=_.isArray(t)?_.findWhere(t,{id:e}):{};return _.isObject(i)&&i.is_header},isFooterLocation:function(e){var t=this.activeLocationsInfo(),i=_.isArray(t)?_.findWhere(t,{id:e}):{};return _.isObject(i)&&i.is_footer},getLevelModel:function(i,o){var s=this,a="no_match",c=function(t,e,i,o){if(_.isUndefined(e)){var n=u(i)(),r=_.isObject(n)?p.extend(!0,{},n):p.extend(!0,{},s.getDefaultSektionSettingValue(o));e=_.isArray(r.collection)?r.collection:[]}return _.each(e,function(e){"no_match"==a&&(t===e.id?a=e:_.isArray(e.collection)&&c(t,e.collection,i,o))}),a};return _.isEmpty(o)?_.each({local:s.localSectionsSettingId(),global:s.getGlobalSectionsSettingId()},function(e,t){"no_match"===a&&c(i,o,e,t)}):c(i,o),a},getLevelPositionInCollection:function(i,o){var s=this,a="no_match",c=function(i,e,o,n){if(_.isUndefined(e)){var t=u(o)(),r=_.isObject(t)?p.extend(!0,{},t):p.extend(!0,{},s.getDefaultSektionSettingValue(n));e=_.isArray(r.collection)?r.collection:[]}_.each(e,function(e,t){"no_match"==a&&(i===e.id?a=t:_.isArray(e.collection)&&c(i,e.collection,o,n))})};return _.isEmpty(o)?_.each({local:s.localSectionsSettingId(),global:s.getGlobalSectionsSettingId()},function(e,t){"no_match"===a&&c(i,e,t,o)}):c(i,o),a},getLevelProperty:function(e){if(e=_.extend({id:"",property:""},e),_.isEmpty(e.id))u.errare("getLevelProperty => invalid id provided");else{var t=this.getLevelModel(e.id);if("no_match"!=t){if(_.isObject(t))return t[e.property];u.errare("getLevelProperty => invalid model for id : "+e.id,t)}else u.errare("getLevelProperty => no level model found for id : "+e.id)}},cloneLevel:function(e){var t=this,i=t.getLevelModel(e);if("no_match"==i)throw new Error("cloneLevel => no match for level id : "+e);var o=p.extend(!0,{},i),n=function(e){if(_.isEmpty(e.id))throw new Error("cloneLevel => missing level id");if(e.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+t.guid(),!_.isEmpty(e.collection)){if(!_.isArray(e.collection))throw new Error("cloneLevel => the collection must be an array for level id : "+e.id);_.each(e.collection,function(e){e.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+t.guid(),n(e)})}return e};return n(o)},getDefaultItemModelFromRegisteredModuleData:function(e){if(!this.isModuleRegistered(e))return{};if(sektionsLocalizedData.registeredModules[e].is_father)return u.errare("getDefaultItemModelFromRegisteredModuleData => Father modules should be treated specifically"),{};var t=sektionsLocalizedData.registeredModules[e].tmpl["item-inputs"],i={id:"",title:""};return _.each(t,function(e,t){switch(t){case"tabs":_.each(e,function(e){_.each(e.inputs,function(e,t){i[t]=e.default||""})});break;default:i[t]=e.default||""}}),i},getRegisteredModuleProperty:function(e,t){return this.isModuleRegistered(e)?sektionsLocalizedData.registeredModules[e][t]:"not_set"},isModuleRegistered:function(e){return sektionsLocalizedData.registeredModules&&!_.isUndefined(sektionsLocalizedData.registeredModules[e])},isMultiItemsModule:function(e){return sektionsLocalizedData.registeredModules[e]&&!0===sektionsLocalizedData.registeredModules[e].is_crud},maybeGenerateNewItemIdsForCrudModules:function(t){var i=this;return(_.isArray(t)||_.isObject(t))&&_.each(t,function(e){_.isArray(t)&&_.isObject(e)&&e.id&&!_.has(e,"level")?-1===e.id.indexOf(sektionsLocalizedData.optPrefixForSektionsNotSaved)&&(e.id=i.guid()):(_.isArray(e)||_.isObject(e))&&i.maybeGenerateNewItemIdsForCrudModules(e)}),t},sniffGFonts:function(e){var n=this,r=[],s=function(i,o,e){if(_.isUndefined(e)){var t=u(i)();e=_.isObject(t)?p.extend(!0,{},t):p.extend(!0,{},n.getDefaultSektionSettingValue(o))}_.each(e,function(e,t){_.isString(t)&&"_css"===t.substr(t.length-4)&&!0===n.inputIsAFontFamilyModifier(t)&&-1<e.indexOf("gfont")&&!_.contains(r,e)&&r.push(e),(_.isArray(e)||_.isObject(e))&&s(i,o,e)})};return(e=e||{is_global_location:!1}).is_global_location?s(n.getGlobalSectionsSettingId(),"global"):s(n.localSectionsSettingId(),"local"),r},sniffAllFonts:function(){var n=this,r=[],s=function(i,o,e){if(_.isUndefined(e)){var t=u(i)();e=_.isObject(t)?p.extend(!0,{},t):p.extend(!0,{},n.getDefaultSektionSettingValue(o))}_.each(e,function(e,t){_.isString(t)&&_.isString(e)&&(-1<e.indexOf("[gfont]")||-1<e.indexOf("[cfont]"))&&r.push(e),(_.isArray(e)||_.isObject(e))&&s(i,o,e)})};return _.each([{id:n.localSectionsSettingId(),scope:"local"},{id:n.getGlobalSectionsSettingId(),scope:"global"},{id:sektionsLocalizedData.optNameForGlobalOptions,scope:"global"}],function(e){s(e.id,e.scope)}),r},getInputDefaultValue:function(i,o,e){var n=this;if(n.cachedDefaultInputValues=n.cachedDefaultInputValues||{},n.cachedDefaultInputValues[o]=n.cachedDefaultInputValues[o]||{},_.has(n.cachedDefaultInputValues[o],i))return n.cachedDefaultInputValues[o][i];if(_.isUndefined(sektionsLocalizedData.registeredModules))u.errare("getInputDefaultValue => missing sektionsLocalizedData.registeredModules");else if(_.isUndefined(sektionsLocalizedData.registeredModules[o]))u.errare("getInputDefaultValue => missing "+o+" in sektionsLocalizedData.registeredModules");else{if(!sektionsLocalizedData.registeredModules[o].is_father){_.isUndefined(e)&&(e=sektionsLocalizedData.registeredModules[o].tmpl);var r="no_default_value_specified";return _.each(e,function(e,t){"no_default_value_specified"===r&&(i!==t||_.isUndefined(e.default)||(r=e.default),"no_default_value_specified"===r&&(_.isArray(e)||_.isObject(e))&&(r=n.getInputDefaultValue(i,o,e)),"no_default_value_specified"!==r&&(n.cachedDefaultInputValues[o][i]=r))}),r}u.errare("getInputDefaultValue => Father modules should be treated specifically")}},getInputType:function(i,o,e){var n=this;if(n.cachedInputTypes=n.cachedInputTypes||{},n.cachedInputTypes[o]=n.cachedInputTypes[o]||{},_.has(n.cachedInputTypes[o],i))return n.cachedInputTypes[o][i];if(_.isUndefined(sektionsLocalizedData.registeredModules))u.errare("getInputType => missing sektionsLocalizedData.registeredModules");else if(_.isUndefined(sektionsLocalizedData.registeredModules[o]))u.errare("getInputType => missing "+o+" in sektionsLocalizedData.registeredModules");else{if(!sektionsLocalizedData.registeredModules[o].is_father){_.isUndefined(e)&&(e=sektionsLocalizedData.registeredModules[o].tmpl);var r="no_input_type_specified";return _.each(e,function(e,t){"no_input_type_specified"===r&&(i!==t||_.isUndefined(e.input_type)||(r=e.input_type),"no_input_type_specified"===r&&(_.isArray(e)||_.isObject(e))&&(r=n.getInputType(i,o,e)),"no_input_type_specified"!==r&&(n.cachedInputTypes[o][i]=r))}),r}u.errare("getInputType => Father modules should be treated specifically")}},getInputRegistrationParams:function(i,o,e){var n=this;if(n.cachedInputRegistrationParams=n.cachedInputRegistrationParams||{},n.cachedInputRegistrationParams[o]=n.cachedInputRegistrationParams[o]||{},_.has(n.cachedInputRegistrationParams[o],i))return n.cachedInputRegistrationParams[o][i];if(_.isUndefined(sektionsLocalizedData.registeredModules))u.errare("getInputRegistrationParams => missing sektionsLocalizedData.registeredModules");else if(_.isUndefined(sektionsLocalizedData.registeredModules[o]))u.errare("getInputRegistrationParams => missing "+o+" in sektionsLocalizedData.registeredModules");else{if(!sektionsLocalizedData.registeredModules[o].is_father){_.isUndefined(e)&&(e=sektionsLocalizedData.registeredModules[o].tmpl);var r={};return _.each(e,function(e,t){_.isEmpty(r)&&(i!==t||_.isUndefined(e.input_type)||(r=e),_.isEmpty(r)&&(_.isArray(e)||_.isObject(e))&&(r=n.getInputRegistrationParams(i,o,e)),_.isEmpty(r)||(n.cachedInputRegistrationParams[o][i]=r))}),r}u.errare("getInputRegistrationParams => Father modules should be treated specifically")}},inputIsAFontFamilyModifier:function(i,e){var o=this;if(o.cachedFontFamilyModifier=o.cachedFontFamilyModifier||{},_.has(o.cachedFontFamilyModifier,i))return o.cachedFontFamilyModifier[i];if(!_.isUndefined(sektionsLocalizedData.registeredModules)){_.isUndefined(e)&&(e=sektionsLocalizedData.registeredModules);var n="not_set";return _.each(e,function(e,t){"not_set"===n&&(i!==t||_.isUndefined(e.input_type)||(n=!_.isUndefined(e.refresh_fonts)&&e.refresh_fonts),"not_set"===n&&(_.isArray(e)||_.isObject(e))&&(n=o.inputIsAFontFamilyModifier(i,e)),"not_set"!==n&&(o.cachedFontFamilyModifier[i]=n))}),n}u.errare("inputIsAFontFamilyModifier => missing sektionsLocalizedData.registeredModules")},getModuleStartingValue:function(e){var a=this;if(!sektionsLocalizedData.registeredModules)return u.errare("getModuleStartingValue => missing sektionsLocalizedData.registeredModules"),"no_starting_value";if(_.isUndefined(sektionsLocalizedData.registeredModules[e]))return u.errare("getModuleStartingValue => the module type "+e+" is not registered"),"no_starting_value";var t,i,o,c=function(e){return readyStartValues=[],_.each(e,function(e){if(_.isObject(e)){var t=p.extend(!0,{},e);t.id=u.czr_sektions.guid(),readyStartValues.push(t)}else u.errare("getModuleStartingValue => multi-item module => items should be objects for module "+mod_type)}),readyStartValues},l={},d=(t=e,sektionsLocalizedData.registeredModules[t]&&sektionsLocalizedData.registeredModules[t].starting_value?sektionsLocalizedData.registeredModules[t].starting_value:{});return o=e,sektionsLocalizedData.registeredModules[o]&&!0===sektionsLocalizedData.registeredModules[o].is_father?_.each((i=e,sektionsLocalizedData.registeredModules[i]&&sektionsLocalizedData.registeredModules[i].children?sektionsLocalizedData.registeredModules[i].children:{}),function(e,t){var i,o,n,r,s=(i=e,r=(n=d)[o=t]?n[o]:{},a.isMultiItemsModule(i)&&_.isArray(r)?c(r):r);_.isEmpty(s)||(l[t]=s)}):l=a.isMultiItemsModule(e)&&_.isArray(d)?c(d):d,_.isEmpty(l)?"no_starting_value":l},selectNextTabbableOrFocusable:function(e){var t=p(e),i=p(":focus"),o=0;if(1===i.length){var n=t.index(i);n+1<t.length&&(o=n+1)}t.eq(o).focus()},selectPrevTabbableOrFocusable:function(e){var t=p(e),i=p(":focus"),o=t.length-1;if(1===i.length){var n=t.index(i);0<n&&(o=n-1)}t.eq(o).focus()},setupSelectInput:function(e){var o=this,t=(o.input_parent,o.module,u.czr_sektions.getInputRegistrationParams(o.id,o.module.module_type)),i={params:e=_.isEmpty(e)?t.choices:e};if(o.module.trigger("nimble-set-select-input-options",i),e=i.params,!_.isEmpty(e)&&_.isObject(e))switch(o.type){case"simpleselect":_.each(e,function(e,t){var i={value:t,html:e};t==o()?p.extend(i,{selected:"selected"}):"px"===t&&p.extend(i,{selected:"selected"}),p("select[data-czrtype]",o.container).append(p("<option>",i))}),p("select[data-czrtype]",o.container).selecter();break;case"multiselect":var n=o();n=_.isString(n)?[n]:n,n=_.isArray(n)?n:[],_.each(e,function(e,t){var i={value:t,html:e};_.contains(n,t)&&p.extend(i,{selected:"selected"}),p("select[data-czrtype]",o.container).append(p("<option>",i))}),p("select[data-czrtype]",o.container).czrSelect2({closeOnSelect:!0,templateSelection:function(e){return e.text.replace(/\u2013|\u2014/g,"")}}),p("select[data-czrtype]",o.container).on("change",function(){0===p(this).find("option:selected").length&&o([])});break;default:u.errare("::setupSelectInput => invalid input type => "+o.type)}else u.errare("api.czr_sektions.setupSelectInput => missing select options for input id => "+o.id+" in module "+o.module.module_type)},maybeSetupDeviceSwitcherForInput:function(){var o=this;if(!o.previewedDevice){var e=['<span class="sek-input-device-switcher">','<i data-sek-device="desktop" class="sek-switcher preview-desktop active" title="'+sektionsLocalizedData.i18n["Settings on desktops"]+'"></i>','<i data-sek-device="tablet" class="sek-switcher preview-tablet" title="'+sektionsLocalizedData.i18n["Settings on tablets"]+'"></i>','<i data-sek-device="mobile" class="sek-switcher preview-mobile" title="'+sektionsLocalizedData.i18n["Settings on mobiles"]+'"></i>',"</span>"].join(" ");o.container.find(".customize-control-title").first().prepend(e),o.previewedDevice=new u.Value(u.previewedDevice()),syncWithPreviewedDevice=function(e){e.stopPropagation(),o.container.find("[data-sek-device]").removeClass("active"),p(this).addClass("active");var t,i="desktop";try{i=p(this).data("sek-device")}catch(e){u.errare("maybeSetupDeviceSwitcherForInput => error when binding sek-switcher",e)}try{u.previewedDevice(i)}catch(e){u.errare("maybeSetupDeviceSwitcherForInput => error when setting the previewed device",e)}o.previewedDevice(i),_.isUndefined(e.isTrigger)&&o.module&&o.module.control&&o.module.control.params.section&&(t=o.module.control.params.section,_.delay(function(){u.previewer.send("sek-animate-to-level",{id:t})},600))},o.container.on("click","[data-sek-device]",syncWithPreviewedDevice);var t=o.container.find('[data-sek-device="'+u.previewedDevice()+'"]');0<t.length&&t.trigger("click")}},scheduleModuleAccordion:function(e){e=e||{expand_first_control:!0};var i=this;if(!0!==i.container.data("sek-module-accordion-has-been-setup")&&(p(i.container).on("click",".customize-control label > .customize-control-title",function(e){e.stopPropagation();var t=p(this).closest(".customize-control");"no"!==t.attr("data-sek-accordion")&&(i.container.find(".customize-control").not(t).each(function(){p(this).attr("data-sek-accordion")||p(this).attr("data-sek-expanded","false")}),t.attr("data-sek-expanded","false"==t.attr("data-sek-expanded")?"true":"false"),t.trigger("true"==t.attr("data-sek-expanded")?"sek-accordion-expanded":"sek-accordion-collapsed"),!0===t.data("module_ready_on_custom_control_event_is_setup")?t.trigger("sek-accordion-expanded"):t.one("module_ready_on_custom_control_event_is_setup",function(){t.trigger("sek-accordion-expanded")}))}),i.container.data("sek-module-accordion-has-been-setup",!0),e.expand_first_control)){var t=_.filter(i.controls(),function(e){return!e.params||!e.params.sek_registration_params||!1!==e.params.sek_registration_params.has_accordion}),o=_.first(t);_.isObject(o)&&!_.isEmpty(o.id)&&u.control(o.id,function(e){e.container.one("items-collection-populated",function(){p(this).find("label > .customize-control-title").trigger("click")}),!0===e.container.data("module_ready_on_custom_control_event_is_setup")?e.container.trigger("sek-accordion-expanded"):e.container.one("module_ready_on_custom_control_event_is_setup",function(){e.container.trigger("sek-accordion-expanded")})})}},isPromise:function(e){return e&&"function"==typeof e.then&&String(p.Deferred().then)===String(e.then)},whenAllPromisesInParallel:function(e){var i=this,t=p.Deferred(),o=[],n=_.keys(e);return _.each(e,function(e,t){o.push(p.Deferred(function(t){(i.isPromise(e)?e:p.Deferred()).done(t.resolve).fail(function(e){t.reject(e)})}))}),p.when.apply(this,o).done(function(){var i={},e=Array.prototype.slice.call(arguments);_.each(e,function(e,t){i[n[t]]=e}),t.resolve(i)}).fail(t.reject),t},whenAllPromisesInSerie:function(t,i,o,n){i=i||0,o=o||{},n=n||p.Deferred();var r=this;if(_.isArray(t)){var e=t[i];(r.isPromise(e)?e:p.Deferred(function(e){e.resolve()})).always(function(e){o[i]=e,i+1==t.length?n.resolve(o):i+1<t.length&&r.whenAllPromisesInSerie(t,i+1,o,n)})}return n},importAttachment:function(t){return wp.ajax.post("sek_import_attachment",{img_url:t,nonce:u.settings.nonce.save}).fail(function(e){u.errare("sek_import_attachment ajax action failed for image "+t,e)})},cleanIds:function(e){e.id="";var t=this;return _.each(e.collection,function(e){e.id="",_.isArray(e.collection)&&t.cleanIds(e)}),e},getDefaultSektionSettingValue:function(e){return!_.isUndefined(e)&&_.contains(["local","global"],e)||u.errare("getDefaultSektionSettingValue => the skope should be set to local or global"),"global"===e?sektionsLocalizedData.defaultGlobalSektionSettingValue:sektionsLocalizedData.defaultLocalSektionSettingValue},scheduleVisibilityOfInputId:function(t,i){var o=this.input_parent;if(!_.isFunction(i)||_.isEmpty(t))throw new Error("::scheduleVisibilityOfInputId => error when firing for input id : "+this.id);if(!o.czr_Input.has(t))throw new Error("::scheduleVisibilityOfInputId => missing input id : "+t);o.czr_Input(t).visible(i()),this.bind(function(e){o.czr_Input(t).visible(i())})},hasCurrentPageNBSectionsNotHeaderFooter:function(){var e,t=this,i=!1,o=this.localSectionsSettingId(),n=u(o)();this.activeLocationsInfo();return n=_.isObject(n)?n:{},e=p.extend(!0,{},n),e=_.isEmpty(e.collection)?[]:e.collection,e=_.isArray(e)?e:[],_.each(e,function(e){i||_.isObject(e)&&"location"==e.level&&e.collection&&(t.isHeaderLocation(e.id)||t.isFooterLocation(e.id)||(i=!_.isEmpty(e.collection)))}),i}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(c,m){m.extend(CZRSeksPrototype,{setupDnd:function(){var t=this;t.bind("sek-refresh-dragzones",function(e){!0!="draggable"in document.createElement("span")&&c.panel(sektionsLocalizedData.sektionsPanelId,function(e){c.notifications.add(new c.Notification("drag-drop-support",{type:"error",message:sektionsLocalizedData.i18n["This browser does not support drag and drop. You might need to update your browser or use another one."],dismissible:!0})),_.delay(function(){c.notifications.remove("drag-drop-support")},1e4)}),t.setupNimbleDragZones(e.input_container)}),c.previewer.bind("ready",function(){try{t.setupNimbleDropZones()}catch(e){c.errare("::setupDnd => error on self.setupNimbleDropZones()",e)}_.isUndefined(_.findWhere(t.registered(),{module_type:"sek_intro_sec_picker_module"}))&&_.isUndefined(_.findWhere(t.registered(),{module_type:"sek_module_picker_module"}))||t.rootPanelFocus()}),t.reactToDrop()},setupNimbleDragZones:function(e){var o=this,n=function(){c.notifications.add(new c.Notification("missing-injection-target",{type:"info",message:sektionsLocalizedData.i18n["You first need to click on a target ( with a + icon ) in the preview."],dismissible:!0})),_.delay(function(){c.notifications.remove("missing-injection-target")},3e4)};e.find('[draggable="true"]').each(function(){m(this).on("dragstart",function(e){(function(e){o.lastClickedTargetInPreview({}),e.originalEvent.dataTransfer.setData("sek-content-type",m(this).data("sek-content-type")),e.originalEvent.dataTransfer.setData("sek-eligible-for-module-dropzones",m(this).data("sek-eligible-for-module-dropzones")),e.originalEvent.dataTransfer.setData("sek-content-id",m(this).data("sek-content-id")),e.originalEvent.dataTransfer.setData("sek-section-type",m(this).data("sek-section-type")),e.originalEvent.dataTransfer.setData("sek-is-user-section",m(this).data("sek-is-user-section")),o.dndData={content_type:e.originalEvent.dataTransfer.getData("sek-content-type"),eligible_for_module_dropzones:"true"===e.originalEvent.dataTransfer.getData("sek-eligible-for-module-dropzones"),content_id:e.originalEvent.dataTransfer.getData("sek-content-id"),section_type:e.originalEvent.dataTransfer.getData("sek-section-type"),is_user_section:"true"===e.originalEvent.dataTransfer.getData("sek-is-user-section")};try{e.originalEvent.dataTransfer.setData("browserSupport","browserSupport"),e.originalEvent.dataTransfer.clearData("browserSupport")}catch(e){c.panel(sektionsLocalizedData.sektionsPanelId,function(e){c.notifications.add(new c.Notification("drag-drop-support",{type:"error",message:sektionsLocalizedData.i18n["This browser does not support drag and drop. You might need to update your browser or use another one."],dismissible:!0})),_.delay(function(){c.notifications.remove("drag-drop-support")},1e4)})}m(this).addClass("sek-dragged"),o.cachedElements.$body.addClass("sek-dragging"),c.previewer.send("sek-drag-start",{content_type:o.dndData.content_type,eligible_for_module_dropzones:o.dndData.eligible_for_module_dropzones})}).call(m(this),e)}).on("dragend",function(e){(function(e){o.cachedElements.$body.removeClass("sek-dragging"),m(this).removeClass("sek-dragged"),c.previewer.send("sek-drag-stop")}).call(m(this),e)}).on("dblclick",function(e){(function(e){var t,i=o.lastClickedTargetInPreview();!_.isEmpty(i)&&i.id?t=o.dnd_getDropZonesElements().find('[data-sek-id="'+i.id+'"]').find(".sek-module-drop-zone-for-first-module").first():n(),t&&0<t.length?(c.czr_sektions.trigger("sek-content-dropped",{drop_target_element:t,location:t.closest('[data-sek-level="location"]').data("sek-id"),before_module_or_nested_section:t.data("drop-zone-before-module-or-nested-section"),after_module_or_nested_section:t.data("drop-zone-after-module-or-nested-section"),before_section:t.data("drop-zone-before-section"),after_section:t.data("drop-zone-after-section"),content_type:m(this).attr("data-sek-content-type"),content_id:m(this).attr("data-sek-content-id"),section_type:m(this).attr("data-sek-section-type"),is_user_section:"true"===m(this).attr("data-sek-is-user-section")}),o.lastClickedTargetInPreview({})):(n(),c.errare("Double click insertion => the target zone was not found"))}).call(m(this),e)})})},setupNimbleDropZones:function(){var t=this;if(this.$dropZones=this.dnd_getDropZonesElements(),this.preDropElement=m("<div>",{class:sektionsLocalizedData.preDropElementClass,html:""}),this.$dropZones.length<1)throw new Error("::setupNimbleDropZones => invalid Dom element");this.$dropZones.each(function(){var e=m(this);!0!==e.data("zone-droppable-setup")&&(t.enterOverTimer=null,e.on("dragenter dragover",sektionsLocalizedData.dropSelectors,function(e){_.isNull(t.enterOverTimer)&&(t.enterOverTimer=!0,_.delay(function(){t.currentMousePosition&&t.currentMousePosition+""==e.clientY+""+e.clientX?t.enterOverTimer=null:(t.currentMousePosition=e.clientY+""+e.clientX,t.dnd_toggleDragApproachClassesToDropZones(e))},100)),t.dnd_canDrop({targetEl:m(this),evt:e})&&(e.stopPropagation(),t.dnd_OnEnterOver(m(this),e))}).on("dragleave drop",sektionsLocalizedData.dropSelectors,function(e){switch(e.type){case"dragleave":t.dnd_isOveringDropTarget(m(this),e)||t.dnd_cleanOnLeaveDrop(m(this),e);break;case"drop":this.$cachedDropZoneCandidates=null,t.dnd_canDrop({targetEl:m(this),evt:e})&&(e.preventDefault(),t.dnd_onDrop(m(this),e),t.dnd_cleanOnLeaveDrop(m(this),e),c.previewer.send("sek-drag-stop"))}}).data("zone-droppable-setup",!0))})},dnd_isInTarget:function(e,t){var i=t.clientY,o=t.clientX,n=e[0].getBoundingClientRect(),r=o<=n.right&&n.left<=o;return i>=n.top&&n.bottom>=i&&r},dnd_toggleDragApproachClassesToDropZones:function(u){var p=this;this.$dropZones=this.$dropZones||this.dnd_getDropZonesElements(),this.$cachedDropZoneCandidates=_.isEmpty(this.$cachedDropZoneCandidates)?this.$dropZones.find(".sek-drop-zone"):this.$cachedDropZoneCandidates,this.distanceTable=[],this.$dropZones.find(".sek-drop-zone").each(function(){var e,t,i=u.clientY,o=u.clientX,n=m(this)[0].getBoundingClientRect(),r=Math.abs(i-(n.bottom-(n.bottom-n.top)/2)),s=(Math.abs(n.top-i),Math.abs(o-(n.right-(n.right-n.left)/2))),a=(n.right,n.left,r<50),c=s<50,l=o<=n.right&&n.left<=o,d=i>=n.top&&n.bottom>=i;p.distanceTable.push({el:m(this),dist:d&&l?0:(e=s,t=r,Math.sqrt(e*e+t*t))}),m(this).removeClass("sek-drag-is-in"),(a||d)&&(c||l)?(m(this).removeClass("sek-drag-is-approaching"),m(this).removeClass("sek-drag-is-close"),m(this).addClass("sek-drag-is-very-close")):(m(this).removeClass("sek-drag-is-approaching"),m(this).removeClass("sek-drag-is-close"),m(this).removeClass("sek-drag-is-very-close")),m(this).removeClass("sek-drag-is-in")});var t=_.min(_.pluck(p.distanceTable,"dist"));p.$dropTargetCandidate=null,_.each(p.distanceTable,function(e){_.isNull(p.$dropTargetCandidate)&&t===e.dist&&(p.$dropTargetCandidate=e.el)}),p.$dropTargetCandidate&&0<p.$dropTargetCandidate.length&&p.dnd_isInTarget(p.$dropTargetCandidate,u)&&p.$dropTargetCandidate.addClass("sek-drag-is-in"),p.enterOverTimer=null},dnd_getPreDropElementContent:function(e){var t,i,o=m(e.currentTarget);switch(this.dndData.content_type){case"module":t=sektionsLocalizedData.i18n["Insert here"],0<o.length&&("between-sections"!==o.data("sek-location")&&"in-empty-location"!==o.data("sek-location")||(t=sektionsLocalizedData.i18n["Insert in a new section"])),i='<div class="sek-module-placeholder-content"><p>'+t+"</p></div>";break;case"preset_section":i='<div class="sek-module-placeholder-content"><p>'+(t=sektionsLocalizedData.i18n["Insert a new section here"])+"</p></div>";break;default:c.errare("::dnd_getPreDropElementContent => invalid content type provided")}return i},dnd_getDropZonesElements:function(){return m(c.previewer.targetWindow().document)},dnd_canDrop:function(e){var t=this,i=(e=_.extend({targetEl:{},evt:{}},e||{})).targetEl;if(!_.isObject(i)||i.length<1)return!1;if(i.closest('[data-sek-level="location"]').length<1)return!1;var o=i.hasClass("sek-content-preset_section-drop-zone"),n=i.hasClass("sek-module-drop-zone-for-first-module"),r=!0===i.closest('[data-sek-level="location"]').data("sek-is-header-location"),s=!0===i.closest('[data-sek-level="location"]').data("sek-is-footer-location"),a="preset_section"===t.dndData.content_type&&"content"===t.dndData.section_type,c=function(e){m(".sek-no-drop-possible-message",i).length<1&&i.append(['<div class="sek-no-drop-possible-message">','<i class="material-icons">not_interested</i>',e,"</div>"].join(""))};return!!i.hasClass("sek-drop-zone")&&(!t.dndData.is_user_section&&(r||s)&&a?(c(r?sektionsLocalizedData.i18n["Header location only accepts modules and pre-built header sections"]:sektionsLocalizedData.i18n["Footer location only accepts modules and pre-built footer sections"]),!1):s&&"preset_section"===t.dndData.content_type&&"header"===t.dndData.section_type?(c(sektionsLocalizedData.i18n["You can't drop a header section in the footer location"]),!1):r&&"preset_section"===t.dndData.content_type&&"footer"===t.dndData.section_type?(c(sektionsLocalizedData.i18n["You can't drop a footer section in the header location"]),!1):"preset_section"===t.dndData.content_type&&!0===t.dndData.eligible_for_module_dropzones&&!o||("preset_section"===t.dndData.content_type&&o||"module"===t.dndData.content_type&&!o||"preset_section"===t.dndData.content_type&&n))},dnd_OnEnterOver:function(e,t){t.preventDefault(),!0!==e.data("is-drag-entered")&&(e.data("is-drag-entered",!0),e.addClass("sek-active-drop-zone"),this.$dropZones.addClass("sek-is-dragging"));try{this.dnd_mayBePrintPreDropElement(e,t)}catch(e){c.errare("Error when trying to insert the preDrop content",e)}},dnd_cleanOnLeaveDrop:function(e,t){var i=this;this.$dropZones=this.$dropZones||this.dnd_getDropZonesElements(),this.preDropElement.remove(),this.$dropZones.removeClass("sek-is-dragging"),m(sektionsLocalizedData.dropSelectors,this.$dropZones).each(function(){i.dnd_cleanSingleDropTarget(m(this))})},dnd_cleanSingleDropTarget:function(e){_.isEmpty(e)||e.length<1||(e.data("is-drag-entered",!1),e.data("preDrop-position",!1),e.removeClass("sek-active-drop-zone"),e.find(".sek-drop-zone").removeClass("sek-drag-is-close"),e.find(".sek-drop-zone").removeClass("sek-drag-is-approaching"),e.removeClass("sek-feed-me-seymore"),e.find(".sek-no-drop-possible-message").remove())},dnd_getPosition:function(e,t){var i=e[0].getBoundingClientRect(),o=i.height;return"before"===e.data("preDrop-position")?o+=this.preDropElement.outerHeight():"after"===e.data("preDrop-position")&&(o-=this.preDropElement.outerHeight()),0<t.originalEvent.clientY-i.top-o/2?"after":"before"},dnd_mayBePrintPreDropElement:function(e,t){var i=this,o=e.data("preDrop-position"),n=this.dnd_getPosition(e,t);if(o!==n&&!0!==i.isPrintingPreDrop){i.isPrintingPreDrop=!0,this.dnd_cleanSingleDropTarget(this.$currentPreDropTarget);var r="between-sections"===e.data("sek-location")||"in-empty-location"===e.data("sek-location");m.when(i.preDropElement.remove()).done(function(){e["before"===n?"prepend":"append"](i.preDropElement).find("."+sektionsLocalizedData.preDropElementClass).html(i.dnd_getPreDropElementContent(t)),e.find("."+sektionsLocalizedData.preDropElementClass).toggleClass("in-new-sektion",r),e.data("preDrop-position",n),e.addClass("sek-feed-me-seymore"),i.isPrintingPreDrop=!1,i.$currentPreDropTarget=e})}},dnd_isOveringDropTarget:function(e,t){var i=e[0].getBoundingClientRect(),o=t.clientX,n=t.clientY,r=i.left,s=i.right,a=i.top,c=i.bottom;return r<=o&&o-r<=s-r&&(a<=n&&n-a<=c-a)},dnd_onDrop:function(e,t){t.stopPropagation();this.dnd_getPosition(e,t),e.index();c.czr_sektions.trigger("sek-content-dropped",{drop_target_element:e,location:e.closest('[data-sek-level="location"]').data("sek-id"),before_module_or_nested_section:e.data("drop-zone-before-module-or-nested-section"),after_module_or_nested_section:e.data("drop-zone-after-module-or-nested-section"),before_section:e.data("drop-zone-before-section"),after_section:e.data("drop-zone-after-section"),content_type:t.originalEvent.dataTransfer.getData("sek-content-type"),eligible_for_module_dropzones:"true"===t.originalEvent.dataTransfer.getData("sek-eligible-for-module-dropzones"),content_id:t.originalEvent.dataTransfer.getData("sek-content-id"),section_type:t.originalEvent.dataTransfer.getData("sek-section-type"),is_user_section:"true"===t.originalEvent.dataTransfer.getData("sek-is-user-section")})},reactToDrop:function(){this.bind("sek-content-dropped",function(e){try{!function(e){if(!_.isObject(e))throw new Error("Invalid params provided");if(e.drop_target_element.length<1)throw new Error("Invalid drop_target_element");var t,i=e.drop_target_element,o="content-in-column";switch(i.data("sek-location")){case"between-sections":o="content-in-a-section-to-create";break;case"in-empty-location":e.is_first_section=!0,e.send_to_preview=!1,o="content-in-empty-location";break;case"between-columns":o="content-in-new-column"}"preset_section"===e.content_type&&(i.hasClass("sek-module-drop-zone-for-first-module")?1<(t=i.closest('div[data-sek-level="section"]')).find(".sek-sektion-inner").first().children('[data-sek-level="column"]').length?(o="preset-section-in-a-nested-section-to-create",e.is_nested=!0,e.in_column=i.closest('[data-sek-level="column"]').data("sek-id"),e.in_sektion=t.data("sek-id")):(e.sektion_to_replace=t.data("sek-id"),e.after_section=e.sektion_to_replace,e.in_column=t.closest('[data-sek-level="column"]').data("sek-id"),o="content-in-a-section-to-replace"):("between-sections"===i.data("sek-location")&&(o="content-in-a-section-to-create"),"between-modules-and-nested-sections"===i.data("sek-location")&&e.eligible_for_module_dropzones&&(o="preset-section-eligible-for-module-dropzones-in-new-nested-sektion",e.is_nested=!0,e.in_column=i.closest('[data-sek-level="column"]').data("sek-id"),t=i.closest('div[data-sek-level="section"]'),e.in_sektion=t.data("sek-id"))));switch(o){case"content-in-column":var n=i.closest("div[data-sek-level]");if(n.length<1)throw new Error("No valid level dom element found");var r=n.data("sek-level"),s=n.data("sek-id");if(_.isEmpty(r)||_.isEmpty(s))throw new Error("No valid level id found");c.previewer.trigger("sek-add-module",{level:r,id:s,in_column:i.closest('div[data-sek-level="column"]').data("sek-id"),in_sektion:i.closest('div[data-sek-level="section"]').data("sek-id"),before_module_or_nested_section:e.before_module_or_nested_section,after_module_or_nested_section:e.after_module_or_nested_section,content_type:e.content_type,content_id:e.content_id});break;case"content-in-a-section-to-create":case"content-in-a-section-to-replace":case"content-in-empty-location":c.previewer.trigger("sek-add-content-in-new-sektion",e);break;case"preset-section-in-a-nested-section-to-create":c.previewer.trigger("sek-add-preset-section-in-new-nested-sektion",e);break;case"preset-section-eligible-for-module-dropzones-in-new-nested-sektion":var a=m.extend(!0,{},e);a=m.extend(a,{before_module_or_nested_section:e.before_module_or_nested_section,after_module_or_nested_section:e.after_module_or_nested_section}),c.previewer.trigger("sek-add-preset-section-in-new-nested-sektion",a);break;default:c.errare("sek control panel => ::reactToDrop => invalid drop case : "+o)}}(e)}catch(e){c.errare("error when reactToDrop",e)}})}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{setupTinyMceEditor:function(){var o=this;l.sekEditorExpanded=new l.Value(!1),o.editorEventsListenerSetup=!1,o.$editorPane=d("#czr-customize-content_editor-pane"),o.$editorDragbar=d("#czr-customize-content_editor-dragbar"),o.$preview=d("#customize-preview"),o.$collapseSidebar=d(".collapse-sidebar"),o.attachResizeEventsToEditor();d("#customize-theme-controls").on("click",'[data-czr-action="open-tinymce-editor"]',function(){var e=d(this).data("czr-control-id"),t=d(this).data("czr-input-id");_.isEmpty(e)||_.isEmpty(t)?l.errare("toggle-tinymce-editor => missing input or control id"):l.sekEditorExpanded(!0)}),l.sekEditorExpanded.bind(function(e,t,i){!function(){l.sekTinyMceEditor=tinyMCE.get(sektionsLocalizedData.idOfDetachedTinyMceTextArea);var e=function(){!1===o.editorEventsListenerSetup&&(o.editorEventsListenerSetup=!0,o.trigger("sek-tiny-mce-editor-bound-and-instantiated"))};l.sekTinyMceEditor&&(l.sekTinyMceEditor.initialized?e():l.sekTinyMceEditor.on("init",function(){e()}))}(),e&&l.sekTinyMceEditor&&l.sekTinyMceEditor.focus(),d(document.body).toggleClass("czr-customize-content_editor-pane-open",e),o.cachedElements.$window[e?"on":"off"]("resize",function(){l.sekEditorExpanded()&&_.delay(function(){o.czrResizeEditor(window.innerHeight-o.$editorPane.height())},50)}),e?(o.czrResizeEditor(window.innerHeight-o.$editorPane.height()),_.delay(function(){o.cachedElements.$window.trigger("resize")},100)):(o.$preview.css("bottom",""),o.$collapseSidebar.css("bottom",""))}),d("#czr-customize-content_editor-pane").on("click",'[data-czr-action="close-tinymce-editor"]',function(){l.sekEditorExpanded(!1)}),d("#customize-controls").on("click",function(e){"open-tinymce-editor"!=d(e.target).data("czr-action")&&l.sekEditorExpanded(!1,{context:"clicked anywhere"})}),d(document).on("keydown",_.throttle(function(e){27===e.keyCode&&l.sekEditorExpanded(!1)},50)),o.bind("sek-tiny-mce-editor-bound-and-instantiated",function(){var e=d(l.sekTinyMceEditor.iframeElement).contents().get(0);d(e).on("keydown",_.throttle(function(e){27===e.keyCode&&l.sekEditorExpanded(!1)},50))}),_.each(["sek-click-on-inactive-zone","sek-add-section","sek-add-column","sek-add-module","sek-remove","sek-move","sek-duplicate","sek-resize-columns","sek-add-content-in-new-sektion","sek-pick-content","sek-edit-options","sek-edit-module","sek-notify"],function(e){"sek-edit-module"!=e?l.previewer.bind(e,function(){l.sekEditorExpanded(!1)}):l.previewer.bind(e,function(e){l.sekEditorExpanded("czr_tiny_mce_editor_module"===e.module_type)})})},attachResizeEventsToEditor:function(){var t=this;d("#czr-customize-content_editor-pane").on("mousedown mouseup",function(e){if(("mousedown"!==e.type||"czr-customize-content_editor-dragbar"===d(e.target).attr("id")||d(e.target).hasClass("czr-resize-handle"))&&l.sekEditorExpanded())switch(e.type){case"mousedown":d(document).on("mousemove."+sektionsLocalizedData.idOfDetachedTinyMceTextArea,function(e){e.preventDefault(),d(document.body).addClass("czr-customize-content_editor-pane-resize"),d("#czr-customize-content_editor_ifr").css("pointer-events","none"),t.czrResizeEditor(e.pageY)});break;case"mouseup":d(document).off("mousemove."+sektionsLocalizedData.idOfDetachedTinyMceTextArea),d(document.body).removeClass("czr-customize-content_editor-pane-resize"),d("#czr-customize-content_editor_ifr").css("pointer-events","")}})},czrResizeEditor:function(e){var t,i=this,o=window.innerHeight,n=(window.innerWidth,{}),r=d("#czr-customize-content_editor_ifr"),s=d("#wp-czr-customize-content_editor-tools"),a=i.$editorPane.find(".mce-toolbar-grp"),c=i.$editorPane.find(".mce-statusbar");l.sekEditorExpanded()&&(_.isNaN(e)||(t=o-e),n.height=t,n.components=s.outerHeight()+a.outerHeight()+c.outerHeight(),t<40&&(n.height=40),o-1<t&&(n.height=o-1),o<i.$editorPane.outerHeight()&&(n.height=o),i.$preview.css("bottom",n.height),i.$editorPane.css("height",n.height),r.css("height",n.height-n.components))}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(d,a){a.extend(CZRSeksPrototype,{export_template:function(e){e=e||{},e=a.extend({scope:"local"},e);var i=[],t={sek_export_nonce:d.settings.nonce.save,skope_id:"local"===e.scope?d.czr_skopeBase.getSkopeProperty("skope_id"):sektionsLocalizedData.globalSkopeId,active_locations:d.czr_sektions.activeLocations()};_.each(t,function(e,t){i.push(encodeURIComponent(t)+"="+encodeURIComponent(e))}),wp.ajax.post("sek_pre_export_checks",{nonce:d.settings.nonce.save,sek_export_nonce:d.settings.nonce.save,skope_id:"local"===e.scope?d.czr_skopeBase.getSkopeProperty("skope_id"):sektionsLocalizedData.globalSkopeId,active_locations:d.czr_sektions.activeLocations()}).done(function(){a(window).off("beforeunload"),window.location.href=[sektionsLocalizedData.customizerURL,"?",i.join("&")].join(""),a(window).on("beforeunload")}).fail(function(e){d.previewer.trigger("sek-notify",{notif_id:"import-failed",type:"error",duration:3e4,message:["<span>","<strong>",[sektionsLocalizedData.i18n["Export failed"],encodeURIComponent(e)].join(" "),"</strong>","</span>"].join("")})})},import_template_from_file:function(i){i=i||{};var e,t,o=(i=a.extend({is_file_import:!0,pre_import_check:!1,assign_missing_locations:!1,input:"",file_input:""},i)).input;if(_.isEmpty(o))throw new Error("::import_template => missing file_input param");if(_.isEmpty(i.file_input))throw new Error("::import_template => missing file_input param");if(i.file_input.length<1||_.isUndefined(i.file_input[0])||!i.file_input[0].files||_.isEmpty(i.file_input.val()))d.previewer.trigger("sek-notify",{notif_id:"missing-import-file",type:"info",duration:3e4,message:['<span style="color:#0075a2">',"<strong>",sektionsLocalizedData.i18n["Missing file"],"</strong>","</span>"].join("")});else{t=d.czr_sektions.getInputRegistrationParams(o.id,o.module.module_type).scope,o.container.find(".sek-uploading").show(),d.notifications.remove("missing-import-file"),d.notifications.remove("import-success"),d.notifications.remove("import-failed"),d.notifications.remove("img-import-errors");var n=new FormData;if(n.append("file_candidate",i.file_input[0].files[0]),n.append("action","sek_get_manually_imported_file_content"),n.append("nonce",d.settings.nonce.save),_.contains(["local","global"],t)){if(n.append("skope",t),i.pre_import_check&&n.append("pre_import_check",i.pre_import_check),n.append("import_img",o.input_parent.czr_Input("import_img")()),o.container.find(".sek-uploading").show(),e=a.ajax({url:wp.ajax.settings.url,data:n,processData:!1,contentType:!1,type:"POST"}),i.pre_import_check)return a.Deferred(function(){var t=this;e.done(function(e){e.success||t.reject(e),d.czr_sektions.isImportedContentEligibleForAPI(e,i)||t.reject(e),t.resolve(e)}).fail(function(e){t.reject(e)})});d.previewer.send("sek-maybe-print-loader",{fullPageLoader:!0,duration:3e4}),_.delay(function(){"pending"===e.state()&&d.previewer.trigger("sek-notify",{notif_id:"import-too-long",type:"error",duration:2e4,message:["<span>","<strong>",sektionsLocalizedData.i18n['Import exceeds server response time, try to uncheck "import images" option.'],"</strong>","</span>"].join("")})},3e4),e.done(function(e){d.czr_sektions.isImportedContentEligibleForAPI(e,i)?(e.data.data.collection=d.czr_sektions.setIdsForImportedTmpl(e.data.data.collection),d.czr_sektions.doUpdateApiSettingAfter_FileImport(e,i)):d.infoLog("::import_template problem => !api.czr_sektions.isImportedContentEligibleForAPI",e,i)}).fail(function(e){d.errare("::import_template => ajax error",e),d.previewer.trigger("sek-notify",{notif_id:"import-failed",type:"error",duration:3e4,message:["<span>","<strong>",sektionsLocalizedData.i18n["Import failed, file problem"],"</strong>","</span>"].join("")})}).always(function(){d.czr_sektions.doAlwaysAfterFileImportAndApiSettingUpdate(i)})}else d.errare("::import_template => invalid scope provided",t)}},pre_checks_from_file_import:function(e,t){if(t=t||{},(t=a.extend({is_file_import:!0,pre_import_check:!1,assign_missing_locations:!1,input:"",file_input:""},t)).is_file_import&&_.isEmpty(t.input))throw new Error("::pre_checks_from_file_import => missing file_input param");var i=d.czr_sektions.activeLocations(),o=a.extend(!0,[],_.isArray(e.data.metas.active_locations)?e.data.metas.active_locations:[]),n=t.input,r=d.czr_sektions.getInputRegistrationParams(n.id,n.module.module_type);if(o=_.filter(o,function(e){return!_.contains(["nimble_local_header","nimble_local_footer"],e)}),_.isArray(o)&&_.isArray(i)){var s=a(o).not(i).get();_.isEmpty(s)?d.czr_sektions.import_template_from_file(t):(t.is_file_import&&(n.container.find('button[data-czr-action="sek-pre-import"]').hide(),"local"===r.scope?n.container.find(".czr-import-dialog.czr-local-import").slideToggle():n.container.find(".czr-import-dialog.czr-global-import").slideToggle()),d.infoLog("sek-pre-import => imported locations missing in current page.",s))}else d.previewer.trigger("sek-notify",{notif_id:"import-failed",type:"info",duration:3e4,message:['<span style="color:#0075a2">',"<strong>",sektionsLocalizedData.i18n["Import failed"],"</strong>","</span>"].join("")}),t.is_file_import&&d.czr_sektions.doAlwaysAfterFileImportAndApiSettingUpdate(t)},setIdsForImportedTmpl:function(i){var o=this;return(_.isObject(i)||_.isArray(i))&&_.each(i,function(e,t){(_.isObject(e)||_.isArray(e))&&(i[t]=o.setIdsForImportedTmpl(e)),"id"!==t||!_.isString(e)||0!==e.indexOf("__rep__me__")&&0!==e.indexOf("__nimble__")||(i[t]=sektionsLocalizedData.optPrefixForSektionsNotSaved+d.czr_sektions.guid())}),i},isImportedContentEligibleForAPI:function(e,t){var i=!0,o=e.data,n=null;e.success||(n=[sektionsLocalizedData.i18n["Import failed"],o].join(" : ")),_.isNull(n)&&!_.isObject(o)&&(n=sektionsLocalizedData.i18n["Import failed, invalid file content"]);var r=o.data,s=o.metas,a=o.img_errors;_.isNull(n)&&!_.isObject(r)&&(n=sektionsLocalizedData.i18n["Import failed, invalid file content"]),_.isNull(n)&&!_.isObject(s)&&(n=sektionsLocalizedData.i18n["Import failed, invalid file content"]);var c=d.czr_sektions.localSectionsSettingId();if(t.is_file_import){var l=t.input;c="local"===d.czr_sektions.getInputRegistrationParams(l.id,l.module.module_type).scope?c:d.czr_sektions.getGlobalSectionsSettingId()}return _.isNull(n)&&_.isEqual(d(c)(),r)&&(d.infoLog("::isImportedContentEligibleForAPI => Setting unchanged"),i=!1),_.isNull(n)||(d.errare("::isImportedContentEligibleForAPI => invalid data sent from server",o),d.errare("::isImportedContentEligibleForAPI => importErrorMsg",n),d.previewer.trigger("sek-notify",{notif_id:"import-failed",type:"error",duration:3e4,message:["<span>","<strong>",n,"</strong>","</span>"].join("")}),i=!1),_.isEmpty(a)||d.previewer.trigger("sek-notify",{notif_id:"img-import-errors",type:"info",duration:6e4,message:['<span style="color:#0075a2">',["<strong>"+sektionsLocalizedData.i18n["Some image(s) could not be imported"]+"</strong><br/>",'<span style="font-size:11px">'+a+"</span>"].join(" : "),"</span>"].join("")}),i},doUpdateApiSettingAfter_FileImport:function(e,t){if(t=t||{},d.czr_sektions.isImportedContentEligibleForAPI(e,t)||!t.is_file_import){var i="local",o=!1;if(t.is_file_import){var n=t.input,r=d.czr_sektions.getInputRegistrationParams(n.id,n.module.module_type);i=r.scope,o="local"===r.scope&&n.input_parent.czr_Input("keep_existing_sections")()}d.czr_sektions.updateAPISetting({action:"sek-import-from-file",scope:i,imported_content:e.data,assign_missing_locations:t.assign_missing_locations,keep_existing_sections:o}).done(function(){"local"===i&&d.czr_sektions.generateUI({action:"sek-generate-local-skope-options-ui",clean_settings:!0}),d.previewer.refresh(),d.previewer.trigger("sek-notify",{notif_id:"import-success",type:"success",duration:3e4,message:["<span>","<strong>",sektionsLocalizedData.i18n["File successfully imported"],"</strong>","</span>"].join("")})}).fail(function(e){d.errare("::doUpdateApiSettingAfter_FileImport => error when firing ::updateAPISetting",e),d.previewer.trigger("sek-notify",{notif_id:"import-failed",type:"error",duration:3e4,message:["<span>","<strong>",[sektionsLocalizedData.i18n["Import failed"],e].join(" : "),"</strong>","</span>"].join("")})}),d.previewer.refresh()}else d.czr_sektions.doAlwaysAfterFileImportAndApiSettingUpdate(t)},doAlwaysAfterFileImportAndApiSettingUpdate:function(e){if(d.previewer.send("sek-clean-loader",{cleanFullPageLoader:!0}),e=e||{},(e=a.extend({is_file_import:!0,pre_import_check:!1,assign_missing_locations:!1,input:"",file_input:""},e)).is_file_import){var t=e.input;t.container.find(".sek-uploading").hide(),e.file_input.val("").trigger("change"),t.container.find(".czr-import-dialog").hide(),t.container.find('button[data-czr-action="sek-pre-import"]').show()}}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(o,d){d.extend(CZRSeksPrototype,{setupTemplateGallery:function(){var t=this;t.templateGalleryExpanded=new o.Value(!1),t.tmplImportDialogVisible=new o.Value(!1),sektionsLocalizedData.isTemplateGalleryEnabled&&(t.templateGalleryExpanded.bind(function(e){t.cachedElements.$body.toggleClass("sek-template-gallery-expanded",e),e?(t.tmplDialogVisible(!1),t.levelTreeExpanded(!1),t.tmplImportDialogVisible(!1),d("#customize-preview iframe").css("z-index",1),t.renderOrRefreshTempGallery()):d("#customize-preview iframe").css("z-index","")}),t.tmplImportDialogVisible.bind(function(e){t.cachedElements.$body.toggleClass("sek-tmpl-dialog-expanded",e),e&&(t.tmplDialogVisible(!1),t.levelTreeExpanded(!1),d("#customize-preview iframe").css("z-index",1))}),o.previewer.bind("ready",function(){t.templateGalleryExpanded(!1)}))},renderTmplGalleryUI:function(){if(0<d("#nimble-tmpl-gallery").length)return d("#nimble-tmpl-gallery");try{_tmpl=wp.template("nimble-top-tmpl-gallery")({})}catch(e){return o.errare("Error when parsing nimble-top-tmpl-gallery template",e),!1}return d("#customize-preview").after(d(_tmpl)),d("#nimble-tmpl-gallery")},renderOrRefreshTempGallery:function(){var e=this;d("#nimble-tmpl-gallery").length<1&&d.when(e.renderTmplGalleryUI({})).done(function(){e.setupTmplGalleryDOMEvents()});var t=d("#nimble-tmpl-gallery").find(".sek-tmpl-gallery-inner");t.html(""),e.getTemplateGalleryHtml().done(function(e){t.html(e)})},setupTmplGalleryDOMEvents:function(){var l=d("#nimble-tmpl-gallery"),i=this;l.on("click",".sek-tmpl-item .use-tmpl",function(e){e.preventDefault(),e.stopPropagation();var t=d(this).closest(".sek-tmpl-item").data("sek-tmpl-item-id");_.isEmpty(t)?o.errare("::setupTmplGalleryDOMEvents => error => invalid template id"):i.hasCurrentPageNBSectionsNotHeaderFooter()?(i._tmplNameWhileImportDialog=t,i.tmplImportDialogVisible(!0)):(o.czr_sektions.get_gallery_tmpl_json_and_import({template_name:t,from:"user"}),i.templateGalleryExpanded(!1))}).on("click",".sek-tmpl-gal-import-dialog .sek-ui-button",function(e){e.preventDefault(),e.stopPropagation();var t=d(this).data("sek-tmpl-import-mode");_.contains(["replace","before","after"],t)?(o.czr_sektions.get_gallery_tmpl_json_and_import({template_name:i._tmplNameWhileImportDialog,from:"user",tmpl_import_mode:t}),i.templateGalleryExpanded(!1)):o.errare("::setupTmplGalleryDOMEvents => error => invalid import mode")}).on("propertychange change click keyup input paste",".sek-filter-tmpl",_.debounce(function(e){e.preventDefault();var t,i,o,n,r,s,a=d(this).val(),c=function(){l.removeClass("search-active"),l.find(".sek-tmpl-item").each(function(){d(this).removeClass("search-match")})};_.isString(a)?(a=a.trim().toLowerCase(),_.isEmpty(a.replace(/\s/g,""))?c():(l.addClass("search-active"),l.find(".sek-tmpl-item").each(function(){t=(d(this).find(".tmpl-title").html()+"").toLowerCase(),i=(d(this).find(".tmpl-desc").html()+"").toLowerCase(),o=(d(this).find(".tmpl-date").html()+"").toLowerCase(),n=-1!=t.indexOf(a),r=-1!=i.indexOf(a),s=-1!=o.indexOf(a),d(this).toggleClass("search-match",n||r||s)}))):c()},100)).on("click",".sek-tmpl-info .remove-tmpl",function(e){e.preventDefault();var t=function(e){i.tmplDialogMode("remove"),i.tmplDialogMode.unbind(t)};i.tmplDialogMode.bind(t),i.tmplDialogVisible(!0)}).on("click",".sek-close-dialog",function(e){e.preventDefault(),i.templateGalleryExpanded(!1)})},getTemplateGalleryHtml:function(){var i,o="",n=[sektionsLocalizedData.baseUrl,"/assets/admin/img/wire_frame.png","?ver=",sektionsLocalizedData.nimbleVersion].join(""),r=d.Deferred();return this.getSavedTmplCollection().done(function(e){_.each(e,function(e,t){i=_.isEmpty(e.description)?[e.title,e.last_modified_date].join(" | "):[e.title,e.last_modified_date,e.description].join(" | "),o+='<div class="sek-tmpl-item" data-sek-tmpl-item-id="'+t+'">',o+='<div class="sek-tmpl-thumb"><img src="'+n+'"/></div>',o+='<div class="sek-tmpl-info" title="'+i+'">',o+='<h3 class="tmpl-title">'+e.title+"</h3>",o+='<p class="tmpl-date"><i>'+[sektionsLocalizedData.i18n["Last modified"]," : ",e.last_modified_date].join(" ")+"</i></p>",o+='<p class="tmpl-desc">'+e.description+"</p>",o+='<i class="material-icons use-tmpl" title="'+sektionsLocalizedData.i18n["Use this template"]+'">add_circle_outline</i>',o+='<i class="material-icons remove-tmpl" title="'+sektionsLocalizedData.i18n["Remove this template"]+'">delete_forever</i>',o+="</div>",o+="</div>"});var t=d("#nimble-tmpl-gallery").find(".czr-css-loader");0<t.length?t.hide({duration:300,complete:function(){d(this).remove(),r.resolve(o)}}):r.resolve(o)}),r.promise()}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(t,e){jQuery.extend(CZRSeksPrototype,t.Events);var i=t.Class.extend(CZRSeksPrototype);try{t.czr_sektions=new i}catch(e){t.errare("api.czr_sektions => problem on instantiation",e)}}(wp.customize),function(r,s,a){r.czrInputMap=r.czrInputMap||{},s.extend(r.czrInputMap,{content_type_switcher:function(e){var i,o=this,n=r.czr_sektions;if(!r.section.has(o.module.control.section()))throw new Error("api.czrInputMap.content_type_switcher => section not registered");i=r.section(o.module.control.section());var t=function(t){o.container.find('[data-sek-content-type="'+(t||"module")+'"]').trigger("click"),a.each(i.controls(),function(e){a.isUndefined(e.content_type)||e.active(t===e.content_type)})};r.czr_sektions.currentContentPickerType=r.czr_sektions.currentContentPickerType||new r.Value,r.bind("nimble-modules-and-sections-controls-registered",function(){t(r.czr_sektions.currentContentPickerType())}),r.czr_sektions.currentContentPickerType.bind(function(e){t(e)}),r.czr_sektions.currentContentPickerType(o()),o.container.on("click","[data-sek-content-type]",function(e){e.preventDefault();var t=s(this).data("sek-content-type");if(o.container.find("[data-sek-content-type]").attr("aria-pressed",!1),n.templateGalleryExpanded(!1),n.levelTreeExpanded(!1),n.tmplDialogVisible&&n.tmplDialogVisible(!1),n.saveSectionDialogVisible&&n.saveSectionDialogVisible(!1),"template"===t){var i=r.czr_sektions.templateGalleryExpanded();s(this).attr("aria-pressed",!i),r.czr_sektions.templateGalleryExpanded(!i)}else r.czr_sektions.templateGalleryExpanded(!1),s(this).attr("aria-pressed",!0),r.czr_sektions.currentContentPickerType(t)}),t(r.czr_sektions.currentContentPickerType())}})}(wp.customize,jQuery,_),function(t,e,i){t.czrInputMap=t.czrInputMap||{},e.extend(t.czrInputMap,{module_picker:function(e){t.czr_sektions.trigger("sek-refresh-dragzones",{type:"module",input_container:this.container})},section_picker:function(e){t.czr_sektions.trigger("sek-refresh-dragzones",{type:"preset_section",input_container:this.container})}})}(wp.customize,jQuery,_),function(s,a,c){s.czrInputMap=s.czrInputMap||{},a.extend(s.czrInputMap,{module_option_switcher:function(e){var t=this;if(!s.section.has(t.module.control.section()))throw new Error(t.input_type+" => section not registered");s.section(t.module.control.section());var i,o="",n=t.module.control.params.sek_registration_params;if(c.isUndefined(n))throw new Error(t.input_type+" => missing registration params");if(n&&n.module_id&&(o=n.module_id,i=n.ui_action),c.isEmpty(o))throw new Error(t.input_type+" => missing module id");t.container.on("click","[data-sek-option-type]",function(e){e.preventDefault(),t.container.find("[data-sek-option-type]").removeClass("is-selected").attr("aria-pressed",!1),a(this).addClass("is-selected").attr("aria-pressed",!0),s.previewer.trigger("settings"===a(this).data("sek-option-type")?"sek-edit-options":"sek-edit-module",{id:o,level:"module"})});var r="sek-generate-level-options-ui"===i?"settings":"content";t.container.find("[data-sek-option-type]").removeClass("is-selected").attr("aria-pressed",!1),t.container.find('[data-sek-option-type="'+r+'"]').addClass("is-selected").attr("aria-pressed",!0)}})}(wp.customize,jQuery,_),function(l,d,u){l.czrInputMap=l.czrInputMap||{};var p=function(e){return u.contains(["px","em","%"],e)||(l.errare("error : invalid unit for input "+this.id,e),e="px"),e},_=function(i){var o=this;i.on("click",".sek-ui-button",function(e,t){e.preventDefault(),i.find(".sek-ui-button").removeClass("is-selected").attr("aria-pressed",!1),d(this).addClass("is-selected").attr("aria-pressed",!0),o.css_unit(d(this).data("sek-unit"),t)}),i.find('.sek-ui-button[data-sek-unit="'+(o.initial_unit||"px")+'"]').addClass("is-selected").attr("aria-pressed",!0)},m=function(t,i){var o=this;t.on("click",".reset-spacing-wrap",function(e){e.preventDefault(),t.find('input[type="number"]').each(function(){d(this).val("")}),o(i),d(".sek-unit-wrapper",t).find('[data-sek-unit="px"]').trigger("click")})};d.extend(l.czrInputMap,{spacing:function(e){var n=this,i=d(".sek-spacing-wrapper",n.container),t=l.czr_sektions.getInputRegistrationParams(n.id,n.module.module_type),o=u.isEmpty(t)||u.isEmpty(t.default)?[]:t.default;if(i.on("input",'input[type="number"]',function(e){var t=d(this).closest("[data-sek-spacing]").data("sek-spacing"),i=d.extend(!0,{},u.isObject(n())?n():{}),o=d(this).val();u.isString(o)&&!u.isEmpty(o)||u.isNumber(o)?i[t]=o:i=u.omit(i,t),n(i)}),m.call(n,i,o),u.isObject(n())){u.each(n(),function(e,t){d('[data-sek-spacing="'+t+'"]',i).find('input[type="number"]').val(e)});var r="px";d(".sek-unit-wrapper .sek-ui-button",n.container).each(function(){var e=d(this).data("sek-unit");u.isEmpty(n())||u.isEmpty(n().unit)||e===n().unit&&(r=e)}),d(".sek-unit-wrapper",n.container).find('[data-sek-unit="'+p.call(n,r)+'"]').trigger("click")}var s=n();n.initial_unit="px",u.isEmpty(s)||(n.initial_unit=u.isEmpty(s.unit)?"px":s.unit),n.css_unit=new l.Value(p.call(n,n.initial_unit)),n.css_unit.bind(function(e){var t;e=u.isEmpty(e)?"px":e,(t=d.extend(!0,{},u.isObject(n())?n():{})).unit=e,n(t)}),_.call(n,i)}}),d.extend(l.czrInputMap,{spacingWithDeviceSwitcher:function(e){var r=this,s=d(".sek-spacing-wrapper",r.container),t=l.czr_sektions.getInputRegistrationParams(r.id,r.module.module_type),a=u.isEmpty(t)||u.isEmpty(t.default)?{}:t.default,c=function(e,t){var i=["mobile","tablet","desktop"];if(u.has(e,t))return e[t];var o=u.findIndex(i,function(e){return t===e});return!u.isEmpty(t)&&o<i.length?c(e,i[o+1]):{}},i=function(e){var t=d.extend(!0,{},u.isObject(r())?r():{}),i=d.extend(!0,{},a);t=u.isObject(t)?d.extend(i,t):i;var o=c(t,e);d("[data-sek-spacing]",s).each(function(){var e=d(this).data("sek-spacing"),t="";u.isEmpty(o)||u.isEmpty(o[e])||(t=o[e]),d(this).find('input[type="number"]').val(t)});var n="px";d(".sek-unit-wrapper .sek-ui-button",r.container).each(function(){var e=d(this).data("sek-unit");u.isEmpty(o)||u.isEmpty(o.unit)||e===o.unit&&(n=e)}),d(".sek-unit-wrapper",r.container).find('[data-sek-unit="'+p.call(r,n)+'"]').trigger("click",{previewed_device_switched:!0})};l.czr_sektions.maybeSetupDeviceSwitcherForInput.call(r);var o=r();r.initial_unit="px",u.isEmpty(o)||u.isEmpty(o[r.previewedDevice()])||(r.initial_unit=u.isEmpty(o[r.previewedDevice()].unit)?"px":o[r.previewedDevice()].unit),r.css_unit=new l.Value(p.call(r,r.initial_unit)),s.on("input",'input[type="number"]',function(e){var t,i=d(this).closest("[data-sek-spacing]").data("sek-spacing"),o=d(this).val(),n=l.previewedDevice()||"desktop";(t=d.extend(!0,{},u.isObject(r())?r():{}))[n]=d.extend(!0,{},t[n]||{}),u.isString(o)&&!u.isEmpty(o)||u.isNumber(o)?t[n][i]=o:t[n]=u.omit(t[n],i),t[n].unit&&r.css_unit()==t[n].unit||(t[n].unit=r.css_unit()),r(t)}),m.call(r,s,a),r.previewedDevice.bind(function(e){try{i(e)}catch(e){l.errare("Error when firing syncWithPreviewedDevice for input type spacingWithDeviceSwitcher for input id "+r.id,e)}}),r.css_unit.bind(function(e,t,i){if(!u.isObject(i)||!0!==i.previewed_device_switched){e=u.isEmpty(e)?"px":e;var o,n=r.previewedDevice()||"desktop";(o=d.extend(!0,{},u.isObject(r())?r():{}))[n]=d.extend(!0,{},o[n]||{}),o[n].unit=e,r(o)}}),_.call(r,s);try{i(l.previewedDevice())}catch(e){l.errare("Error when firing syncWithPreviewedDevice for input type spacingWithDeviceSwitcher for input id "+r.id,e)}}})}(wp.customize,jQuery,_),function(o,a,c){o.czrInputMap=o.czrInputMap||{},a.extend(o.czrInputMap,{bg_position:function(e){var t=this;a(".sek-bg-pos-wrapper",t.container).on("change",'input[type="radio"]',function(e){t(a(this).val())}),c.isEmpty(t())||t.container.find('input[value="'+t()+'"]').attr("checked",!0).trigger("click")},bgPositionWithDeviceSwitcher:function(e){var n=this,t=o.czr_sektions.getInputRegistrationParams(n.id,n.module.module_type),r=c.isEmpty(t)||c.isEmpty(t.default)?{}:t.default;o.czr_sektions.maybeSetupDeviceSwitcherForInput.call(n);var s=function(e,t){var i=["mobile","tablet","desktop"];if(c.has(e,t))return e[t];var o=c.findIndex(i,function(e){return t===e});return!c.isEmpty(t)&&o<i.length?s(e,i[o+1]):{}},i=function(e){var t=a.extend(!0,{},c.isObject(n())?n():{}),i=a.extend(!0,{},r);t=c.isObject(t)?a.extend(i,t):i;var o=s(t,e);n.container.find('input[value="'+o+'"]').attr("checked",!0).trigger("click",{previewed_device_switched:!0})};a(".sek-bg-pos-wrapper",n.container).on("change",'input[type="radio"]',function(e){var t,i=a(this).val();(t=a.extend(!0,{},c.isObject(n())?n():{}))[o.previewedDevice()||"desktop"]=i,n(t)}),n.previewedDevice.bind(function(e){try{i(e)}catch(e){o.errare("Error when firing syncWithPreviewedDevice for input type spacingWithDeviceSwitcher for input id "+n.id,e)}});try{i(o.previewedDevice())}catch(e){o.errare("Error when firing syncWithPreviewedDevice for input type bgPositionWithDeviceSwitcher for input id "+n.id,e)}}})}(wp.customize,jQuery,_),function(c,l,d){c.czrInputMap=c.czrInputMap||{};var e=function(e){var n=this,t=c.czr_sektions.getInputRegistrationParams(n.id,n.module.module_type),r=d.isEmpty(t)||d.isEmpty(t.default)?{}:t.default,i="verticalAlignWithDeviceSwitcher"===n.type?".sek-v-align-wrapper":".sek-h-align-wrapper",s=l(i,n.container);c.czr_sektions.maybeSetupDeviceSwitcherForInput.call(n);var a=function(e,t){var i=["mobile","tablet","desktop"];if(d.has(e,t))return e[t];var o=d.findIndex(i,function(e){return t===e});return!d.isEmpty(t)&&o<i.length?a(e,i[o+1]):{}},o=function(e){var t=l.extend(!0,{},d.isObject(n())?n():{}),i=l.extend(!0,{},r);t=d.isObject(t)?l.extend(i,t):i;var o=a(t,e);s.find(".selected").removeClass("selected"),s.find('div[data-sek-align="'+o+'"]').addClass("selected")};s.on("click","[data-sek-align]",function(e){var t;e.preventDefault(),(t=l.extend(!0,{},d.isObject(n())?n():{}))[c.previewedDevice()||"desktop"]=l(this).data("sek-align"),s.find(".selected").removeClass("selected"),l.when(l(this).addClass("selected")).done(function(){n(t)})}),n.previewedDevice.bind(function(e){try{o(e)}catch(e){c.errare("Error when firing syncWithPreviewedDevice for input type : "+n.type+" for input id "+n.id,e)}});try{o(c.previewedDevice())}catch(e){c.errare("Error when firing syncWithPreviewedDevice for input type : "+n.type+" for input id "+n.id,e)}};l.extend(c.czrInputMap,{horizTextAlignmentWithDeviceSwitcher:e,horizAlignmentWithDeviceSwitcher:e,verticalAlignWithDeviceSwitcher:e})}(wp.customize,jQuery,_),function(f,g,h){f.czrInputMap=f.czrInputMap||{},g.extend(f.czrInputMap,{font_picker:function(e){var p=this,_=p.input_parent,o=function(e,t){_();var o=g('select[data-czrtype="'+p.id+'"]',p.container);h.isNull(p())||h.isEmpty(p())?o.append('<option value="none" selected="selected">'+sektionsLocalizedData.i18n["Select a font family"]+"</option>"):o.append('<option value="none">'+sektionsLocalizedData.i18n["Select a font family"]+"</option>");var i=[{title:sektionsLocalizedData.i18n["Web safe fonts"],type:"cfont",list:t.cfonts},{title:sektionsLocalizedData.i18n["Google fonts"],type:"gfont",list:t.gfonts}],n=f.czr_sektions.sniffAllFonts(),r=sektionsLocalizedData.alreadyUsedFonts,s=[],a=[];if(!h.isEmpty(r)&&h.isObject(r)&&h.each(r,function(e){a.push(e)}),h.isArray(n)&&h.each(n,function(e){a.push(e)}),!h.isEmpty(a)){var c={},l=[];a.forEach(function(e){c[e]=(c[e]||0)+1});var d=h.sortBy(c,function(e){return e});h.each(d,function(i){h.each(c,function(e,t){i!==e||h.contains(l,t)||l.unshift(t)})}),h.each(l,function(e){s.push({name:e})}),i.unshift({title:sektionsLocalizedData.i18n["Already used fonts"],type:null,list:s})}h.each(i,function(e){var t,r,s,i=g("<optgroup>",{label:e.title,html:(t=e.list,r=e.type,s="",h.each(t,function(e){var t,i,o=h.isString(e.name)?e.name:"Undefined Font Family",n=o.replace(/[+|:]/g," ");t=o,i=r,o=h.isEmpty(i)?t:h.isString(t)?["[",i,"]",t].join(""):"",n=n.replace("[cfont]","").replace("[gfont]",""),o==p()?s+='<option selected="selected" value="'+o+'">'+n+"</option>":s+='<option value="'+o+'">'+n+"</option>"}),s)});o.append(i)});var u={escapeMarkup:function(e){return e}};e&&g.extend(u,{resultsAdapter:e,closeOnSelect:!1}),o.czrSelect2(u),g(".czrSelect2-selection__rendered",p.container).css(m(p()))},m=function(e){if(!h.isString(e)||h.isEmpty(e))return{};var t,i,o,n=(e=e.replace("[gfont]","").replace("[cfont]","")).split(":");return t=r(e),i=n[1]?n[1].replace(/[^0-9.]+/g,""):400,i=h.isNumber(i)?i:400,o=n[1]&&-1!=n[1].indexOf("italic")?"italic":"",{"font-family":"none"==t?"inherit":t.replace(/[+|:]/g," "),"font-weight":i||400,"font-style":o||"normal"}},r=function(e){if(!h.isString(e)||h.isEmpty(e))return e;var t=(e=e.replace("[gfont]","").replace("[cfont]","")).split(":");return h.isString(t[0])?t[0].replace(/[+|:]/g," "):""};g.when(function(){var e,t=g.Deferred();h.isEmpty(f.sek_fontCollections)?(h.isUndefined(f.sek_fetchingFontCollection)||"pending"!=f.sek_fetchingFontCollection.state()?(e=f.CZR_Helpers.getModuleTmpl({tmpl:"font_list",module_type:"font_picker_input",module_id:p.module.id}),f.sek_fetchingFontCollection=e):e=f.sek_fetchingFontCollection,e.done(function(e){if("string"!=typeof e||"{"!==e[0])throw new Error("font_picker => server list is not JSON.parse-able");f.sek_fontCollections=JSON.parse(e),t.resolve(f.sek_fontCollections)}).fail(function(e){t.reject(e)})):t.resolve(f.sek_fontCollections);return t.promise()}()).done(function(t){var i;(i=g.Deferred(),void 0!==g.fn.czrSelect2&&void 0!==g.fn.czrSelect2.amd&&"function"==typeof g.fn.czrSelect2.amd.require?g.fn.czrSelect2.amd.require(["czrSelect2/results","czrSelect2/utils"],function(e,t){var o=function(e,t,i){o.__super__.constructor.call(this,e,t,i)};t.Extend(o,e),o.prototype.bind=function(e,t){var i=this;e.on("results:focus",function(e){"true"!=e.element.attr("aria-selected")&&i.trigger("select",{data:e.data})}),o.__super__.bind.call(this,e,t)},i.resolve(o)}):i.resolve(!1),i.promise()).done(function(e){o(e,t)})}).fail(function(e){f.errare("font_picker => fail response =>",e)})}})}(wp.customize,jQuery,_),function(r,s,a){r.czrInputMap=r.czrInputMap||{},s.extend(r.czrInputMap,{fa_icon_picker:function(){var o=this,n=!1,e=function(t){!0!==o.iconCollectionSet&&(s.when(s.Deferred(function(t){a.isEmpty(o.sek_faIconCollection)?r.CZR_Helpers.getModuleTmpl({tmpl:"icon_list",module_type:"fa_icon_picker_input",module_id:o.module.id}).done(function(e){if("string"!=typeof e||"["!==e[0])throw new Error("fa_icon_picker => server list is not JSON.parse-able");o.sek_faIconCollection=JSON.parse(e),t.resolve(o.sek_faIconCollection)}).fail(function(e){t.reject(e)}):t.resolve(o.sek_faIconCollection)})).done(function(e){!function(e){a.each(e,function(e){var t={value:e,html:r.CZR_Helpers.capitalize(e.substring(7))};t.value==o()&&(s.extend(t,{selected:"selected"}),n=!0),s("select[data-czrtype]",o.container).append(s("<option>",t))});var t,i=function(e){return e.id?s('<span class="'+e.element.value+'"></span><span class="social-name">&nbsp;&nbsp;'+e.text+"</span>"):e.text};t=n?s("<option>"):s("<option>",{selected:"selected"}),s("select[data-czrtype]",o.container).prepend(t).czrSelect2({templateResult:i,templateSelection:i,placeholder:sektionsLocalizedData.i18n["Select an icon"],allowClear:!0})}(e),t&&!0===t.open_on_init&&a.delay(function(){try{s("select[data-czrtype]",o.container).czrSelect2("open")}catch(e){}},100)}).fail(function(e){r.errare("fa_icon_picker => fail response =>",e)}),o.iconCollectionSet=!0)};o.container.on("click",function(){e()}),a.delay(function(){e({open_on_init:!1})},1e3)}})}(wp.customize,jQuery,_),function(u,p,_){u.czrInputMap=u.czrInputMap||{},p.extend(u.czrInputMap,{code_editor:function(e){var o=this,i=this.module.control,n=(o.input_parent(),!1),r=o.container.find("textarea"),s=o.container.find(".customize-control-title"),a=function(){return p.Deferred(function(t){var i=_.isEmpty(r.data("editor-code-type"))?"text/html":r.data("editor-code-type");u.czr_sektions.code_editor_params&&u.czr_sektions.code_editor_params[i]?t.resolve(u.czr_sektions.code_editor_params[i]):wp.ajax.post("sek_get_code_editor_params",{nonce:u.settings.nonce.save,code_type:i}).done(function(e){_.isObject(e)||u.errare(o.id+" => error => invalid code editor params sent by server",e),u.czr_sektions.code_editor_params={},u.czr_sektions.code_editor_params[i]=e,t.resolve(u.czr_sektions.code_editor_params[i])}).fail(function(e){t.reject(e)})})};o.isReady.done(function(){var t=function(e){_.isEmpty(this.editor)&&(_.isEmpty(this.module.control.container.attr("data-sek-expanded"))||"false"==this.module.control.container.attr("data-sek-expanded")||setTimeout(function(){if(n)try{c(n)}catch(e){u.errare("error in sek_control => code_editor() input",e),l()}else l();s.trigger("click")},10))};r.html(o()),p.when(a()).done(function(e){wp.codeEditor&&(_.isUndefined(e)||!1!==e)&&(n=e),t.call(o),o.module.control.container.on("sek-accordion-expanded",function(){t.call(o)})}).fail(function(e){u.errare(o.id+" => error when getting the editor params from server")})});var c=function(e){var t,i=!1;t=_.extend({},e,{onTabNext:CZRSeksPrototype.selectNextTabbableOrFocusable(":tabbable"),onTabPrevious:CZRSeksPrototype.selectPrevTabbableOrFocusable(":tabbable"),onUpdateErrorNotice:d}),o.editor=wp.codeEditor.initialize(r,t),p(o.editor.codemirror.display.lineDiv).attr({role:"textbox","aria-multiline":"true","aria-label":s.html(),"aria-describedby":"editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4"}),s.on("click",function(e){e.stopPropagation(),o.editor.codemirror.focus()}),o.editor.codemirror.on("change",function(e){i=!0,r.val(e.getValue()).trigger("change"),i=!1}),o.editor.codemirror.setValue(o()),o.bind(o.id+":changed",function(e){i||o.editor.codemirror.setValue(e)}),o.editor.codemirror.on("keydown",function(e,t){27===t.keyCode&&t.stopPropagation()})},l=function(){var n=r[0];o.editor=n,r.on("blur",function(){r.data("next-tab-blurs",!1)}),r.on("keydown",function(e){var t,i,o;27!==e.keyCode?9!==e.keyCode||e.ctrlKey||e.altKey||e.shiftKey||r.data("next-tab-blurs")||(t=n.selectionStart,i=n.selectionEnd,o=n.value,0<=t&&(n.value=o.substring(0,t).concat("\t",o.substring(i)),r.selectionStart=n.selectionEnd=t+1),e.stopPropagation(),e.preventDefault()):r.data("next-tab-blurs")||(r.data("next-tab-blurs",!0),e.stopPropagation())})},d=function(e){var t;i.setting.notifications.remove(o.id),0!==e.length&&(t=1===e.length?sektionsLocalizedData.i18n.codeEditorSingular.replace("%d","1").replace("%s",s.html()):sektionsLocalizedData.i18n.codeEditorPlural.replace("%d",String(e.length)).replace("%s",s.html()),i.setting.notifications.add(o.id,new u.Notification(o.id,{message:t,type:"warning"})))}}})}(wp.customize,jQuery,_),function(e,r,t){e.czrInputMap=e.czrInputMap||{},r.extend(e.czrInputMap,{range_simple:function(e){var t=this,i=r(".sek-range-with-unit-picker-wrapper",t.container),o=i.find('input[type="number"]'),n=i.find('input[type="range"]');n.on("input",function(e){o.val(r(this).val()).trigger("input")}),o.on("input",function(e){t(r(this).val()),n.val(r(this).val())}),n.val(o.val()||0)},number_simple:function(e){var t=this;t.container.find('input[type="number"]').on("input",function(e){t(r(this).val())})}})}(wp.customize,jQuery,_),function(d,u,p){d.czrInputMap=d.czrInputMap||{},u.extend(d.czrInputMap,{range_simple_device_switcher:function(e){var s=this,t=u(".sek-range-with-unit-picker-wrapper",s.container),a=t.find('input[type="number"]'),r=t.find('input[type="range"]'),i=d.czr_sektions.getInputRegistrationParams(s.id,s.module.module_type),c=p.isEmpty(i)||p.isEmpty(i.default)?{}:i.default,l=function(e,t){var i=["mobile","tablet","desktop"];if(p.has(e,t))return e[t];var o=p.findIndex(i,function(e){return t===e});return!p.isEmpty(t)&&o<i.length?l(e,i[o+1]):u.extend(!0,{desktop:""},c).desktop},o=function(e){var t=s(),i={};i=u.extend(!0,{},c),p.isObject(t)?i=u.extend(!0,{},t):p.isString(t)&&!p.isEmpty(t)&&(i={desktop:t});var o,n=l(i,e),r=(o=n,p.isEmpty(o)||!p.isString(o)?"16":o.replace(/px|em|%/g,""));a.val(r).trigger("input",{previewed_device_switched:!0})};d.czr_sektions.maybeSetupDeviceSwitcherForInput.call(s),r.on("input",function(e){a.val(u(this).val()).trigger("input")}),a.on("input",function(e,t){var i,o=d.previewedDevice()||"desktop",n=u(this).val();(i=u.extend(!0,{},p.isObject(s())?s():{}))[o]=u.extend(!0,{},i[o]||{}),p.isString(n)&&!p.isEmpty(n)&&(i[o]=n),(p.isEmpty(t)||p.isObject(t)&&!0!==t.previewed_device_switched)&&s(i),r.val(u(this).val())}),s.previewedDevice.bind(function(e){try{o(e)}catch(e){d.errare("Error when firing syncWithPreviewedDevice for input type "+s.type+" for input id "+s.id,e)}}),r.val(a.val()||0);try{o(d.previewedDevice())}catch(e){d.errare("Error when firing syncWithPreviewedDevice for input type "+s.type+" for input id "+s.id,e)}}})}(wp.customize,jQuery,_),function(a,c,l){a.czrInputMap=a.czrInputMap||{},c.extend(a.czrInputMap,{range_with_unit_picker:function(e){var t=this,i=c(".sek-range-with-unit-picker-wrapper",t.container),o=i.find('input[type="number"]'),n=i.find('input[type="range"]'),r=i.find("input[data-czrtype]").data("sek-unit"),s=function(e){return l.contains(["px","em","%"],e)||(a.errare("error : invalid unit for input "+t.id,e),e="px"),e};t.css_unit=new a.Value(l.isEmpty(r)?"px":s(r)),t.css_unit.bind(function(e){e=l.isEmpty(e)?"px":e,i.find('input[type="number"]').trigger("input")}),n.on("input",function(e){o.val(c(this).val()).trigger("input")}),o.on("input",function(e){t(c(this).val()+s(t.css_unit())),n.val(c(this).val())}),n.val(o.val()||0),i.on("click",".sek-ui-button",function(e){e.preventDefault(),i.find(".sek-ui-button").removeClass("is-selected").attr("aria-pressed",!1),c(this).addClass("is-selected").attr("aria-pressed",!0),i.find("input[data-czrtype]").data("sek-unit",c(this).data("sek-unit")),t.css_unit(c(this).data("sek-unit"))}),i.find('.sek-ui-button[data-sek-unit="'+r+'"]').addClass("is-selected").attr("aria-pressed",!0)}})}(wp.customize,jQuery,_),function(a,_,m){a.czrInputMap=a.czrInputMap||{},_.extend(a.czrInputMap,{range_with_unit_picker_device_switcher:function(e){var c=this,l=_(".sek-range-with-unit-picker-wrapper",c.container),d=l.find('input[type="number"]'),r=l.find('input[type="range"]'),s=function(e){return m.contains(["px","em","%"],e)||(a.errare("range_with_unit_picker_device_switcher => error : invalid unit for input "+c.id,e),e="px"),e},t=a.czr_sektions.getInputRegistrationParams(c.id,c.module.module_type),u=m.isEmpty(t)||m.isEmpty(t.default)?{}:t.default,i=function(){return l.find("input[data-czrtype]").data("sek-unit")||"px"},p=function(e,t){var i=["mobile","tablet","desktop"];if(m.has(e,t))return e[t];var o=m.findIndex(i,function(e){return t===e});return!m.isEmpty(t)&&o<i.length?p(e,i[o+1]):_.extend(!0,{desktop:""},u).desktop},o=function(e){var t=c(),i={};i=_.extend(!0,{},u),m.isObject(t)?i=_.extend(!0,{},t):m.isString(t)&&!m.isEmpty(t)&&(i={desktop:t});var o,n,r=p(i,e),s=(n=r,m.isEmpty(n)||!m.isString(n)?"px":n.replace(/[0-9]|\.|,/g,"")),a=(o=r,m.isEmpty(o)||!m.isString(o)?"16":o.replace(/px|em|%/g,""));_(".sek-unit-wrapper",l).find('[data-sek-unit="'+s+'"]').trigger("click",{previewed_device_switched:!0}),l.find('.sek-ui-button[data-sek-unit="'+s+'"]').addClass("is-selected").attr("aria-pressed",!0),d.val(a).trigger("input",{previewed_device_switched:!0})};a.czr_sektions.maybeSetupDeviceSwitcherForInput.call(c),c.css_unit=new a.Value(m.isEmpty(i())?"px":s(i()));var n='<button type="button" class="button sek-reset-button sek-float-right">'+sektionsLocalizedData.i18n.Reset+"</button>";c.container.find(".customize-control-title").append(n),c.css_unit.bind(function(e,t,i){m.isObject(i)&&!0===i.previewed_device_switched||d.trigger("input")}),r.on("input",function(e){d.val(_(this).val()).trigger("input")}),d.on("input",function(e,t){var i,o=a.previewedDevice()||"desktop",n=_(this).val()+s(c.css_unit());(i=_.extend(!0,{},m.isObject(c())?c():{}))[o]=_.extend(!0,{},i[o]||{}),m.isString(n)&&!m.isEmpty(n)&&(i[o]=n),(m.isEmpty(t)||m.isObject(t)&&!0!==t.previewed_device_switched)&&c(i),r.val(_(this).val())}),l.on("click",".sek-ui-button",function(e,t){e.stopPropagation(),l.find(".sek-ui-button").removeClass("is-selected").attr("aria-pressed",!1),_(this).addClass("is-selected").attr("aria-pressed",!0),l.find("input[data-czrtype]").data("sek-unit",_(this).data("sek-unit")),c.css_unit(_(this).data("sek-unit"),t)}),c.previewedDevice.bind(function(e){try{o(e)}catch(e){a.errare("Error when firing syncWithPreviewedDevice for input type range_with_unit_picker_device_switcher for input id "+c.id,e)}}),c.container.on("click",".sek-reset-button",function(e){var t=a.previewedDevice(),i=_.extend(!0,{},m.isObject(c())?c():{});m.isEmpty(i[t])||(i=m.omit(i,t),c(i),o(a.previewedDevice()))}),r.val(d.val()||0);try{o(a.previewedDevice())}catch(e){a.errare("Error when firing syncWithPreviewedDevice for input type range_with_unit_picker_device_switcher for input id "+c.id,e)}}})}(wp.customize,jQuery,_),function(g,h,v){g.czrInputMap=g.czrInputMap||{},h.extend(g.czrInputMap,{borders:function(e){var a=this,c=h(".sek-borders",a.container),l=c.find('input[type="number"]'),d=c.find('input[type="range"]'),u=c.find(".sek-alpha-color-input"),p=function(e){return v.contains(["px","em","%"],e)||(g.errare("borders => error : invalid unit for input "+a.id,e),e="px"),e},_=function(e){return v.isEmpty(e)||!v.isString(e)?"16":e.replace(/px|em|%/g,"")},m=function(e){return v.isEmpty(e)||!v.isString(e)?"px":e.replace(/[0-9]|\.|,/g,"")},t=g.czr_sektions.getInputRegistrationParams(a.id,a.module.module_type),f=v.isEmpty(t)||v.isEmpty(t.default)?{}:t.default;a.cssBorderTypes=["top","left","right","bottom"];var i,o,n=function(){var e=a(),t="px";return v.isObject(e)&&v.has(e,"_all_")&&v.isObject(e._all_)&&!v.isEmpty(e._all_.wght)&&(t=p(m(e._all_.wght))),t},r=function(){var e=a(),t="#000000";return v.isObject(e)&&v.has(e,"_all_")&&v.isObject(e._all_)&&!v.isEmpty(e._all_.col)&&(t=e._all_.col),t},s=function(e){if(!v.contains(v.union(a.cssBorderTypes,["_all_"]),e))throw new Error("Error in syncWithBorderType : the border type must be one of those values '_all_', 'top', 'left', 'right', 'bottom'");var t=a(),i={},o=h.extend(!0,{},f);v.isObject(t)?i=h.extend(!0,{},t):v.isString(t)&&(i={_all_:{wght:t}});var n,r,s=function(e,t){var i,o=h.extend(!0,{},f);if(!v.has(o,"_all_"))throw new Error("Error when firing getCurrentBorderTypeOrAllValue : the default value of the borders input must be php registered as an array formed : array( 'wght' => '1px', 'col' => '#000000' )");return i=v.isObject(e)&&v.has(e,"_all_")?v.extend(o._all_,e._all_):o._all_,v.has(e,t)&&v.isObject(e[t])?v.extend(i,e[t]):o._all_}(i=h.extend(o,i),e);if(v.isEmpty(s)||!v.isObject(s)||v.isEmpty(s.wght)||v.isEmpty(s.col))throw new Error("Error in syncWithBorderType : getCurrentBorderTypeOrAllValue must return an object formed : array( 'wght' => '1px', 'col' => '#000000' )");n=m(s.wght),r=_(s.wght),h(".sek-unit-wrapper",c).find('[data-sek-unit="'+n+'"]').trigger("click",{border_type_switched:!0}),c.find('.sek-ui-button[data-sek-unit="'+n+'"]').addClass("is-selected").attr("aria-pressed",!0),l.val(r).trigger("input",{border_type_switched:!0}),u.data("border_type_switched",!0),u.val(s.col).trigger("change"),u.data("border_type_switched",!1)};a.borderColor=new g.Value(v.isEmpty(r())?"#000000":r()),a.css_unit=new g.Value(v.isEmpty(n())?"px":p(n())),a.borderType=new g.Value("_all_"),l.val((i=a(),o=1,v.isObject(i)&&v.has(i,"_all_")&&v.isObject(i._all_)&&!v.isEmpty(i._all_.wght)&&(o=_(i._all_.wght)),o=parseInt(o,10),(!v.isNumber(o)||o<0)&&(g.errare("Error in borders input type for module : "+a.module.module_type+" the initial border width is invalid : "+o),o=1),o)),u.val(a.borderColor()),u.wpColorPicker({palettes:!0,width:1440<=window.innerWidth?271:251,change:function(e,t){h(this).val(t.color.toString()).trigger("colorpickerchange"),a.borderColor(t.color.toString(),{border_type_switched:!0===h(this).data("border_type_switched")})},clear:function(e,t){h(this).val("").trigger("colorpickerchange"),a.borderColor("")}}),a.css_unit.bind(function(e,t,i){(!v.isObject(i)||!0!==i.border_type_switched&&!0!==i.initializing_the_unit)&&l.trigger("input",i)}),a.borderColor.bind(function(e,t,i){(!v.isObject(i)||!0!==i.border_type_switched&&!0!==i.initializing_the_color)&&l.trigger("input",i)}),a.borderType.bind(function(e){try{s(e)}catch(e){g.errare("Error when firing syncWithBorderType for input type borders for module type "+a.module.module_type,e)}}),d.on("input",function(e){l.val(h(this).val()).trigger("input")}),l.on("input",function(e,t){var i,o=a.borderType()||"_all_",n=a.borderColor(),r=h(this).val()+p(a.css_unit()),s=h.extend(!0,{},f);(i=h.extend(!0,{},v.isObject(a())?a():s))[o]=h.extend(!0,{},i[o]||s[o]),v.isString(r)&&!v.isEmpty(r)&&(i[o].wght=r),i[o].col=n,(v.isEmpty(t)||v.isObject(t)&&!0!==t.border_type_switched)&&("_all_"===o&&v.each(a.cssBorderTypes,function(e){i=v.omit(i,e)}),a(i)),d.val(h(this).val())}),c.on("click","[data-sek-unit]",function(e,t){e.preventDefault(),c.find("[data-sek-unit]").removeClass("is-selected").attr("aria-pressed",!1),h(this).addClass("is-selected").attr("aria-pressed",!0),c.find("input[data-czrtype]").data("sek-unit",h(this).data("sek-unit")),a.css_unit(h(this).data("sek-unit"),t)}),c.on("click","[data-sek-border-type]",function(e,t){e.preventDefault(),c.find("[data-sek-border-type]").removeClass("is-selected").attr("aria-pressed",!1),h(this).addClass("is-selected").attr("aria-pressed",!0);var i="_all_";try{i=h(this).data("sek-border-type")}catch(e){g.errare("borders input type => error when attaching click event",e)}a.borderType(i,t)}),a.container.on("click",".sek-reset-button",function(e){var t=a.borderType()||"_all_",i=h.extend(!0,{},v.isObject(a())?a():{});v.isEmpty(i[t])||(i=v.omit(i,t),a(i),s(t))}),d.val(l.val()||0);try{s(a.borderType())}catch(e){g.errare("Error when firing syncWithBorderType for input type borders for module type "+a.module.module_type,e)}h('[data-sek-unit="'+a.css_unit()+'"]',c).trigger("click",{initializing_the_unit:!0})}})}(wp.customize,jQuery,_),function(m,f,g){m.czrInputMap=m.czrInputMap||{},f.extend(m.czrInputMap,{border_radius:function(e){var a=this,c=f(".sek-borders",a.container),l=c.find('input[type="number"]'),s=c.find('input[type="range"]'),d=function(e){return g.contains(["px","em","%"],e)||(m.errare("border_radius => error : invalid unit for input "+a.id,e),e="px"),e},u=function(e){return g.isEmpty(e)||!g.isString(e)?"16":e.replace(/px|em|%/g,"")},p=function(e){return g.isEmpty(e)||!g.isString(e)?"px":e.replace(/[0-9]|\.|,/g,"")},t=m.czr_sektions.getInputRegistrationParams(a.id,a.module.module_type),_=g.isEmpty(t)||g.isEmpty(t.default)?{}:t.default;a.cssRadiusTypes=["top_left","top_right","bottom_right","bottom_left"];var i,o,n=function(){var e=a(),t="px";return g.isObject(e)&&g.has(e,"_all_")&&(t=d(p(e._all_))),t},r=function(e){if(!g.contains(["_all_","top_left","top_right","bottom_right","bottom_left"],e))throw new Error("Error in syncWithRadiusType : the radius type must be one of those values '_all_', 'top_left', 'top_right', 'bottom_right', 'bottom_left', => radius type => "+e);var t=a(),i={},o=f.extend(!0,{},_);g.isObject(t)?i=f.extend(!0,{},t):g.isString(t)&&(i={_all_:"0px"});var n,r,s=function(e,t){var i,o=f.extend(!0,{},_);if(!g.has(o,"_all_"))throw new Error("Error when firing getCurrentRadiusTypeOrAllValue : the default value of the border_radius input must be php registered as an array");return i=g.isObject(e)&&g.has(e,"_all_")?e._all_:o._all_,g.has(e,t)?e[t]:i}(i=f.extend(o,i),e);if(g.isEmpty(s)||!g.isString(s))throw new Error("Error in syncWithRadiusType : getCurrentRadiusTypeOrAllValue must return a string like 3em");n=p(s),r=u(s),f(".sek-unit-wrapper",c).find('[data-sek-unit="'+n+'"]').trigger("click",{radius_type_switched:!0}),c.find('.sek-ui-button[data-sek-unit="'+n+'"]').addClass("is-selected").attr("aria-pressed",!0),l.val(r).trigger("input",{radius_type_switched:!0})};a.css_unit=new m.Value(g.isEmpty(n())?"px":d(n())),a.radiusType=new m.Value("_all_"),l.val((i=a(),o=0,g.isObject(i)&&g.has(i,"_all_")&&(o=u(i._all_)),o=parseInt(o,10),(!g.isNumber(o)||o<0)&&(m.errare("Error in border_radius input type for module : "+a.module.module_type+" the initial radius is invalid : "+o),o=0),o)),a.css_unit.bind(function(e,t,i){(!g.isObject(i)||!0!==i.radius_type_switched&&!0!==i.initializing_the_unit)&&l.trigger("input",i)}),a.radiusType.bind(function(e){try{r(e)}catch(e){m.errare("Error when firing syncWithRadiusType for input type border_radius for module type "+a.module.module_type,e)}}),s.on("input",function(e){l.val(f(this).val()).trigger("input")}),l.on("input",function(e,t){var i,o=a.radiusType()||"_all_",n=f(this).val()+d(a.css_unit()),r=f.extend(!0,{},_);(i=f.extend(!0,{},g.isObject(a())?a():r))[o]=f.extend(!0,{},i[o]||r[o]),g.isString(n)&&!g.isEmpty(n)&&(i[o]=n),(g.isEmpty(t)||g.isObject(t)&&!0!==t.radius_type_switched)&&("_all_"===o&&g.each(a.cssRadiusTypes,function(e){i=g.omit(i,e)}),a(i)),s.val(f(this).val())}),c.on("click","[data-sek-unit]",function(e,t){e.preventDefault(),c.find("[data-sek-unit]").removeClass("is-selected").attr("aria-pressed",!1),f(this).addClass("is-selected").attr("aria-pressed",!0),c.find("input[data-czrtype]").data("sek-unit",f(this).data("sek-unit")),a.css_unit(f(this).data("sek-unit"),t)}),c.on("click","[data-sek-radius-type]",function(e,t){e.preventDefault(),c.find("[data-sek-radius-type]").removeClass("is-selected").attr("aria-pressed",!1),f(this).addClass("is-selected").attr("aria-pressed",!0);var i="_all_";try{i=f(this).data("sek-radius-type")}catch(e){m.errare("border_radius input type => error when attaching click event",e)}a.radiusType(i,t)}),a.container.on("click",".sek-reset-button",function(e){var t=a.radiusType()||"_all_",i=f.extend(!0,{},g.isObject(a())?a():{});g.isEmpty(i[t])||(i=g.omit(i,t),a(i),r(t))}),s.val(l.val()||0);try{r(a.radiusType())}catch(e){m.errare("Error when firing syncWithRadiusType for input type border_radius for module type "+a.module.module_type,e)}f('[data-sek-unit="'+a.css_unit()+'"]',c).trigger("click",{initializing_the_unit:!0})}})}(wp.customize,jQuery,_),function(r,s,a){r.czrInputMap=r.czrInputMap||{},s.extend(r.czrInputMap,{buttons_choice:function(e){var o=this,n=s(".sek-button-choice-wrapper",o.container),t=n.find('input[type="number"]'),i=r.czr_sektions.getInputRegistrationParams(o.id,o.module.module_type);a.isEmpty(i)||a.isEmpty(i.default)||i.default;t.val(o()),n.on("click","[data-sek-choice]",function(e,t){var i;e.stopPropagation(),n.find("[data-sek-choice]").removeClass("is-selected").attr("aria-pressed",!1),s(this).addClass("is-selected").attr("aria-pressed",!0);try{i=s(this).data("sek-choice")}catch(e){r.errare("buttons_choice input type => error when attaching click event",e)}o(i)}),s('[data-sek-choice="'+o()+'"]',n).trigger("click",{initializing_the_unit:!0})}})}(wp.customize,jQuery,_),function(o,n,r){o.czrInputMap=o.czrInputMap||{},n.extend(o.czrInputMap,{reset_button:function(e){this.container.on("click","[data-sek-reset-scope]",function(e,t){e.stopPropagation();var i=n(this).data("sek-reset-scope");!r.isEmpty(i)&&r.contains(["local","global"],i)?o.czr_sektions.updateAPISetting({action:"sek-reset-collection",scope:i}).done(function(e){o.previewer.refresh(),o.previewer.trigger("sek-notify",{notif_id:"reset-success",type:"success",duration:8e3,message:["<span>","<strong>",sektionsLocalizedData.i18n["Reset complete"],"</strong>","</span>"].join("")})}).fail(function(e){o.errare("reset_button input => error when firing ::updateAPISetting",e),o.previewer.trigger("sek-notify",{notif_id:"reset-failed",type:"error",duration:8e3,message:["<span>","<strong>",sektionsLocalizedData.i18n["Reset failed"],"<br/>","<i>"+e+"</i>","</strong>","</span>"].join("")})}):o.errare("reset_button input => invalid scope provided.",i)})}})}(wp.customize,jQuery,_),function(i,r,s){i.czrInputMap=i.czrInputMap||{},r.extend(i.czrInputMap,{revision_history:function(e){var n=this;_selected_found=!1;var t=function(t){!0!==n.revisionHistorySet&&(r.when(r.Deferred(function(t){s.isEmpty(n.sek_revisionHistory)?i.czr_sektions.getRevisionHistory({is_local:"local_revisions"===n.id}).done(function(e){if(!s.isObject(e))throw new Error("_getRevisionHistory => server list is not a object");n.sek_revisionHistory=e,t.resolve(n.sek_revisionHistory)}).fail(function(e){t.reject(e)}):t.resolve(n.sek_revisionHistory)})).done(function(e){!function(e){if(!(0<n.container.find(".sek-revision-history").length))if(s.isEmpty(e))n.container.append(["<i>",sektionsLocalizedData.i18n["No revision history available for the moment."],"</i>"].join(""));else{n.container.append(r("<select/>",{class:"sek-revision-history",html:['<option value="_select_">'," -",sektionsLocalizedData.i18n.Select,"- ","</option>"].join("")}));var o=[];s.each(e,function(e,t){var i={value:t,html:e};i.value==n()&&(r.extend(i,{selected:"selected"}),_selected_found=!0),o.unshift(r("<option>",i))}),o[0].html([o[0].html(),sektionsLocalizedData.i18n["(currently published version)"]].join(" ")),s.each(o,function(e){r("select.sek-revision-history",n.container).append(e)}),r("select.sek-revision-history",n.container).selecter()}}(e),t&&!0===t.open_on_init&&s.delay(function(){try{r("select[data-czrtype]",n.container).czrSelect2("open")}catch(e){}},100)}).fail(function(e){i.errare("_getRevisionHistory => fail response =>",e)}),n.revisionHistorySet=!0)};n.container.on("change",".sek-revision-history",function(){var e=r(this).val();"_select_"!==e&&i.czr_sektions.setSingleRevision({revision_post_id:e,is_local:"local_revisions"===n.id})}),s.delay(function(){t({open_on_init:!1})},1e3)}})}(wp.customize,jQuery,_),function(p,_,m){p.czrInputMap=p.czrInputMap||{},_.extend(p.czrInputMap,{nimble_tinymce_editor:function(){var t=this,e=t.container.find("textarea").first(),i=0<e.length?e.attr("id"):null,o=p.czr_sektions.getInputRegistrationParams(t.id,t.module.module_type),n=sektionsLocalizedData.defaultToolbarBtns;if(m.isNull(i))throw new Error("api.czrInputMap.nimble_tinymce_editor => missing textarea for module :"+t.module.id);if(tinyMCE.get(i))throw new Error("api.czrInputMap.nimble_tinymce_editor => duplicate editor id.");var r,s,a=function(){return o&&o.editor_params&&!0===o.editor_params.autop},c={tinymce:{toolbar1:function(){var e=n.split(",");if(o.editor_params&&m.isArray(o.editor_params.excludedBtns)){var t=o.editor_params.excludedBtns;e=m.filter(e,function(e){return!m.contains(t,e)})}if(o.editor_params&&m.isString(o.editor_params.includedBtns)){var i=o.editor_params.includedBtns;m.isEmpty(i)||!m.isArray(sektionsLocalizedData[i])?p.errare("nimble_tinymce_editor input => invalid set of buttons provided",i):(i=sektionsLocalizedData[i],e=m.filter(e,function(e){return m.contains(i,e)}))}return e.join(",")}(),content_css:(r=wp.editor.getDefaultSettings(),s=[sektionsLocalizedData.tinyMceNimbleEditorStylesheetUrl],r&&r.tinymce&&r.tinymce.content_css&&(s=m.union(r.tinymce.content_css.split(","),s)),s.join(",")),min_height:40,height:o.editor_params&&m.isNumber(o.editor_params.height)?o.editor_params.height:p.czr_sektions.TINYMCE_EDITOR_HEIGHT},quicktags:{buttons:"strong,em,link,code"},mediaButtons:!o.editor_params||!1!==o.editor_params.media_button};c.tinymce.wpautop=a(),a()||(c.tinymce.forced_root_block=""),wp.editor.initialize(i,c);var l=tinyMCE.get(i);if(!l)throw new Error("setupTinyMceEditor => missing editor instance for module :"+t.module.id);p.czrActiveWPEditors=p.czrActiveWPEditors||[];var d=_.extend(!0,[],p.czrActiveWPEditors);d.push(i),p.czrActiveWPEditors=d;var u=function(){e.html(t()),l.setContent(t())};l.initialized?u():l.on("init",u),l.on("input change keyup",function(e){t(l.getContent())})},detached_tinymce_editor:function(){var e,t=this,i=_("textarea#"+sektionsLocalizedData.idOfDetachedTinyMceTextArea),o=p.czr_sektions.getInputRegistrationParams(t.id,t.module.module_type);if(!(0<i.length))throw new Error("api.czrInputMap::detached_tinymce_editor => missing textarea element");if(e=i.attr("id"),window.tinymce&&(mceInstance=window.tinymce.get(e),mceInstance&&mceInstance.remove()),!window.nimbleTinyMCEPreInit||!window.nimbleTinyMCEPreInit.mceInit||!window.nimbleTinyMCEPreInit.mceInit[e])throw new Error("setupDetachedTinyMceEditor => invalid nimbleTinyMCEPreInit global var");var n,r,s=nimbleTinyMCEPreInit.mceInit[e];s.content_css=(n=wp.editor.getDefaultSettings(),r=[sektionsLocalizedData.tinyMceNimbleEditorStylesheetUrl],n&&n.tinymce&&n.tinymce.content_css&&(r=m.union(n.tinymce.content_css.split(","),r)),r.join(","));var a=t.input_parent,c=function(){var e=a();return m.isUndefined(e.autop)?o&&o.editor_params&&!0===o.editor_params.autop:e.autop};s.wpautop=c(),c()||(s.forced_root_block=""),s.toolbar1=sektionsLocalizedData.defaultToolbarBtns,s.toolbar2="",window.tinymce.init(s),window.QTags.getInstance(e);var l=tinyMCE.get(e);if(!l)throw new Error("setupDetachedTinyMceEditor => missing editor instance for module :"+t.module.id);var d=function(){var e=t();l.setContent(e),p.sekEditorExpanded(!0),_(window).trigger("resize")};l.initialized?d():l.on("init",d),l.on("input change keyup keydown click SetContent BeforeSetContent",function(e){t(c()?l.getContent():wp.editor.removep(l.getContent()))}),p.sekCurrentDetachedTinyMceInput=t,i.data("czr-bound-for-detached-editor")||(i.on("input",function(e,t){p.sekCurrentDetachedTinyMceInput(_(this).val())}),i.data("czr-bound-for-detached-editor",!0))}})}(wp.customize,jQuery,_),function(l,d,u){l.czrInputMap=l.czrInputMap||{},d.extend(l.czrInputMap,{import_export:function(){var r=this,t=r.container.find('button[data-czr-action="sek-pre-import"]'),s=r.container.find("input[name=sek-import-file]"),e=l.czr_sektions.getInputRegistrationParams(r.id,r.module.module_type),a=e.scope,c="local"===e.scope?l.czr_sektions.localSectionsSettingId():l.czr_sektions.getGlobalSectionsSettingId();u.contains(["local","global"],a)||l.errare("api.czrInputMap.import_export => invalid currentScope",a),s.on("change",function(e){t.toggleClass("disabled",u.isEmpty(d(this).val()))});r.container.on("click","[data-czr-action]",function(e){var i,t;switch(e.stopPropagation(),d(this).data("czr-action")){case"sek-export":if(i=!1,t=wp.customize.dirtyValues(),u.isEmpty(t)||u.each(t,function(e,t){i||(i=-1!==t.indexOf("nimble"))}),i){alert(sektionsLocalizedData.i18n["You need to publish before exporting."]);break}var o=l(c)(),n=!0;if(u.each(o.collection,function(e){n&&(u.isEmpty(e.collection)||(n=!1))}),n){alert(sektionsLocalizedData.i18n["Nothing to export."]);break}l.czr_sektions.export_template({scope:a});break;case"sek-pre-import":if(u.isEmpty(l.czr_sektions.activeLocations())){alert(sektionsLocalizedData.i18n["The current page has no available locations to import Nimble Builder sections."]);break}l.czr_sektions.import_template_from_file({pre_import_check:!0,input:r,file_input:s}).done(function(e){l.czr_sektions.pre_checks_from_file_import(e,{pre_import_check:!1,input:r,file_input:s})}).fail(function(e){l.errare("import_export_ input => pre_checks_from_file_import failed",e),l.czr_sektions.doAlwaysAfterFileImportAndApiSettingUpdate({input:r,file_input:s}),l.czr_sektions.import_template_from_file({input:r,file_input:s})});break;case"sek-import-as-is":l.czr_sektions.import_template_from_file({input:r,file_input:s});break;case"sek-import-assign":l.czr_sektions.import_template_from_file({assign_missing_locations:!0,input:r,file_input:s});break;case"sek-cancel-import":l.czr_sektions.doAlwaysAfterFileImportAndApiSettingUpdate({input:r,file_input:s})}})}})}(wp.customize,jQuery,_),function(c,l,d){c.czrInputMap=c.czrInputMap||{},l.extend(c.czrInputMap,{simpleselect:function(e){c.czr_sektions.setupSelectInput.call(this,e)},multiselect:function(e){c.czr_sektions.setupSelectInput.call(this,e)},simpleselectWithDeviceSwitcher:function(e){var r=this,t=(r.input_parent,r.module,c.czr_sektions.getInputRegistrationParams(r.id,r.module.module_type)),n=l("select",r.container),s=d.isEmpty(t)||d.isEmpty(t.default)?{}:t.default,i={params:e=d.isEmpty(e)?t.choices:e};if(r.module.trigger("nimble-set-select-input-options",i),e=i.params,!d.isEmpty(e)&&d.isObject(e)){d.each(e,function(e,t){var i={value:t,html:e};t==r()?l.extend(i,{selected:"selected"}):"px"===t&&l.extend(i,{selected:"selected"}),n.append(l("<option>",i))});var a=function(e,t){var i=["mobile","tablet","desktop"];if(d.has(e,t))return e[t];var o=d.findIndex(i,function(e){return t===e});return!d.isEmpty(t)&&o<i.length?a(e,i[o+1]):l.extend(!0,{desktop:""},s).desktop};c.czr_sektions.maybeSetupDeviceSwitcherForInput.call(r),n.on("change",function(e,t){var i,o=c.previewedDevice()||"desktop",n=l(this).val();(i=l.extend(!0,{},d.isObject(r())?r():{}))[o]=l.extend(!0,{},i[o]||{}),d.isString(n)&&!d.isEmpty(n)&&(i[o]=n),(d.isEmpty(t)||d.isObject(t)&&!0!==t.previewed_device_switched)&&r(i)}),r.previewedDevice.bind(function(e){try{!function(e){var t=r(),i={};i=l.extend(!0,{},s),d.isObject(t)?i=l.extend(!0,{},t):d.isString(t)&&!d.isEmpty(t)&&(i={desktop:t});var o=a(i,e);n.val(o).trigger("change",{previewed_device_switched:!0})}(e)}catch(e){c.errare("Error when firing syncWithPreviewedDevice for input type "+r.type+" for input id "+r.id,e)}})}else c.errare("api.czr_sektions.setupSelectInput => missing select options for input id => "+r.id+" in module "+r.module.module_type)}})}(wp.customize,jQuery,_),function(a,c,l){a.czrInputMap=a.czrInputMap||{},c.extend(a.czrInputMap,{category_picker:function(e){var o=this,n=c("select[data-czrtype]",o.container),r=function(){var e=o();return e=l.isString(e)?[e]:e,l.isArray(e)?e:[]},t=function(t){!0!==o.catCollectionSet&&(c.when(c.Deferred(function(i){l.isEmpty(a.czr_sektions.post_categories)?wp.ajax.post("sek_get_post_categories",{nonce:a.settings.nonce.save}).done(function(e){l.isArray(e)||a.errare(o.id+" => error => invalid category collection sent by server");var t={};l.each(e,function(e){l.isEmpty(e.slug)||l.isEmpty(e.name)?i.reject("missing slug or name for at least one category"):t[e.slug]=e.name}),a.czr_sektions.post_categories=t,i.resolve(a.czr_sektions.post_categories)}).fail(function(e){i.reject(e)}):i.resolve(a.czr_sektions.post_categories)})).done(function(e){i(e),t&&!0===t.open_on_init&&l.delay(function(){try{n.czrSelect2("open")}catch(e){}},100)}).fail(function(e){a.errare(o.id+" => fail response when _getCategoryCollection()",e)}),o.catCollectionSet=!0)},i=function(e){l.each(e,function(e,t){var i={value:t,html:e};l.contains(r(),t)&&c.extend(i,{selected:"selected"}),n.append(c("<option>",i))}),n.czrSelect2({closeOnSelect:!0,templateSelection:function(e){return e.text.replace(/\u2013|\u2014/g,"")}}),n.on("change",function(){0===c(this).find("option:selected").length&&o([])})},s={};l.each(r(),function(e){s[e]=(e+"").replace(/-/g," ")}),i(s),o.container.on("click",function(){!0!==o.catCollectionSet&&(n.czrSelect2("destroy"),c.when(n.find("option").remove()).done(function(){t({open_on_init:!0})}))})}})}(wp.customize,jQuery,_),function(r,s,e){r.czrInputMap=r.czrInputMap||{},s.extend(r.czrInputMap,{grid_layout:function(e){var o=this,n=s(".sek-grid-layout-wrapper",o.container);n.find('input[type="hidden"]').val(o()),n.on("click","[data-sek-grid-layout]",function(e,t){var i;e.stopPropagation(),n.find("[data-sek-grid-layout]").removeClass("selected").attr("aria-pressed",!1),s(this).addClass("selected").attr("aria-pressed",!0);try{i=s(this).data("sek-grid-layout")}catch(e){r.errare(o.type+" => error when attaching click event",e)}o(i)}),s('[data-sek-grid-layout="'+o()+'"]',n).trigger("click")}})}(wp.customize,jQuery,_),function(i,e,t){i.czrInputMap=i.czrInputMap||{},e.extend(i.czrInputMap,{refresh_preview_button:function(e){this.container.on("click",".sek-refresh-button",function(e,t){e.stopPropagation(),i.previewer.refresh()})}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_content_type_switcher_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_content_type_switcher_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_content_type_switcher_module"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_module_picker_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_module_picker_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_module_picker_module"))}})}(wp.customize,jQuery,_),function(t,e,i){t.czrModuleMap=t.czrModuleMap||{};var o=sektionsLocalizedData.presetSectionsModules;i.isArray(o)&&!i.isEmpty(o)?i.each(o,function(e){t.czrModuleMap[e]={crud:!1,name:t.czr_sektions.getRegisteredModuleProperty(e,"name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.extend({id:"",title:""},t.czr_sektions.getDefaultItemModelFromRegisteredModuleData(e))}}):t.errare("api.czrModuleMap => error when adding section modules")}(wp.customize,jQuery,_),function(s,i,a){var e={initialize:function(e,t){this.inputConstructor=s.CZRInput.extend({initialize:function(e,t){var i=this;s.CZRInput.prototype.initialize.call(i,e,t),i.isReady.then(function(){i.renderUserSavedSections(),i.attachDomEvents()})},getUserSavedSections:function(){var t=i.Deferred();return a.isEmpty(s.czr_sektions.userSavedSections)?s.czr_sektions.getSavedSectionCollection().done(function(e){t.resolve(e)}):t.resolve(s.czr_sektions.userSavedSections),t.promise()},renderUserSavedSections:function(){var o=this,n="",r=o.container.find(".sek-content-type-wrapper"),t=function(e){if(r.find(".sek-user-section-wrapper").remove(),a.isEmpty(e)){var t=[sektionsLocalizedData.baseUrl,"/assets/admin/img/save_section_notice.png","?ver=",sektionsLocalizedData.nimbleVersion].join("");doc_url="https://docs.presscustomizr.com/article/417-how-to-save-and-reuse-sections-with-nimble-builder",n=['<div class="sek-user-section-wrapper">','<img src="'+t+'" />','<br/><a href="'+doc_url+'" target="_blank" rel="noreferrer nofollow">'+doc_url+"</a>","</div>"].join(""),r.append(n),o.module.container.find(".czr-item-content .customize-control-title").html("You did not save any section yet.")}else{var i="background: url("+[sektionsLocalizedData.baseUrl,"/assets/admin/img/nb_sec_pholder.png","?ver=",sektionsLocalizedData.nimbleVersion].join("")+") 50% 50% / cover no-repeat;";a.each(e,function(e,t){a.isEmpty(e.description)?_titleAttr=[e.title,e.last_modified_date].join(" | "):_titleAttr=[e.title,e.last_modified_date,e.description].join(" | "),n=['<div class="sek-user-section-wrapper">','<div draggable="true" data-sek-is-user-section="true" data-sek-section-type="content" data-sek-content-type="preset_section" data-sek-content-id="'+t+'" style="" title="'+e.title+'">','<div class="sek-sec-thumb" style="'+i+'"></div>','<div class="sek-overlay"></div>','<div class="sek-sec-info" title="'+_titleAttr+'">','<h3 class="sec-title">'+e.title+"</h3>",'<p class="sec-date"><i>'+[sektionsLocalizedData.i18n["Last modified"]," : ",e.last_modified_date].join(" ")+"</i></p>",'<p class="sec-desc">'+e.description+"</p>",'<i class="material-icons remove-user-sec" title="'+sektionsLocalizedData.i18n["Remove this template"]+'">delete_forever</i>',"</div>","</div>","</div>"].join(""),r.append(n)})}s.czr_sektions.trigger("sek-refresh-dragzones",{type:"preset_section",input_container:o.container})};o.getUserSavedSections().done(function(e){t(e)}),s.czr_sektions.allSavedSections.bind(function(e){t(e)})},attachDomEvents:function(){this.container.on("click",".sek-sec-info .remove-user-sec",function(e){e.preventDefault();var t=s.czr_sektions,i=function(e){t.saveSectionDialogMode("remove"),t.saveSectionDialogMode.unbind(i)};t.saveSectionDialogMode.bind(i),t.saveSectionDialogVisible(!0)})}}),s.CZRDynModule.prototype.initialize.call(this,e,t)}};s.czrModuleMap=s.czrModuleMap||{},i.extend(s.czrModuleMap,{sek_my_sections_sec_picker_module:{mthds:e,crud:!1,name:s.czr_sektions.getRegisteredModuleProperty("sek_my_sections_sec_picker_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:s.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_my_sections_sec_picker_module")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_mod_option_switcher_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_mod_option_switcher_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_mod_option_switcher_module"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_level_anchor_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_level_anchor_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_anchor_module"))}})}(wp.customize,jQuery,_),function(r,e,s){var t={initialize:function(e,t){this.itemConstructor=r.CZRItem.extend(this.CZRItemConstructor||{}),r.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!s.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){r.errorLog("item.setInputVisibilityDeps() : "+e)}}),r.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var o=this,n=o.module;o.czr_Input.each(function(i){switch(i.id){case"bg-image":s.each(["bg-attachment","bg-scale","bg-repeat","bg-parallax","bg-parallax-force"],function(t){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"bg-parallax-force":e=!s.isEmpty(i()+"")&&r.CZR_Helpers.isChecked(o.czr_Input("bg-parallax")());break;case"bg-scale":case"bg-repeat":e=!s.isEmpty(i()+"")&&!r.CZR_Helpers.isChecked(o.czr_Input("bg-parallax")());break;default:e=!s.isEmpty(i()+"")}return e})}catch(e){r.errare(n.id+" => error in setInputVisibilityDeps",e)}});break;case"bg-apply-overlay":s.each(["bg-color-overlay","bg-opacity-overlay"],function(e){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return r.CZR_Helpers.isChecked(i())})}catch(e){r.errare(n.id+" => error in setInputVisibilityDeps",e)}});break;case"bg-parallax":s.each(["bg-parallax-force","bg-scale","bg-repeat"],function(t){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"bg-parallax-force":e=!s.isEmpty(o.czr_Input("bg-image")()+"")&&r.CZR_Helpers.isChecked(i());break;case"bg-repeat":case"bg-scale":e=!s.isEmpty(o.czr_Input("bg-image")()+"")&&!r.CZR_Helpers.isChecked(i())}return e})}catch(e){r.errare(n.id+" => error in setInputVisibilityDeps",e)}}),i.bind(function(e){r.CZR_Helpers.isChecked(i())&&r.CZR_Helpers.isChecked(o.czr_Input("bg-attachment")())&&o.czr_Input("bg-attachment").container.find("input[type=checkbox]").trigger("click")});break;case"bg-attachment":i.bind(function(e){r.CZR_Helpers.isChecked(i())&&r.CZR_Helpers.isChecked(o.czr_Input("bg-parallax")())&&o.czr_Input("bg-parallax").container.find("input[type=checkbox]").trigger("click")});break;case"bg-use-video":s.each(["bg-video","bg-video-loop","bg-video-delay-start","bg-video-on-mobile","bg-video-start-time","bg-video-end-time"],function(e){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return r.CZR_Helpers.isChecked(i())})}catch(e){r.errare(n.id+" => error in setInputVisibilityDeps",e)}})}}),n.control&&n.control.params&&n.control.params.sek_registration_params&&(s.contains(["section","column"],n.control.params.sek_registration_params.level)||s.each(["bg-use-video","bg-video","bg-video-loop","bg-video-on-mobile","bg-video-start-time","bg-video-end-time"],function(e){o.czr_Input(e).visible(!1)}))}}};r.czrModuleMap=r.czrModuleMap||{},e.extend(r.czrModuleMap,{sek_level_bg_module:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("sek_level_bg_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:s.extend({id:"",title:""},r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_bg_module"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_level_text_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_level_text_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_text_module")}})}(wp.customize,jQuery,_),function(o,e,n){var t={initialize:function(e,t){this.itemConstructor=o.CZRItem.extend(this.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var i=this.module;this.czr_Input.each(function(t){switch(t.id){case"border-type":n.each(["borders"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){o.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{sek_level_border_module:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("sek_level_border_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.extend({id:"",title:""},o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_border_module"))}})}(wp.customize,jQuery,_),function(o,e,n){var t={initialize:function(e,t){this.itemConstructor=o.CZRItem.extend(this.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var i=this.module;this.czr_Input.each(function(t){switch(t.id){case"use-custom-breakpoint":n.each(["custom-breakpoint","apply-to-all"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){o.errare(i.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{sek_level_breakpoint_module:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("sek_level_breakpoint_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.extend({id:"",title:""},o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_breakpoint_module"))}})}(wp.customize,jQuery,_),function(o,e,n){var t={initialize:function(e,t){this.itemConstructor=o.CZRItem.extend(this.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var i=this.module;this.czr_Input.each(function(t){switch(t.id){case"height-type":n.each(["custom-height","overflow_hidden"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"custom"===t()})}catch(e){o.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{sek_level_height_module:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("sek_level_height_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.extend({id:"",title:""},o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_height_module"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_level_visibility_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_level_visibility_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_visibility_module"))}})}(wp.customize,jQuery,_),function(i,e,o){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"width-type":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"custom-width",function(){return"custom"===e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_level_width_module:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_level_width_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_width_module"))}})}(wp.customize,jQuery,_),function(d,u,p){var e={initialize:function(e,t){var i=this;i.inputConstructor=d.CZRInput.extend(i.CZRInputConstructor||{}),i.itemConstructor=d.CZRItem.extend(i.CZRItemConstructor||{}),d.CZRDynModule.prototype.initialize.call(i,e,t)},CZRInputConstructor:{range_simple:function(e){var t,i=this,o=u(".sek-range-with-unit-picker-wrapper",i.container),n=o.find('input[type="number"]'),r=o.find('input[type="range"]');try{t=i.module.control.params.sek_registration_params}catch(e){return void d.errare("Error when getting the module registration params",e)}if(p.isUndefined(t.level_id))d.errare("Error : missing column id",er);else if(i.columnId=t.level_id,i.columnModel=u.extend(!0,{},d.czr_sektions.getLevelModel(i.columnId)),i.parentSectionModel=d.czr_sektions.getParentSectionFromColumnId(i.columnId),"no_match"!=i.columnModel)if("no_match"!=i.parentSectionModel){i.colNb=p.size(i.parentSectionModel.collection),n.attr("data-sek-width-range-column-id",i.columnId),1===i.colNb?i.container.html(["<p>",sektionsLocalizedData.i18n["This is a single-column section with a width of 100%. You can act on the internal width of the parent section, or adjust padding and margin."]].join("")):i.container.show();var s,a=d.czr_sektions.getLevelModel(i.columnId),c="_not_set_";if("no_match"!=a){var l=a.options&&a.options.width&&a.options.width["custom-width"]&&p.isNumber(+a.options.width["custom-width"]);l?c=a.options.width["custom-width"]:!l&&a.width&&p.isNumber(+a.width)&&(c=a.width),s="_not_set_"!==c?c:"_not_set_"===i()?Math.floor(100/i.colNb):i(),s=1*+parseFloat(s).toFixed(3),(!p.isNumber(s)||100<s||s<0)&&(d.errare("Error => invalid column width",s),s=50),r.on("input",function(e,t){n.val(u(this).val()).trigger("input",t)}),n.on("input",p.debounce(function(e,t){r.val(u(this).val()),t&&t.is_init||i(+parseFloat(u(this).val()).toFixed(3))},300)),n.on("input",p.debounce(function(e,t){t&&(t.is_init||t.is_resize_column_trigger)||i.sayItToApi(u(this).val())},300)),r.val(s).trigger("input",{is_init:!0})}else d.errare("sek_level_width_column module => invalid column model")}else d.errare("sek_level_width_column module => invalid parent section model");else d.errare("sek_level_width_column module => invalid column model")},sayItToApi:function(e,t){var i=this,o=p.findIndex(i.parentSectionModel.collection,{id:i.columnId}),n=o+1==i.colNb?o-1:o+1,r=p.find(i.parentSectionModel.collection,function(e,t){return n===t});"no_match"===r&&d.errare("sek_level_width_column module => invalid sister column model"),d.previewer.trigger("sek-resize-columns",{action:"sek-resize-columns",level:"column",in_sektion:i.parentSectionModel.id,id:i.columnId,resized_column:i.columnId,sister_column:r.id,resizedColumnWidthInPercent:e,col_number:i.colNb})}}};d.czrModuleMap=d.czrModuleMap||{},u.extend(d.czrModuleMap,{sek_level_width_column:{mthds:e,crud:!1,name:d.czr_sektions.getRegisteredModuleProperty("sek_level_width_column","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:p.extend({id:"",title:""},d.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_width_column"))}})}(wp.customize,jQuery,_),function(i,e,o){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"use-custom-outer-width":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"outer-section-width",function(){return e()});break;case"use-custom-inner-width":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"inner-section-width",function(){return e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_level_width_section:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_level_width_section","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_width_section"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_level_spacing_module:{mthds:"",crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_level_spacing_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_spacing_module"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_level_cust_css_section:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_level_cust_css_section","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_cust_css_section"))}})}(wp.customize,jQuery,_),function(i,e,o){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var e=this.module;i.trigger("nb_setup_visibility_deps_for_animation_module",{item:this,module:e})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_level_animation_module:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_level_animation_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:o.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_animation_module"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_template:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_template","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_template"))}})}(wp.customize,jQuery,_),function(i,e,o){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"use-custom-outer-width":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"outer-section-width",function(){return e()});break;case"use-custom-inner-width":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"inner-section-width",function(){return e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_local_widths:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_local_widths","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:o.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_widths"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_custom_css:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_custom_css","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_custom_css"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_reset:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_reset","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_reset"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_performances:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_performances","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_performances"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_header_footer:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_header_footer","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_header_footer"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_revisions:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_revisions","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_revisions"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_imp_exp:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_imp_exp","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_imp_exp"))}})}(wp.customize,jQuery,_),function(i,e,o){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"links_underline":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"links_underline_hover",function(){return!e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_global_text:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_global_text","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_text"))}})}(wp.customize,jQuery,_),function(o,e,n){var t={initialize:function(e,t){this.itemConstructor=o.CZRItem.extend(this.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var i=this.module;this.czr_Input.each(function(t){switch(t.id){case"use-custom-breakpoint":n.each(["global-custom-breakpoint","apply-to-all"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){o.errare(i.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{sek_global_breakpoint:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("sek_global_breakpoint","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:n.extend({id:"",title:""},o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_breakpoint"))}})}(wp.customize,jQuery,_),function(i,e,o){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"use-custom-outer-width":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"outer-section-width",function(){return e()});break;case"use-custom-inner-width":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"inner-section-width",function(){return e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_global_widths:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_global_widths","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:o.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_widths"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_global_performances:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_global_performances","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_performances"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_global_header_footer:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_global_header_footer","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_header_footer"))}})}(wp.customize,jQuery,_),function(r,e,s){var t={initialize:function(e,t){this.itemConstructor=r.CZRItem.extend(this.CZRItemConstructor||{}),r.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!s.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){r.errorLog("item.setInputVisibilityDeps() : "+e)}}),r.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var o=this,n=o.module;o.czr_Input.each(function(i){switch(i.id){case"enable":s.each(["public_key","private_key","badge","show_failure_message","failure_message","score"],function(t){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"failure_message":e=i()&&o.czr_Input("show_failure_message")();break;default:e=i()}return e})}catch(e){r.errare(n.module_type+" => error in setInputVisibilityDeps",e)}});break;case"show_failure_message":s.each(["failure_message"],function(e){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()&&o.czr_Input("enable")()})}catch(e){r.errare(n.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};r.czrModuleMap=r.czrModuleMap||{},e.extend(r.czrModuleMap,{sek_global_recaptcha:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("sek_global_recaptcha","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:s.extend({id:"",title:""},r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_recaptcha"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_global_revisions:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_global_revisions","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_revisions"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_global_reset:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_global_reset","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_reset"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_global_imp_exp:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_global_imp_exp","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_imp_exp"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_global_beta_features:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_global_beta_features","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_beta_features"))}})}(wp.customize,jQuery,_),function(n,e,r){var t={initialize:function(e,t){this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t),this.bind("set_default_content_picker_options",function(e){return e.defaultContentPickerOption.defaultOption={title:'<span style="font-weight:bold">'+sektionsLocalizedData.i18n["Set a custom url"]+"</span>",type:"",type_label:"",object:"",id:"_custom_",url:""},e})},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var o=this,t=o.module;o.czr_Input.each(function(i){switch(i.id){case"img":n.czr_sektions.scheduleVisibilityOfInputId.call(i,"img-size",function(){return!r.isEmpty(i()+"")&&r.isNumber(i())});break;case"link-to":r.each(["link-pick-url","link-custom-url","link-target"],function(t){try{n.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e="url"===i()&&"_custom_"==o.czr_Input("link-pick-url")().id;break;case"link-pick-url":e="url"===i();break;case"link-target":e=!r.contains(["no-link","img-lightbox"],i())}return e})}catch(e){n.errare("Image module => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":n.czr_sektions.scheduleVisibilityOfInputId.call(i,"link-custom-url",function(){return"_custom_"==i().id&&"url"==o.czr_Input("link-to")()});break;case"border-type":r.each(["borders"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return"none"!==i()})}catch(e){n.errare(t.id+" => error in setInputVisibilityDeps",e)}});break;case"use_custom_width":r.each(["custom_width"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){n.errare("Image module => error in setInputVisibilityDeps",e)}});break;case"use_custom_height":r.each(["custom_height"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){n.errare("Image module => error in setInputVisibilityDeps",e)}});break;case"use_custom_title_attr":r.each(["heading_title"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){n.errare("Image module => error in setInputVisibilityDeps",e)}})}}),n.trigger("nb_setup_visibility_deps_for_img_module",{item:o,module:t})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_image_main_settings_child:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_image_main_settings_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_image_main_settings_child")}})}(wp.customize,jQuery,_),function(o,e,n){var t={initialize:function(e,t){this.itemConstructor=o.CZRItem.extend(this.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var e=this,i=e.module;e.czr_Input.each(function(t){switch(t.id){case"border-type":n.each(["borders"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){o.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_image_borders_corners_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_image_borders_corners_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_image_borders_corners_child")}})}(wp.customize,jQuery,_),function(o,e,t){var i={initialize:function(e,t){this.inputConstructor=o.CZRInput.extend(this.CZRTextEditorInputMths||{}),o.CZRDynModule.prototype.initialize.call(this,e,t)},CZRTextEditorInputMths:{initialize:function(e,t){var i=this;"detached_tinymce_editor"==i.type&&i.isReady.then(function(){i.container.find('[data-czr-action="open-tinymce-editor"]').trigger("click")}),o.CZRInput.prototype.initialize.call(i,e,t)}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_tinymce_child:{mthds:i,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_tinymce_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_tinymce_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_simple_html_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_simple_html_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_html_module")}})}(wp.customize,jQuery,_),function(o,e,n){var t={initialize:function(e,t){this.itemConstructor=o.CZRItem.extend(this.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(i){switch(i.id){case"img-type":n.each(["img-id","img-size"],function(t){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"img-id":e="custom"===i();break;default:e="none"!==i()}return e})}catch(e){o.errare("Featured pages module => error in setInputVisibilityDeps",e)}});break;case"content-type":n.each(["content-custom-text"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return"custom"===i()})}catch(e){o.errare("Featured pages module => error in setInputVisibilityDeps",e)}});break;case"btn-display":n.each(["btn-custom-text"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){o.errare("Featured pages module => error in setInputVisibilityDeps",e)}})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_featured_pages_module:{mthds:t,crud:o.czr_sektions.getRegisteredModuleProperty("czr_featured_pages_module","is_crud"),hasPreItem:!1,refresh_on_add_item:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_featured_pages_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_featured_pages_module")}})}(wp.customize,jQuery,_),function(r,e,s){var t={initialize:function(e,t){this.itemConstructor=r.CZRItem.extend(this.CZRItemConstructor||{}),this.bind("set_default_content_picker_options",function(e){return e.defaultContentPickerOption.defaultOption={title:'<span style="font-weight:bold">'+sektionsLocalizedData.i18n["Set a custom url"]+"</span>",type:"",type_label:"",object:"",id:"_custom_",url:""},e}),r.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!s.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){r.errorLog("item.setInputVisibilityDeps() : "+e)}}),r.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var o=this,n=o.module;o.czr_Input.each(function(i){switch(i.id){case"link-to":s.each(["link-pick-url","link-custom-url","link-target"],function(t){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e="url"==i()&&"_custom_"==o.czr_Input("link-pick-url")().id;break;default:e="url"==i()}return e})}catch(e){r.errare(n.module_type+" => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":r.czr_sektions.scheduleVisibilityOfInputId.call(i,"link-custom-url",function(){return"_custom_"==i().id&&"url"==o.czr_Input("link-to")()});break;case"use_custom_color_on_hover":s.each(["color_hover"],function(e){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){r.errare(n.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};r.czrModuleMap=r.czrModuleMap||{},e.extend(r.czrModuleMap,{czr_icon_settings_child:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("czr_icon_settings_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_icon_settings_child")}})}(wp.customize,jQuery,_),function(o,e,n){var t={initialize:function(e,t){this.itemConstructor=o.CZRItem.extend(this.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var e=this,i=e.module;e.czr_Input.each(function(t){switch(t.id){case"border-type":n.each(["borders"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){o.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_icon_spacing_border_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_icon_spacing_border_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_icon_spacing_border_child")}})}(wp.customize,jQuery,_),function(n,e,r){var t={initialize:function(e,t){this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t),this.bind("set_default_content_picker_options",function(e){return e.defaultContentPickerOption.defaultOption={title:'<span style="font-weight:bold">'+sektionsLocalizedData.i18n["Set a custom url"]+"</span>",type:"",type_label:"",object:"",id:"_custom_",url:""},e})},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var o=this;o.module;o.czr_Input.each(function(i){switch(i.id){case"link-to":r.each(["link-pick-url","link-custom-url","link-target"],function(t){try{n.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e=i()&&"_custom_"==o.czr_Input("link-pick-url")().id;break;case"link-pick-url":case"link-target":e=i()}return e})}catch(e){n.errare("Heading module => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":n.czr_sektions.scheduleVisibilityOfInputId.call(i,"link-custom-url",function(){return"_custom_"==i().id&&!0===o.czr_Input("link-to")()})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_heading_child:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_heading_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_heading_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_heading_spacing_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_heading_spacing_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_heading_spacing_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_divider_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_divider_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_divider_module")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_spacer_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_spacer_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_spacer_module")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_map_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_map_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_map_module")}})}(wp.customize,jQuery,_),function(i,e,o){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRButtonItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRButtonItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(t){switch(t.id){case"quote_design":o.each(["border_width_css","border_color_css"],function(e){try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"border-before"==t()})}catch(e){i.errare("Quote module => error in setInputVisibilityDeps",e)}}),o.each(["icon_color_css","icon_size_css"],function(e){try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"quote-icon-before"==t()})}catch(e){i.errare("Quote module => error in setInputVisibilityDeps",e)}})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_quote_design_child:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_quote_design_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_quote_design_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_quote_quote_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_quote_quote_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_quote_quote_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_quote_cite_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_quote_cite_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_quote_cite_child")}})}(wp.customize,jQuery,_),function(n,e,r){var t={initialize:function(e,t){this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),this.bind("set_default_content_picker_options",function(e){return e.defaultContentPickerOption.defaultOption={title:'<span style="font-weight:bold">'+sektionsLocalizedData.i18n["Set a custom url"]+"</span>",type:"",type_label:"",object:"",id:"_custom_",url:""},e}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var o=this;o.module;o.czr_Input.each(function(i){switch(i.id){case"link-to":r.each(["link-pick-url","link-custom-url","link-target"],function(t){try{n.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e="url"==i()&&"_custom_"==o.czr_Input("link-pick-url")().id;break;default:e="url"==i()}return e})}catch(e){n.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":n.czr_sektions.scheduleVisibilityOfInputId.call(i,"link-custom-url",function(){return"_custom_"==i().id&&"url"==o.czr_Input("link-to")()});break;case"icon":n.czr_sektions.scheduleVisibilityOfInputId.call(i,"icon-side",function(){return!r.isEmpty(i())})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_btn_content_child:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_btn_content_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_btn_content_child")}})}(wp.customize,jQuery,_),function(o,e,n){var t={initialize:function(e,t){this.itemConstructor=o.CZRItem.extend(this.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var e=this,i=e.module;e.czr_Input.each(function(t){switch(t.id){case"use_custom_bg_color_on_hover":n.each(["bg_color_hover"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){o.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"border-type":n.each(["borders"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){o.errare(i.id+" => error in setInputVisibilityDeps",e)}});break;case"use_box_shadow":n.each(["push_effect"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){o.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"width-type":o.czr_sektions.scheduleVisibilityOfInputId.call(t,"custom-width",function(){return"custom"===t()}),n.each(["custom-width","h_inner_align_css"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"custom"===t()})}catch(e){o.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"height-type":o.czr_sektions.scheduleVisibilityOfInputId.call(t,"custom-height",function(){return"custom"===t()})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_btn_design_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_btn_design_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_btn_design_child")}})}(wp.customize,jQuery,_),function(n,e,r){var t={initialize:function(e,t){this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var o=this.module;this.czr_Input.each(function(i){switch(i.id){case"layout":r.each(["columns","img_column_width","has_tablet_breakpoint","has_mobile_breakpoint"],function(t){try{n.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"columns":e="grid"===i();break;case"has_tablet_breakpoint":case"has_mobile_breakpoint":case"img_column_width":e="list"===i()}return e})}catch(e){n.errare(o.module_type+" => error in setInputVisibilityDeps",e)}});break;case"categories":r.each(["must_have_all_cats"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){var e=i();return r.isArray(e)&&1<e.length})}catch(e){n.errare(o.module_type+" => error in setInputVisibilityDeps",e)}});break;case"display_pagination":r.each(["posts_per_page","post_number"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return"posts_per_page"===e?i():!i()})}catch(e){n.errare(o.module_type+" => error in setInputVisibilityDeps",e)}});break;case"custom_grid_spaces":r.each(["column_gap","row_gap"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){n.errare(o.module_type+" => error in setInputVisibilityDeps",e)}});break;case"show_excerpt":r.each(["excerpt_length"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){n.errare(o.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_post_grid_main_child:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_post_grid_main_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_post_grid_main_child")}})}(wp.customize,jQuery,_),function(r,e,s){var t={initialize:function(e,t){this.itemConstructor=r.CZRItem.extend(this.CZRItemConstructor||{}),r.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!s.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){r.errorLog("item.setInputVisibilityDeps() : "+e)}}),r.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var o=this,n=o.module;o.czr_Input.each(function(i){switch(i.id){case"show_thumb":s.each(["img_size","img_has_custom_height","img_height","border_radius_css","use_post_thumb_placeholder"],function(t){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"img_height":e=i()&&o.czr_Input("img_has_custom_height")();break;default:e=i()}return e})}catch(e){r.errare(n.module_type+" => error in setInputVisibilityDeps",e)}});break;case"img_has_custom_height":s.each(["img_height"],function(e){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()&&o.czr_Input("show_thumb")()})}catch(e){r.errare(n.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};r.czrModuleMap=r.czrModuleMap||{},e.extend(r.czrModuleMap,{czr_post_grid_thumb_child:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("czr_post_grid_thumb_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_post_grid_thumb_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_post_grid_metas_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_post_grid_metas_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_post_grid_metas_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_post_grid_fonts_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_post_grid_fonts_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_post_grid_fonts_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_menu_content_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_menu_content_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_menu_content_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_menu_mobile_options:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_menu_mobile_options","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_menu_mobile_options")}})}(wp.customize,jQuery,_),function(i,e,o){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(t){switch(t.id){case"show_name_field":o.each(["name_field_label","name_field_required"],function(e){try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){i.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"show_subject_field":o.each(["subject_field_label","subject_field_required"],function(e){try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){i.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"show_message_field":o.each(["message_field_label","message_field_required"],function(e){try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){i.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"show_privacy_field":o.each(["privacy_field_label","privacy_field_required"],function(e){try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){i.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,"link-custom-url",function(){return t()})}catch(e){i.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_simple_form_fields_child:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_simple_form_fields_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_fields_child")}})}(wp.customize,jQuery,_),function(o,e,n){var t={initialize:function(e,t){this.itemConstructor=o.CZRItem.extend(this.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var i=this.module;this.czr_Input.each(function(t){switch(t.id){case"border-type":n.each(["borders"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){o.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_simple_form_design_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_simple_form_design_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_design_child")}})}(wp.customize,jQuery,_),function(o,e,n){var t={initialize:function(e,t){this.itemConstructor=o.CZRItem.extend(this.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var i=this.module;this.czr_Input.each(function(t){switch(t.id){case"use_custom_bg_color_on_hover":n.each(["bg_color_hover"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){o.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"border-type":n.each(["borders"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){o.errare(i.id+" => error in setInputVisibilityDeps",e)}});break;case"use_box_shadow":n.each(["push_effect"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){o.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_simple_form_button_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_simple_form_button_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_button_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_simple_form_fonts_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_simple_form_fonts_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_fonts_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_simple_form_submission_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_simple_form_submission_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_submission_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_font_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_font_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_font_child")}})}(wp.customize,jQuery,_),function(i,e,t){var o={initialize:function(e,t){this.bind("nimble-set-select-input-options",function(e){e.params=sektionsLocalizedData.registeredWidgetZones}),i.CZRDynModule.prototype.initialize.call(this,e,t)}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_widget_area_module:{mthds:o,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_widget_area_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_widget_area_module")}})}(wp.customize,jQuery,_),function(s,a,c){var e={initialize:function(e,t){var i=this;i.crudModulePart="nimble-crud-module-part",i.rudItemPart="nimble-rud-item-part",i.itemConstructor=s.CZRItem.extend(i.CZRItemConstructor||{}),s.CZRDynModule.prototype.initialize.call(i,e,t)},generateItemId:function(){return s.czr_sektions.guid()},_makeItemsSortable:function(e){if(!wp.media.isTouchDevice&&a.fn.sortable){var i=this;a("."+i.control.css_attr.items_wrapper,i.container).sortable({handle:"."+i.control.css_attr.item_sort_handle,start:function(){},update:function(e,t){i._getSortedDOMItemCollection().done(function(e){i.itemCollection.set(e)}).then(function(){c.has(i,"preItem")&&i.preItemExpanded.set(!1),i.closeAllItems().closeRemoveDialogs(),i.trigger("item-collection-sorted")})}})}},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!c.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){s.errorLog("item.setInputVisibilityDeps() : "+e)}}),s.CZRItem.prototype.ready.call(t)},_buildTitle:function(e,t,i){var o=this.module;return e=e||("string"==typeof t?s.CZR_Helpers.capitalize(t.replace("fa-","")):""),e=s.CZR_Helpers.truncate(e,20),'<div><span class="'+t+'" style="color:'+(i=i||o.defaultSocialColor)+'"></span> '+e+"</div>"},writeItemViewTitle:function(e){var t=this.module,i=e||this(),o=(i.icon?i.icon:"").replace("fa-","").replace("envelope","email").replace("far","").replace("fab","").replace("fas","");a("."+t.control.css_attr.item_title,this.container).html(this._buildTitle(o,i.icon,i.color_css))},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(t){switch(t.id){case"use_custom_color_on_hover":c.each(["social_color_hover"],function(e){try{s.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){s.errare("Featured pages module => error in setInputVisibilityDeps",e)}})}})},toggleRemoveAlert:function(){this.removeItem()},removeItem:function(e){e=e||{};var t=this,i=this.module,o=c.clone(i.itemCollection());i.trigger("pre_item_dom_remove",t()),t._destroyView(),o=c.without(o,c.findWhere(o,{id:t.id})),i.itemCollection.set(o),i.trigger("pre_item_api_remove",t());var n=a.extend(!0,{},t());if(i.czr_Item.remove(t.id),"postMessage"!=s(i.control.id).transport||!c.has(e,"dom_event")||c.has(e.dom_event,"isTrigger")||s.CZR_Helpers.hasPartRefresh(i.control.id))i.trigger("item-removed",n),i.control.trigger("item-removed",n);else{var r=function(){s.previewer.unbind("ready",r),i.trigger("item-removed",n)};s.previewer.bind("ready",r)}}}};s.czrModuleMap=s.czrModuleMap||{},a.extend(s.czrModuleMap,{czr_social_icons_settings_child:{mthds:e,crud:!0,hasPreItem:!1,refresh_on_add_item:!1,name:s.czr_sektions.getRegisteredModuleProperty("czr_social_icons_settings_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:s.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_social_icons_settings_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_social_icons_style_child:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_social_icons_style_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_social_icons_style_child")}})}(wp.customize,jQuery,_),function(g,h,v){var e={initialize:function(e,t){var i=this;i.crudModulePart="nimble-crud-module-part",i.rudItemPart="nimble-rud-item-part",i.itemConstructor=g.CZRItem.extend(i.CZRItemConstructor||{}),g.CZRDynModule.prototype.initialize.call(i,e,t)},generateItemId:function(){return g.czr_sektions.guid()},_makeItemsSortable:function(e){if(!wp.media.isTouchDevice&&h.fn.sortable){var i=this;h("."+i.control.css_attr.items_wrapper,i.container).sortable({handle:"."+i.control.css_attr.item_sort_handle,start:function(){},update:function(e,t){i._getSortedDOMItemCollection().done(function(e){i.itemCollection.set(e)}).then(function(){v.has(i,"preItem")&&i.preItemExpanded.set(!1),i.closeAllItems().closeRemoveDialogs(),i.trigger("item-collection-sorted")})}})}},getPreItem:function(){var e=g.czr_sektions.getRegisteredModuleProperty("czr_img_slider_collection_child","starting_value"),t=h.extend(!0,{},this.preItem());if(v.isObject(e)){var i=h.extend(!0,{},e);return h.extend(t,i)}return this.preItem()},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!v.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){g.errorLog("item.setInputVisibilityDeps() : "+e)}}),g.CZRItem.prototype.ready.call(t);var i=function(){g.previewer.send("sek-item-focus",{control_id:t.module.control.id,item_id:t.id,item_value:t()})};t.viewState.callbacks.add(function(e,t){"expanded"===e&&i()}),t.callbacks.add(i),t.bind("sek-request-item-focus-in-preview",i)},writeItemViewTitle:function(e,t){var i=this,o=i.module,n=e||i(),r="",s="",a="not_set",c=!v.isUndefined(t)&&v.isObject(t);if(!c||!t.input_changed||v.contains(["img","text_content"],t.input_changed)){if(v.isEmpty(n.title)){var l=v.findIndex(o.itemCollection(),function(e){return e.id===i.id});l=v.isUndefined(l)?1:l+1}else r=n.title;r=g.CZR_Helpers.truncate(r,15),n.img&&(s=n.img,v.isString(n.img)&&(s=-1!==n.img.indexOf("http")?n.img:parseInt(n.img,10)));var d=function(){return h.Deferred(function(){var e=this;v.isUndefined(s)||v.isEmpty(""+s)?e.resolve(""):v.isString(s)&&-1!==s.indexOf("http")?e.resolve(s):wp.media.attachment(s).fetch().always(function(){if(v.isObject(this)&&v.has(this,"attributes")&&v.has(this.attributes,"sizes")){var i=this.get("sizes");i&&v.isObject(i)&&v.each(["thumbnail","medium","large","full"],function(e,t){"not_set"===a&&i[e]&&v.isObject(i[e])&&i[e].url&&(a=i[e].url)}),e.resolve(a)}})}).promise()},u=h("."+o.control.css_attr.item_title,i.container).find(".sek-slide-title"),p=h("."+o.control.css_attr.item_title,i.container).find(".sek-slide-thumb"),_=n.text_content?n.text_content:"";_=(_=h("<div>").html(_).text()).substring(0,60),u.length<1?(h("."+o.control.css_attr.item_title,i.container).html(""),h("."+o.control.css_attr.item_title,i.container).append(h("<div/>",{class:"sek-slide-title",html:_}))):u.html(_);var m=c&&t.input_changed&&"img"===t.input_changed,f=function(e){return v.isEmpty(""+e)||"not_set"===e?"":'<img src="'+e+'" width="32" alt="'+r+'" />'};h("."+o.control.css_attr.item_title,i.container).css("padding","0 4px"),p.length<1?d().done(function(e){h("."+o.control.css_attr.item_title,i.container).prepend(h("<div/>",{class:"sek-slide-thumb",html:f(e)}))}):!m&&c||d().done(function(e){p.html(f(e))})}},setInputVisibilityDeps:function(){var o=this,t=o.module;o.czr_Input.each(function(i){switch(i.id){case"link-to":v.each(["link-pick-url","link-custom-url","link-target"],function(t){try{g.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e="url"===i()&&"_custom_"==o.czr_Input("link-pick-url")().id;break;case"link-pick-url":e="url"===i();break;case"link-target":e=!v.contains(["no-link"],i())}return e})}catch(e){g.errare("Image module => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":g.czr_sektions.scheduleVisibilityOfInputId.call(i,"link-custom-url",function(){return"_custom_"==i().id&&"url"==o.czr_Input("link-to")()});break;case"apply-overlay":v.each(["color-overlay","opacity-overlay"],function(e){try{g.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return g.CZR_Helpers.isChecked(i())})}catch(e){g.errare(t.id+" => error in setInputVisibilityDeps",e)}});break;case"enable_text":v.each(["text_content","font_family_css","font_size_css","line_height_css","color_css","h_alignment_css","v_alignment","spacing_css"],function(e){try{g.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return g.CZR_Helpers.isChecked(i())})}catch(e){g.errare(t.id+" => error in setInputVisibilityDeps",e)}});break;case"apply_overlay":v.each(["color-overlay","opacity-overlay"],function(e){try{g.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return g.CZR_Helpers.isChecked(i())})}catch(e){g.errare(t.id+" => error in setInputVisibilityDeps",e)}})}})},toggleRemoveAlert:function(){this.removeItem()},removeItem:function(e){e=e||{};var t=this,i=this.module,o=v.clone(i.itemCollection());i.trigger("pre_item_dom_remove",t()),t._destroyView(),o=v.without(o,v.findWhere(o,{id:t.id})),i.itemCollection.set(o),i.trigger("pre_item_api_remove",t());var n=h.extend(!0,{},t());if(i.czr_Item.remove(t.id),"postMessage"!=g(i.control.id).transport||!v.has(e,"dom_event")||v.has(e.dom_event,"isTrigger")||g.CZR_Helpers.hasPartRefresh(i.control.id))i.trigger("item-removed",n),i.control.trigger("item-removed",n);else{var r=function(){g.previewer.unbind("ready",r),i.trigger("item-removed",n)};g.previewer.bind("ready",r)}}}};g.czrModuleMap=g.czrModuleMap||{},h.extend(g.czrModuleMap,{czr_img_slider_collection_child:{mthds:e,crud:!0,hasPreItem:!1,refresh_on_add_item:!1,name:g.czr_sektions.getRegisteredModuleProperty("czr_img_slider_collection_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:g.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_img_slider_collection_child")}})}(wp.customize,jQuery,_),function(o,e,n){var t={initialize:function(e,t){var i=this;i.crudModulePart="nimble-crud-module-part",i.rudItemPart="nimble-rud-item-part",i.itemConstructor=o.CZRItem.extend(i.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(i,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var i=this.module;this.czr_Input.each(function(t){switch(t.id){case"height-type":n.each(["custom-height"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"custom"===t()})}catch(e){o.errare(i.id+" => error in setInputVisibilityDeps",e)}});break;case"autoplay":n.each(["autoplay_delay","pause_on_hover"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return o.CZR_Helpers.isChecked(t())})}catch(e){o.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_img_slider_opts_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_img_slider_opts_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_img_slider_opts_child")}})}(wp.customize,jQuery,_),function(d,u,p){var e={initialize:function(e,t){var i=this;i.crudModulePart="nimble-crud-module-part",i.rudItemPart="nimble-rud-item-part",i.itemConstructor=d.CZRItem.extend(i.CZRItemConstructor||{}),d.CZRDynModule.prototype.initialize.call(i,e,t)},generateItemId:function(){return d.czr_sektions.guid()},_makeItemsSortable:function(e){if(!wp.media.isTouchDevice&&u.fn.sortable){var i=this;u("."+i.control.css_attr.items_wrapper,i.container).sortable({handle:"."+i.control.css_attr.item_sort_handle,start:function(){},update:function(e,t){i._getSortedDOMItemCollection().done(function(e){i.itemCollection.set(e)}).then(function(){p.has(i,"preItem")&&i.preItemExpanded.set(!1),i.closeAllItems().closeRemoveDialogs(),i.trigger("item-collection-sorted")})}})}},getPreItem:function(){var e=d.czr_sektions.getRegisteredModuleProperty("czr_accordion_collection_child","starting_value"),t=u.extend(!0,{},this.preItem());if(p.isObject(e)){var i=u.extend(!0,{},e);return u.extend(t,i)}return this.preItem()},CZRItemConstructor:{ready:function(){var e=this;d.CZRItem.prototype.ready.call(e);var i=function(){d.previewer.send("sek-item-focus",{control_id:e.module.control.id,item_id:e.id,item_value:e()})};e.viewState.callbacks.add(function(e,t){"expanded"===e&&i()}),e.callbacks.add(i),e.bind("sek-request-item-focus-in-preview",i),e.module.bind("item-collection-sorted",function(){e.writeItemViewTitle(e(),{input_changed:"title_text"})})},writeItemViewTitle:function(e,t){var i=this,o=i.module,n=e||i(),r="";if(!(!p.isUndefined(t)&&p.isObject(t))||!t.input_changed||p.contains(["title_text"],t.input_changed)){if(p.isEmpty(n.title)){var s=p.findIndex(o.itemCollection(),function(e){return e.id===i.id});s=p.isUndefined(s)?1:s+1}else r=n.title;r=d.CZR_Helpers.truncate(r,25);var a=u("."+o.control.css_attr.item_title,i.container).find(".sek-accord-title"),c=n.title_text?n.title_text:"";c=u("<div>").html(c).text();var l=i.module.container.find(".czr-items-wrapper > li").index(i.container);c=(c=p.isEmpty(c)?sektionsLocalizedData.i18n["Accordion title"]+" #"+(+l+1):c).substring(0,60),a.length<1?(u("."+o.control.css_attr.item_title,i.container).html(""),u("."+o.control.css_attr.item_title,i.container).append(u("<div/>",{class:"sek-accord-title",html:c}))):a.html(c)}},toggleRemoveAlert:function(){this.removeItem()},removeItem:function(e){e=e||{};var t=this,i=this.module,o=p.clone(i.itemCollection());i.trigger("pre_item_dom_remove",t()),t._destroyView(),o=p.without(o,p.findWhere(o,{id:t.id})),i.itemCollection.set(o),i.trigger("pre_item_api_remove",t());var n=u.extend(!0,{},t());if(i.czr_Item.remove(t.id),"postMessage"!=d(i.control.id).transport||!p.has(e,"dom_event")||p.has(e.dom_event,"isTrigger")||d.CZR_Helpers.hasPartRefresh(i.control.id))i.trigger("item-removed",n),i.control.trigger("item-removed",n);else{var r=function(){d.previewer.unbind("ready",r),i.trigger("item-removed",n)};d.previewer.bind("ready",r)}}}};d.czrModuleMap=d.czrModuleMap||{},u.extend(d.czrModuleMap,{czr_accordion_collection_child:{mthds:e,crud:!0,hasPreItem:!1,refresh_on_add_item:!1,name:d.czr_sektions.getRegisteredModuleProperty("czr_accordion_collection_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:d.czr_sektions.getDefaultIte