Version Description
January 4th 2017 = * fixed : customizer not loading when deprecated link widget is enabled
Download this release
Release Info
Developer | nikeo |
Plugin | Hueman Addons |
Version | 2.0.6 |
Comparing to | |
See all releases |
Code changes from version 2.0.5 to 2.0.6
- assets/czr/js/czr-control.js +132 -83
- assets/czr/js/czr-control.min.js +7 -7
- ha-fire.php +2 -2
- lang/en_US.po +1 -1
- readme.txt +4 -1
assets/czr/js/czr-control.js
CHANGED
@@ -94,6 +94,10 @@ var api = api || wp.customize, $ = $ || jQuery;
|
|
94 |
api.czr_skopeReady = $.Deferred();
|
95 |
api.bind( 'ready' , function() {
|
96 |
if ( serverControlParams.isSkopOn ) {
|
|
|
|
|
|
|
|
|
97 |
api.czr_skopeBase = new api.CZR_skopeBase();
|
98 |
api.czr_skopeSave = new api.CZR_skopeSave();
|
99 |
api.czr_skopeReset = new api.CZR_skopeReset();
|
@@ -101,6 +105,17 @@ var api = api || wp.customize, $ = $ || jQuery;
|
|
101 |
api.czr_skopeReady.done( function() {
|
102 |
api.trigger('czr-skope-ready');
|
103 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
}
|
105 |
if ( serverControlParams.isChangeSetOn ) {
|
106 |
api.settings.timeouts.changesetAutoSave = 10000;
|
@@ -122,6 +137,66 @@ var api = api || wp.customize, $ = $ || jQuery;
|
|
122 |
} );
|
123 |
} );
|
124 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
|
126 |
})( wp.customize , jQuery, _);
|
127 |
var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
|
@@ -148,7 +223,7 @@ $.extend( CZRSkopeBaseMths, {
|
|
148 |
api.czr_isResettingSkope = new api.Value( false );
|
149 |
api.state.create('switching-skope')(false);
|
150 |
api.czr_dirtyness.callbacks.add( function() { return self.apiDirtynessReact.apply(self, arguments ); } );
|
151 |
-
|
152 |
self.bindAPISettings();
|
153 |
api.state.bind( 'change', function() {
|
154 |
self.setSaveButtonStates();
|
@@ -223,8 +298,15 @@ $.extend( CZRSkopeBaseMths, {
|
|
223 |
api.czr_topNoteVisible = new api.Value( false );
|
224 |
api.czr_skopeReady.then( function() {
|
225 |
api.czr_topNoteVisible.bind( function( visible ) {
|
226 |
-
|
227 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
var _query = $.extend(
|
229 |
api.previewer.query(),
|
230 |
{ nonce: api.previewer.nonce.save }
|
@@ -233,7 +315,9 @@ $.extend( CZRSkopeBaseMths, {
|
|
233 |
.always( function () {})
|
234 |
.fail( function ( response ) { api.consoleLog( 'czr_dismiss_top_note failed', _query, response ); })
|
235 |
.done( function( response ) {});
|
236 |
-
}
|
|
|
|
|
237 |
});
|
238 |
_.delay( function() {
|
239 |
api.czr_topNoteVisible( ! _.isEmpty( serverControlParams.isTopNoteOn ) || 1 == serverControlParams.isTopNoteOn );
|
@@ -274,58 +358,6 @@ $.extend( CZRSkopeBaseMths, {
|
|
274 |
});
|
275 |
});
|
276 |
},//initialize
|
277 |
-
toggleSkopeLoadPane : function() {
|
278 |
-
var self = this, $skopeLoadingPanel;
|
279 |
-
_render = function() {
|
280 |
-
var dfd = $.Deferred();
|
281 |
-
try {
|
282 |
-
_tmpl = wp.template( 'czr-skope-pane' )({ is_skope_loading : true });
|
283 |
-
}
|
284 |
-
catch(e) {
|
285 |
-
throw new Error('Error when parsing the the reset skope template : ' + e );//@to_translate
|
286 |
-
}
|
287 |
-
$.when( $('#customize-preview').after( $( _tmpl ) ) )
|
288 |
-
.always( function() {
|
289 |
-
dfd.resolve( $( '#czr-skope-pane' ) );
|
290 |
-
});
|
291 |
-
|
292 |
-
return dfd.promise();
|
293 |
-
};
|
294 |
-
|
295 |
-
|
296 |
-
$('body').addClass('czr-skop-loading');
|
297 |
-
_render()
|
298 |
-
.done( function( $_el ) {
|
299 |
-
$skopeLoadingPanel = $_el;
|
300 |
-
})
|
301 |
-
.then( function() {
|
302 |
-
if ( ! $skopeLoadingPanel.length )
|
303 |
-
return;
|
304 |
-
|
305 |
-
_.delay( function() {
|
306 |
-
var _height = $('#customize-preview').height();
|
307 |
-
$skopeLoadingPanel.css( 'line-height', _height +'px' ).css( 'height', _height + 'px' );
|
308 |
-
$('body').addClass('czr-skope-pane-open');
|
309 |
-
}, 50 );
|
310 |
-
});
|
311 |
-
|
312 |
-
api.czr_skopeReady.done( function() {
|
313 |
-
_.delay( function() {
|
314 |
-
$.when( $('body').removeClass('czr-skope-pane-open') ).done( function() {
|
315 |
-
_.delay( function() {
|
316 |
-
$.when( $('body').removeClass('czr-skop-loading') ).done( function() {
|
317 |
-
if ( false !== $skopeLoadingPanel.length ) {
|
318 |
-
setTimeout( function() {
|
319 |
-
$skopeLoadingPanel.remove();
|
320 |
-
}, 400 );
|
321 |
-
}
|
322 |
-
});
|
323 |
-
}, 200);
|
324 |
-
});
|
325 |
-
}, 50);
|
326 |
-
|
327 |
-
});
|
328 |
-
},
|
329 |
embedSkopeWrapper : function() {
|
330 |
var self = this;
|
331 |
$('#customize-header-actions').append( $('<div/>', {class:'czr-scope-switcher', html:'<div class="czr-skopes-wrapper"></div>'}) );
|
@@ -494,42 +526,59 @@ $.extend( CZRSkopeBaseMths, {
|
|
494 |
var self = this,
|
495 |
_defaultParams = {
|
496 |
title : '',
|
497 |
-
message : ''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
498 |
};
|
499 |
|
500 |
noteParams = $.extend( _defaultParams , noteParams);
|
501 |
|
502 |
if ( visible ) {
|
503 |
-
|
504 |
-
self.welcomeNote = $_el;
|
505 |
-
_.delay( function() {
|
506 |
-
$('body').addClass('czr-top-note-open');
|
507 |
-
}, 200 );
|
508 |
-
api.CZR_Helpers.setupDOMListeners(
|
509 |
-
[ {
|
510 |
-
trigger : 'click keydown',
|
511 |
-
selector : '.czr-top-note-close',
|
512 |
-
name : 'close-top-note',
|
513 |
-
actions : function() {
|
514 |
-
api.czr_topNoteVisible( false );
|
515 |
-
}
|
516 |
-
} ] ,
|
517 |
-
{ dom_el : self.welcomeNote },
|
518 |
-
self
|
519 |
-
);
|
520 |
-
});
|
521 |
} else {
|
522 |
-
|
523 |
-
if ( self.welcomeNote.length ) {
|
524 |
-
_.delay( function() {
|
525 |
-
self.welcomeNote.remove();
|
526 |
-
}, 300 );
|
527 |
-
}
|
528 |
}
|
529 |
_.delay( function() {
|
530 |
-
|
531 |
},
|
532 |
-
20000
|
533 |
);
|
534 |
},
|
535 |
renderTopNoteTmpl : function( params ) {
|
94 |
api.czr_skopeReady = $.Deferred();
|
95 |
api.bind( 'ready' , function() {
|
96 |
if ( serverControlParams.isSkopOn ) {
|
97 |
+
api.czr_isLoadingSkope = new api.Value( false );
|
98 |
+
api.czr_isLoadingSkope.bind( function( loading ) {
|
99 |
+
toggleSkopeLoadPane( loading );
|
100 |
+
});
|
101 |
api.czr_skopeBase = new api.CZR_skopeBase();
|
102 |
api.czr_skopeSave = new api.CZR_skopeSave();
|
103 |
api.czr_skopeReset = new api.CZR_skopeReset();
|
105 |
api.czr_skopeReady.done( function() {
|
106 |
api.trigger('czr-skope-ready');
|
107 |
});
|
108 |
+
setTimeout( function() {
|
109 |
+
if ( 'pending' == api.czr_skopeReady.state() ) {
|
110 |
+
api.czr_skopeBase.toggleTopNote( true, {
|
111 |
+
title : 'There was a problem when trying to load the customizer.',//@to_translate
|
112 |
+
message : 'Please open your <a href="http://docs.presscustomizr.com/article/272-inspect-your-webpages-in-your-browser-with-the-development-tools" target="_blank">browser debug tool</a>, and report any error message (in red) printed in the javascript console in the <a href="https://wordpress.org/support/theme/hueman" target="_blank">Hueman theme forum</a>.',//@to_translate
|
113 |
+
selfCloseAfter : 40000
|
114 |
+
});
|
115 |
+
|
116 |
+
api.czr_isLoadingSkope( false );
|
117 |
+
}
|
118 |
+
}, 15000);
|
119 |
}
|
120 |
if ( serverControlParams.isChangeSetOn ) {
|
121 |
api.settings.timeouts.changesetAutoSave = 10000;
|
137 |
} );
|
138 |
} );
|
139 |
}
|
140 |
+
var toggleSkopeLoadPane = function( loading ) {
|
141 |
+
loading = _.isUndefined( loading ) ? true : loading;
|
142 |
+
var self = this, $skopeLoadingPanel,
|
143 |
+
_render = function() {
|
144 |
+
var dfd = $.Deferred();
|
145 |
+
try {
|
146 |
+
_tmpl = wp.template( 'czr-skope-pane' )({ is_skope_loading : true });
|
147 |
+
}
|
148 |
+
catch(e) {
|
149 |
+
throw new Error('Error when parsing the the reset skope template : ' + e );//@to_translate
|
150 |
+
}
|
151 |
+
$.when( $('#customize-preview').after( $( _tmpl ) ) )
|
152 |
+
.always( function() {
|
153 |
+
dfd.resolve( $( '#czr-skope-pane' ) );
|
154 |
+
});
|
155 |
+
|
156 |
+
return dfd.promise();
|
157 |
+
},
|
158 |
+
_destroy = function() {
|
159 |
+
_.delay( function() {
|
160 |
+
$.when( $('body').removeClass('czr-skope-pane-open') ).done( function() {
|
161 |
+
_.delay( function() {
|
162 |
+
$.when( $('body').removeClass('czr-skop-loading') ).done( function() {
|
163 |
+
if ( false !== $( '#czr-skope-pane' ).length ) {
|
164 |
+
setTimeout( function() {
|
165 |
+
$( '#czr-skope-pane' ).remove();
|
166 |
+
}, 400 );
|
167 |
+
}
|
168 |
+
});
|
169 |
+
}, 200);
|
170 |
+
});
|
171 |
+
}, 50);
|
172 |
+
};
|
173 |
+
if ( 'pending' == api.czr_skopeReady.state() && loading ) {
|
174 |
+
$('body').addClass('czr-skop-loading');
|
175 |
+
_render()
|
176 |
+
.done( function( $_el ) {
|
177 |
+
$skopeLoadingPanel = $_el;
|
178 |
+
})
|
179 |
+
.then( function() {
|
180 |
+
if ( ! $skopeLoadingPanel.length )
|
181 |
+
return;
|
182 |
+
|
183 |
+
_.delay( function() {
|
184 |
+
var _height = $('#customize-preview').height();
|
185 |
+
$skopeLoadingPanel.css( 'line-height', _height +'px' ).css( 'height', _height + 'px' );
|
186 |
+
$('body').addClass('czr-skope-pane-open');
|
187 |
+
}, 50 );
|
188 |
+
});
|
189 |
+
}
|
190 |
+
|
191 |
+
api.czr_skopeReady.done( function() {
|
192 |
+
_destroy();
|
193 |
+
});
|
194 |
+
if ( ! loading ) {
|
195 |
+
_destroy();
|
196 |
+
}
|
197 |
+
};//toggleSkopeLoadPane
|
198 |
+
|
199 |
+
|
200 |
|
201 |
})( wp.customize , jQuery, _);
|
202 |
var CZRSkopeBaseMths = CZRSkopeBaseMths || {};
|
223 |
api.czr_isResettingSkope = new api.Value( false );
|
224 |
api.state.create('switching-skope')(false);
|
225 |
api.czr_dirtyness.callbacks.add( function() { return self.apiDirtynessReact.apply(self, arguments ); } );
|
226 |
+
api.czr_isLoadingSkope( true );
|
227 |
self.bindAPISettings();
|
228 |
api.state.bind( 'change', function() {
|
229 |
self.setSaveButtonStates();
|
298 |
api.czr_topNoteVisible = new api.Value( false );
|
299 |
api.czr_skopeReady.then( function() {
|
300 |
api.czr_topNoteVisible.bind( function( visible ) {
|
301 |
+
var noteParams = {},
|
302 |
+
_defaultParams = {
|
303 |
+
title : '',
|
304 |
+
message : '',
|
305 |
+
actions : '',
|
306 |
+
selfCloseAfter : 20000
|
307 |
+
};
|
308 |
+
noteParams = $.extend( _defaultParams , serverControlParams.topNoteParams );
|
309 |
+
noteParams.actions = function() {
|
310 |
var _query = $.extend(
|
311 |
api.previewer.query(),
|
312 |
{ nonce: api.previewer.nonce.save }
|
315 |
.always( function () {})
|
316 |
.fail( function ( response ) { api.consoleLog( 'czr_dismiss_top_note failed', _query, response ); })
|
317 |
.done( function( response ) {});
|
318 |
+
};
|
319 |
+
|
320 |
+
self.toggleTopNote( visible, noteParams );
|
321 |
});
|
322 |
_.delay( function() {
|
323 |
api.czr_topNoteVisible( ! _.isEmpty( serverControlParams.isTopNoteOn ) || 1 == serverControlParams.isTopNoteOn );
|
358 |
});
|
359 |
});
|
360 |
},//initialize
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
361 |
embedSkopeWrapper : function() {
|
362 |
var self = this;
|
363 |
$('#customize-header-actions').append( $('<div/>', {class:'czr-scope-switcher', html:'<div class="czr-skopes-wrapper"></div>'}) );
|
526 |
var self = this,
|
527 |
_defaultParams = {
|
528 |
title : '',
|
529 |
+
message : '',
|
530 |
+
actions : '',
|
531 |
+
selfCloseAfter : 20000
|
532 |
+
},
|
533 |
+
_renderAndSetup = function() {
|
534 |
+
$.when( self.renderTopNoteTmpl( noteParams ) ).done( function( $_el ) {
|
535 |
+
self.welcomeNote = $_el;
|
536 |
+
_.delay( function() {
|
537 |
+
$('body').addClass('czr-top-note-open');
|
538 |
+
}, 200 );
|
539 |
+
api.CZR_Helpers.setupDOMListeners(
|
540 |
+
[ {
|
541 |
+
trigger : 'click keydown',
|
542 |
+
selector : '.czr-top-note-close',
|
543 |
+
name : 'close-top-note',
|
544 |
+
actions : function() {
|
545 |
+
_destroy().done( function() {
|
546 |
+
if ( _.isFunction( noteParams.actions ) ) {
|
547 |
+
noteParams.actions();
|
548 |
+
}
|
549 |
+
});
|
550 |
+
}
|
551 |
+
} ] ,
|
552 |
+
{ dom_el : self.welcomeNote },
|
553 |
+
self
|
554 |
+
);
|
555 |
+
});
|
556 |
+
},
|
557 |
+
_destroy = function() {
|
558 |
+
var dfd = $.Deferred();
|
559 |
+
$('body').removeClass('czr-top-note-open');
|
560 |
+
if ( self.welcomeNote.length ) {
|
561 |
+
_.delay( function() {
|
562 |
+
self.welcomeNote.remove();
|
563 |
+
dfd.resolve();
|
564 |
+
}, 300 );
|
565 |
+
} else {
|
566 |
+
dfd.resolve();
|
567 |
+
}
|
568 |
+
return dfd.promise();
|
569 |
};
|
570 |
|
571 |
noteParams = $.extend( _defaultParams , noteParams);
|
572 |
|
573 |
if ( visible ) {
|
574 |
+
_renderAndSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
575 |
} else {
|
576 |
+
_destroy();
|
|
|
|
|
|
|
|
|
|
|
577 |
}
|
578 |
_.delay( function() {
|
579 |
+
_destroy();
|
580 |
},
|
581 |
+
noteParams.selfCloseAfter || 20000
|
582 |
);
|
583 |
},
|
584 |
renderTopNoteTmpl : function( params ) {
|
assets/czr/js/czr-control.min.js
CHANGED
@@ -6,10 +6,10 @@ Array.prototype.filter||(Array.prototype.filter=function(a){"use strict";if(void
|
|
6 |
Array.prototype.map||(Array.prototype.map=function(a,b){var c,d,e;if(null===this)throw new TypeError(" this is null or not defined");var f=Object(this),g=f.length>>>0;if("function"!=typeof a)throw new TypeError(a+" is not a function");for(arguments.length>1&&(c=b),d=new Array(g),e=0;e<g;){var h,i;e in f&&(h=f[e],i=a.call(c,h,e,f),d[e]=i),e++}return d}),/*! iCheck v1.0.1 by Damir Sultanov, http://git.io/arlzeA, MIT Licensed */
|
7 |
"function"!=typeof jQuery.fn.iCheck&&!function(a){function b(a,b,e){var f=a[0],g=/er/.test(e)?p:/bl/.test(e)?n:l,h=e==q?{checked:f[l],disabled:f[n],indeterminate:"true"==a.attr(p)||"false"==a.attr(o)}:f[g];if(/^(ch|di|in)/.test(e)&&!h)c(a,g);else if(/^(un|en|de)/.test(e)&&h)d(a,g);else if(e==q)for(g in h)h[g]?c(a,g,!0):d(a,g,!0);else b&&"toggle"!=e||(b||a[u]("ifClicked"),h?f[r]!==k&&d(a,g):c(a,g))}function c(b,c,e){var q=b[0],u=b.parent(),v=c==l,x=c==p,y=c==n,z=x?o:v?m:"enabled",A=f(b,z+g(q[r])),B=f(b,c+g(q[r]));if(!0!==q[c]){if(!e&&c==l&&q[r]==k&&q.name){var C=b.closest("form"),D='input[name="'+q.name+'"]',D=C.length?C.find(D):a(D);D.each(function(){this!==q&&a(this).data(i)&&d(a(this),c)})}x?(q[c]=!0,q[l]&&d(b,l,"force")):(e||(q[c]=!0),v&&q[p]&&d(b,p,!1)),h(b,v,c,e)}q[n]&&f(b,w,!0)&&u.find("."+j).css(w,"default"),u[s](B||f(b,c)||""),y?u.attr("aria-disabled","true"):u.attr("aria-checked",x?"mixed":"true"),u[t](A||f(b,z)||"")}function d(a,b,c){var d=a[0],e=a.parent(),i=b==l,k=b==p,q=b==n,u=k?o:i?m:"enabled",v=f(a,u+g(d[r])),x=f(a,b+g(d[r]));!1!==d[b]&&((k||!c||"force"==c)&&(d[b]=!1),h(a,i,u,c)),!d[n]&&f(a,w,!0)&&e.find("."+j).css(w,"pointer"),e[t](x||f(a,b)||""),q?e.attr("aria-disabled","false"):e.attr("aria-checked","false"),e[s](v||f(a,u)||"")}function e(b,c){b.data(i)&&(b.parent().html(b.attr("style",b.data(i).s||"")),c&&b[u](c),b.off(".i").unwrap(),a(v+'[for="'+b[0].id+'"]').add(b.closest(v)).off(".i"))}function f(a,b,c){return a.data(i)?a.data(i).o[b+(c?"":"Class")]:void 0}function g(a){return a.charAt(0).toUpperCase()+a.slice(1)}function h(a,b,c,d){d||(b&&a[u]("ifToggled"),a[u]("ifChanged")[u]("if"+g(c)))}var i="iCheck",j=i+"-helper",k="radio",l="checked",m="un"+l,n="disabled",o="determinate",p="in"+o,q="update",r="type",s="addClass",t="removeClass",u="trigger",v="label",w="cursor",x=/ipad|iphone|ipod|android|blackberry|windows phone|opera mini|silk/i.test(navigator.userAgent);a.fn[i]=function(f,g){var h='input[type="checkbox"], input[type="'+k+'"]',m=a(),o=function(b){b.each(function(){var b=a(this);m=b.is(h)?m.add(b):m.add(b.find(h))})};if(/^(check|uncheck|toggle|indeterminate|determinate|disable|enable|update|destroy)$/i.test(f))return f=f.toLowerCase(),o(this),m.each(function(){var c=a(this);"destroy"==f?e(c,"ifDestroyed"):b(c,!0,f),a.isFunction(g)&&g()});if("object"!=typeof f&&f)return this;var w=a.extend({checkedClass:l,disabledClass:n,indeterminateClass:p,labelHover:!0,aria:!1},f),y=w.handle,z=w.hoverClass||"hover",A=w.focusClass||"focus",B=w.activeClass||"active",C=!!w.labelHover,D=w.labelHoverClass||"hover",E=0|(""+w.increaseArea).replace("%","");return("checkbox"==y||y==k)&&(h='input[type="'+y+'"]'),-50>E&&(E=-50),o(this),m.each(function(){var f=a(this);e(f);var g=this,h=g.id,m=-E+"%",o=100+2*E+"%",o={position:"absolute",top:m,left:m,display:"block",width:o,height:o,margin:0,padding:0,background:"#fff",border:0,opacity:0},m=x?{position:"absolute",visibility:"hidden"}:E?o:{position:"absolute",opacity:0},p="checkbox"==g[r]?w.checkboxClass||"icheckbox":w.radioClass||"i"+k,y=a(v+'[for="'+h+'"]').add(f.closest(v)),F=!!w.aria,G=i+"-"+Math.random().toString(36).substr(2,6),H='<div class="'+p+'" '+(F?'role="'+g[r]+'" ':"");F&&y.each(function(){H+='aria-labelledby="',this.id?H+=this.id:(this.id=G,H+=G),H+='"'}),H=f.wrap(H+"/>")[u]("ifCreated").parent().append(w.insert),o=a('<ins class="'+j+'"/>').css(o).appendTo(H),f.data(i,{o:w,s:f.attr("style")}).css(m),w.inheritClass&&H[s](g.className||""),w.inheritID&&h&&H.attr("id",i+"-"+h),"static"==H.css("position")&&H.css("position","relative"),b(f,!0,q),y.length&&y.on("click.i mouseover.i mouseout.i touchbegin.i touchend.i",function(c){var d=c[r],e=a(this);if(!g[n]){if("click"==d){if(a(c.target).is("a"))return;b(f,!1,!0)}else C&&(/ut|nd/.test(d)?(H[t](z),e[t](D)):(H[s](z),e[s](D)));if(!x)return!1;c.stopPropagation()}}),f.on("click.i focus.i blur.i keyup.i keydown.i keypress.i",function(a){var b=a[r];return a=a.keyCode,"click"!=b&&("keydown"==b&&32==a?(g[r]==k&&g[l]||(g[l]?d(f,l):c(f,l)),!1):void("keyup"==b&&g[r]==k?!g[l]&&c(f,l):/us|ur/.test(b)&&H["blur"==b?t:s](A)))}),o.on("click mousedown mouseup mouseover mouseout touchbegin.i touchend.i",function(a){var c=a[r],d=/wn|up/.test(c)?B:z;if(!g[n]){if("click"==c?b(f,!1,!0):(/wn|er|in/.test(c)?H[s](d):H[t](d+" "+B),y.length&&C&&d==z&&y[/ut|nd/.test(c)?t:s](D)),!x)return!1;a.stopPropagation()}})})}}(window.jQuery||window.Zepto),"function"!=typeof jQuery.fn.selecter&&!function(a,b){"use strict";function c(b){b=a.extend({},x,b||{}),null===w&&(w=a("body"));for(var c=a(this),e=0,f=c.length;f>e;e++)d(c.eq(e),b);return c}function d(b,c){if(!b.hasClass("selecter-element")){c=a.extend({},c,b.data("selecter-options")),c.external&&(c.links=!0);var d=b.find("option, optgroup"),g=d.filter("option"),h=g.filter(":selected"),n=""!==c.label?-1:g.index(h),p=c.links?"nav":"div";c.tabIndex=b[0].tabIndex,b[0].tabIndex=-1,c.multiple=b.prop("multiple"),c.disabled=b.is(":disabled");var q="<"+p+' class="selecter '+c.customClass;v?q+=" mobile":c.cover&&(q+=" cover"),q+=c.multiple?" multiple":" closed",c.disabled&&(q+=" disabled"),q+='" tabindex="'+c.tabIndex+'">',c.multiple||(q+='<span class="selecter-selected'+(""!==c.label?" placeholder":"")+'">',q+=a("<span></span").text(r(""!==c.label?c.label:h.text(),c.trim)).html(),q+="</span>"),q+='<div class="selecter-options">',q+="</div>",q+="</"+p+">",b.addClass("selecter-element").after(q);var s=b.next(".selecter"),u=a.extend({$select:b,$allOptions:d,$options:g,$selecter:s,$selected:s.find(".selecter-selected"),$itemsWrapper:s.find(".selecter-options"),index:-1,guid:t++},c);e(u),o(n,u),void 0!==a.fn.scroller&&u.$itemsWrapper.scroller(),u.$selecter.on("touchstart.selecter click.selecter",".selecter-selected",u,f).on("click.selecter",".selecter-item",u,j).on("close.selecter",u,i).data("selecter",u),u.$select.on("change.selecter",u,k),v||(u.$selecter.on("focus.selecter",u,l).on("blur.selecter",u,m),u.$select.on("focus.selecter",u,function(a){a.data.$selecter.trigger("focus")}))}}function e(b){for(var c="",d=b.links?"a":"span",e=0,f=0,g=b.$allOptions.length;g>f;f++){var h=b.$allOptions.eq(f);if("OPTGROUP"===h[0].tagName)c+='<span class="selecter-group',h.is(":disabled")&&(c+=" disabled"),c+='">'+h.attr("label")+"</span>";else{var i=h.val();h.attr("value")||h.attr("value",i),c+="<"+d+' class="selecter-item',h.is(":selected")&&""===b.label&&(c+=" selected"),h.is(":disabled")&&(c+=" disabled"),c+='" ',c+=b.links?'href="'+i+'"':'data-value="'+i+'"',c+=">"+a("<span></span>").text(r(h.text(),b.trim)).html()+"</"+d+">",e++}}b.$itemsWrapper.html(c),b.$items=b.$selecter.find(".selecter-item")}function f(c){c.preventDefault(),c.stopPropagation();var d=c.data;if(!d.$select.is(":disabled"))if(a(".selecter").not(d.$selecter).trigger("close.selecter",[d]),v){var e=d.$select[0];if(b.document.createEvent){var f=b.document.createEvent("MouseEvents");f.initMouseEvent("mousedown",!1,!0,b,0,0,0,0,0,!1,!1,!1,!1,0,null),e.dispatchEvent(f)}else e.fireEvent&&e.fireEvent("onmousedown")}else d.$selecter.hasClass("closed")?g(c):d.$selecter.hasClass("open")&&i(c)}function g(b){b.preventDefault(),b.stopPropagation();var c=b.data;if(!c.$selecter.hasClass("open")){var d=c.$selecter.offset(),e=w.outerHeight(),f=c.$itemsWrapper.outerHeight(!0),g=c.index>=0?c.$items.eq(c.index).position():{left:0,top:0};d.top+f>e&&c.$selecter.addClass("bottom"),c.$itemsWrapper.show(),c.$selecter.removeClass("closed").addClass("open"),w.on("click.selecter-"+c.guid,":not(.selecter-options)",c,h),void 0!==a.fn.scroller?c.$itemsWrapper.scroller("scroll",c.$itemsWrapper.find(".scroller-content").scrollTop()+g.top,0).scroller("reset"):c.$itemsWrapper.scrollTop(c.$itemsWrapper.scrollTop()+g.top)}}function h(b){b.preventDefault(),b.stopPropagation(),0===a(b.currentTarget).parents(".selecter").length&&i(b)}function i(a){a.preventDefault(),a.stopPropagation();var b=a.data;b.$selecter.hasClass("open")&&(b.$itemsWrapper.hide(),b.$selecter.removeClass("open bottom").addClass("closed"),w.off(".selecter-"+b.guid))}function j(b){b.preventDefault(),b.stopPropagation();var c=a(this),d=b.data;if(!d.$select.is(":disabled")){if(d.$itemsWrapper.is(":visible")){var e=d.$items.index(c);o(e,d),p(d)}d.multiple||i(b)}}function k(b,c){var d=a(this),e=b.data;if(!c&&!e.multiple){var f=e.$options.index(e.$options.filter("[value='"+s(d.val())+"']"));o(f,e),p(e)}}function l(b){b.preventDefault(),b.stopPropagation();var c=b.data;c.$select.is(":disabled")||c.multiple||(c.$selecter.addClass("focus").on("keydown.selecter"+c.guid,c,n),a(".selecter").not(c.$selecter).trigger("close.selecter",[c]))}function m(b){b.preventDefault(),b.stopPropagation();var c=b.data;c.$selecter.removeClass("focus").off("keydown.selecter"+c.guid+" keyup.selecter"+c.guid),a(".selecter").not(c.$selecter).trigger("close.selecter",[c])}function n(b){var c=b.data;if(13===b.keyCode)c.$selecter.hasClass("open")&&(i(b),o(c.index,c)),p(c);else if(!(9===b.keyCode||b.metaKey||b.altKey||b.ctrlKey||b.shiftKey)){b.preventDefault(),b.stopPropagation();var d=c.$items.length-1,e=c.index<0?0:c.index;if(a.inArray(b.keyCode,u?[38,40,37,39]:[38,40])>-1)e+=38===b.keyCode||u&&37===b.keyCode?-1:1,0>e&&(e=0),e>d&&(e=d);else{var f,g,h=String.fromCharCode(b.keyCode).toUpperCase();for(g=c.index+1;d>=g;g++)if(f=c.$options.eq(g).text().charAt(0).toUpperCase(),f===h){e=g;break}if(0>e)for(g=0;d>=g;g++)if(f=c.$options.eq(g).text().charAt(0).toUpperCase(),f===h){e=g;break}}e>=0&&o(e,c)}}function o(a,b){var c=b.$items.eq(a),d=c.hasClass("selected"),e=c.hasClass("disabled");if(!e){if(-1===a&&""!==b.label)b.$selected.html(b.label);else if(d)b.multiple&&(b.$options.eq(a).prop("selected",null),c.removeClass("selected"));else{var f=c.html();c.data("value"),b.multiple?b.$options.eq(a).prop("selected",!0):(b.$selected.html(f).removeClass("placeholder"),b.$items.filter(".selected").removeClass("selected"),b.$select[0].selectedIndex=a),c.addClass("selected")}(!d||b.multiple)&&(b.index=a)}}function p(a){a.links?q(a):(a.callback.call(a.$selecter,a.$select.val(),a.index),a.$select.trigger("change",[!0]))}function q(a){var c=a.$select.val();a.external?b.open(c):b.location.href=c}function r(a,b){return 0===b?a:a.length>b?a.substring(0,b)+"...":a}function s(a){return a.replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1")}var t=0,u=b.navigator.userAgent.toLowerCase().indexOf("firefox")>-1,v=/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(b.navigator.userAgent||b.navigator.vendor||b.opera),w=null,x={callback:a.noop,cover:!1,customClass:"",label:"",external:!1,links:!1,trim:0},y={defaults:function(b){return x=a.extend(x,b||{}),a(this)},disable:function(b){return a(this).each(function(c,d){var e=a(d).next(".selecter").data("selecter");if(e)if("undefined"!=typeof b){var f=e.$items.index(e.$items.filter("[data-value="+b+"]"));e.$items.eq(f).addClass("disabled"),e.$options.eq(f).prop("disabled",!0)}else e.$selecter.hasClass("open")&&e.$selecter.find(".selecter-selected").trigger("click.selecter"),e.$selecter.addClass("disabled"),e.$select.prop("disabled",!0)})},enable:function(b){return a(this).each(function(c,d){var e=a(d).next(".selecter").data("selecter");if(e)if("undefined"!=typeof b){var f=e.$items.index(e.$items.filter("[data-value="+b+"]"));e.$items.eq(f).removeClass("disabled"),e.$options.eq(f).prop("disabled",!1)}else e.$selecter.removeClass("disabled"),e.$select.prop("disabled",!1)})},destroy:function(){return a(this).each(function(b,c){var d=a(c).next(".selecter").data("selecter");d&&(d.$selecter.hasClass("open")&&d.$selecter.find(".selecter-selected").trigger("click.selecter"),void 0!==a.fn.scroller&&d.$selecter.find(".selecter-options").scroller("destroy"),d.$select[0].tabIndex=d.tabIndex,d.$select.off(".selecter").removeClass("selecter-element").show(),d.$selecter.off(".selecter").remove())})},refresh:function(){return a(this).each(function(b,c){var d=a(c).next(".selecter").data("selecter");if(d){var f=d.index;d.$allOptions=d.$select.find("option, optgroup"),d.$options=d.$allOptions.filter("option"),d.index=-1,f=d.$options.index(d.$options.filter(":selected")),e(d),o(f,d)}})}};a.fn.selecter=function(a){return y[a]?y[a].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof a&&a?this:c.apply(this,arguments)},a.selecter=function(a){"defaults"===a&&y.defaults.apply(this,Array.prototype.slice.call(arguments,1))}}(jQuery,window),"function"!=typeof jQuery.fn.stepper&&!function(a){"use strict";function b(b){b=a.extend({},k,b||{});for(var d=a(this),e=0,f=d.length;f>e;e++)c(d.eq(e),b);return d}function c(b,c){if(!b.hasClass("stepper-input")){c=a.extend({},c,b.data("stepper-options"));var e=parseFloat(b.attr("min")),f=parseFloat(b.attr("max")),g=parseFloat(b.attr("step"))||1;b.addClass("stepper-input").wrap('<div class="stepper '+c.customClass+'" />').after('<span class="stepper-arrow up">'+c.labels.up+'</span><span class="stepper-arrow down">'+c.labels.down+"</span>");var h=b.parent(".stepper"),j=a.extend({$stepper:h,$input:b,$arrow:h.find(".stepper-arrow"),min:void 0!==typeof e&&!isNaN(e)&&e,max:void 0!==typeof f&&!isNaN(f)&&f,step:void 0===typeof g||isNaN(g)?1:g,timer:null},c);j.digits=i(j.step),b.is(":disabled")&&h.addClass("disabled"),h.on("touchstart.stepper mousedown.stepper",".stepper-arrow",j,d).data("stepper",j)}}function d(b){b.preventDefault(),b.stopPropagation(),e(b);var c=b.data;if(!c.$input.is(":disabled")&&!c.$stepper.hasClass("disabled")){var d=a(b.target).hasClass("up")?c.step:-c.step;c.timer=g(c.timer,125,function(){f(c,d,!1)}),f(c,d),a("body").on("touchend.stepper mouseup.stepper",c,e)}}function e(b){b.preventDefault(),b.stopPropagation();var c=b.data;h(c.timer),a("body").off(".stepper")}function f(a,b){var c=parseFloat(a.$input.val()),d=b;void 0===typeof c||isNaN(c)?d=a.min!==!1?a.min:0:a.min!==!1&&c<a.min?d=a.min:d+=c;var e=(d-a.min)%a.step;0!==e&&(d-=e),a.min!==!1&&d<a.min&&(d=a.min),a.max!==!1&&d>a.max&&(d-=a.step),d!==c&&(d=j(d,a.digits),a.$input.val(d).trigger("change"))}function g(a,b,c){return h(a),setInterval(c,b)}function h(a){a&&(clearInterval(a),a=null)}function i(a){var b=String(a);return b.indexOf(".")>-1?b.length-b.indexOf(".")-1:0}function j(a,b){var c=Math.pow(10,b);return Math.round(a*c)/c}var k={customClass:"",labels:{up:"Up",down:"Down"}},l={defaults:function(b){return k=a.extend(k,b||{}),a(this)},destroy:function(){return a(this).each(function(){var b=a(this).data("stepper");b&&(b.$stepper.off(".stepper").find(".stepper-arrow").remove(),b.$input.unwrap().removeClass("stepper-input"))})},disable:function(){return a(this).each(function(){var b=a(this).data("stepper");b&&(b.$input.attr("disabled","disabled"),b.$stepper.addClass("disabled"))})},enable:function(){return a(this).each(function(){var b=a(this).data("stepper");b&&(b.$input.attr("disabled",null),b.$stepper.removeClass("disabled"))})}};a.fn.stepper=function(a){return l[a]?l[a].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof a&&a?this:b.apply(this,arguments)},a.stepper=function(a){"defaults"===a&&l.defaults.apply(this,Array.prototype.slice.call(arguments,1))}}(jQuery,this),/*! Select2 4.0.1 | https://github.com/select2/select2/blob/master/LICENSE.md */!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return u.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=s.map,p=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(a=a.split("/"),g=a.length-1,s.nodeIdCompat&&w.test(a[g])&&(a[g]=a[g].replace(w,"")),a=n.slice(0,n.length-1).concat(a),k=0;k<a.length;k+=1)if(m=a[k],"."===m)a.splice(k,1),k-=1;else if(".."===m){if(1===k&&(".."===a[2]||".."===a[0]))break;k>0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||p)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&p&&p[d]&&(i=p[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=v.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),n.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){q[a]=b}}function j(a){if(e(r,a)){var c=r[a];delete r[a],t[a]=!0,m.apply(b,c)}if(!e(q,a)&&!e(t,a))throw new Error("No "+a);return q[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return function(){return s&&s.config&&s.config[a]||{}}}var m,n,o,p,q={},r={},s={},t={},u=Object.prototype.hasOwnProperty,v=[].slice,w=/\.js$/;o=function(a,b){var c,d=k(a),e=d[0];return a=d[1],e&&(e=f(e,b),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(b)):f(a,b):(a=f(a,b),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},p={require:function(a){return g(a)},exports:function(a){var b=q[a];return"undefined"!=typeof b?b:q[a]={}},module:function(a){return{id:a,uri:"",exports:q[a],config:l(a)}}},m=function(a,c,d,f){var h,k,l,m,n,s,u=[],v=typeof d;if(f=f||a,"undefined"===v||"function"===v){for(c=!c.length&&d.length?["require","exports","module"]:c,n=0;n<c.length;n+=1)if(m=o(c[n],f),k=m.f,"require"===k)u[n]=p.require(a);else if("exports"===k)u[n]=p.exports(a),s=!0;else if("module"===k)h=u[n]=p.module(a);else if(e(q,k)||e(r,k)||e(t,k))u[n]=j(k);else{if(!m.p)throw new Error(a+" missing "+k);m.p.load(m.n,g(f,!0),i(k),{}),u[n]=q[k]}l=d?d.apply(q[a],u):void 0,a&&(h&&h.exports!==b&&h.exports!==q[a]?q[a]=h.exports:l===b&&s||(q[a]=l))}else a&&(q[a]=d)},a=c=n=function(a,c,d,e,f){if("string"==typeof a)return p[a]?p[a](c):j(o(a,c).f);if(!a.splice){if(s=a,s.deps&&n(s.deps,s.callback),!c)return;c.splice?(a=c,c=d,d=null):a=b}return c=c||function(){},"function"==typeof d&&(d=e,e=f),e?m(b,a,c,d):setTimeout(function(){m(b,a,c,d)},4),n},n.config=function(a){return n(a)},a._defined=q,d=function(a,b,c){if("string"!=typeof a)throw new Error("See almond README: incorrect module build, no module name");b.splice||(c=b,b=[]),e(q,a)||e(r,a)||(r[a]=[a,b,c])},d.amd={jQuery:!0}}(),b.requirejs=a,b.require=c,b.define=d}}(),b.define("almond",function(){}),b.define("jquery",[],function(){var b=a||$;return null==b&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),b}),b.define("select2/utils",["jquery"],function(a){function b(a){var b=a.prototype,c=[];for(var d in b){var e=b[d];"function"==typeof e&&"constructor"!==d&&c.push(d)}return c}var c={};c.Extend=function(a,b){function c(){this.constructor=a}var d={}.hasOwnProperty;for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},c.Decorate=function(a,c){function d(){var b=Array.prototype.unshift,d=c.prototype.constructor.length,e=a.prototype.constructor;d>0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;h<g.length;h++){var i=g[h];d.prototype[i]=a.prototype[i]}for(var j=(function(a){var b=function(){};a in d.prototype&&(b=d.prototype[a]);var e=c.prototype[a];return function(){var a=Array.prototype.unshift;return a.call(arguments,b),e.apply(this,arguments)}}),k=0;k<f.length;k++){var l=f[k];d.prototype[l]=j(l)}return d};var d=function(){this.listeners={}};return d.prototype.on=function(a,b){this.listeners=this.listeners||{},a in this.listeners?this.listeners[a].push(b):this.listeners[a]=[b]},d.prototype.trigger=function(a){var b=Array.prototype.slice;this.listeners=this.listeners||{},a in this.listeners&&this.invoke(this.listeners[a],b.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},d.prototype.invoke=function(a,b){for(var c=0,d=a.length;d>c;c++)a[c].apply(this,b)},c.Observable=d,c.generateChars=function(a){for(var b="",c=0;a>c;c++){var d=Math.floor(36*Math.random());b+=d.toString(36)}return b},c.bind=function(a,b){return function(){a.apply(b,arguments)}},c._convertData=function(a){for(var b in a){var c=b.split("-"),d=a;if(1!==c.length){for(var e=0;e<c.length;e++){var f=c[e];f=f.substring(0,1).toLowerCase()+f.substring(1),f in d||(d[f]={}),e==c.length-1&&(d[f]=a[b]),d=d[f]}delete a[b]}}return a},c.hasScroll=function(b,c){var d=a(c),e=c.style.overflowX,f=c.style.overflowY;return(e!==f||"hidden"!==f&&"visible"!==f)&&("scroll"===e||"scroll"===f||(d.innerHeight()<c.scrollHeight||d.innerWidth()<c.scrollWidth))},c.escapeMarkup=function(a){var b={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<ul class="select2-results__options" role="tree"></ul>');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a('<li role="treeitem" aria-live="assertive" class="select2-results__option"></li>'),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c<a.results.length;c++){var d=a.results[c],e=this.option(d);b.push(e)}this.$results.append(b)},c.prototype.position=function(a,b){var c=b.find(".select2-results");c.append(a)},c.prototype.sort=function(a){var b=this.options.get("sorter");return b(a)},c.prototype.setClasses=function(){var b=this;this.data.current(function(c){var d=a.map(c,function(a){return a.id.toString()}),e=b.$results.find(".select2-results__option[aria-selected]");e.each(function(){var b=a(this),c=a.data(this,"data"),e=""+c.id;null!=c.element&&c.element.selected||null==c.element&&a.inArray(e,d)>-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")});var f=e.filter("[aria-selected=true]");f.length>0?f.first().trigger("mouseenter"):e.first().trigger("mouseenter")})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group",a(h),this.template(b,h);for(var i=[],j=0;j<b.children.length;j++){var k=b.children[j],l=this.option(k);i.push(l)}var m=a("<ul></ul>",{"class":"select2-results__options select2-results__options--nested"});m.append(i),g.append(h),g.append(m)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b,c){var d=this,e=b.id+"-results";this.$results.attr("id",e),b.on("results:all",function(a){d.clear(),d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("results:append",function(a){d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("query",function(a){d.hideMessages(),d.showLoading(a)}),b.on("select",function(){b.isOpen()&&d.setClasses()}),b.on("unselect",function(){b.isOpen()&&d.setClasses()}),b.on("open",function(){d.$results.attr("aria-expanded","true"),d.$results.attr("aria-hidden","false"),d.setClasses(),d.ensureHighlightVisible()}),b.on("close",function(){d.$results.attr("aria-expanded","false"),d.$results.attr("aria-hidden","true"),d.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=d.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=d.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a);if(0!==c){var e=c-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top,h=f.offset().top,i=d.$results.scrollTop()+(h-g);0===e?d.$results.scrollTop(0):0>h-g&&d.$results.scrollTop(i)}}),b.on("results:next",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a),e=c+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top+d.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=d.$results.scrollTop()+h-g;0===e?d.$results.scrollTop(0):h>g&&d.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){d.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=d.$results.scrollTop(),c=d.$results.get(0).scrollHeight-d.$results.scrollTop()+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=d.$results.height();e?(d.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(d.$results.scrollTop(d.$results.get(0).scrollHeight-d.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var c=a(this),e=c.data("data");return"true"===c.attr("aria-selected")?void(d.options.get("multiple")?d.trigger("unselect",{originalEvent:b,data:e}):d.trigger("close",{})):void d.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted"),d.trigger("results:focus",{data:c,element:a(this)})})},c.prototype.getHighlightedResults=function(){var a=this.$results.find(".select2-results__option--highlighted");return a},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),2>=c?this.$results.scrollTop(0):(g>this.$results.outerHeight()||0>g)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){var a={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46};return a}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a('<span class="select2-selection" role="combobox" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a,b){var d=this,e=(a.id+"-container",a.id+"-results");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",e),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),d.$selection.focus(),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2"),e=a(".select2.select2-container--open");e.each(function(){var b=a(this);if(this!=d[0]){var c=b.data("element");c.select2("close")}})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){var c=b.find(".selection");c.append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d),this.$selection.attr("aria-labelledby",d),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("blur",function(a){}),a.on("selection:update",function(a){c.update(a.data)})},e.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},e.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},e.prototype.selectionContainer=function(){return a("<span></span>")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.$selection.find(".select2-selection__rendered"),d=this.display(b,c);c.empty().append(d),c.prop("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html('<ul class="select2-selection__rendered"></ul>'),a},d.prototype.bind=function(b,c){
|
8 |
var e=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){e.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!e.options.get("disabled")){var c=a(this),d=c.parent(),f=d.data("data");e.trigger("unselect",{originalEvent:b,data:f})}})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},d.prototype.selectionContainer=function(){var b=a('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">×</span></li>');return b},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d<a.length;d++){var e=a[d],f=this.selectionContainer(),g=this.display(e,f);f.append(g),f.prop("title",e.title||e.text),f.data("data",e),b.push(f)}var h=this.$selection.find(".select2-selection__rendered");c.appendMany(h,b)}},d}),b.define("select2/selection/placeholder",["../utils"],function(a){function b(a,b,c){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c)}return b.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},b.prototype.createPlaceholder=function(a,b){var c=this.selectionContainer();return c.html(this.display(b)),c.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),c},b.prototype.update=function(a,b){var c=1==b.length&&b[0].id!=this.placeholder.id,d=b.length>1;if(d||c)return a.call(this,b);this.clear();var e=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(e)},b}),b.define("select2/selection/allowClear",["jquery","../keys"],function(a,b){function c(){}return c.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},c.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var c=this.$selection.find(".select2-selection__clear");if(0!==c.length){b.stopPropagation();for(var d=c.data("data"),e=0;e<d.length;e++){var f={data:d[e]};if(this.trigger("unselect",f),f.prevented)return}this.$element.val(this.placeholder.id).trigger("change"),this.trigger("toggle",{})}}},c.prototype._handleKeyboardClear=function(a,c,d){d.isOpen()||(c.which==b.DELETE||c.which==b.BACKSPACE)&&this._handleClear(c)},c.prototype.update=function(b,c){if(b.call(this,c),!(this.$selection.find(".select2-selection__placeholder").length>0||0===c.length)){var d=a('<span class="select2-selection__clear">×</span>');d.data("data",c),this.$selection.find(".select2-selection__rendered").prepend(d)}},c}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a('<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" aria-autocomplete="list" /></li>');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented();var b=a.which;if(b===c.BACKSPACE&&""===e.$search.val()){var d=e.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var f=d.data("data");e.searchRemoveChoice(f),a.preventDefault()}}});var f=document.documentMode,g=f&&11>=f;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){return g?void e.$selection.off("input.search input.searchcheck"):void e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(g&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{var b=this.$search.val().length+1;a=.75*b+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){var a={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};return a}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),d+=null!=c.id?"-"+c.id.toString():"-"+a.generateChars(4)},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f<a.length;f++){var g=a[f].id;-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")});else{var d=a.id;this.$element.val(d),this.$element.trigger("change")}},d.prototype.unselect=function(a){var b=this;if(this.$element.prop("multiple"))return a.selected=!1,c(a.element).is("option")?(a.element.selected=!1,void this.$element.trigger("change")):void this.current(function(d){for(var e=[],f=0;f<d.length;f++){var g=d[f].id;g!==a.id&&-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")})},d.prototype.bind=function(a,b){var c=this;this.container=a,a.on("select",function(a){c.select(a.data)}),a.on("unselect",function(a){c.unselect(a.data)})},d.prototype.destroy=function(){this.$element.find("*").each(function(){c.removeData(this,"data")})},d.prototype.query=function(a,b){var d=[],e=this,f=this.$element.children();f.each(function(){var b=c(this);if(b.is("option")||b.is("optgroup")){var f=e.item(b),g=e.matches(a,f);null!==g&&d.push(g)}}),b({results:d})},d.prototype.addOptions=function(a){b.appendMany(this.$element,a)},d.prototype.option=function(a){var b;a.children?(b=document.createElement("optgroup"),b.label=a.text):(b=document.createElement("option"),void 0!==b.textContent?b.textContent=a.text:b.innerText=a.text),a.id&&(b.value=a.id),a.disabled&&(b.disabled=!0),a.selected&&(b.selected=!0),a.title&&(b.title=a.title);var d=c(b),e=this._normalizeItem(a);return e.element=b,c.data(b,"data",e),d},d.prototype.item=function(a){var b={};if(b=c.data(a[0],"data"),null!=b)return b;if(a.is("option"))b={id:a.val(),text:a.text(),disabled:a.prop("disabled"),selected:a.prop("selected"),title:a.prop("title")};else if(a.is("optgroup")){b={text:a.prop("label"),children:[],title:a.prop("title")};for(var d=a.children("option"),e=[],f=0;f<d.length;f++){var g=c(d[f]),h=this.item(g);e.push(h)}b.children=e}return b=this._normalizeItem(b),b.element=a[0],c.data(a[0],"data",b),b},d.prototype._normalizeItem=function(a){c.isPlainObject(a)||(a={id:a,text:a}),a=c.extend({},{text:""},a);var b={selected:!1,disabled:!1};return null!=a.id&&(a.id=a.id.toString()),null!=a.text&&(a.text=a.text.toString()),null==a._resultId&&a.id&&null!=this.container&&(a._resultId=this.generateResultId(this.container,a)),c.extend({},b,a)},d.prototype.matches=function(a,b){var c=this.options.get("matcher");return c(a,b)},d}),b.define("select2/data/array",["./select","../utils","jquery"],function(a,b,c){function d(a,b){var c=b.get("data")||[];d.__super__.constructor.call(this,a,b),this.addOptions(this.convertToOptions(c))}return b.Extend(d,a),d.prototype.select=function(a){var b=this.$element.find("option").filter(function(b,c){return c.value==a.id.toString()});0===b.length&&(b=this.option(a),this.addOptions(b)),d.__super__.select.call(this,a)},d.prototype.convertToOptions=function(a){function d(a){return function(){return c(this).val()==a.id}}for(var e=this,f=this.$element.find("option"),g=f.map(function(){return e.item(c(this)).id}).get(),h=[],i=0;i<a.length;i++){var j=this._normalizeItem(a[i]);if(c.inArray(j.id,g)>=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},l,j),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&""!==a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");if(void 0!==f&&(this.createTag=f),b.call(this,c,d),a.isArray(e))for(var g=0;g<e.length;g++){var h=e[g],i=this._normalizeItem(h),j=this.option(i);this.$element.append(j)}}return b.prototype.query=function(a,b,c){function d(a,f){for(var g=a.results,h=0;h<g.length;h++){var i=g[h],j=null!=i.children&&!d({results:i.children},!0),k=i.text===b.term;if(k||j)return!f&&(a.data=g,void c(a))}if(f)return!0;var l=e.createTag(b);if(null!=l){var m=e.option(l);m.attr("data-select2-tag",!0),e.addOptions([m]),e.insertTag(g,l)}a.results=g,c(a)}var e=this;return this._removeOldTags(),null==b.term||null!=b.page?void a.call(this,b,c):void a.call(this,b,d)},b.prototype.createTag=function(b,c){var d=a.trim(c.term);return""===d?null:{id:d,text:d}},b.prototype.insertTag=function(a,b,c){b.unshift(c)},b.prototype._removeOldTags=function(b){var c=(this._lastTag,this.$element.find("option[data-select2-tag]"));c.each(function(){this.selected||a(this).remove()})},b}),b.define("select2/data/tokenizer",["jquery"],function(a){function b(a,b,c){var d=c.get("tokenizer");void 0!==d&&(this.tokenizer=d),a.call(this,b,c)}return b.prototype.bind=function(a,b,c){a.call(this,b,c),this.$search=b.dropdown.$search||b.selection.$search||c.find(".select2-search__field")},b.prototype.query=function(a,b,c){function d(a){e.trigger("select",{data:a})}var e=this;b.term=b.term||"";var f=this.tokenizer(b,this.options,d);f.term!==b.term&&(this.$search.length&&(this.$search.val(f.term),this.$search.focus()),b.term=f.term),a.call(this,b,c)},b.prototype.tokenizer=function(b,c,d,e){for(var f=d.get("tokenSeparators")||[],g=c.term,h=0,i=this.createTag||function(a){return{id:a.term,text:a.term}};h<g.length;){var j=g[h];if(-1!==a.inArray(j,f)){var k=g.substr(0,h),l=a.extend({},c,{term:k}),m=i(l);null!=m?(e(m),g=g.substr(h+1)||"",h=0):h++}else h++}return{term:g}},b}),b.define("select2/data/minimumInputLength",[],function(){function a(a,b,c){this.minimumInputLength=c.get("minimumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",b.term.length<this.minimumInputLength?void this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumInputLength",[],function(){function a(a,b,c){this.maximumInputLength=c.get("maximumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",this.maximumInputLength>0&&b.term.length>this.maximumInputLength?void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;return d.maximumSelectionLength>0&&f>=d.maximumSelectionLength?void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}}):void a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<span class="select2-dropdown"><span class="select2-results"></span></span>');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" /></span>');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){var b=e.showSearch(a);b?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){var c=e.$results.offset().top+e.$results.outerHeight(!1),d=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1);c+50>=d&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('<li class="select2-results__option select2-results__option--load-more"role="treeitem" aria-disabled="true"></li>'),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a("<span></span>"),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id,h=this.$container.parents().filter(b.hasScroll);h.off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=(this.$container.position(),this.$container.offset());f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.top<f.top-h.height,k=i.bottom>f.bottom+h.height,l={left:f.left,top:g.bottom};if("static"!==this.$dropdownParent[0].style.position){var m=this.$dropdownParent.offset();l.top-=m.top,l.left-=m.left}c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d<b.length;d++){var e=b[d];e.children?c+=a(e.children):c++}return c}function b(a,b,c,d){this.minimumResultsForSearch=c.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),a.call(this,b,c,d)}return b.prototype.showSearch=function(b,c){return!(a(c.data.results)<this.minimumResultsForSearch)&&b.call(this,c)},b}),b.define("select2/dropdown/selectOnClose",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("close",function(){d._handleSelectOnClose()})},a.prototype._handleSelectOnClose=function(){var a=this.getHighlightedResults();if(!(a.length<1)){var b=a.data("data");null!=b.element&&b.element.selected||null==b.element&&b.selected||this.trigger("select",{data:b})}},a}),b.define("select2/dropdown/closeOnSelect",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("select",function(a){d._selectTriggered(a)}),b.on("unselect",function(a){d._selectTriggered(a)})},a.prototype._selectTriggered=function(a,b){var c=b.originalEvent;c&&c.ctrlKey||this.trigger("close",{})},a}),b.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(a){var b=a.input.length-a.maximum,c="Please delete "+b+" character";return 1!=b&&(c+="s"),c},inputTooShort:function(a){var b=a.minimum-a.input.length,c="Please enter "+b+" or more characters";return c},loadingMore:function(){return"Loading more results…"},maximumSelected:function(a){var b="You can only select "+a.maximum+" item";return 1!=a.maximum&&(b+="s"),b},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),b.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C){function D(){
|
9 |
-
this.reset()}D.prototype.apply=function(l){if(l=a.extend({},this.defaults,l),null==l.dataAdapter){if(null!=l.ajax?l.dataAdapter=o:null!=l.data?l.dataAdapter=n:l.dataAdapter=m,l.minimumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),(null!=l.tokenSeparators||null!=l.tokenizer)&&(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L<K.length;L++){var M=K[L],N={};try{N=k.loadPath(M)}catch(O){try{M=this.defaults.amdLanguageBase+M,N=k.loadPath(M)}catch(P){l.debug&&window.console&&console.warn&&console.warn('Select2: The language file for "'+M+'" could not be automatically loaded. A fallback will be used instead.');continue}}J.extend(N)}l.translations=J}else{var Q=k.loadPath(this.defaults.amdLanguageBase+"en"),R=new k(l.language);R.extend(Q),l.translations=R}return l},D.prototype.reset=function(){function b(a){function b(a){return l[a]||a}return a.replace(/[^\u0000-\u007E]/g,b)}function c(d,e){if(""===a.trim(d.term))return e;if(e.children&&e.children.length>0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){var h=e.children[g],i=c(d,h);null==i&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var j=b(e.text).toUpperCase(),k=b(d.term).toUpperCase();return j.indexOf(k)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)};var E=new D;return E}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return 0>=e?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;i>h;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this._sync=c.bind(this._syncAttributes,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._sync);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._sync)}),this._observer.observe(this.$element[0],{attributes:!0,subtree:!1})):this.$element[0].addEventListener&&this.$element[0].addEventListener("DOMAttrModified",b._sync,!1)},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),(null==a||0===a.length)&&(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._sync),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&this.$element[0].removeEventListener("DOMAttrModified",this._sync,!1),this._sync=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null},e.prototype.render=function(){var b=a('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),b.define("jquery-mousewheel",["jquery"],function(a){return a}),b.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(a,b,c,d){if(null==a.fn.select2){var e=["open","close","destroy"];a.fn.select2=function(b){if(b=b||{},"object"==typeof b)return this.each(function(){var d=a.extend(!0,{},b);new c(a(this),d)}),this;if("string"==typeof b){var d;return this.each(function(){var c=a(this).data("select2");null==c&&window.console&&console.error&&console.error("The select2('"+b+"') method was called on an element that is not using Select2.");var e=Array.prototype.slice.call(arguments,1);d=c[b].apply(c,e)}),a.inArray(b,e)>-1?this:d}throw new Error("Invalid arguments for Select2: "+b)}}return null==a.fn.select2.defaults&&(a.fn.select2.defaults=d),c}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,c});var czr_debug={log:function(a){debug.queue.push(["log",arguments,debug.stack.slice(0)]),window.console&&"function"==typeof window.console.log&&window.console.log(a)},error:function(a){debug.queue.push(["error",arguments,debug.stack.slice(0)]),window.console&&"function"==typeof window.console.error&&window.console.error(a)},queue:[],stack:[]},api=api||wp.customize,$=$||jQuery;!function(a,b,c){a.consoleLog=function(){c.isUndefined(console)&&"function"!=typeof window.console.log||!serverControlParams.isDevMode||console.log.apply(console,arguments)},a.czr_isSkopOn=function(){return serverControlParams.isSkopOn&&c.has(a,"czr_skopeBase")},a.czr_isChangeSetOn=function(){return serverControlParams.isChangeSetOn&&!0},a.czr_wp_conditionals=new a.Value,a.czr_widgetZoneSettings=new a.Value,a.sidebar_insights=new a.Values,a.sidebar_insights.create("candidates"),a.sidebar_insights.create("actives"),a.sidebar_insights.create("inactives"),a.sidebar_insights.create("registered"),a.sidebar_insights.create("available_locations"),a.czr_partials=new a.Value,a.czr_activeSectionId=new a.Value(""),a.czr_activePanelId=new a.Value(""),a.bind("ready",function(){if("function"!=typeof a.Section)throw new Error("Your current version of WordPress does not support the customizer sections needed for this theme. Please upgrade WordPress to the latest version.");var b=function(b,c){a.czr_activeSectionId(b?c:"")};a.section.each(function(a){a.expanded.bind(function(c){b(c,a.id)})}),a.section.bind("add",function(c){a.trigger("czr-paint",{active_panel_id:c.panel()}),c.expanded.bind(function(a){b(a,c.id)})});var d=function(b,d){a.czr_activePanelId(b?d:""),c.isEmpty(a.czr_activePanelId())&&a.czr_activeSectionId("")};a.panel.each(function(a){a.expanded.bind(function(b){d(b,a.id)})}),a.panel.bind("add",function(a){a.expanded.bind(function(b){d(b,a.id)})})}),a.bind("ready",function(){var d=function(){a.section("themes").active.bind(function(d){c.has(serverControlParams,"isThemeSwitchOn")&&c.isEmpty(serverControlParams.isThemeSwitchOn)&&(a.section("themes").active(!1),a.section("themes").active.callbacks=b.Callbacks())})};a.section.has("themes")?d():a.section.when("themes",function(a){d()})}),a.czr_skopeReady=b.Deferred(),a.bind("ready",function(){serverControlParams.isSkopOn&&(a.czr_skopeBase=new a.CZR_skopeBase,a.czr_skopeSave=new a.CZR_skopeSave,a.czr_skopeReset=new a.CZR_skopeReset,a.trigger("czr-skope-started"),a.czr_skopeReady.done(function(){a.trigger("czr-skope-ready")})),serverControlParams.isChangeSetOn&&(a.settings.timeouts.changesetAutoSave=1e4)}),c.has(a,"_latestRevision")||(a._latestRevision=0,a._latestSettingRevisions={},a.bind("change",function(b){a._latestRevision+=1,a._latestSettingRevisions[b.id]=a._latestRevision}),a.bind("ready",function(){a.bind("add",function(b){b._dirty&&(a._latestRevision+=1,a._latestSettingRevisions[b.id]=a._latestRevision)})}))}(wp.customize,jQuery,_);var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{globalSettingVal:{},initialize:function(){var a=this;a.skope_colors={global:"rgb(255, 255, 255)",special_group:"rgba(173, 213, 247, 0.55)",group:"rgba(173, 213, 247, 0.55)",local:"rgba(78, 122, 199, 0.35)"},api.czr_isPreviewerSkopeAware=$.Deferred(),api.czr_initialSkopeCollectionPopulated=$.Deferred(),a.skopeWrapperEmbedded=$.Deferred(),api.czr_skope=new api.Values,api.czr_skopeCollection=new api.Value([]),api.czr_currentSkopesCollection=new api.Value([]),api.czr_activeSkopeId=new api.Value,api.czr_dirtyness=new api.Value((!1)),api.czr_isResettingSkope=new api.Value((!1)),api.state.create("switching-skope")(!1),api.czr_dirtyness.callbacks.add(function(){return a.apiDirtynessReact.apply(a,arguments)}),a.toggleSkopeLoadPane(),a.bindAPISettings(),api.state.bind("change",function(){a.setSaveButtonStates()}),"pending"==a.skopeWrapperEmbedded.state()&&$.when(a.embedSkopeWrapper()).done(function(){a.skopeWrapperEmbedded.resolve()}),api.previewer.bind("czr-skopes-synced",function(b){if(serverControlParams.isSkopOn){var c=this,d=api.czr_currentSkopesCollection();if(!_.has(b,"czr_skopes"))throw new Error("Missing skopes in the server data");api.czr_skopeBase.updateSkopeCollection(b.czr_skopes,c.channel()),api.czr_initialSkopeCollectionPopulated.then(function(){var c=_.isUndefined(_.findWhere(api.czr_currentSkopesCollection(),{id:api.czr_activeSkopeId()}));api.czr_skopeBase.reactWhenSkopeSyncedDone(b).done(function(){if(c)api.czr_activeSkopeId(a.getActiveSkopeId()).done(function(){api.consoleLog("INITIAL ACTIVE SKOPE SET : "+arguments[1]+" => "+arguments[0]),"pending"==api.czr_skopeReady.state()&&api.czr_skopeReady.resolve(a.getActiveSkopeId()),a._writeCurrentSkopeTitle()});else if(!_.isEmpty(d)){var e=_.findWhere(d,{skope:"local"}).opt_name,f=_.findWhere(b.czr_skopes,{skope:"local"}).opt_name;f!==e&&"resolved"==api.czr_skopeReady.state()&&a._writeCurrentSkopeTitle()}})})}}),api.czr_currentSkopesCollection.bind(function(b,c){return a.currentSkopesCollectionReact(b,c)},{deferred:!0}),api.czr_initialSkopeCollectionPopulated.done(function(){api.czr_activeSkopeId.bind(function(b,c){return a.activeSkopeReact(b,c)},{deferred:!0}),api.czr_activeSectionId.callbacks.add(function(){return a.activeSectionReact.apply(a,arguments)}),api.czr_activePanelId.callbacks.add(function(){return a.activePanelReact.apply(a,arguments)})}),api.bind("skope-switched",function(b,c){api.czr_skopeReady.then(function(){api.czr_CrtlDependenciesReady.then(function(){_.isUndefined(api.czr_activeSectionId())||_.isEmpty(api.czr_activeSectionId())||api.czr_ctrlDependencies.setServiDependencies(api.czr_activeSectionId(),null,!0)}),a.updateCtrlSkpNot(api.CZR_Helpers.getSectionControlIds()),api.czr_skope.has(c)&&$("#customize-controls").removeClass(["czr-",api.czr_skope(c)().skope,"-skope-level"].join("")),api.czr_skope.has(b)&&$("#customize-controls").addClass(["czr-",api.czr_skope(b)().skope,"-skope-level"].join(""))})}),api.czr_serverNotification=new api.Value({status:"success",message:"",expanded:!0}),api.czr_serverNotification.bind(function(b,c){a.toggleServerNotice(b)}),api.czr_topNoteVisible=new api.Value((!1)),api.czr_skopeReady.then(function(){api.czr_topNoteVisible.bind(function(b){if(a.toggleTopNote(b,serverControlParams.topNoteParams||{}),!b){var c=$.extend(api.previewer.query(),{nonce:api.previewer.nonce.save});wp.ajax.post("czr_dismiss_top_note",c).always(function(){}).fail(function(a){api.consoleLog("czr_dismiss_top_note failed",c,a)}).done(function(a){})}}),_.delay(function(){api.czr_topNoteVisible(!_.isEmpty(serverControlParams.isTopNoteOn)||1==serverControlParams.isTopNoteOn)},2e3)}),a.scopeSwitcherEventMap=[{trigger:"click keydown",selector:".czr-dismiss-notification",name:"dismiss-notification",actions:function(){api.czr_serverNotification({expanded:!1})}},{trigger:"click keydown",selector:".czr-toggle-title-notice",name:"toggle-title-notice",actions:function(b){_.isUndefined(a.skopeTitleNoticeVisible)&&(a.skopeTitleNoticeVisible=new api.Value((!1)),a.skopeTitleNoticeVisible.bind(function(a){b.dom_el.find(".czr-skope-title").toggleClass("notice-visible",a)})),a.skopeTitleNoticeVisible(!a.skopeTitleNoticeVisible())}}],api.CZR_Helpers.setupDOMListeners(a.scopeSwitcherEventMap,{dom_el:$(".czr-scope-switcher")},a),a.refreshedControls=["czr_cropped_image"],a.initWidgetSidebarSpecifics(),api.bind("czr-paint",function(b){api.czr_skopeReady.then(function(){a.wash(b).paint(b)})})},toggleSkopeLoadPane:function(){var a;_render=function(){var a=$.Deferred();try{_tmpl=wp.template("czr-skope-pane")({is_skope_loading:!0})}catch(b){throw new Error("Error when parsing the the reset skope template : "+b)}return $.when($("#customize-preview").after($(_tmpl))).always(function(){a.resolve($("#czr-skope-pane"))}),a.promise()},$("body").addClass("czr-skop-loading"),_render().done(function(b){a=b}).then(function(){a.length&&_.delay(function(){var b=$("#customize-preview").height();a.css("line-height",b+"px").css("height",b+"px"),$("body").addClass("czr-skope-pane-open")},50)}),api.czr_skopeReady.done(function(){_.delay(function(){$.when($("body").removeClass("czr-skope-pane-open")).done(function(){_.delay(function(){$.when($("body").removeClass("czr-skop-loading")).done(function(){!1!==a.length&&setTimeout(function(){a.remove()},400)})},200)})},50)})},embedSkopeWrapper:function(){var a=this;$("#customize-header-actions").append($("<div/>",{"class":"czr-scope-switcher",html:'<div class="czr-skopes-wrapper"></div>'})),$("body").addClass("czr-skop-on");var b=[{trigger:"click keydown",selector:".czr-skope-switch",name:"control_skope_switch",actions:function(a){var b=$(a.dom_event.currentTarget,a.dom_el).attr("data-skope-id");!_.isEmpty(b)&&api.czr_skope.has(b)&&api.czr_activeSkopeId(b)}}];api.CZR_Helpers.setupDOMListeners(b,{dom_el:$(".czr-scope-switcher")},a)},apiDirtynessReact:function(a){$("body").toggleClass("czr-api-dirty",a),api.state("saved")(!a)},setSaveButtonStates:function(){api.state.has("saving")||(api.state.create("saving"),api.state("saving").bind(function(a){$(document.body).toggleClass("saving",a)}));var a=$("#save"),b=$(".customize-controls-close"),c=api.state("saved"),d=api.state("saving"),e=api.state("activated"),f=api.state.has("changesetStatus")?api.state("changesetStatus")():"auto-draft";api.czr_dirtyness()||!c()?(a.val(api.l10n.save),b.find(".screen-reader-text").text(api.l10n.cancel)):(a.val(api.l10n.saved),b.find(".screen-reader-text").text(api.l10n.close));var g=!(d()||e()&&c()||"publish"===f);a.prop("disabled",!g)}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{toggleServerNotice:function(a){if(a=_.isObject(a)?a:{},a=_.extend({status:"success",expanded:!0,message:"",auto_collapse:!1},a),"changeset_already_published"!=a.message&&serverControlParams.isDevMode){this.serverNoticeEmbedded=this.serverNoticeEmbedded||$.Deferred();var b=this,c=function(){$(".czr-scope-switcher").prepend($("<div/>",{"class":"czr-server-notice",html:'<span class="czr-server-message"></span><span class="fa fa-times-circle czr-dismiss-notification"></span>'}))},d=function(){var c,d,e=$(".czr-server-notice",".czr-scope-switcher"),f=$(".wp-full-overlay-header"),g=($(".wp-full-overlay-sidebar .wp-full-overlay-sidebar-content"),function(a){return!0});b.skopeTitleNoticeVisible&&b.skopeTitleNoticeVisible(!1),a.expanded?(e.toggleClass("czr-server-error","error"==a.status),"error"==a.status?$(".czr-server-message",e).html(_.isEmpty(a.message)?"Server Problem.":a.message):$(".czr-server-message",e).html(_.isEmpty(a.message)?"Success.":a.message),d=$(".czr-server-notice",".czr-scope-switcher").outerHeight(),c=f.outerHeight()+d,setTimeout(function(){$.when(g(c)).done(function(){e.fadeIn({duration:200,complete:function(){$(this).css("height","auto")}})})},400)):(e.fadeOut({duration:200,complete:function(){}}),setTimeout(function(){g()},200))};"pending"==b.serverNoticeEmbedded.state()?$.when(c()).done(function(){setTimeout(function(){b.serverNoticeEmbedded.resolve(),d()},200)}):d(),_.delay(function(){api.czr_serverNotification({expanded:!1})},"success"==a.status||!1!==a.auto_collapse?4e3:5e3)}},buildServerResponse:function(a){var b=!1;if(_.isObject(a)&&(!_.has(a,"responseJSON")||_.isUndefined(a.responseJSON.data)||_.isEmpty(a.responseJSON.data)?_.has(a,"statusText")&&!_.isEmpty(a.statusText)&&(b=a.statusText):b=a.responseJSON.data),_.isObject(a)&&!b)try{JSON.stringify(a)}catch(c){b="Server Error"}else b?"-1"===a&&(b="Identification issue detected, please refresh your page."):b="0"===a?"Not logged in.":a;return b}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{toggleTopNote:function(a,b){b=_.isObject(b)?b:{};var c=this,d={title:"",message:""};b=$.extend(d,b),a?$.when(c.renderTopNoteTmpl(b)).done(function(a){c.welcomeNote=a,_.delay(function(){$("body").addClass("czr-top-note-open")},200),api.CZR_Helpers.setupDOMListeners([{trigger:"click keydown",selector:".czr-top-note-close",name:"close-top-note",actions:function(){api.czr_topNoteVisible(!1)}}],{dom_el:c.welcomeNote},c)}):($("body").removeClass("czr-top-note-open"),c.welcomeNote.length&&_.delay(function(){c.welcomeNote.remove()},300)),_.delay(function(){api.czr_topNoteVisible(!1)},2e4)},renderTopNoteTmpl:function(a){if($("#czr-top-note").length)return $("#czr-top-note");var b="",c=a.title||"",d=a.message||"";try{b=wp.template("czr-top-note")({title:c})}catch(e){throw new Error("Error when parsing the the top note template : "+e)}return $("#customize-preview").after($(b)),$(".czr-note-message","#czr-top-note").html(d),$("#czr-top-note")}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{bindAPISettings:function(a){var b=this,c=function(a,c,d){var e,f=this.id;_.has(api,"czr_activeSkopeId")&&!_.isUndefined(api.czr_activeSkopeId())||api.consoleLog("The api.czr_activeSkopeId() is undefined in the api.previewer._new_refresh() method."),api(f)._dirty&&(e=b.isSettingSkopeEligible(f)?api.czr_activeSkopeId():b.getGlobalSkopeId(),api.czr_skope(e).updateSkopeDirties(f,a)),_.has(api.control(f),"czr_states")&&!api.control(f).czr_states("isResetting")()&&api.control(f).czr_states("resetVisible")(!1),b.isSettingSkopeEligible(f)&&b.updateCtrlSkpNot(f)};_.isUndefined(a)?api.each(function(a){a.bind(c)}):api(a).bind(c);var d=function(a){a.callbacks.has(c)||a.bind(c)};api.topics.change.has(d)||api.bind("change",d)}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{reactWhenSkopeSyncedDone:function(a){var b=$.Deferred();if(!_.has(a,"czr_skopes")||_.isEmpty(a.czr_skopes))throw new Error("Missing skope data after refresh",a);api.czr_dirtyness()||api.czr_dirtyness(!!_.isBoolean(a.isChangesetDirty)&&a.isChangesetDirty);var c=a.czr_skopes;return _.each(api.czr_skopeCollection(),function(a){var b=_.findWhere(c,{opt_name:a.opt_name});if(!_.isUndefined(b)){var d=_.isEmpty(b.changeset||{})?{}:b.changeset,e={};_.each(d,function(a,b){api.has(b)||api.consoleLog("In reactWhenSkopeSyncedDone : attempting to update the changeset with a non registered setting : "+b),e[b]=a}),api.czr_skope(a.id).changesetValues(e)}}),_.each(api.czr_skopeCollection(),function(a){var b=_.findWhere(c,{opt_name:a.opt_name});if(!_.isUndefined(b)){var d=$.extend(!0,{},api.czr_skope(a.id).dbValues()),e=$.extend(d,b.db||{}),f={};_.each(e,function(a,b){api.has(b)||api.consoleLog("In reactWhenSkopeSyncedDone : attempting to update the db values with a non registered setting : "+b),f[b]=a}),api.czr_skope(a.id).dbValues(f)}}),_.delay(function(){b.resolve()},500),b.promise()}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{_maybeSetupAssignedMenuLocations:function(a){(_.isUndefined(a)||_.isEmpty(a)||!api.section.has(a.id))&&api.consoleLog("In _maybeSetupAssignedMenuLocations : no valid section_id provided.");if(a.assignedLocations){var b=function(a){};a.assignedLocations.callbacks.has(b)||a.assignedLocations.bind(b)}},activeSectionReact:function(a,b){"add_menu"!=a&&api.trigger("czr-paint",{active_section_id:a});var c=this,d=function(a){var b=api.CZR_Helpers.getSectionControlIds(a);_.each(b,function(a){if(api.has(a)&&!_.isUndefined(api.control(a))){var b=api.control(a);_.has(b,"czr_states")&&(b.czr_states("noticeVisible")(!1),b.czr_states("resetVisible")(!1))}})},e=function(a,b){c.setupActiveSkopedControls({section_id:b}),c.processSilentUpdates({section_id:b}).fail(function(){throw new Error("Fail to process silent updates after initial skope collection has been populated")}).done(function(){c.isExcludedSidebarsWidgets()||c.forceSidebarDirtyRefresh(b,api.czr_activeSkopeId())}),_.has(api.topics,"active-section-setup")||api.bind("active-section-setup",function(a){var b={controls:[],section_id:""};a=_.extend(b,a),c._maybeSetupAssignedMenuLocations(a)}),api.czr_skopeReady.then(function(){var a=function(a){api.czr_serverNotification({status:"success",message:[a,"can only be customized site wide."].join(" ")}),api.czr_activeSkopeId(c.getGlobalSkopeId())};"global"!=api.czr_skope(api.czr_activeSkopeId())().skope&&(!c.isExcludedWPCustomCss()||"custom_css"!=b&&"admin_sec"!=b||a(api.section(b).params.title),"nav_menu["!=b.substring(0,"nav_menu[".length)&&"add_menu"!=b||api.czr_serverNotification({status:"success",message:["Menus are created site wide."].join(" ")}))}),api.trigger("active-section-setup",a)};api.czr_initialSkopeCollectionPopulated.then(function(){api.section.when(a,function(b){b.deferred.embedded.then(function(){e(b,a)})}),!_.isEmpty(b)&&api.section.has(b)&&d(b)})},activePanelReact:function(a,b){var c=this;api.czr_initialSkopeCollectionPopulated.then(function(){api.trigger("czr-paint",{active_panel_id:a});api.czr_skopeReady.then(function(){"global"!=api.czr_skope(api.czr_activeSkopeId())().skope&&c.isExcludedSidebarsWidgets()&&"widgets"==a&&api.czr_serverNotification({status:"success",message:["Widgets are created site wide."].join(" ")})}),api.czr_skopeReady.then(function(){"nav_menus"==a&&_.each(api.panel(a).sections(),function(a){c.processSilentUpdates({section_id:a.id,awake_if_not_active:!0})})})})}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{wash:function(a){var b=function(a){_.has(a,"el")&&a.el.length&&$.when(a.el.removeClass("czr-painted")).done(function(){$(this).css("background","").css("color","")})};return api.czr_skopeBase.paintedElements&&(_.each(api.czr_skopeBase.paintedElements(),function(a){b(a)}),api.czr_skopeBase.paintedElements([])),this},paint:function(a){var b="inherit",c={active_panel_id:api.czr_activePanelId(),
|
10 |
-
active_section_id:api.czr_activeSectionId(),is_skope_switch:!1},d=[];a=$.extend(c,a),!_.isUndefined(api.czr_activeSkopeId())&&api.czr_skope.has(api.czr_activeSkopeId())&&(b=api.czr_skope(api.czr_activeSkopeId()).color);var e=function(c){_.has(c,"el")&&c.el.length&&(a.is_skope_switch?$.when(c.el.addClass("czr-painted")).done(function(){$(this).css("background",c.bgColor||b)}):c.el.css("background",c.bgColor||b),"global"!=api.czr_skope(api.czr_activeSkopeId())().skope&&c.el.css("color","#000"))};return api.czr_skopeBase.paintedElements=api.czr_skopeBase.paintedElements||new api.Value([]),_.isEmpty(a.active_panel_id)&&_.isEmpty(a.active_section_id)&&(d.push({el:$("#customize-info").find(".accordion-section-title").first()}),api.panel.each(function(a){d.push({el:a.container.find(".accordion-section-title").first()})}),api.section.each(function(a){_.isEmpty(a.panel())&&d.push({el:a.container.find(".accordion-section-title").first()})})),!_.isEmpty(a.active_panel_id)&&_.isEmpty(a.active_section_id)&&api.panel.when(a.active_panel_id,function(a){a.deferred.embedded.then(function(){d.push({el:a.container.find(".accordion-section-title, .customize-panel-back")})})}),_.isEmpty(a.active_section_id)||api.section.when(a.active_section_id,function(a){a.deferred.embedded.then(function(){d.push({el:a.container.find(".customize-section-title, .customize-section-back"),bgColor:"inherit"},{el:a.container}),api.czr_isChangeSetOn()||d.push({el:a.container.find(".accordion-section-content")})})}),_.each(d,function(a){e(a)}),api.czr_skopeBase.paintedElements(d),this}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{isSkopeRegisteredInCollection:function(a,b){return b=b||api.czr_skopeCollection(),!_.isUndefined(_.findWhere(b,{id:a}))},isSkopeRegisteredInCurrentCollection:function(a,b){return b=b||api.czr_currentSkopesCollection(),!_.isUndefined(_.findWhere(b,{id:a}))},isGlobalSkopeRegistered:function(){var a=_.findWhere(api.czr_currentSkopesCollection(),{skope:"global"});return _.isObject(a)&&_.has(a,"id")},getGlobalSkopeId:function(){if(!_.has(api,"czr_skope"))return"";var a="";return api.czr_skope.each(function(b){"global"==b().skope&&(a=b().id)}),a},getChangedGlobalDBSettingValues:function(a){var b={};return _.each(a,function(a,c){_wpSetId=api.CZR_Helpers.build_setId(c),_.has(api.settings.settings,_wpSetId)&&(_.isEqual(a,api.settings.settings[_wpSetId].value)||(b[c]=a))}),b},getActiveSkopeId:function(a){a=a||api.czr_currentSkopesCollection();var b=!_.isEmpty(api.czr_activeSkopeId())&&api.czr_skope.has(api.czr_activeSkopeId())?api.czr_skope(api.czr_activeSkopeId())().skope:serverControlParams.isLocalSkope?"local":"global",c=_.findWhere(a,{skope:b});if(_skpId=_.isUndefined(c)?_.findWhere(a,{skope:"global"}).id:c.id,_.isUndefined(_skpId))throw new Error("No default skope was found in getActiveSkopeId ",a);return _skpId},getActiveSkopeName:function(){return api.czr_skope.has(api.czr_activeSkopeId())?api.czr_skope(api.czr_activeSkopeId())().skope:"global"},isSettingSkopeEligible:function(a){var b=this,c=api.CZR_Helpers.getOptionName(a);return _.isUndefined(a)||!api.has(a)?(api.consoleLog("THE SETTING "+a+" IS NOT ELIGIBLE TO SKOPE BECAUSE UNDEFINED OR NOT REGISTERED IN THE API."),!1):!b.isExcludedWPBuiltinSetting(a)&&(!_.contains(serverControlParams.skopeExcludedSettings,c)&&(b.isThemeSetting(a),!0))},isSettingResetEligible:function(a){var b=this;api.CZR_Helpers.getOptionName(a);if(_.isUndefined(a)||!api.has(a))return void api.consoleLog("THE SETTING "+a+" IS NOT ELIGIBLE TO RESET BECAUSE UNDEFINED OR NOT REGISTERED IN THE API.");if(!b.isExcludedWPBuiltinSetting(a))return!(!b.isThemeSetting(a)&&!b.isWPAuthorizedSetting(a))||void api.consoleLog("THE SETTING "+a+" IS NOT ELIGIBLE TO RESET BECAUSE NOT PART OF THE THEME OPTIONS AND NOT WP AUTHORIZED BUILT IN OPTIONS")},isThemeSetting:function(a){return _.isString(a)&&-1!==a.indexOf(serverControlParams.themeOptions)},isWPAuthorizedSetting:function(a){return _.isString(a)&&_.contains(serverControlParams.wpBuiltinSettings,a)},isExcludedWPBuiltinSetting:function(a){var b=this;if(_.isUndefined(a))return!0;if("active_theme"==a)return!0;if(_.contains(serverControlParams.wpBuiltinSettings,a))return!1;var c=["widget_","nav_menu","sidebars_","custom_css","nav_menu[","nav_menu_item","nav_menus_created_posts","nav_menu_locations"],d=!1;return _.each(c,function(c){switch(c){case"widget_":case"sidebars_":c==a.substring(0,c.length)&&(d=b.isExcludedSidebarsWidgets());break;case"nav_menu[":case"nav_menu_item":case"nav_menus_created_posts":c==a.substring(0,c.length)&&(d=!0);break;case"nav_menu_locations":c==a.substring(0,c.length)&&(d=b.isExcludedNavMenuLocations());break;case"custom_css":c==a.substring(0,c.length)&&(d=b.isExcludedWPCustomCss())}}),d},isExcludedSidebarsWidgets:function(){var a=serverControlParams.isSidebarsWigetsSkoped;return!(!_.isUndefined(a)&&!_.isEmpty(a)&&!1!==a)},isExcludedNavMenuLocations:function(){if(!api.czr_isChangeSetOn())return!0;var a=serverControlParams.isNavMenuLocationsSkoped;return!(!_.isUndefined(a)&&!_.isEmpty(a)&&!1!==a)},isExcludedWPCustomCss:function(){var a=serverControlParams.isWPCustomCssSkoped;return!(!_.isUndefined(a)&&!_.isEmpty(a)&&!1!==a)},_getDBSettingVal:function(a,b){var c=api.CZR_Helpers.getOptionName(a),d=api.CZR_Helpers.build_setId(a);return api.czr_skope.has(b)?_.has(api.czr_skope(b).dbValues(),d)?api.czr_skope(b).dbValues()[d]:_.has(api.czr_skope(b).dbValues(),c)?api.czr_skope(b).dbValues()[c]:"_no_db_val":(api.consoleLog("_getDBSettingVal : the requested skope id is not registered : "+b),"_no_db_val")},getSkopeDirties:function(a,b){if(!api.czr_skope.has(a))return{};b=b||{},b=_.extend({unsaved:!0},b);var c={};return _.each(api.czr_skope(a).dirtyValues(),function(a,d){var e;api.czr_isChangeSetOn()&&(e=api._latestSettingRevisions[d],api.state("changesetStatus").get()&&b&&b.unsaved&&(_.isUndefined(e)||e<=api._lastSavedRevision))||(c[d]=a)}),c},getSkopeExcludedDirties:function(){var a=this,b={};api.each(function(a,c){a._dirty&&(b[c]=a())});var c=a.getGlobalSkopeId();a.getSkopeDirties(c);return _.omit(b,function(b,c){return a.isSettingSkopeEligible(c)})},parseWidgetId:function(a,b){var c,d={number:null,id_base:null};return c=a.match(/^(.+)-(\d+)$/),c?(d.id_base=c[1],d.number=parseInt(c[2],10)):d.id_base=a,_.isUndefined(b)||(d.id_base=d.id_base.replace(b,"")),d},widgetIdToSettingId:function(a,b){var c,d=this.parseWidgetId(a,b);return c=d.id_base,d.number&&(c+="["+d.number+"]"),c},isWidgetRegisteredGlobally:function(a){var b=this;return registered=!1,_.each(_wpCustomizeWidgetsSettings.registeredWidgets,function(c,d){registered||"widget_"+b.widgetIdToSettingId(d)!=a||(registered=!0)}),registered}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{getAppliedPrioritySkopeId:function(a,b){if(!api.has(api.CZR_Helpers.build_setId(a)))throw new Error("getAppliedPrioritySkopeId : the requested setting id does not exist in the api : "+api.CZR_Helpers.build_setId(a));if(!api.czr_skope.has(b))throw new Error("getAppliedPrioritySkopeId : the requested skope id is not registered : "+b);var c=this,d=_.findWhere(api.czr_currentSkopesCollection(),{skope:"local"}).id;if(_.isUndefined(d)||b==d)return b;var e=function(d){var f=api.CZR_Helpers.build_setId(a),g="___",h=api.czr_skope(d)();if(d==b)return b;if(api.czr_skope(d).getSkopeSettingAPIDirtyness(f))return h.id;if(api.czr_isChangeSetOn()&&api.czr_skope(d).getSkopeSettingChangesetDirtyness(f))return h.id;var i=c._getDBSettingVal(a,d);return"_no_db_val"!=i?h.id:"global"==h.skope?h.id:"___"!=g?h.title:e(c._getParentSkopeId(h))};return e(d)},getOverridenSkopeTitles:function(){var a=a||api.czr_activeSkopeId();if(!api.czr_skope.has(a))throw new Error("getInheritedSkopeTitles : the requested skope id is not registered : "+a);var b=this,c=_.findWhere(api.czr_currentSkopesCollection(),{skope:"local"}).id;if(!_.isUndefined(c)&&a!=c){var d=function(c,e){e=e||[];var f=api.czr_skope(c)();return c==a?e:(e.unshift(c),d(b._getParentSkopeId(f),e))};return _.map(d(c),function(a){return b.buildSkopeLink(a)}).join(" and ")}},getInheritedSkopeId:function(a,b){if(!api.has(api.CZR_Helpers.build_setId(a)))throw new Error("getInheritedSkopeId : the requested setting id does not exist in the api : "+api.CZR_Helpers.build_setId(a));if(!api.czr_skope.has(b))throw new Error("getInheritedSkopeId : the requested skope id is not registered : "+b);var c,d=this,e=api.CZR_Helpers.build_setId(a),f="___",g=api.czr_skope(b)();if(c=_.has(api.settings.settings,e)?api.settings.settings[e].value:null,api.czr_skope(b).getSkopeSettingAPIDirtyness(e))return b;if(api.czr_isChangeSetOn()&&api.czr_skope(b).getSkopeSettingChangesetDirtyness(e))return b;var h=d._getDBSettingVal(a,b);return"_no_db_val"!=h?b:"global"==g.skope?b:"___"!=f?b:d.getInheritedSkopeId(a,d._getParentSkopeId(g))},getInheritedSkopeTitles:function(a,b){if(a=a||api.czr_activeSkopeId(),!api.czr_skope.has(a))throw new Error("getInheritedSkopeTitles : the requested skope id is not registered : "+a);b=b||[];var c=this,d=api.czr_skope(a)();return a!==api.czr_activeSkopeId()&&b.unshift(a),"global"!==d.skope?c.getInheritedSkopeTitles(c._getParentSkopeId(d),b):_.map(b,function(a){return c.buildSkopeLink(a)}).join(" and ")},buildSkopeLink:function(a){if(!api.czr_skope.has(a))throw new Error("buildSkopeLink : the requested skope id is not registered : "+a);var b="Switch to scope : "+api.czr_skope(a)().title;return['<span class="czr-skope-switch" title=" '+b+'" data-skope-id="'+a+'">',api.czr_skope(a)().title,"</span>"].join("")},getSkopeSettingVal:function(a,b){if(!api.has(api.CZR_Helpers.build_setId(a)))throw new Error("getSkopeSettingVal : the requested setting id does not exist in the api : "+api.CZR_Helpers.build_setId(a));if(!api.czr_skope.has(b))throw new Error("getSkopeSettingVal : the requested skope id is not registered : "+b);var c,d=this,e=api.CZR_Helpers.build_setId(a),f="___",g=api.czr_skope(b)();if(c=_.has(api.settings.settings,e)?api.settings.settings[e].value:null,api.czr_skope(b).getSkopeSettingAPIDirtyness(e))return api.czr_skope(b).dirtyValues()[e];if(api.czr_isChangeSetOn()&&api.czr_skope(b).getSkopeSettingChangesetDirtyness(e))return api.czr_skope(b).changesetValues()[e];var h=d._getDBSettingVal(a,b);return"_no_db_val"!=h?h:"global"==g.skope?"___"==f?c:f:"___"!=f?f:d.getSkopeSettingVal(a,d._getParentSkopeId(g))},applyDirtyCustomizedInheritance:function(a,b){b=b||api.czr_activeSkopeId()||api.czr_skopeBase.getGlobalSkopeId(),a=a||{};var c=this,d=api.czr_skope(b)();if("global"==d.skope)return a;var e=c._getParentSkopeId(d),f=api.czr_skope(e).dirtyValues();return _.each(f,function(b,c){var e=api.CZR_Helpers.getOptionName(c);_.isUndefined(a[c])&&_.isUndefined(api.czr_skope(d.id).dbValues()[e])&&(a[c]=b)}),"global"==api.czr_skope(e)().skope?a:c.applyDirtyCustomizedInheritance(a,e)},_getParentSkopeId:function(a,b){var c=this,d=["local","group","special_group","global"],e=b||1*(_.findIndex(d,function(b){return a.skope==b})+1),f=d[e];return _.isUndefined(f)?_.findWhere(api.czr_currentSkopesCollection(),{skope:"global"}).id:_.isUndefined(_.findWhere(api.czr_currentSkopesCollection(),{skope:f}))?c._getParentSkopeId(a,e+1):_.findWhere(api.czr_currentSkopesCollection(),{skope:f}).id},_getChildSkopeId:function(a,b){var c=this,d=["local","group","special_group","global"],e=b||1*(_.findIndex(d,function(b){return a.skope==b})-1),f=d[e];return _.isUndefined(f)?_.findWhere(api.czr_currentSkopesCollection(),{skope:"local"}).id:_.isUndefined(_.findWhere(api.czr_currentSkopesCollection(),{skope:f}))?c._getParentSkopeId(a,e-1):_.findWhere(api.czr_currentSkopesCollection(),{skope:f}).id}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{updateSkopeCollection:function(a,b){var c=this;if(_api_ready_collection=[],_.each(a,function(a,b){var d=$.extend(!0,{},a);_api_ready_collection.push(c.prepareSkopeForAPI(d))}),c.isGlobalSkopeRegistered()){var d=[],e=$.extend(!0,{},api.czr_skope(c.getGlobalSkopeId())());_.each(_api_ready_collection,function(a,b){"global"==a.skope?d.push(e):d.push(a)}),_api_ready_collection=d}api.czr_currentSkopesCollection(_api_ready_collection)},prepareSkopeForAPI:function(a){if(!_.isObject(a))throw new Error("prepareSkopeForAPI : a skope must be an object to be API ready");var b=this,c={};if(_.each(serverControlParams.defaultSkopeModel,function(b,d){var e=a[d];switch(d){case"title":if(!_.isString(e))throw new Error("prepareSkopeForAPI : a skope title property must a string");c[d]=e;break;case"long_title":if(!_.isString(e))throw new Error("prepareSkopeForAPI : a skope title property must a string");c[d]=e;break;case"skope":if(!_.isString(e)||_.isEmpty(e))throw new Error('prepareSkopeForAPI : a skope "skope" property must a string not empty');c[d]=e;break;case"level":if(!_.isString(e)||_.isEmpty(e))throw new Error("prepareSkopeForAPI : a skope level must a string not empty for skope "+e.skope);c[d]=e;break;case"dyn_type":if(!_.isString(e)||!_.contains(serverControlParams.skopeDynTypes,e))throw new Error("prepareSkopeForAPI : missing or invalid dyn type for skope "+a);c[d]=e;break;case"opt_name":if(!_.isString(e)||_.isEmpty(e))throw new Error('prepareSkopeForAPI : invalid "opt_name" property for skope '+e.skope);c[d]=e;break;case"obj_id":if(!_.isString(e))throw new Error('prepareSkopeForAPI : invalid "obj_id" for skope '+e.skope);c[d]=e;break;case"is_winner":if(!_.isUndefined(e)&&!_.isBoolean(e))throw new Error('prepareSkopeForAPI : skope property "is_winner" must be a boolean');c[d]=e;break;case"is_forced":if(!_.isUndefined(e)&&!_.isBoolean(e))throw new Error('prepareSkopeForAPI : skope property "is_primary" must be a boolean');c[d]=e;break;case"db":if((_.isArray(e)||_.isEmpty(e))&&(e={}),_.isUndefined(e)||!_.isObject(e))throw new Error('prepareSkopeForAPI : skope property "db" must be an object');c[d]=e;break;case"changeset":if((_.isArray(e)||_.isEmpty(e))&&(e={}),_.isUndefined(e)||!_.isObject(e))throw new Error('prepareSkopeForAPI : skope property "changeset" must be an object');c[d]=e;break;case"has_db_val":if(!_.isUndefined(e)&&!_.isBoolean(e))throw new Error('prepareSkopeForAPI : skope property "has_db_val" must be a boolean');c[d]=e}}),c.color=b.skope_colors[c.skope]||"rgb(255, 255, 255)",c.id=c.skope+"_"+c.level,!_.isString(c.id)||_.isEmpty(c.id))throw new Error("prepareSkopeForAPI : a skope id must a string not empty");return _.isString(c.title)&&!_.isEmpty(c.title)||(c.title=id,c.long_title=id),c},currentSkopesCollectionReact:function(a,b){var c=this,d=$.extend(!0,[],a)||[],e=($.extend(!0,[],b)||[],$.Deferred()),f=[];_.each(d,function(a){api.czr_skope.has(a.id)||f.push(a)}),_.each(f,function(a){a=$.extend(!0,{},a),api.czr_skope.add(a.id,new api.CZR_skope(a.id,a))}),_.each(f,function(a){if(!api.czr_skope.has(a.id))throw new Error("Skope id : "+a.id+" has not been instantiated.");"pending"==api.czr_skope(a.id).isReady.state()&&api.czr_skope(a.id).ready()});var g=_.size(d),h=function(a){var b=a.container.attr("class").split(" ");_.each(a.container.attr("class").split(" "),function(a){"width-"==a.substring(0,6)&&(b=_.without(b,a))}),$.when(a.container.attr("class",b.join(" "))).done(function(){a.container.addClass("width-"+Math.round(100/g))})};return api.czr_skope.each(function(a){if(_.isUndefined(_.findWhere(d,{id:a().id})))a.visible(!1),a.isReady.then(function(){a.container.toggleClass("active-collection",!1)});else{a.visible(!0);var b=function(){h(a),a.container.toggleClass("active-collection",!0)};"pending"==a.isReady.state()?a.isReady.then(function(){b()}):b()}}),_.isEmpty(b)&&!_.isEmpty(a)&&api.czr_initialSkopeCollectionPopulated.resolve(),c.maybeSynchronizeGlobalSkope(),e.resolve("changed").promise()},maybeSynchronizeGlobalSkope:function(a){if(a=a||{},!_.isObject(a))throw new Error("maybeSynchronizeGlobalSkope : args must be an object");var b,c,d,e=this,f=$.Deferred();_.extend({isGlobalReset:!1,isSetting:!1,settingIdToReset:"",isSkope:!1,skopeIdToReset:""},a);if(e.isGlobalSkopeRegistered()){var g=api.czr_skope(e.getGlobalSkopeId()).dbValues();if(_.each(g,function(a,b){api.has(b)&&!_.isEqual(api.settings.settings[b].value,a)&&(api.settings.settings[b].value=a)}),a.isGlobalReset&&a.isSetting){if(b=a.settingIdToReset,c=api.CZR_Helpers.getOptionName(b),d=serverControlParams.defaultOptionsValues[c],_.isUndefined(api.settings.settings[b])||_.isUndefined(d))return;d!=api.settings.settings[b].value&&(api.settings.settings[b].value=d)}a.isGlobalReset&&a.isSkope&&_.each(api.settings.settings,function(a,b){e.isThemeSetting(b)&&(c=api.CZR_Helpers.getOptionName(b),_.has(serverControlParams.defaultOptionsValues,c)&&(api.settings.settings[b].value=serverControlParams.defaultOptionsValues[c]))})}return f.resolve().promise()}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{activeSkopeReact:function(a,b){var c=this,d=$.Deferred();if(!_.isUndefined(b)&&api.czr_skope.has(b))api.czr_skope(b).active(!1);else if(!_.isUndefined(b))throw new Error("listenToActiveSkope : previous scope does not exist in the collection",b);if(_.isUndefined(a)||!api.czr_skope.has(a))throw new Error("listenToActiveSkope : requested scope "+a+" does not exist in the collection");api.czr_skope(a).active(!0);var e=function(a){return api.czr_activeSkopeId(c.getGlobalSkopeId()),api.czr_serverNotification({status:"success",message:[a,"can only be customized site wide."].join(" ")}),d.resolve().promise()};if(c.isExcludedSidebarsWidgets()&&"widgets"==api.czr_activePanelId()&&a!=c.getGlobalSkopeId()&&api.czr_serverNotification({status:"success",message:["Widgets are created site wide."].join(" ")}),c.isExcludedWPCustomCss()&&"custom_css"==api.czr_activeSectionId()&&a!=c.getGlobalSkopeId())return e(api.section(api.czr_activeSectionId()).params.title);if("admin_sec"==api.czr_activeSectionId()&&a!=c.getGlobalSkopeId())return e(api.section(api.czr_activeSectionId()).params.title);if("nav_menu"!=api.czr_activeSectionId().substring(0,"nav_menu".length)&&"add_menu"!=api.czr_activeSectionId()||a==c.getGlobalSkopeId()||api.czr_serverNotification({status:"success",message:["Menus are created site wide."].join(" ")}),"nav_menus"==api.czr_activePanelId()&&_.each(api.panel(api.czr_activePanelId()).sections(),function(a){c.processSilentUpdates({section_id:a.id,awake_if_not_active:!0})}),api.state("switching-skope")(!0),c._writeCurrentSkopeTitle(a),api.trigger("czr-paint",{is_skope_switch:!0}),_.isUndefined(api.czr_activeSectionId()))return api.state("switching-skope")(!1),api.previewer.refresh(),d.resolve().promise();_.has(api,"czrModulePanelState")&&api.czrModulePanelState(!1);var f=c._getSilentUpdateCandidates();_.isUndefined(b)||_.each(api.czr_skope(b).dirtyValues(),function(a,b){_.contains(f,b)||f.push(b)}),_.isUndefined(a)||_.each(api.czr_skope(a).dirtyValues(),function(a,b){_.contains(f,b)||f.push(b)});var g=function(){c.processSilentUpdates({candidates:f,section_id:null,refresh:!1}).fail(function(){throw d.reject(),api.state("switching-skope")(!1),new Error("Fail to process silent updates in _debouncedProcessSilentUpdates")}).done(function(c){api.previewer.refresh().always(function(){api.trigger("skope-switched",a,b),d.resolve(),api.state("switching-skope")(!1)})})};return _.has(api,"czr_isModuleExpanded")&&!1!==api.czr_isModuleExpanded()?(api.czr_isModuleExpanded().setupModuleViewStateListeners(!1),(g=_.debounce(g,400))()):g(),d.promise()},_writeCurrentSkopeTitle:function(a){var b=this,c=api.czr_skope(a||api.czr_activeSkopeId())().long_title,d=function(){var d=b.getInheritedSkopeTitles(),e=b.getOverridenSkopeTitles();return $.trim(['<span class="czr-main-title"><span class="czr-toggle-title-notice fa fa-info-circle"></span>',"global"==api.czr_skope(a||api.czr_activeSkopeId())().skope?c:["Customizing",c].join(" "),"</span>",'<span class="czr-skope-inherits-from">',"In this context :",_.isEmpty(d)?" ":"inherits from",d,_.isEmpty(d)?"":_.isEmpty(e)?".":", and",_.isEmpty(e)?" ":"overridden by",e,_.isEmpty(e)?"":".","</span>"].join(" "))},e=function(a){a?$(".czr-scope-switcher").find(".spinner").fadeIn():$(".czr-scope-switcher").find(".spinner").fadeOut()};b.skopeWrapperEmbedded.then(function(){$(".czr-scope-switcher").find(".czr-current-skope-title").length?$.when($(".czr-scope-switcher").find(".czr-skope-title").fadeOut(200)).done(function(){$(this).html(d()).fadeIn(200)}):$(".czr-scope-switcher").prepend($("<h2/>",{"class":"czr-current-skope-title",html:['<span class="czr-skope-title">','<span class="spinner">',d(),"</span>","</span>"].join("")})),_.isUndefined(api.state("switching-skope").isBound)&&(api.state("switching-skope").bind(e),api.state("switching-skope").isBound=!0)})}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{processSilentUpdates:function(a){a=_.isString(a)?{candidates:[a]}:a||{};var b=this,c={candidates:[],section_id:api.czr_activeSectionId(),refresh:!0,awake_if_not_active:!1},d=$.Deferred();if(a=$.extend(c,a),_.isString(a.candidates)&&(a.candidates=[a.candidates]),_.isEmpty(a.candidates)&&(a.candidates=b._getSilentUpdateCandidates(a.section_id,a.awake_if_not_active)),!_.isArray(a.candidates))throw new Error("processSilentUpdates : the update candidates must be an array.");if(_.isEmpty(a.candidates))return d.resolve([]).promise();var e=function(){b.silentlyUpdateSettings(a.candidates,a.refresh).fail(function(){d.reject()}).done(function(c){_.delay(function(){b.setupActiveSkopedControls({section_id:a.section_id})},1e3),d.resolve(c)})};return"pending"==api.czr_skopeReady.state()?(d.resolve([]),api.czr_skopeReady.done(function(){e()})):e(),d.promise()},silentlyUpdateSettings:function(a,b){api.state.has("silent-update-processing")||api.state.create("silent-update-processing")(!1),api.state("silent-update-processing")(!0);var c=this,d={},e=$.Deferred();b=!!_.isUndefined(b)||b,(_.isUndefined(a)||_.isEmpty(a))&&(a=c._getSilentUpdateCandidates()),_.isString(a)&&(a=[a]),_.each(a,function(a){api.control.has(a)&&"czr_multi_module"==api.control(a).params.type||(d[a]=c.getSettingUpdatePromise(a))});var f=[],g=[];return _.each(d,function(a,b){a.done(function(a){var c=api.CZR_Helpers.build_setId(b),d=api.czr_skope(api.czr_activeSkopeId()).getSkopeSettingDirtyness(b);_.isEqual(api(c)(),a)||g.push(b),api(c).silent_set(a,d)}),f.push(a)}),$.when.apply(null,f).fail(function(){throw e.reject(),new Error("silentlyUpdateSettings FAILED. Candidates : "+a)}).always(function(){api.state("silent-update-processing")(!1)}).then(function(){_.each(f,function(b){if(_.isObject(b)&&"resolved"!==b.state())throw new Error("a silent update promise is unresolved : "+a)}),b&&!_.isEmpty(g)?api.previewer.refresh().always(function(){e.resolve(g)}):e.resolve(g)}),e.promise()},getSettingUpdatePromise:function(a){if(_.isUndefined(a))throw new Error("getSettingUpdatePromise : the provided setId is not defined");if(!api.has(api.CZR_Helpers.build_setId(a)))throw new Error("getSettingUpdatePromise : the provided wpSetId is not registered : "+api.CZR_Helpers.build_setId(a));var b=this,c=api.CZR_Helpers.build_setId(a),d=api(c)(),e=$.Deferred(),f=!1,g=api.czr_activeSkopeId(),h=api.czr_skopeBase.getSkopeSettingVal(a,g);if(_.isEqual(d,h))return e.resolve(h).promise();if(api.control.has(c)){var i=api.control(c).params.type,j=api.settings.controls[c];switch(i){case"czr_cropped_image":f=b._getCzrCroppedImagePromise(c,j);break;case"czr_module":b._processCzrModuleSilentActions(c,i,g,j)}}return _.has(api.settings.controls,"header_image")&&"header_image"==c&&(f=b._getHeaderImagePromise(c,g)),f&&_.isObject(f)?f.always(function(){e.resolve(h)}):e.resolve(h),e.promise()},_getSilentUpdateCandidates:function(a,b){var c=this,d=[];if(a=_.isUndefined(a)||_.isNull(a)?api.czr_activeSectionId():a,_.isEmpty(api.czr_activeSectionId())&&!b)return[];if(_.isUndefined(a))return api.consoleLog("_getSilentUpdateCandidates : No active section provided"),[];if(!api.section.has(a))throw new Error("_getSilentUpdateCandidates : The section "+a+" is not registered in the API.");var e=api.CZR_Helpers.getSectionSettingIds(a);return e=_.filter(e,function(a){return c.isSettingSkopeEligible(a)}),_.each(e,function(a){d.push(a)}),d}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{_processCzrModuleSilentActions:function(a,b,c,d){var e,f,g,h,i,j=_.has(api.control(a).params,"syncCollection")?api.control(a).params.syncCollection:"",k=api.CZR_Helpers.build_setId(a),l=api.czr_skopeBase.getSkopeSettingVal(k,c),m=api.czr_skope(api.czr_activeSkopeId());_.isEmpty(j)||_.isUndefined(j)||(e=api.CZR_Helpers.build_setId(j),f=api.czr_skopeBase.getSkopeSettingVal(e,c),g=api.settings.controls[e],h=api.controlConstructor.czr_multi_module,i=api.control(e).syncSektionModule()().id,api.control(e).container.remove(),api.control.remove(e),api(e).silent_set(f,m.getSkopeSettingDirtyness(e)),$.extend(g,{czr_skope:c}),api.control.add(e,new h(e,{params:g,previewer:api.previewer}))),_constructor=api.controlConstructor[b],api.control(a).container.remove(),api.control.remove(a),api(a).silent_set(l,m.getSkopeSettingDirtyness(k)),$.extend(d,{czr_skope:c}),api.control.add(a,new _constructor(a,{params:d,previewer:api.previewer})),_.isEmpty(j)||_.isUndefined(j)||(api.consoleLog("FIRE SEKTION MODULE?",i,api.control(a).czr_Module(i).isReady.state()),api.control(a).czr_Module(i).fireSektionModule())},_getCzrCroppedImagePromise:function(a,b){var c=api.controlConstructor.czr_cropped_image,d=$.Deferred(),e=api.has(a)?api(a)():null;return e=null===e?"":e,wp.media.attachment(e).fetch().done(function(){api.control(a).container.remove(),api.control.remove(a),b.attachment=this.attributes,api.control.add(a,new c(a,{params:b,previewer:api.previewer})),d.resolve()}).fail(function(){api.control(a).container.remove(),api.control.remove(a),b=_.omit(b,"attachment"),api.control.add(a,new c(a,{params:b,previewer:api.previewer})),d.reject()}),d.promise()},_getHeaderImagePromise:function(a,b){var c=$.Deferred();if(!_.has(api.settings.controls,"header_image")||"header_image"!=a)return c.resolve().promise();var d=api.controlConstructor.header,e=$.extend(!0,{},api.settings.controls.header_image);header_image_data=null===api.czr_skopeBase.getSkopeSettingVal("header_image_data",b)?"":api.czr_skopeBase.getSkopeSettingVal("header_image_data",b);var f,g=function(a){a=a||e,api.control("header_image").container.remove(),api.control.remove("header_image"),api.HeaderTool.UploadsList=api.czr_HeaderTool.UploadsList,api.HeaderTool.DefaultsList=api.czr_HeaderTool.DefaultsList,api.HeaderTool.CombinedList=api.czr_HeaderTool.CombinedList;var b=function(){api.control.add("header_image",new d("header_image",{params:a,previewer:api.previewer}))};(b=_.debounce(b,800))()};return _.has(header_image_data,"attachment_id")?(f=header_image_data.attachment_id,wp.media.attachment(f).fetch().done(function(){e.attachment=this.attributes,g(e),c.resolve()}).fail(function(){e=_.omit(e,"attachment"),api.control("header_image").container.remove(),api.control.remove("header_image"),api.HeaderTool.UploadsList=api.czr_HeaderTool.UploadsList,api.HeaderTool.DefaultsList=api.czr_HeaderTool.DefaultsList,api.HeaderTool.CombinedList=api.czr_HeaderTool.CombinedList,api.control.add("header_image",new d("header_image",{params:e,previewer:api.previewer})),c.reject()})):(g(),c.resolve()),c.promise()}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{setupActiveSkopedControls:function(a){var b,c,d,e,f=this;if(defaultSetupParams={controls:[],section_id:api.czr_activeSectionId()},d=$.extend(defaultSetupParams,a),!_.isObject(d)||!_.has(d,"controls")||!_.has(d,"section_id"))throw new Error("SetupControlsReset : the setupParams param must be an object with properties controls and section_id.");b=d.section_id,c=d.controls,e=[],!_.isEmpty(b)&&_.isString(b)||(b=api.czr_activeSectionId()),_.isEmpty(c)&&(c=api.CZR_Helpers.getSectionControlIds(b)),c=_.isString(c)?[c]:c,e=_.filter(c,function(a){var b=api.CZR_Helpers.getControlSettingId(a);return b&&!f.isSettingSkopeEligible(b)&&api.control(a).container.addClass("czr-not-skoped"),b&&f.isWPAuthorizedSetting(b)&&api.control(a).container.addClass("is-wp-authorized-setting"),b&&f.isSettingSkopeEligible(b)}),"nav_menu["!=b.substring(0,"nav_menu[".length)&&(_.isEmpty(c)||api.czr_skopeReady.then(function(){$.when(f.renderControlsSingleReset(e)).done(function(){f.listenSkopedControls(c)})}),f.renderCtrlSkpNotIcon(c))},listenSkopedControls:function(a){var b=this;_.each(a,function(a){if(api.has(a)&&!_.isUndefined(api.control(a))){var c=api.control(a),d=api.CZR_Helpers.getControlSettingId(a),e=(api.CZR_Helpers.getOptionName(d),{hasDBVal:!1,isDirty:!1,noticeVisible:!1,resetVisible:!1,isResetting:!1});_.has(c,"czr_states")||(c.czr_states=new api.Values,_.each(e,function(a,b){c.czr_states.create(b)}),b.bindControlStates(c)),c.czr_states("hasDBVal")(api.czr_skope(api.czr_activeSkopeId()).hasSkopeSettingDBValues(d)),c.czr_states("isDirty")(api.czr_skope(api.czr_activeSkopeId()).getSkopeSettingDirtyness(d)),_.has(c,"userEventMap")||(c.userEventMap=[{trigger:"click keydown",selector:".czr-setting-reset, .czr-cancel-button",name:"control_reset_warning",actions:function(){(c.czr_states("isDirty")()||c.czr_states("hasDBVal")())&&(_.each(_.without(api.CZR_Helpers.getSectionControlIds(c.section()),a),function(a){_.has(api.control(a),"czr_states")&&api.control(a).czr_states("resetVisible")(!1)}),c.czr_states("resetVisible")(!c.czr_states("resetVisible")()),c.czr_states("resetVisible")()&&c.czr_states("noticeVisible")(!1))}},{trigger:"click keydown",selector:".czr-control-do-reset",name:"control_do_reset",actions:function(){b.doResetSetting(a)}},{trigger:"click keydown",selector:".czr-skope-switch",name:"control_skope_switch",actions:function(a){var b=$(a.dom_event.currentTarget,a.dom_el).attr("data-skope-id");!_.isEmpty(b)&&api.czr_skope.has(b)&&api.czr_activeSkopeId(b)}},{trigger:"click keydown",selector:".czr-toggle-notice",name:"control_toggle_notice",actions:function(a){c.czr_states("noticeVisible")(!c.czr_states("noticeVisible")()),c.czr_states("noticeVisible")()&&c.czr_states("resetVisible")(!1)}}],api.CZR_Helpers.setupDOMListeners(c.userEventMap,{dom_el:c.container},b))}})},bindControlStates:function(a){if(!api.control.has(a.id))throw new Error("in bindControlStates, the provided ctrl id is not registered in the api : "+a.id);var b=this;api.CZR_Helpers.getControlSettingId(a.id);a.czr_states("hasDBVal").bind(function(b){a.container.toggleClass("has-db-val",b),b?_title="Reset your customized ( and published ) value":a.czr_states("isDirty")()?_title="Reset your customized ( but not yet published ) value":_title="Not customized yet, nothing to reset",a.container.find(".czr-setting-reset").attr("title",_title)}),a.czr_states("isDirty").bind(function(b){a.container.toggleClass("is-dirty",b);var c;c=b?"Reset your customized ( but not yet published ) value":a.czr_states("hasDBVal")()?"Reset your customized ( and published ) value":"Not customized yet, nothing to reset",a.container.find(".czr-setting-reset").attr("title",c)}),a.czr_states("noticeVisible").bind(function(c){a.container.toggleClass("czr-notice-visible",c);var d=a.getNotificationsContainerElement();!1!==d&&!1!==d.length&&(c?(b.updateCtrlSkpNot(a.id),d.stop().slideDown("fast",null,function(){$(this).css("height","auto")})):$.when(d.stop().slideUp("fast",null,function(){$(this).css("height","auto")})).done(function(){b.removeCtrlSkpNot(a.id)}))}),a.czr_states("resetVisible").bind(function(c){a.section()||api.czr_activeSectionId();c?$.when(b.renderControlResetWarningTmpl(a.id)).done(function(b){_.isEmpty(b)||(a.czr_resetDialogContainer=b.container,b.container.slideToggle("fast"),b.is_authorized||_.delay(function(){$.when(a.czr_resetDialogContainer.slideToggle("fast")).done(function(){a.czr_resetDialogContainer.remove()})},3e3))}):_.has(a,"czr_resetDialogContainer")&&a.czr_resetDialogContainer.length&&$.when(a.czr_resetDialogContainer.slideToggle("fast")).done(function(){a.czr_resetDialogContainer.remove()})})}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{renderControlsSingleReset:function(a){
|
11 |
-
var b=this,c=$.Deferred();(_.isUndefined(a)||_.isEmpty(a))&&(a=api.CZR_Helpers.getSectionControlIds(api.czr_activeSectionId()),a=_.filter(a,function(a){var c=api.CZR_Helpers.getControlSettingId(a);return c&&b.isSettingSkopeEligible(c)}));var d=_.isArray(a)?a:[a],e=function(a){return _.isEmpty(a)?void c.resolve():void _.each(a,function(a){api.control.when(a,function(){var b=api.control(a);api.CZR_Helpers.getControlSettingId(a);return $(".czr-setting-reset",b.container).length?void c.resolve():void b.deferred.embedded.then(function(){$.when(b.container.find(".customize-control-title").first().prepend($("<span/>",{"class":"czr-setting-reset fa fa-refresh",title:""}))).done(function(){b.container.addClass("czr-skoped"),$(".czr-setting-reset",b.container).fadeIn(400),c.resolve()})})})})};return e=_.debounce(e,200),e(d),c.promise()},renderControlResetWarningTmpl:function(a){if(!api.control.has(a))return{};var b,c,d=api.control(a),e=api.CZR_Helpers.getControlSettingId(a),f="",g=function(){return!!_.contains(serverControlParams.wpBuiltinSettings,api.CZR_Helpers.getOptionName(e))||!_.contains(serverControlParams.themeSettingList,api.CZR_Helpers.getOptionName(e))}();d.czr_states("isDirty")()?(b=["Please confirm that you want to reset your current customizations for this option in ",api.czr_skope(api.czr_activeSkopeId())().title,"."].join(""),c="Your customizations have been reset."):g&&"global"==api.czr_skope(api.czr_activeSkopeId())().skope?b="This WordPress setting can not be reset site wide.":(b=["Please confirm that you want to reset this option in ",api.czr_skope(api.czr_activeSkopeId())().title,"."].join(""),c="The options have been reset.");var h=!(g&&"global"==api.czr_skope(api.czr_activeSkopeId())().skope&&!d.czr_states("isDirty")()),i={warning_message:b,success_message:c,is_authorized:h};try{f=wp.template("czr-reset-control")(i)}catch(j){throw new Error("Error when parsing the the reset control template : "+j)}return $(".customize-control-title",d.container).first().after($(f)),{container:$(".czr-ctrl-reset-warning",d.container),is_authorized:h}},doResetSetting:function(a){var b=this,c=api.CZR_Helpers.getControlSettingId(a),d=api.control(a),e=api.czr_activeSkopeId(),f=d.czr_states("isDirty")()?"_resetControlDirtyness":"_resetControlAPIVal",g=function(a,b){b=!_.isUndefined(b)&&b,a.czr_states("resetVisible")(!1),a.czr_states("isResetting")(!1),a.container.removeClass("czr-resetting-control")},h=function(a){var h=function(){api.czr_skopeBase.processSilentUpdates({candidates:a,refresh:!1}).fail(function(){api.consoleLog("Silent update failed after resetting control : "+a)}).done(function(){$.when($(".czr-crtl-reset-dialog",d.container).fadeOut("300")).done(function(){$.when($(".czr-reset-success",d.container).fadeIn("300")).done(function(c){_.delay(function(){$.when(c.fadeOut("300")).done(function(){g(d),b.setupActiveSkopedControls({controls:[a]}),_.delay(function(){d.czr_states("noticeVisible")(!0)},300),_.delay(function(){d.czr_states("noticeVisible")(!1)},4e3)})},1e3)})})})};b[f](a).done(function(){api.consoleLog("REFRESH AFTER A SETTING RESET"),api.previewer.refresh().fail(function(a){api.consoleLog("SETTING RESET REFRESH FAILED",a)}).done(function(a){if("global"==api.czr_skope(e)().skope&&"_resetControlAPIVal"==f){var b,d={},g=api.czr_skope(e)().opt_name;!_.isUndefined(a.skopesServerData)&&_.has(a.skopesServerData,"czr_skopes")&&(b=a.skopesServerData.czr_skopes,_.isUndefined(_.findWhere(b,{opt_name:g}))&&(d=_.findWhere(b,{opt_name:g}).db||{})),api.czr_skopeBase.maybeSynchronizeGlobalSkope({isGlobalReset:!0,isSetting:!0,settingIdToReset:c}).done(function(){h()})}else h()})})};d.czr_states("isResetting")(!0),d.container.addClass("czr-resetting-control"),api.czr_skopeReset[d.czr_states("isDirty")()?"resetChangeset":"resetPublished"]({skope_id:e,setId:c,is_setting:!0}).done(function(b){h(a)}).fail(function(c){$.when($(".czr-crtl-reset-dialog",d.container).fadeOut("300")).done(function(){$.when($(".czr-reset-fail",d.container).fadeIn("300")).done(function(){$(".czr-reset-fail",d.container).append("<p>"+c+"</p>"),_.delay(function(){g(d),b.setupActiveSkopedControls({controls:[a]})},2e3)})})})},_resetControlDirtyness:function(a){var b=api.CZR_Helpers.getControlSettingId(a),c=api.czr_skope(api.czr_activeSkopeId()),d=$.extend(!0,{},c.dirtyValues()),e={},f=$.extend(!0,{},c.changesetValues()),g={},h=$.Deferred();return e=_.omit(d,b),g=_.omit(f,b),c.dirtyValues(e),c.changesetValues(e),h.resolve().promise()},_resetControlAPIVal:function(a){var b=api.CZR_Helpers.getControlSettingId(a),c=api.czr_skope(api.czr_activeSkopeId()).dbValues(),d=$.extend(!0,{},c),e=$.Deferred();return _.has(api.control(a),"czr_states")&&(api.control(a).czr_states("hasDBVal")(!1),api.czr_skope(api.czr_activeSkopeId()).dbValues(_.omit(d,b))),e.resolve().promise()}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{renderCtrlSkpNotIcon:function(a){var b=_.isArray(a)?a:[a];_.each(b,function(a){api.control.when(a,function(){var b=api.control(a);b.deferred.embedded.then(function(){$(".czr-toggle-notice",b.container).length||$.when(b.container.find(".customize-control-title").first().append($("<span/>",{"class":"czr-toggle-notice fa fa-info-circle",title:"Display informations about the scope of this option."}))).done(function(){$(".czr-toggle-notice",b.container).fadeIn(400)})})})})},updateCtrlSkpNot:function(a){var b=this,c=_.isArray(a)?a:[a],d=function(a){return a&&b.isSettingSkopeEligible(a)},e=function(a,c){var e,f,g=api.czr_activeSkopeId(),h=b.getInheritedSkopeId(a,g),i=b.getAppliedPrioritySkopeId(a,g),j=[];return d(a)?(h==i&&api.czr_skope.has(h)&&g==h&&(e=!_.isUndefined(api.czr_skope(g).dirtyValues()[a]),f=!_.isUndefined(api.czr_skope(g).dbValues()[a]),e?"global"==api.czr_skope(h)().skope?j.push(["Customized. Will be published site wide."].join(" ")):j.push(["Customized. Will be published for :",api.czr_skope(h)().title].join(" ")):f?"global"==api.czr_skope(h)().skope?j.push(["Customized and published site wide."].join(" ")):j.push(["Customized and published for :",api.czr_skope(h)().title].join(" ")):j.push("Default website value published site wide.")),h!==g&&api.czr_skope.has(h)&&(e=!_.isUndefined(api.czr_skope(h).dirtyValues()[a]),f=!_.isUndefined(api.czr_skope(h).dbValues()[a]),e||f?j.push("Inherited from : "+b.buildSkopeLink(h)):j.push("Default website value")),i!==g&&api.czr_skope.has(i)&&(e=!_.isUndefined(api.czr_skope(i).dirtyValues()[a]),j.push([e?"The value that will be published for":"The value currently published for",api.czr_skope(c)().title,e?"is customized in scope :":"is set in scope :",b.buildSkopeLink(i),e?", and will override this one once published because it has a higher priority.":", because it has a higher priority than this one."].join(" "))),j.join(" | ")):(j.push(["This option is always customized site wide and can't be reset."].join(" ")),j.join(" | "))};_.each(c,function(a){api.control.when(a,function(){var b=api.control(a),c=api.CZR_Helpers.getControlSettingId(a);_.has(b,"czr_states")&&b.czr_states("noticeVisible")()&&b.deferred.embedded.then(function(){var a=_.findWhere(api.czr_currentSkopesCollection(),{skope:"local"}).id,d=b.getNotificationsContainerElement();if(d&&d.length&&!_.isUndefined(a)){_html=e(c,a);var f=$(".czr-skope-notice",d);f.length?f.html(_html):d.append(['<span class="czr-notice czr-skope-notice">',_html,"</span>"].join(""))}})})})},removeCtrlSkpNot:function(a){var b=_.isArray(a)?a:[a];_.each(b,function(a){api.control.when(a,function(){var b=api.control(a);b.deferred.embedded.then(function(){var a=b.getNotificationsContainerElement();if(a&&a.length){var c=$(".czr-skope-notice",a);c.length&&c.remove()}})})})}});var CZRSkopeSaveMths=CZRSkopeSaveMths||{};$.extend(CZRSkopeSaveMths,{initialize:function(){this.changesetStatus="publish",this.saveBtn=$("#save")},save:function(a){var b,c=this,d=api.state("processing"),e=new api.Messenger({url:api.settings.url.parent,channel:"loader"});c.globalSaveDeferred=$.Deferred(),c.previewer=api.previewer,c.globalSkopeId=api.czr_skopeBase.getGlobalSkopeId(),c.saveArgs=a,a&&a.status&&(c.changesetStatus=a.status),api.state("saving")()&&c.globalSaveDeferred.reject("already_saving");var f=function(a,b){api.state("saving")(!1),api.state("processing").set(0),c.saveBtn.prop("disabled",!1),!_.isUndefined(a)&&a.setting_validities&&api._handleSettingValidities({settingValidities:a.setting_validities,focusInvalidControl:!0}),"pending"==b&&api.czr_serverNotification({message:a,status:"error"})},g=function(a){var b,d=$.Deferred();return api.state("saving")(!0),c.fireAllSubmission(a).always(function(a){b=a.response,f(b,this.state())}).fail(function(a){b=a.response,api.consoleLog("ALL SUBMISSIONS FAILED",b),c.globalSaveDeferred.reject(b),api.trigger("error",b),d.resolve(a.hasNewMenu)}).done(function(a){b=a.response,api.previewer.refresh({waitSkopeSynced:!0}).fail(function(a){c.globalSaveDeferred.reject(c.previewer,[b]),api.consoleLog("SAVE REFRESH FAIL",a)}).done(function(f){if(api.previewer.send("saved",b),b=_.extend({changeset_status:"publish"},b||{}),api.czr_isChangeSetOn()){var g=api._latestRevision;api.state("changesetStatus").set(b.changeset_status),"publish"===b.changeset_status&&(api.each(function(a){a._dirty&&(_.isUndefined(api._latestSettingRevisions[a.id])||api._latestSettingRevisions[a.id]<=g)&&(a._dirty=!1)}),api.state("changesetStatus").set(""),api.settings.changeset.uuid=b.next_changeset_uuid,e.send("changeset-uuid",api.settings.changeset.uuid))}else api.each(function(a){a._dirty=!1});f=_.extend({previewer:f.previewer||c.previewer,skopesServerData:f.skopesServerData||{}},f),c.reactWhenSaveDone(f.skopesServerData),c.globalSaveDeferred.resolveWith(c.previewer,[b]),api.trigger("saved",b||{}),d.resolve(a.hasNewMenu)})}),d.promise()};return 0===d()?g().done(function(a){a&&g({saveGlobal:!1,saveSkopes:!0})}):(b=function(){0===d()&&(api.state.unbind("change",b),g())},api.state.bind("change",b)),c.globalSaveDeferred.promise()}});var CZRSkopeSaveMths=CZRSkopeSaveMths||{};$.extend(CZRSkopeSaveMths,{getSubmitPromise:function(a){var b=this,c=$.Deferred(),d={};if(_.isEmpty(a)||!api.czr_skope.has(a))return api.consoleLog("getSubmitPromise : no skope id requested OR skope_id not registered : "+a),c.resolve().promise();var e=api.czr_skope(a)();return api.czr_skope(a).dirtyness()||a===b.globalSkopeId?(_.each(api.czr_skopeBase.getSkopeDirties(a),function(a,b){d[b]=_.extend({value:a})}),this.submit({skope_id:a,customize_changeset_data:d,dyn_type:e.dyn_type}).done(function(a){c.resolve(a)}).fail(function(b){api.consoleLog("GETSUBMIT FAILED PROMISE FOR SKOPE : ",a,b),c.reject(b)}),c.promise()):c.resolve().promise()},submit:function(a){var b,c=this,d={skope_id:null,the_dirties:{},customize_changeset_data:{},dyn_type:null,opt_name:null},e=[],f=$.Deferred();if(a=$.extend(d,a),_.isNull(a.skope_id))throw new Error("OVERRIDEN SAVE::submit : MISSING skope_id");if(_.isNull(a.the_dirties))throw new Error("OVERRIDEN SAVE::submit : MISSING the_dirties");if(_.has(api,"Notification")&&(api.each(function(a){a.notifications.each(function(b){"error"===b.type&&api.consoleLog("NOTIFICATION ERROR on SUBMIT SAVE",b),"error"!==b.type||b.data&&b.data.from_server||(e.push(a.id),settingInvalidities[a.id]||(settingInvalidities[a.id]={}),settingInvalidities[a.id][b.code]=b)})}),b=api.findControlsForSettings(e),!_.isEmpty(b)))return _.values(b)[0][0].focus(),f.rejectWith(c.previewer,[{setting_invalidities:settingInvalidities}]).promise();var g={skope_id:a.skope_id,action:"save",the_dirties:a.the_dirties,dyn_type:a.dyn_type,opt_name:a.opt_name};api.czr_isChangeSetOn()&&$.extend(g,{excludeCustomizedSaved:!1});var h=$.extend(c.previewer.query(g),{nonce:c.previewer.nonce.save,customize_changeset_status:c.changesetStatus,customize_changeset_data:JSON.stringify(a.customize_changeset_data)});api.czr_isChangeSetOn()&&(c.saveArgs&&c.saveArgs.date&&(h.customize_changeset_date=c.saveArgs.date),c.saveArgs&&c.saveArgs.title&&(h.customize_changeset_title=c.saveArgs.title));var i=wp.ajax.post("global"!==h.skope?"customize_skope_changeset_save":"customize_save",h);return c.saveBtn.prop("disabled",!0),api.trigger("save",i),i.fail(function(b){api.consoleLog("SUBMIT REQUEST FAIL",a.skope_id,b),"0"===b?b="not_logged_in":"-1"===b&&(b="invalid_nonce"),"invalid_nonce"===b?c.previewer.cheatin():"not_logged_in"===b&&(c.previewer.preview.iframe.hide(),c.previewer.login().done(function(){c.previewer.save(),c.previewer.preview.iframe.show()})),api.trigger("error",b),f.reject(b)}),i.done(function(a){f.resolve(a)}),f.promise()}});var CZRSkopeSaveMths=CZRSkopeSaveMths||{};$.extend(CZRSkopeSaveMths,{fireAllSubmission:function(a){var b=this,c=$.Deferred(),d=[],e=$.Deferred(),f={},g=[],h=[],i={saveGlobal:!0,saveSkopes:!0};a=$.extend(i,a),_.each(api.czr_skopeCollection(),function(a){"global"!==a.skope&&d.push(a.id)});var j=function(a){if(_.isUndefined(d[a+1])&&g.length==d.length){if(_.isEmpty(h))e.resolve(f);else{var b=function(){var a=[];return _.each(h,function(b){a.push(api.czr_skopeBase.buildServerResponse(b))}),$.trim(a.join(" | "))};e.reject(b())}return!0}},k=function(a){return a=a||0,_.isUndefined(d[a])&&(api.consoleLog("Undefined Skope in Save recursive call ",a,_skopesToUpdate,_skopesToUpdate[a]),e.resolve(f)),b.getSubmitPromise(d[a]).always(function(){g.push(a)}).fail(function(b){h.push(b),api.consoleLog("RECURSIVE PUSH FAIL FOR SKOPE : ",d[a]),j(a)||k(a+1)}).done(function(b){b=b||{},f=_.isEmpty(f)?b||{}:$.extend(f,b),j(a)||k(a+1)}),e.promise()},l=!1;_.each(api.czr_skope("global__all_").dirtyValues(),function(a,b){"nav_menu["==b.substring(0,"nav_menu[".length)&&(l=!0)});var m=function(){b.getSubmitPromise(b.globalSkopeId).fail(function(a){api.consoleLog("GLOBAL SAVE SUBMIT FAIL",a),a=api.czr_skopeBase.buildServerResponse(a),c.reject(a)}).done(function(a){f=_.isEmpty(f)?a||{}:$.extend(f,a),c.resolve({response:f,hasNewMenu:l})})};return l&&a.saveGlobal?m():a.saveGlobal&&a.saveSkopes?k().fail(function(a){api.consoleLog("RECURSIVE SAVE CALL FAIL",a),c.reject(a)}).done(function(a){b.cleanSkopeChangesetMetas().always(function(){m()})}):a.saveGlobal&&!a.saveSkopes?m():!a.saveGlobal&&a.saveSkopes&&k().fail(function(a){api.consoleLog("RECURSIVE SAVE CALL FAIL",a),c.reject(a)}).done(function(a){f=_.isEmpty(f)?a||{}:$.extend(f,a),b.cleanSkopeChangesetMetas().always(function(){c.resolve({response:f,hasNewMenu:l})})}),c.promise()},cleanSkopeChangesetMetas:function(){var a=$.Deferred();return _query=$.extend(api.previewer.query(),{nonce:api.previewer.nonce.save}),wp.ajax.post("czr_clean_skope_changeset_metas_after_publish",_query).always(function(){a.resolve()}).fail(function(a){api.consoleLog("cleanSkopeChangesetMetas failed",_query,a)}).done(function(a){api.consoleLog("cleanSkopeChangesetMetas done",_query,a)}),a.promise()}});var CZRSkopeSaveMths=CZRSkopeSaveMths||{};$.extend(CZRSkopeSaveMths,{reactWhenSaveDone:function(a){var b={};a=_.extend({czr_skopes:[],isChangesetDirty:!1},a),_.each(api.czr_skopeCollection(),function(a){b[a.opt_name]=api.czr_skopeBase.getSkopeDirties(a.id),api.czr_skope(a.id).dirtyValues({}),api.czr_skope(a.id).changesetValues({})});var c=[],d=a.czr_skopes;api.consoleLog("REACT WHEN SAVE DONE",b,d),_.each(b,function(a,b){_.each(a,function(a,e){if(!_.isUndefined(_.findWhere(d,{opt_name:b}))&&api.czr_skopeBase.isSettingSkopeEligible(e)){var f=_.findWhere(d,{opt_name:b}).db,g=_.findWhere(d,{opt_name:b}).skope,h=api.CZR_Helpers.build_setId(e),i=api.CZR_Helpers.getOptionName(e),j=f[h];_.isUndefined(j)&&"global"==g&&a===serverControlParams.defaultOptionsValues[i]||!_.isUndefined(j)&&_.isEqual(j,a)||c.push({opt_name:b,setId:h,server_val:j,api_val:a})}})}),_.isEmpty(c)?api.consoleLog("ALL RIGHT, SERVER AND API ARE SYNCHRONIZED AFTER SAVE"):api.consoleLog("SOME SETTINGS HAVE NOT BEEN PROPERLY SAVED : ",c),api.czr_skopeBase.maybeSynchronizeGlobalSkope(),api.czr_skopeBase.updateCtrlSkpNot(api.CZR_Helpers.getSectionControlIds())}});var CZRSkopeResetMths=CZRSkopeResetMths||{};$.extend(CZRSkopeResetMths,{initialize:function(){var a=this;a.previewer=api.previewer,api.state.create("czr-resetting")(!1),api.state("czr-resetting").bind(function(a){$(document.body).toggleClass("czr-resetting",!1!==a)})},resetChangeset:function(a){var b,c,d,e,f,g=$.Deferred(),h=this,i=api.state("processing"),j={is_setting:!1,is_skope:!1,skope_id:api.czr_activeSkopeId()||"",setId:""};a=_.extend(j,a);var k=a.skope_id,l=a.setId;return api.czr_isChangeSetOn()?(c=function(b,c){if(_.isUndefined(b))throw new Error("RESET: MISSING skope_id");if(api.state("czr-resetting")(!0),e={skope_id:b,action:"reset"},f=$.extend(h.previewer.query(e),{nonce:h.previewer.nonce.save}),a.is_setting)$.extend(f,{setting_id:c}),d="czr_changeset_setting_reset";else{if(!a.is_skope)return g.reject("reset_ajax_action_not_specified").promise();d="czr_changeset_skope_reset"}wp.ajax.post(d,f).always(function(){api.state("czr-resetting")(!1)}).fail(function(b){"0"===b?b="not_logged_in":"-1"===b&&(b="invalid_nonce"),"invalid_nonce"===b?h.previewer.cheatin():"not_logged_in"===b&&(h.previewer.preview.iframe.hide(),h.previewer.login().done(function(){h.resetChangeset(a),h.previewer.preview.iframe.show()})),api.consoleLog(d+" failed ",f,b),b=api.czr_skopeBase.buildServerResponse(b),api.trigger("error",b),api.czr_serverNotification({message:b,status:"error"}),g.reject(b)}).done(function(a){g.resolve(a)})},0===i()&&!1===api.state("czr-resetting")()?c(k,l):(b=function(){0===i()&&!1===api.state("czr-resetting")()&&(api.state.unbind("change",b),c(k,l))},api.state.bind("change",b)),g.promise()):g.resolve().promise()},resetPublished:function(a){var b,c,d,e,f,g=$.Deferred(),h=this,i=api.state("processing"),j={is_setting:!1,is_skope:!1,skope_id:api.czr_activeSkopeId()||"",setId:""};a=_.extend(j,a);var k=a.skope_id,l=a.setId;return c=function(b,c){if(_.isUndefined(b))throw new Error("RESET: MISSING skope_id");if(api.state("czr-resetting")(!0),e={skope_id:b,action:"reset"},f=$.extend(h.previewer.query(e),{nonce:h.previewer.nonce.save}),a.is_setting)$.extend(f,{setting_id:c}),d="czr_published_setting_reset";else{if(!a.is_skope)return g.reject("reset_ajax_action_not_specified").promise();d="czr_published_skope_reset"}api.consoleLog("in czr_reset submit : ",b,f),wp.ajax.post(d,f).always(function(){api.state("czr-resetting")(!1)}).fail(function(b){"0"===b?b="not_logged_in":"-1"===b&&(b="invalid_nonce"),"invalid_nonce"===b?h.previewer.cheatin():"not_logged_in"===b&&(h.previewer.preview.iframe.hide(),h.previewer.login().done(function(){h.resetChangeset(a),h.previewer.preview.iframe.show()})),api.consoleLog(d+" failed ",f,b),b=api.czr_skopeBase.buildServerResponse(b),api.trigger("error",b),api.czr_serverNotification({message:b,status:"error"}),g.reject(b)}).done(function(a){g.resolve(a)})},0===i()&&!1===api.state("czr-resetting")()?c(k,l):(b=function(){0===i()&&!1===api.state("czr-resetting")()&&(api.state.unbind("change",b),c(k,l))},api.state.bind("change",b)),g.promise()}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{initWidgetSidebarSpecifics:function(){var a=this;a.isExcludedSidebarsWidgets()||api.czr_activeSkopeId.bind(function(b){a.forceSidebarDirtyRefresh(api.czr_activeSectionId(),b)}),$(document).bind("widget-added",function(b,c){if(!a.isExcludedSidebarsWidgets()){var d=c.closest(".customize-control").attr("id"),e=api.czr_skopeBase.widgetIdToSettingId(d,"customize-control-");if(!api.has(e))throw new Error("AN ADDED WIDGET COULD NOT BE BOUND IN SKOPE. "+e);a.listenAPISettings(e)}})},forceSidebarDirtyRefresh:function(a,b){var c=this;if(!c.isExcludedSidebarsWidgets()){var d=api.state("saved")(),e=function(){if(api.section.has(a)&&"sidebar"==api.section(a).params.type){var b=b||api.czr_activeSkopeId(),e="sidebars_widgets["+api.section(a).params.sidebarId+"]",f=c.getSkopeSettingVal(e,b);api.czr_skope(b).updateSkopeDirties(e,f),api.previewer.refresh({the_dirties:api.czr_skope(b).dirtyValues()}).done(function(){api.state("saved")(d)})}};e=_.debounce(e,500),e()}}});var CZRSkopeMths=CZRSkopeMths||{};$.extend(CZRSkopeMths,{initialize:function(a,b){var c=this;api.Value.prototype.initialize.call(c,null,b),c.isReady=$.Deferred(),c.embedded=$.Deferred(),c.el="czr-scope-"+a,$.extend(c,b||{}),c.visible=new api.Value((!0)),c.winner=new api.Value((!1)),c.priority=new api.Value,c.active=new api.Value((!1)),c.dirtyness=new api.Value((!1)),c.skopeResetDialogVisibility=new api.Value((!1)),c.hasDBValues=new api.Value((!1)),c.dirtyValues=new api.Value({}),c.dbValues=new api.Value({}),c.changesetValues=new api.Value({}),c.userEventMap=new api.Value([{trigger:"click keydown",selector:".czr-scope-switch, .czr-skp-switch-link",name:"skope_switch",actions:function(){api.czr_activeSkopeId(c().id)}},{trigger:"click keydown",selector:".czr-scope-reset",name:"skope_reset_warning",actions:"reactOnSkopeResetUserRequest"}]),c.skopeResetDialogVisibility.bind(function(a,b){return c.skopeResetDialogReact(a)},{deferred:!0}),c.dirtyValues.callbacks.add(function(){return c.dirtyValuesReact.apply(c,arguments)}),c.changesetValues.callbacks.add(function(){return c.changesetValuesReact.apply(c,arguments)}),c.dbValues.callbacks.add(function(){return c.dbValuesReact.apply(c,arguments)}),c.callbacks.add(function(){return c.skopeReact.apply(c,arguments)}),c.set(_.omit(b,function(a,b){return _.contains(["db","changeset","has_db_val"],b)})),c.embedded.fail(function(){throw new Error("The container of skope "+c().id+" has not been embededd")}).done(function(){c.setupDOMListeners(c.userEventMap(),{dom_el:c.container}),c.visible.bind(function(a){c.container.toggle(a)}),c.active.callbacks.add(function(){return c.activeStateReact.apply(c,arguments)}),c.dirtyness.callbacks.add(function(){return c.dirtynessReact.apply(c,arguments)}),c.hasDBValues.callbacks.add(function(){return c.hasDBValuesReact.apply(c,arguments)}),c.winner.callbacks.add(function(){return c.winnerReact.apply(c,arguments)}),c.dirtyness(!_.isEmpty(b.changeset)),c.hasDBValues(!_.isEmpty(b.db)),c.winner(b.is_winner),c.isReady.resolve()})},ready:function(){var a=this;$.when(a.embedSkopeDialogBox()).done(function(b){!1!==b.length?(b.css("background-color",a.color),a.container=b,a.embedded.resolve(b)):a.embedded.reject()})},dirtyValuesReact:function(a,b){var c=this;c.dirtyness(!_.isEmpty(a)),api.czr_dirtyness(!_.isEmpty(a));var d=[];_.each(b,function(b,c){_.has(a,c)||d.push(c)}),c().id==api.czr_activeSkopeId()&&(_.each(d,function(a){_.has(api.control(a),"czr_states")&&api.control(a).czr_states("isDirty")(!1)}),_.each(a,function(a,b){_.has(api.control(b),"czr_states")&&api.control(b).czr_states("isDirty")(!0)}))},changesetValuesReact:function(a,b){var c=this,d=$.extend(!0,{},c.dirtyValues());c.dirtyValues($.extend(d,a))},dbValuesReact:function(a,b){var c=this;c.hasDBValues(!_.isEmpty("global"!=c().skope?a:_.omit(a,function(a,b){return!api.czr_skopeBase.isThemeSetting(b)})));var d=[];_.each(b,function(b,c){_.has(a,c)||d.push(c)}),c().id==api.czr_activeSkopeId()&&(_.each(d,function(a){_.has(api.control(a),"czr_states")&&api.control(a).czr_states("hasDBVal")(!1)}),_.each(a,function(a,b){_.has(api.control(b),"czr_states")&&api.control(b).czr_states("hasDBVal")(!0)}))},skopeReact:function(a,b){var c=this,d=[],e=[];api.czr_skopeBase.isSkopeRegisteredInCollection(a.id)?(d=$.extend(!0,[],api.czr_skopeCollection()),e=d,_.each(d,function(b,d){b.id==c().id&&(e[d]=a)}),api.czr_skopeCollection(e)):(d=$.extend(!0,[],api.czr_skopeCollection()),d.push(a),api.czr_skopeCollection(d))},activeStateReact:function(a,b){var c=this;c.container.toggleClass("inactive").toggleClass("active",a),$(".czr-scope-switch",c.container).toggleClass("fa-toggle-on",a).toggleClass("fa-toggle-off",!a)},dirtynessReact:function(a,b){var c=this;$.when(this.container.toggleClass("dirty",a)).done(function(){a?$(".czr-scope-reset",c.container).fadeIn("slow").attr("title",["Reset the current customizations for",c().title].join(" ")):c.hasDBValues()||$(".czr-scope-reset",c.container).fadeOut("fast")})},hasDBValuesReact:function(a,b){var c=this;$.when(c.container.toggleClass("has-db-val",a)).done(function(){a?$(".czr-scope-reset",c.container).fadeIn("slow").attr("title",["global"==c().skope?"Reset the theme options published site wide":"Reset your website published options for","global"==c().skope?"":c().title].join(" ")):c.dirtyness()||$(".czr-scope-reset",c.container).fadeOut("fast")})},winnerReact:function(a){var b=this;this.container.toggleClass("is_winner",a),a&&_.each(api.czr_currentSkopesCollection(),function(a){if(a.id!=b().id){var c=$.extend(!0,{},a);$.extend(c,{is_winner:!1}),api.czr_skope(a.id)(c)}})},updateSkopeDirties:function(a,b){var c=this;api.CZR_Helpers.getOptionName(a);if(!api.czr_skopeBase.isSettingSkopeEligible(a)&&"global"!=c().skope)return api.czr_skope(api.czr_skopeBase.getGlobalSkopeId()).updateSkopeDirties(a,b);var d=$.extend(!0,{},c.dirtyValues()),e={};return e[a]=b,c.dirtyValues.set($.extend(d,e)),c.dirtyValues()},getSkopeSettingDirtyness:function(a){var b=this;return b.getSkopeSettingAPIDirtyness(a)||b.getSkopeSettingChangesetDirtyness(a)},getSkopeSettingAPIDirtyness:function(a){var b=this;return _.has(b.dirtyValues(),api.CZR_Helpers.build_setId(a))},getSkopeSettingChangesetDirtyness:function(a){var b=this;return api.czr_isChangeSetOn()?_.has(b.changesetValues(),api.CZR_Helpers.build_setId(a)):b.getSkopeSettingAPIDirtyness(a)},hasSkopeSettingDBValues:function(a){var b=api.CZR_Helpers.build_setId(a);return!_.isUndefined(api.czr_skope(api.czr_activeSkopeId()).dbValues()[b])}});var CZRSkopeMths=CZRSkopeMths||{};$.extend(CZRSkopeMths,{embedSkopeDialogBox:function(){var a=this,b=$.extend(!0,{},a()),c="";if(!$("#customize-header-actions").find(".czr-scope-switcher").length)throw new Error("The skope switcher wrapper is not printed, the skope can not be embedded.");try{c=wp.template("czr-skope")(_.extend(b,{el:a.el}))}catch(d){throw new Error("Error when parsing the template of a skope"+d)}return $(".czr-skopes-wrapper","#customize-header-actions").append($(c)),$("."+a.el,".czr-skopes-wrapper")},renderResetWarningTmpl:function(){var a,b,c=this,d=$.extend(!0,{},c()),e="";c.dirtyness()?(a=["Please confirm that you want to reset your current customizations for : ",c().title,"."].join(""),b=["Your customizations have been reset for ",c().title,"."].join("")):(a=["Please confirm that you want to reset your published customizations to defaults for : ",c().title,"."].join(""),b=["The options have been reset to defaults for ",c().title,"."].join(""));try{e=wp.template("czr-skope-pane")(_.extend(d,{el:c.el,warning_message:a,success_message:b}))}catch(f){throw new Error("Error when parsing the the reset skope template : "+f)}return $("#customize-preview").after($(e)),$("#czr-skope-pane")},getEl:function(){var a=this;return $(a.el,"#customize-header-actions")}});var CZRSkopeMths=CZRSkopeMths||{};$.extend(CZRSkopeMths,{reactOnSkopeResetUserRequest:function(){var a=this,b=function(){api.state("czr-resetting")(!0),api.czr_activeSkopeId()!=a().id?api.czr_activeSkopeId(a().id).done(function(){a.skopeResetDialogVisibility(!a.skopeResetDialogVisibility()).done(function(){api.state("czr-resetting")(!1)})}):a.skopeResetDialogVisibility(!a.skopeResetDialogVisibility()).done(function(){api.state("czr-resetting")(!1)})};return api.state("czr-resetting")()||0!==api.state("processing")()?void api.czr_serverNotification({message:"Slow down, you move too fast !",status:"success",auto_collapse:!0}):void(api.czr_activeSkopeId()!=a().id&&api.czr_skope(api.czr_activeSkopeId()).skopeResetDialogVisibility()?api.czr_skope(api.czr_activeSkopeId()).skopeResetDialogVisibility(!1).done(function(){b()}):b())},skopeResetDialogReact:function(a){var b=this,c=$.Deferred();return b.userResetEventMap=b.userResetEventMap||new api.Value([{trigger:"click keydown",selector:".czr-scope-reset-cancel",name:"skope_reset_cancel",actions:function(){b.skopeResetDialogVisibility(!b.skopeResetDialogVisibility())}},{trigger:"click keydown",selector:".czr-scope-do-reset",name:"skope_do_reset",actions:"doResetSkopeValues"}]),a?(api.czr_isResettingSkope(b().id),$.when(b.renderResetWarningTmpl()).done(function(a){b.resetPanel=a,b.resetPanel.addClass(b.dirtyness()?"dirty-reset":"db-reset"),b.setupDOMListeners(b.userResetEventMap(),{dom_el:b.resetPanel})}).then(function(){setTimeout(function(){var a=$("#customize-preview").height();b.resetPanel.css("line-height",a+"px").css("height",a+"px"),$("body").addClass("czr-skope-pane-open")},50)})):$.when($("body").removeClass("czr-skope-pane-open")).done(function(){_.has(b,"resetPanel")&&!1!==b.resetPanel.length&&setTimeout(function(){b.resetPanel.remove(),api.czr_isResettingSkope(!1)},300)}),_.delay(function(){c.resolve()},350),c.promise()},doResetSkopeValues:function(){var a=this,b=a().id,c=a.dirtyness()?"_resetSkopeDirties":"_resetSkopeAPIValues",d=function(){var d=function(){api.czr_skopeBase.processSilentUpdates({refresh:!1}).fail(function(){api.consoleLog("Silent update failed after resetting skope : "+b)}).done(function(){$.when($(".czr-reset-warning",a.resetPanel).fadeOut("300")).done(function(){$.when($(".czr-reset-success",a.resetPanel).fadeIn("300")).done(function(){_.delay(function(){api.czr_isResettingSkope(!1),a.skopeResetDialogVisibility(!1)},2e3)})})})};a[c]().done(function(){api.previewer.refresh().fail(function(a){api.consoleLog("SKOPE RESET REFRESH FAILED",a)}).done(function(a){if("global"==api.czr_skope(b)().skope&&"_resetSkopeAPIValues"==c){var e,f={},g=api.czr_skope(b)().opt_name;!_.isUndefined(a.skopesServerData)&&_.has(a.skopesServerData,"czr_skopes")&&(e=a.skopesServerData.czr_skopes,_.isUndefined(_.findWhere(e,{opt_name:g}))&&(f=_.findWhere(e,{opt_name:g}).db||{})),api.czr_skopeBase.maybeSynchronizeGlobalSkope({isGlobalReset:!0,isSkope:!0,skopeIdToReset:b}).done(function(){d()})}else d()})})};$("body").addClass("czr-resetting-skope"),api.czr_skopeReset[a.dirtyness()?"resetChangeset":"resetPublished"]({skope_id:a().id,is_skope:!0}).always(function(){$("body").removeClass("czr-resetting-skope")}).done(function(a){d()}).fail(function(b){a.skopeResetDialogVisibility(!1),api.consoleLog("Skope reset failed",b)})},_resetSkopeDirties:function(){var a=this,b=$.Deferred();return a.dirtyValues({}),a.changesetValues({}),b.resolve().promise()},_resetSkopeAPIValues:function(){var a=this,b=$.Deferred();return a.dbValues({}),b.resolve().promise()}}),function(a,b,c){serverControlParams.isSkopOn&&(a.Value.prototype.set=function(d,e){var f=this._value,g=b.Deferred(),h=this,i=[];return d=this._setter.apply(this,arguments),d=this.validate(d),null===d||c.isEqual(f,d)?this:(this._value=d,this._dirty=!0,this._deferreds?(c.each(h._deferreds,function(a){i.push(a.apply(null,[d,f,e]))}),b.when.apply(null,i).fail(function(){a.consoleLog("A deferred callback failed in api.Value::set()")}).then(function(){h.callbacks.fireWith(h,[d,f,e]),g.resolveWith(h,[d,f,e])}),g.promise(h)):(this.callbacks.fireWith(this,[d,f,e]),g.resolveWith(h,[d,f,e]).promise(h)))},a.Value.prototype.bind=function(){var a=this,d=!1,e=[];return b.each(arguments,function(a,b){d||(d=c.isObject(b)&&b.deferred),c.isFunction(b)&&e.push(b)}),d?(a._deferreds=a._deferreds||[],c.each(e,function(b){c.contains(b,a._deferreds)||a._deferreds.push(b)})):a.callbacks.add.apply(a.callbacks,arguments),this},a.Setting.prototype.silent_set=function(b,d){var e=this._value,f=a.state("saved")();return b=this._setter.apply(this,arguments),b=this.validate(b),null===b||c.isEqual(e,b)?this:(this._value=b,this._dirty=c.isUndefined(d)||!c.isBoolean(d)?this._dirty:d,this.callbacks.fireWith(this,[b,e,{silent:!0}]),a.state("saved")(f),this)})}(wp.customize,jQuery,_),function(a,b,c){a.bind("ready",function(){if(serverControlParams.isSkopOn){var d=a.previewer.query;a.previewer.query=function(e){if(!c.has(a,"czr_skope"))return a.consoleLog("QUERY : SKOPE IS NOT ON. FALLING BACK ON CORE QUERY"),d.apply(this);if("pending"==a.czr_initialSkopeCollectionPopulated.state())return a.consoleLog("QUERY : INITIAL SKOPE COLLECTION NOT POPULATED YET. FALLING BACK ON CORE QUERY"),
|
12 |
-
d.apply(this);if("pending"==a.czr_isPreviewerSkopeAware.state()&&a.czr_isPreviewerSkopeAware.resolve(),!c.isObject(e)&&"resolved"==a.czr_initialSkopeCollectionPopulated.state()&&"resolved"==a.czr_initialSkopeCollectionPopulated.state())return d.apply(this);!c.isUndefined(e.skope_id)&&c.isString(e.skope_id)||(e.skope_id=a.czr_activeSkopeId()||a.czr_skopeBase.getGlobalSkopeId());var f,g={},h={},i={skope_id:null,action:null,the_dirties:{},dyn_type:null,opt_name:null};if(e=b.extend(i,e),!c.isObject(e.the_dirties))throw a.consoleLog("QUERY PARAMS : ",e),new Error("QUERY DIRTIES MUST BE AN OBJECT. Requested action : "+e.action);if("pending"!=a.czr_isPreviewerSkopeAware.state()&&c.isNull(e.skope_id))throw a.consoleLog("QUERY PARAMS : ",e),new Error("OVERRIDEN QUERY : NO SKOPE ID. FALLING BACK ON CORE QUERY. Requested action : "+e.action);if(!c.contains([null,"refresh","save","reset","changeset_update"],e.action))throw a.consoleLog("QUERY PARAMS : ",e),new Error("A REQUESTED QUERY HAS NO AUTHORIZED ACTION. Requested action : "+e.action);var j=function(){if("pending"==a.czr_initialSkopeCollectionPopulated.state())return{};var b={};return c.each(a.czr_currentSkopesCollection(),function(c){"global"!=c.skope&&(b[c.id]=a.czr_skopeBase.getSkopeDirties(c.id))}),b};switch(c.isNull(e.the_dirties)||c.isEmpty(e.the_dirties)?(g=a.dirtyValues({unsaved:e.excludeCustomizedSaved||!1}),h=j()):"global"==a.czr_skopeBase.getActiveSkopeName()?g=e.the_dirties:h[a.czr_activeSkopeId()]=e.the_dirties,e.action){case null:case"refresh":break;case"changeset_update":if(c.isUndefined(e.opt_name))throw new Error("Missing opt_name param in the changeset_update query for skope : "+e.skope_id);break;case"save":if(c.isNull(e.dyn_type)&&(e.dyn_type=a.czr_skope(e.skope_id)().dyn_type),c.isNull(e.dyn_type)||c.isUndefined(e.dyn_type))throw new Error("QUERY : A SAVE QUERY MUST HAVE A VALID DYN TYPE."+e.skope_id);break;case"reset":if(c.isNull(e.dyn_type)&&(e.dyn_type=a.czr_skope(e.skope_id)().dyn_type),c.isNull(e.dyn_type)||c.isUndefined(e.dyn_type))throw new Error("QUERY : A RESET QUERY MUST HAVE A VALID DYN TYPE."+e.skope_id)}var k={};return c.each(a.czr_currentSkopesCollection(),function(a){k[a.skope]={id:a.id,opt_name:a.opt_name}}),f={wp_customize:"on",customized:"{}"==JSON.stringify(g)?'{"__not_customized__"}':JSON.stringify(g),skopeCustomized:JSON.stringify(h),nonce:this.nonce.preview,skope:a.czr_skope(e.skope_id)().skope,level_id:a.czr_skope(e.skope_id)().level,skope_id:e.skope_id,dyn_type:e.dyn_type,opt_name:c.isNull(e.opt_name)?a.czr_skope(e.skope_id)().opt_name:e.opt_name,obj_id:a.czr_skope(e.skope_id)().obj_id,current_skopes:JSON.stringify(k)||{},channel:this.channel(),revisionIndex:a._latestRevision},f=a.czr_isChangeSetOn()?b.extend(f,{customize_theme:a.settings.theme.stylesheet,customize_changeset_uuid:a.settings.changeset.uuid}):b.extend(f,{theme:a.settings.theme.stylesheet})}}})}(wp.customize,jQuery,_),function(a,b,c){a.bind("czr-skope-started",function(){a.previewer.save=function(b){return a.czr_skopeSave.save()}})}(wp.customize,jQuery,_),function(a,b,c){if(serverControlParams.isSkopOn){a.Element.synchronizer.checkbox.update=function(a){this.element.prop("checked",a),this.element.iCheck("update")};var d=a.Element.synchronizer.val.update;a.Element.synchronizer.val.update=function(b){var c=this,e=function(){c.element.is("select")?c.element.val(b).trigger("change"):c.element.hasClass("wp-color-picker")?c.element.val(b).trigger("change"):c.element.val(b)};if(serverControlParams.isSkopOn){if("pending"==a.czr_skopeReady.state())return d.call(c,b);a.czr_skopeReady.then(function(){e()})}else e()},a.Element.synchronizer.val.refresh=function(){var a=this;return this.element.is("select")&&c.isNull(this.element.val())?c.isArray(a())?[]:c.isObject(a())?{}:"":this.element.val()}}}(wp.customize,jQuery,_),function(a,b,c){var d=a.Previewer.prototype.refresh,e=function(f){f=c.extend({waitSkopeSynced:!0,the_dirties:{}},f),c.has(a,"czr_activeSkopeId")&&!c.isUndefined(a.czr_activeSkopeId())||a.consoleLog("The api.czr_activeSkopeId() is undefined in the api.previewer._new_refresh() method.");var g=this,h=b.Deferred();if(!c.has(a,"czr_activeSkopeId")&&"pending"==a.czr_skopeReady.state())return a.czr_skopeReady.done(function(){e.apply(a.previewer,f)}),d.apply(g),h.resolve().promise();g.send("loading-initiated"),g.abort();var i=a.czr_getSkopeQueryParams({skope_id:a.czr_activeSkopeId(),action:"refresh",the_dirties:f.the_dirties||{}});return g.loading=new a.PreviewFrame({url:g.url(),previewUrl:g.previewUrl(),query:g.query(i)||{},container:g.container,signature:"WP_CUSTOMIZER_SIGNATURE"}),g.settingsModifiedWhileLoading={},onSettingChange=function(a){g.settingsModifiedWhileLoading[a.id]=!0},a.bind("change",onSettingChange),g.loading.always(function(){a.unbind("change",onSettingChange)}),a.czr_isChangeSetOn()||(g._previousPreview=g._previousPreview||g.preview),g.loading.done(function(b){var c,d=this;g.preview=d,g.targetWindow(d.targetWindow()),g.channel(d.channel()),c=function(b){d.unbind("synced",c),d.unbind("czr-skopes-synced",c),g._previousPreview?g._previousPreview.destroy():g.preview&&g.preview.destroy(),g._previousPreview=g.preview,g.deferred.active.resolve(),delete g.loading,a.trigger("pre_refresh_done",{previewer:g,skopesServerData:b||{}}),h.resolve({previewer:g,skopesServerData:b||{}})},a.czr_isChangeSetOn()||g.send("sync",{scroll:g.scroll,settings:a.get()}),f.waitSkopeSynced?d.bind("czr-skopes-synced",c):d.bind("synced",c),g.trigger("ready",b)}),g.loading.fail(function(b,c){a.consoleLog("LOADING FAILED : ",arguments),g.send("loading-failed"),a.czr_isChangeSetOn()||"redirect"===b&&c&&g.previewUrl(c),"logged out"===b&&(g.preview&&(g.preview.destroy(),delete g.preview),g.login().done(g.refresh)),"cheatin"===b&&g.cheatin(),h.reject(b)}),h.promise()};a.bind("czr-skope-started",function(){czr_override_refresh_for_skope(),a.Previewer.prototype.refresh=e}),a.czr_getSkopeQueryParams=function(d){if(!a.czr_isChangeSetOn())return d;d=c.isObject(d)?d:{};var e=d.action||"refresh";switch(e){case"refresh":d=b.extend(d,{excludeCustomizedSaved:!0})}return d},czr_override_refresh_for_skope=function(){serverControlParams.isSkopOn&&(a.previewer.refresh=function(d){var f=b.Deferred(),g=function(b){var c,d=function(){return 0===a.state("processing").get()},g=function(){e.call(a.previewer,b).done(function(a){f.resolve(a)})};d()?g():(c=function(){d()&&(g(),a.state("processing").unbind(c))},a.state("processing").bind(c))};return g=c.debounce(g,a.previewer.refreshBuffer),g(d),f.promise()})}}(wp.customize,jQuery,_),function(a,b,c){serverControlParams.isSkopOn&&(a.dirtyValues=function(b){return a.czr_skopeBase.getSkopeDirties(a.czr_skopeBase.getGlobalSkopeId(),b)})}(wp.customize,jQuery,_),function(a,b,c){if(serverControlParams.isSkopOn&&a.czr_isChangeSetOn()){var d=a.requestChangesetUpdate;a.requestChangesetUpdate=function(e){var f=b.Deferred(),g=[],h=[],i=e||{},j=[],k=[],l=b.Deferred();(0===a._lastSavedRevision||c.isEmpty(a.state("changesetStatus")()))&&(i=c.extend(i,{blogname:{dummy_change:"dummy_change"}})),c.each(a.czr_currentSkopesCollection(),function(a){"global"!=a.skope&&g.push(a.id)});var m=function(d){if(c.isUndefined(g[d+1])&&h.length==g.length){if(c.isEmpty(j))l.resolve(k);else{var e=function(){var d=[];return c.each(j,function(b){d.push(a.czr_skopeBase.buildServerResponse(b))}),b.trim(d.join(" | "))};l.reject(e())}return!0}},n=function(b){return(c.isUndefined(b)||0==b)&&a.state("processing").set(1),b=b||0,c.isUndefined(g[b])?(a.consoleLog("Undefined Skope in changeset recursive call ",b,g,g[b]),l.resolve(k).promise()):(a._requestSkopeChangetsetUpdate(e,g[b]).always(function(){h.push(b)}).fail(function(c){j.push(c),a.consoleLog("CHANGESET UPDATE RECURSIVE FAIL FOR SKOPE : ",g[b]),m(b)||n(b+1)}).done(function(a){k.push(a),m(b)||n(b+1)}),l.promise())},o=a._lastSavedRevision;return d(i).fail(function(b){a.consoleLog("WP requestChangesetUpdateFail",b,a.czr_skopeBase.buildServerResponse(b)),a._lastSavedRevision=Math.max(a._latestRevision,a._lastSavedRevision),a.state("processing").set(0),f.reject(b),b=a.czr_skopeBase.buildServerResponse(b),a.czr_serverNotification({message:b,status:"error"})}).done(function(b){"pending"==a.czr_initialSkopeCollectionPopulated.state()&&f.resolve(b),a._lastSavedRevision=o,n().always(function(){a._lastSavedRevision=Math.max(a._latestRevision,a._lastSavedRevision),a.state("processing").set(0)}).fail(function(b){f.reject(b),a.consoleLog("CHANGESET UPDATE RECURSIVE PUSH FAIL",b,k),a.trigger("changeset-error",b),a.czr_serverNotification({message:b,status:"error"})}).done(function(){f.resolve(b)})}),f.promise()},a._requestSkopeChangetsetUpdate=function(d,e){if(c.isUndefined(e)||!a.czr_skope.has(e))throw new Error("In api._requestSkopeChangetsetUpdate() : a valid and registered skope_id must be provided");var f,g=new b.Deferred,h={};if(e=e||a.czr_activeSkopeId(),d&&c.extend(h,d),c.each(a.czr_skopeBase.getSkopeDirties(e),function(a,b){d&&null===d[b]||(h[b]=c.extend({},h[b]||{},{value:a}))}),c.isEmpty(h))return g.resolve({}),g.promise();if(a._latestRevision<=a._lastSavedRevision)return g.resolve({}),g.promise();a.trigger("skope-changeset-save",h);var i={skope_id:e,action:"changeset_update",opt_name:a.czr_skope(e).opt_name};return f=a.previewer.query(c.extend(i,{excludeCustomizedSaved:!0})),delete f.customized,c.extend(f,{nonce:a.settings.nonce.save,customize_changeset_data:JSON.stringify(h)}),wp.ajax.post("customize_skope_changeset_save",f).done(function(a){g.resolve(a)}).fail(function(b){a.consoleLog("SKOPE CHANGESET FAIL FOR SKOPE "+b.skope_id,b),g.reject(b)}).always(function(b){b.setting_validities&&a._handleSettingValidities({settingValidities:b.setting_validities})}),g.promise()}}}(wp.customize,jQuery,_),function(a,b,c){if(serverControlParams.isSkopOn){var d=a.Setting.prototype.preview;a.Setting.prototype.preview=function(b,e,f){if(c.has(a,"czr_isPreviewerSkopeAware")&&"pending"==a.czr_isPreviewerSkopeAware.state()&&this.previewer.refresh(),!c.has(f,"silent")||!1===f.silent)return d.call(this)}}}(wp.customize,jQuery,_),function(a,b,c){if("function"==typeof a.Section){var d=a.Section.prototype.initialize;a.Section.prototype.initialize=function(a,e){d.apply(this,[a,e]);var f=this;this.expanded.callbacks.add(function(a){if(a){var d=f.container.closest(".wp-full-overlay-sidebar-content"),e=f.container.find(".accordion-section-content");_resizeContentHeight=function(){e.css("height",d.innerHeight())},_resizeContentHeight(),b(window).on("resize.customizer-section",c.debounce(_resizeContentHeight,110))}})}}}(wp.customize,jQuery,_),function(a,b,c){a.CZR_Helpers=a.CZR_Helpers||{},a.CZR_Helpers=b.extend(a.CZR_Helpers,{getControlSettingId:function(b,d){if(d="default",!a.control.has(b))throw new Error("The requested control_id is not registered in the api yet : "+b);if(c.has(a.control(b),"settings")&&!c.isEmpty(a.control(b).settings)){if(!c.has(a.control(b).settings,d))throw new Error("The requested control_id does not have the requested setting type : "+b+" , "+d);if(c.isUndefined(a.control(b).settings[d].id))throw new Error("The requested control_id has no setting id assigned : "+b);return a.control(b).settings[d].id}},getDocSearchLink:function(a){a=c.isString(a)?a:"";var b=a.replace(/ /g,"+"),d=[serverControlParams.docURL,"search?query=",b].join("");return['<a href="'+d+'" title="'+serverControlParams.translatedStrings.readDocumentation+'" target="_blank">'," ",'<span class="fa fa-question-circle-o"></span>'].join("")},build_setId:function(a){return c.contains(serverControlParams.wpBuiltinSettings,a)?a:c.contains(serverControlParams.themeSettingList,a)&&-1==a.indexOf(serverControlParams.themeOptions)?[serverControlParams.themeOptions+"[",a,"]"].join(""):a},getOptionName:function(a){return-1==a.indexOf(serverControlParams.themeOptions)?a:a.replace(/\[|\]/g,"").replace(serverControlParams.themeOptions,"")},has_part_refresh:function(b){if(c.has(a,"czr_partials"))return c.contains(c.map(a.czr_partials(),function(a,d){return c.contains(a.settings,b)}),!0)},getSectionControlIds:function(b){return b=b||a.czr_activeSectionId(),a.section.has(b)?c.map(a.section(b).controls(),function(a){return a.id}):[]},getSectionSettingIds:function(b){if(b=b||a.czr_activeSectionId(),a.section.has(b)){var d=this,e=[],f=d.getSectionControlIds(b);return c.each(f,function(b){c.each(a.control(b).settings,function(a,b){e.push(a.id)})}),e}},capitalize:function(a){return c.isString(a)?a.charAt(0).toUpperCase()+a.slice(1):a},truncate:function(a,b,d){if(c.isUndefined(a))return"";var e=a.length>b,f=e?a.substr(0,b-1):a;return f=d&&e?f.substr(0,f.lastIndexOf(" ")):f,e?f+"...":f},isMultiItemModule:function(b,d){if(!c.isUndefined(b)||c.isObject(d)){if(c.isObject(d)&&c.has(d,"module_type"))b=d.module_type;else if(c.isUndefined(b)||c.isNull(b))return;if(c.has(a.czrModuleMap,b))return a.czrModuleMap[b].crud||a.czrModuleMap[b].multi_item||!1}},isCrudModule:function(b,d){if(!c.isUndefined(b)||c.isObject(d)){if(c.isObject(d)&&c.has(d,"module_type"))b=d.module_type;else if(c.isUndefined(b)||c.isNull(b))return;if(c.has(a.czrModuleMap,b))return a.czrModuleMap[b].crud||!1}}})}(wp.customize,jQuery,_),function(a,b,c){a.CZR_Helpers=a.CZR_Helpers||{},a.CZR_Helpers=b.extend(a.CZR_Helpers,{addActions:function(a,b,d){var e=this;d=d||e,d[a]=d[a]||[],new_event_map=c.clone(d[a]),d[a]=c.union(new_event_map,c.isArray(b)?b:[b])},doActions:function(a,b,c){b.trigger(a,c)},setupDOMListeners:function(d,e,f){var g=this;f=f||g,c.map(d,function(d){if(!c.isString(d.selector)||c.isEmpty(d.selector))throw new Error("setupDOMListeners : selector must be a string not empty. Aborting setup of action(s) : "+d.actions.join(","));e.dom_el.on(d.trigger,d.selector,function(h,i){if(h.stopPropagation(),!a.utils.isKeydownButNotEnterEvent(h)){h.preventDefault();var j=c.clone(e);c.has(j,"model")&&c.has(j.model,"id")&&(c.has(f,"get")?j.model=f():j.model=f.getModel(j.model.id)),b.extend(j,{event:d,dom_event:h}),b.extend(j,i),g.executeEventActionChain(j,f)}})})},executeEventActionChain:function(a,b){var d=this;if(!c.has(a,"event")||!c.has(a.event,"actions"))throw new Error("executeEventActionChain : No obj.event or no obj.event.actions properties found");if("function"==typeof a.event.actions)return a.event.actions(a);c.isArray(a.event.actions)||(a.event.actions=[a.event.actions]);var e=!1;c.map(a.event.actions,function(f){if(!e){if("function"!=typeof b[f])throw new Error("executeEventActionChain : the action : "+f+" has not been found when firing event : "+a.event.selector);var g=c.has(a,"dom_el")&&-1!=a.dom_el.length?a.dom_el:d.container;g.trigger("before_"+f,c.omit(a,"event"));var h=b[f](a);!1===h&&(e=!0),g.trigger("after_"+f,c.omit(a,"event"))}})}})}(wp.customize,jQuery,_),function(a,b,c){a.bind("ready",function(){a.previewer.bind("houston-widget-settings",function(b){var d=c.filter(b.registeredSidebars,function(a){return!c.findWhere(_wpCustomizeWidgetsSettings.registeredSidebars,{id:a.id})}),e=c.filter(b.registeredSidebars,function(a){return!c.has(b.renderedSidebars,a.id)});e=c.map(e,function(a){return a.id});var f=c.map(b.registeredSidebars,function(a){return a.id});a.czr_widgetZoneSettings.set({actives:b.renderedSidebars,inactives:e,registered:f,candidates:d,available_locations:b.availableWidgetLocations})}),a.previewer.bind("czr-wp-conditional-ready",function(b){a.czr_wp_conditionals.set(b)}),a.previewer.bind("czr-partial-refresh",function(b){a.czr_partials.set(b)})})}(wp.customize,jQuery,_);var CZRInputMths=CZRInputMths||{};$.extend(CZRInputMths,{initialize:function(a,b){if(_.isUndefined(b.item)||_.isEmpty(b.item))throw new Error("No item assigned to input "+b.id+". Aborting");if(_.isUndefined(b.module))throw new Error("No module assigned to input "+b.id+". Aborting");api.Value.prototype.initialize.call(this,null,b);var c=this;if($.extend(c,b||{}),c.isReady=$.Deferred(),_.isUndefined(b.input_value)||c.set(b.input_value),c.type_map={text:"",textarea:"",check:"setupIcheck",select:"setupSelect",upload:"setupImageUploader",color:"setupColorPicker",content_picker:"setupContentPicker",text_editor:"setupTextEditor",password:""},_.has(c.type_map,c.type)){var d=c.type_map[c.type];_.isFunction(c[d])&&c[d]()}var e={text:"keyup",textarea:"keyup",password:"keyup",color:"colorpickerchange",range:"input propertychange"};c.input_event_map=[{trigger:$.trim(["change",e[c.type]||""].join(" ")),selector:"input[data-type], select[data-type], textarea[data-type]",name:"set_input_value",actions:function(a){if(!_.has(c.item,"syncElements")||!_.has(c.item.syncElements,c.id))throw new Error("WARNING : THE INPUT "+c.id+" HAS NO SYNCED ELEMENT.")}}]},ready:function(){var a=this;a.setupDOMListeners(a.input_event_map,{dom_el:a.container},a),a.callbacks.add(function(){return a.inputReact.apply(a,arguments)}),$.when(a.setupSynchronizer()).done(function(){a.isReady.resolve(a)})},setupSynchronizer:function(){var a=this,b=a.item,c=a.container.find("[data-type]"),d=a.container.find("[data-type]").is("textarea");if(d)throw new Error("TO DO : THE TEXTAREA INPUT ARE NOT READY IN THE SYNCHRONIZER!");var e=new api.Element(c);b.syncElements=b.syncElements||{},b.syncElements[a.id]=e,e.sync(a),e.set(a())},inputReact:function(a,b){var c=this,d=c.item(),e=_.clone(d);e=!_.isObject(e)||_.isEmpty(e)?{}:e,e[c.id]=a,c.item.set(e),_.has(c,"is_preItemInput")||c.item.trigger(c.id+":changed",a)}});var CZRInputMths=CZRInputMths||{};$.extend(CZRInputMths,{setupImageUploader:function(){var a=this,b=a();return a.attachment={},a.container?(this.contentRendered=$.Deferred(),this.setupContentRendering(b,{}),void this.contentRendered.done(function(){a.czrImgUploaderBinding()})):this},setupContentRendering:function(a,b){var c=this;c.attachment.id!=a&&b!==a?(a||(c.attachment={},c.renderImageUploaderTemplate()),wp.media.attachment(a).fetch().done(function(){c.attachment=this.attributes,c.renderImageUploaderTemplate()})):c.attachment.id&&c.attachment.id!==a||c.renderImageUploaderTemplate()},czrImgUploaderBinding:function(){var a=this;_.bindAll(a,"czrImgUploadRemoveFile","czrImgUploadOpenFrame","czrImgUploadSelect"),a.container.on("click keydown",".upload-button",a.czrImgUploadOpenFrame),a.container.on("click keydown",".thumbnail-image img",a.czrImgUploadOpenFrame),a.container.on("click keydown",".remove-button",a.czrImgUploadRemoveFile),a.bind(a.id+":changed",function(b,c){a.contentRendered=$.Deferred(),a.setupContentRendering(b,c)})},czrImgUploadOpenFrame:function(a){api.utils.isKeydownButNotEnterEvent(a)||(a.preventDefault(),this.frame||this.czrImgUploadInitFrame(),this.frame.open())},czrImgUploadInitFrame:function(){var a=this,b=this.getUploaderLabels();a.frame=wp.media({button:{text:b.frame_button},states:[new wp.media.controller.Library({title:b.frame_title,library:wp.media.query({type:"image"}),multiple:!1,date:!1})]}),a.frame.on("select",a.czrImgUploadSelect)},czrImgUploadRemoveFile:function(a){var b=this;api.utils.isKeydownButNotEnterEvent(a)||(a.preventDefault(),b.attachment={},b.set(""))},czrImgUploadSelect:function(){var a=this,b=a.frame.state().get("selection").first().toJSON();window._wpmejsSettings||{};a.attachment=b,a.set(b.id)},renderImageUploaderTemplate:function(){var a=this;if(0!==$("#tmpl-czr-input-img-uploader-view-content").length){var b=wp.template("czr-input-img-uploader-view-content");if(b&&a.container){var c=a.container.find("."+a.module.control.css_attr.img_upload_container);if(c.length){var d={button_labels:a.getUploaderLabels(),settings:a.id,attachment:a.attachment,canUpload:!0};return c.html(b(d)),a.contentRendered.resolve(),a.container.trigger(a.id+":content_rendered"),!0}}}},getUploaderLabels:function(){var a=serverControlParams.translatedStrings,b={select:a.select_image,change:a.change_image,remove:a.remove_image,"default":a.default_image,placeholder:a.placeholder_image,frame_title:a.frame_title_image,frame_button:a.frame_button_image};return _.each(b,function(a,b){if(_.isUndefined(a)){var c=this;throw new Error("A translated string is missing ( "+b+" ) for the image uploader input in module : "+c.module.id)}}),b}}),$.extend(CZRInputMths,{setupColorPicker:function(){var a=this;a.container.find("input").wpColorPicker({change:function(a,b){$(this).val($(this).wpColorPicker("color")).trigger("colorpickerchange").trigger("change")}})}}),$.extend(CZRInputMths,{setupSelect:function(){var a=this;$("select",a.container).not(".no-selecter-js").each(function(){$(this).selecter({})})}});var CZRInputMths=CZRInputMths||{};$.extend(CZRInputMths,{setupContentPicker:function(){var a=this,b=[];a.object=["post"],a.type="post_type",a.container.find(".czr-input").append('<select data-select-type="content-picker-select" class="js-example-basic-simple"></select>'),b=[{trigger:"change",selector:"select[data-select-type]",name:"set_input_value",actions:"updateContentPickerModel"}],a.setupDOMListeners(b,{dom_el:a.container},a),a.setupContentSelecter()},setupContentSelecter:function(){var a=this;a.container.find("select").select2({placeholder:{id:"-1",title:"Select"},data:a.setupSelectedContents(),ajax:{url:serverControlParams.AjaxUrl,type:"POST",dataType:"json",delay:250,debug:!0,data:function(b){var c=b.page?b.page-1:0;return c=b.term?b.page:c,{action:b.term?"search-available-content-items-customizer":"load-available-content-items-customizer",search:b.term,wp_customize:"on",page:c,type:a.type,object:a.object,CZRCpNonce:serverControlParams.CZRCpNonce}},processResults:function(a,b){if(!a.success)return{results:[]};var c=a.data.items,d=[];return _.each(c,function(a){d.push({id:a.id,title:a.title,type_label:a.type_label,object_type:a.object})}),{results:d,pagination:{more:10==a.data.items.length}}}},templateSelection:a.czrFormatContentSelected,templateResult:a.czrFormatContentSelected,escapeMarkup:function(a){return a}})},czrFormatContentSelected:function(a){if(a.loading)return a.text;var b="<div class='content-picker-item clearfix'><div class='content-item-bar'><span class='item-title'>"+a.title+"</span>";return a.type_label&&(b+="<span class='item-type'>"+a.type_label+"</span>"),b+="</div></div>"},setupSelectedContents:function(){var a=this,b=a();return b},updateContentPickerModel:function(a){var b=this,c=$(a.dom_event.currentTarget,a.dom_el),d=$(c,a.dom_el).select2("data");d.length&&(d=_.map(d,function(a){return{id:a.id,type_label:a.type_label,title:a.title,object_type:a.object_type}})),b.set(d)}});var CZRInputMths=CZRInputMths||{};$.extend(CZRInputMths,{setupTextEditor:function(){var a=this;a();if(!a.container)throw new Error("The input container is not set for WP text editor in module."+a.module.id);a.czrRenderInputTextEditorTemplate()&&(a.editor=tinyMCE("czr-customize-content_editor"),a.textarea=$("#czr-customize-content_editor"),a.editorPane=$("#czr-customize-content_editor-pane"),a.dragbar=$("#czr-customize-content_editor-dragbar"),a.editorFrame=$("#czr-customize-content_editor_ifr"),a.mceTools=$("#wp-czr-customize-content_editor-tools"),a.mceToolbar=a.editorPane.find(".mce-toolbar-grp"),a.mceStatusbar=a.editorPane.find(".mce-statusbar"),a.preview=$("#customize-preview"),a.collapse=$(".collapse-sidebar"),a.textpreview=a.container.find("textarea"),a.toggleButton=a.container.find("button.text_editor-button"),a.editorExpanded=new api.Value((!1)),a.czrUpdateTextPreview(),a.czrSetToggleButtonText(a.editorExpanded()),a.czrTextEditorBinding(),a.czrResizeEditorOnUserRequest())},czrTextEditorBinding:function(){var a=this,b=a.editor,c=a.textarea,d=a.toggleButton,e=(a.editorExpanded,a.editorPane);a.bind(a.id+":changed",a.czrUpdateTextPreview),_.bindAll(a,"czrOnVisualEditorChange","czrOnTextEditorChange","czrResizeEditorOnWindowResize"),d.on("click",function(){a.editorExpanded.set(!a.editorExpanded()),a.editorExpanded()&&b.focus()}),a.module.czr_ModuleState.bind(function(b){"expanded"!=b&&a.editorExpanded.set(!1)}),a.editorExpanded.bind(function(d){api.consoleLog("in input.editorExpanded",d,a()),b.locker&&b.locker!==a&&(b.locker.editorExpanded.set(!1),b.locker=null),b.locker&&b.locker!==a||($(document.body).toggleClass("czr-customize-content_editor-pane-open",d),b.locker=a),a.czrSetToggleButtonText(d),d?(b.setContent(wp.editor.autop(a())),b.on("input change keyup",a.czrOnVisualEditorChange),c.on("input",a.czrOnTextEditorChange),a.czrResizeEditor(window.innerHeight-e.height()),$(window).on("resize",a.czrResizeEditorOnWindowResize)):(b.off("input change keyup",a.czrOnVisualEditorChange),c.off("input",a.czrOnTextEditorChange),$(window).off("resize",a.czrResizeEditorOnWindowResize),a.czrResizeReset())})},czrOnVisualEditorChange:function(){var a,b=this,c=b.editor;a=wp.editor.removep(c.getContent()),b.set(a)},czrOnTextEditorChange:function(){var a,b=this,c=b.textarea;a=c.val(),b.set(a)},czrUpdateTextPreview:function(){var a,b=this,c=b();a=c.replace(/(<([^>]+)>)/gi,""),a.length>30&&(a=a.substring(0,34)+"..."),b.textpreview.val(a)},czrRenderInputTextEditorTemplate:function(){var a=this;if(0===$("#tmpl-czr-input-text_editor-view-content").length)throw new Error("Missing js template for text editor input in module : "+a.module.id);var b=wp.template("czr-input-text_editor-view-content"),c=a.container.find("input");if(b&&a.container)return api.consoleLog("Model injected in text editor tmpl : ",a()),c.after(b(a())),!0},czrIsEditorExpanded:function(){return $(document.body).hasClass("czr-customize-content_editor-pane-open")},czrResizeReset:function(){var a=this,b=a.preview,c=a.collapse,d=a.container.closest("ul.accordion-section-content");d.css("padding-bottom",""),b.css("bottom",""),c.css("bottom","")},czrResizeEditor:function(a){var b=window.innerHeight,c=window.innerWidth,d=40,e=1,f=782,g=56,h=8,i=4,j={},k=this,l=k.container.closest("ul.accordion-section-content"),m=k.mceTools,n=k.mceToolbar,o=k.mceStatusbar,p=k.preview,q=k.collapse,r=k.editorPane,s=k.editorFrame;k.editorExpanded()&&(_.isNaN(a)||(resizeHeight=b-a),j.height=resizeHeight,j.components=m.outerHeight()+n.outerHeight()+o.outerHeight(),resizeHeight<d&&(j.height=d),resizeHeight>b-e&&(j.height=b-e),b<r.outerHeight()&&(j.height=b),p.css("bottom",j.height),r.css("height",j.height),s.css("height",j.height-j.components),q.css("bottom",j.height+h),g>b-j.height&&q.css("bottom",o.outerHeight()+i),c<=f?l.css("padding-bottom",j.height):l.css("padding-bottom",""))},czrResizeEditorOnWindowResize:function(){var a=this,b=50,c=a.editorPane;a.editorExpanded()&&_.delay(function(){a.czrResizeEditor(window.innerHeight-c.height())},b)},czrResizeEditorOnUserRequest:function(){var a=this,b=a.dragbar,c=a.editorFrame;b.on("mousedown",function(){a.editorExpanded()&&$(document).on("mousemove.czr-customize-content_editor",function(b){b.preventDefault(),$(document.body).addClass("czr-customize-content_editor-pane-resize"),c.css("pointer-events","none"),a.czrResizeEditor(b.pageY)})}),b.on("mouseup",function(){a.editorExpanded()&&($(document).off("mousemove.czr-customize-content_editor"),$(document.body).removeClass("czr-customize-content_editor-pane-resize"),c.css("pointer-events",""))})},czrSetToggleButtonText:function(a){var b=this;b.toggleButton.text(serverControlParams.translatedStrings[a?"textEditorClose":"textEditorOpen"])}});var CZRItemMths=CZRItemMths||{};$.extend(CZRItemMths,{initialize:function(a,b){if(_.isUndefined(b.module)||_.isEmpty(b.module))throw new Error("No module assigned to item "+a+". Aborting");var c=this;api.Value.prototype.initialize.call(c,null,b),c.isReady=$.Deferred(),c.embedded=$.Deferred(),c.contentRendered=$.Deferred(),$.extend(c,b||{}),c.defaultItemModel=_.clone(b.defaultItemModel)||{id:"",title:""};var d=$.extend(c.defaultItemModel,b.initial_item_model);c.set(d),c.userEventMap=new api.Value([{trigger:"click keydown",selector:["."+c.module.control.css_attr.display_alert_btn,"."+c.module.control.css_attr.cancel_alert_btn].join(","),name:"toggle_remove_alert",actions:["toggleRemoveAlertVisibility"]},{trigger:"click keydown",selector:"."+c.module.control.css_attr.remove_view_btn,name:"remove_item",actions:["removeItem"]},{trigger:"click keydown",selector:["."+c.module.control.css_attr.edit_view_btn,"."+c.module.control.css_attr.item_title].join(","),name:"edit_view",actions:["setViewVisibility"]}]),c.isReady.done(function(){c.module.updateItemsCollection({item:c()}),c.callbacks.add(function(){return c.itemReact.apply(c,arguments)}),c.mayBeRenderItemWrapper(),c.embedded.done(function(){c.itemWrapperViewSetup(d)}),c.contentRendered.done(function(){_.has(c,"czr_Input")||c.setupInputCollectionFromDOM()})})},ready:function(){this.isReady.resolve()},itemReact:function(a,b){var c=this,d=c.module;d.updateItemsCollection({item:a}),c.writeItemViewTitle(a),_.isEmpty(b)&&_.isUndefined(b)||(api.consoleLog("DO WE REALLY NEED TO SEND THIS TO THE PREVIEW WITH _sendItem(to, from) ?"),c._sendItem(a,b))}});var CZRItemMths=CZRItemMths||{};$.extend(CZRItemMths,{setupInputCollectionFromDOM:function(){var a=this,b=a.module;if(a.czr_Input=new api.Values,a.inputConstructor=b.inputConstructor,_.isEmpty(a.defaultItemModel)||_.isUndefined(a.defaultItemModel))throw new Error("No default model found in item "+a.id+". Aborting");var c=$.extend(!0,{},a());c=_.isObject(c)?$.extend(a.defaultItemModel,c):a.defaultItemModel;var d={};$("."+b.control.css_attr.sub_set_wrapper,a.container).each(function(e){var f=$(this).find("[data-type]").attr("data-type"),g=_.has(c,f)?c[f]:"";if(!_.isUndefined(f)&&!_.isEmpty(f)){if(!_.has(c,f))throw new Error("The item property : "+f+" has been found in the DOM but not in the item model : "+a.id+". The input can not be instantiated.");a.czr_Input.add(f,new a.inputConstructor(f,{id:f,type:$(this).attr("data-input-type"),input_value:g,container:$(this),item:a,module:b})),a.czr_Input(f).ready(),d[f]=g}})},removeInputCollection:function(){var a=this;a.czr_Input.each(function(b){a.czr_Input.remove(b.id)})}});var CZRItemMths=CZRItemMths||{};$.extend(CZRItemMths,{_sendItem:function(a,b){var c=this,d=c.module,e=[];_.each(b,function(b,c){b!=a[c]&&e.push(c)}),_.each(e,function(b){d.control.previewer.send("sub_setting",{set_id:d.control.id,id:a.id,changed_prop:b,value:a[b]}),d.trigger("item_sent",{item:a,dom_el:c.container,changed_prop:b})})},removeItem:function(){var a=this,b=this.module,c=_.clone(b.itemCollection());b.trigger("pre_item_dom_remove",a()),a._destroyView(),c=_.without(c,_.findWhere(c,{id:a.id})),b.itemCollection.set(c),b.trigger("pre_item_api_remove",a()),b.czr_Item.remove(a.id)},getModel:function(a){return this()}});var CZRItemMths=CZRItemMths||{};$.extend(CZRItemMths,{mayBeRenderItemWrapper:function(){var a=this;"pending"==a.embedded.state()&&$.when(a.renderItemWrapper()).done(function(b){if(a.container=b,_.isUndefined(a.container)||!a.container.length)throw new Error("In mayBeRenderItemWrapper the Item view has not been rendered : "+a.id);a.embedded.resolve()})},itemWrapperViewSetup:function(a){var b=this;this.module;a=b()||b.initial_item_model,b.czr_ItemState=new api.Value,b.czr_ItemState.set("closed"),b.writeItemViewTitle();var c=function(a,c,d){if(_.isUndefined(a)||!1===a.length)throw new Error("Module : "+b.module.id+", the item content has not been rendered for "+b.id);b.contentRendered.resolve(),b.toggleItemExpansion(c,d)};b.module.isMultiItem()?b.czr_ItemState.callbacks.add(function(d,e){return"resolved"==b.contentRendered.state()?void b.toggleItemExpansion(d,e):void $.when(b.renderItemContent(a)).done(function(a){(c=_.debounce(c,400))(a,d,e)})}):(b.czr_ItemState.callbacks.add(function(a,c){b.toggleItemExpansion.apply(b,arguments)}),$.when(b.renderItemContent(a)).done(function(a){c(a,!0)})),api.CZR_Helpers.setupDOMListeners(b.userEventMap(),{model:a,dom_el:b.container},b)},renderItemWrapper:function(a){var b=this,c=b.module;if(a=a||b(),$_view_el=$("<li>",{"class":c.control.css_attr.single_item,"data-id":a.id,id:a.id}),c.itemsWrapper.append($_view_el),c.isMultiItem()){var d=c.getTemplateEl("rudItemPart",a);if(0===$("#tmpl-"+d).length)throw new Error("Missing template for item "+b.id+". The provided template script has no been found : #tmpl-"+c.getTemplateEl("rudItemPart",a));$_view_el.append($(wp.template(d)(a)))}return $_view_el.append($("<div/>",{
|
13 |
-
"class":c.control.css_attr.item_content})),$_view_el},renderItemContent:function(a){var b=this,c=this.module;if(a=a||b(),0===$("#tmpl-"+c.getTemplateEl("itemInputList",a)).length)throw new Error("No item content template defined for module "+c.id+". The template script id should be : #tmpl-"+c.getTemplateEl("itemInputList",a));var d=wp.template(c.getTemplateEl("itemInputList",a));return d?($(d(a)).appendTo($("."+c.control.css_attr.item_content,b.container)),$($(d(a)),b.container)):this},writeItemViewTitle:function(a){var b=this,c=b.module,d=a||b(),e=_.has(d,"title")?api.CZR_Helpers.capitalize(d.title):d.id;e=api.CZR_Helpers.truncate(e,20),$("."+c.control.css_attr.item_title,b.container).text(e),api.CZR_Helpers.doActions("after_writeViewTitle",b.container,d,b)},setViewVisibility:function(a,b){var c=this,d=this.module;b?c.czr_ItemState.set("expanded_noscroll"):(d.closeAllItems(c.id),_.has(d,"preItem")&&d.preItemExpanded.set(!1),c.czr_ItemState.set("expanded"==c._getViewState()?"closed":"expanded"))},_getViewState:function(){return-1==this.czr_ItemState().indexOf("expanded")?"closed":"expanded"},toggleItemExpansion:function(a,b,c){var d=this,e=this.module;$("."+e.control.css_attr.item_content,d.container).first().slideToggle({duration:c||200,done:function(){var b="closed"!=a;d.container.toggleClass("open",b),e.closeAllAlerts();var c=$(this).siblings().find("."+e.control.css_attr.edit_view_btn);c.toggleClass("active",b),b?c.removeClass("fa-pencil").addClass("fa-minus-square").attr("title",serverControlParams.translatedStrings.close):c.removeClass("fa-minus-square").addClass("fa-pencil").attr("title",serverControlParams.translatedStrings.edit),"expanded"==a&&e._adjustScrollExpandedBlock(d.container)}})},toggleRemoveAlertVisibility:function(a){var b=this,c=this.module,d=$("."+c.control.css_attr.remove_alert_wrapper,b.container).first();a.dom_event;if(c.closeAllItems(),_.has(c,"preItem")&&c.preItemExpanded.set(!1),$("."+c.control.css_attr.remove_alert_wrapper,b.container).not(d).each(function(){$(this).hasClass("open")&&$(this).slideToggle({duration:200,done:function(){$(this).toggleClass("open",!1),$(this).siblings().find("."+c.control.css_attr.display_alert_btn).toggleClass("active",!1)}})}),!wp.template(c.AlertPart)||!b.container)throw new Error("No removal alert template available for items in module :"+c.id);d.html(wp.template(c.AlertPart)({title:b().title||b.id})),d.slideToggle({duration:200,done:function(){var d=!$(this).hasClass("open")&&$(this).is(":visible");$(this).toggleClass("open",d),$(a.dom_el).find("."+c.control.css_attr.display_alert_btn).toggleClass("active",d),d&&c._adjustScrollExpandedBlock(b.container)}})},_destroyView:function(a){this.container.fadeOut({duration:a||400,done:function(){$(this).remove()}})}});var CZRModuleMths=CZRModuleMths||{};$.extend(CZRModuleMths,{initialize:function(a,b){if(_.isUndefined(b.control)||_.isEmpty(b.control))throw new Error("No control assigned to module "+a);var c=this;api.Value.prototype.initialize.call(this,null,b),c.isReady=$.Deferred(),$.extend(c,b||{}),$.extend(c,{crudModulePart:"czr-crud-module-part",rudItemPart:"czr-rud-item-part",ruItemPart:"czr-ru-item-part",itemInputList:"",AlertPart:"czr-rud-item-alert-part"}),c.embedded=$.Deferred(),c.isInSektion()||(c.container=$(c.control.selector),c.embedded.resolve()),c.embedded.done(function(){$.when(c.renderModuleParts()).done(function(a){if(!1===a.length)throw new Error("The items wrapper has not been rendered for module : "+c.id);c.itemsWrapper=a})}),c.itemCollection=new api.Value,c.itemCollection.set([]),c.defaultAPIitemModel={id:"",initial_item_model:{},defaultItemModel:{},control:{},module:{},is_added_by_user:!1},c.defaultItemModel={id:"",title:""},c.itemConstructor=api.CZRItem,c.czr_Item=new api.Values,c.inputConstructor=api.CZRInput,c.isReady.done(function(){c.isDirty=new api.Value(b.dirty||!1),c.set(c.initializeModuleModel(b)),c.callbacks.add(function(){return c.moduleReact.apply(c,arguments)}),c.control.isModuleRegistered(c.id)||c.control.updateModulesCollection({module:b,is_registered:!1}),c.bind("items-collection-populated",function(a){c.itemCollection.callbacks.add(function(){return c.itemCollectionReact.apply(c,arguments)}),c.isMultiItem()&&c._makeItemsSortable(),api.consoleLog("SAVED ITEM COLLECTION OF MODULE "+c.id+" IS READY")}),c.isInSektion()||c.populateSavedItemCollection()})},ready:function(){var a=this;a.isReady.resolve(),api.consoleLog("MODULE READY IN BASE MODULE CLASS : ",a.id)},initializeModuleModel:function(a){var b=this;if(!b.isMultiItem()&&!b.isCrud()&&_.isEmpty(a.items)){var c=_.clone(b.defaultItemModel);a.items=[$.extend(c,{id:b.id})]}return a},itemCollectionReact:function(a,b,c){var d=this,e=d(),f=$.extend(!0,{},e);f.items=a,d.isDirty.set(!0),d.set(f,c||{})},moduleReact:function(a,b,c){var d=this,e=d.control,f=(_.size(b.items)==_.size(a.items)&&!_.isEmpty(_.difference(a.items,b.items)),a.column_id!=b.column_id,_.has(c,"item_collection_sorted")&&c.item_collection_sorted),g=function(){d.control.previewer.refresh()};f&&(_.has(d,"preItem")&&d.preItemExpanded.set(!1),d.closeAllItems(),d.closeAllAlerts()),"postMessage"==api(d.control.id).transport&&f&&!api.CZR_Helpers.has_part_refresh(d.control.id)&&(g=_.debounce(g,500))(),e.updateModulesCollection({module:$.extend(!0,{},a),data:c})},getModuleSection:function(){return this.section},isInSektion:function(){var a=this;return _.has(a,"sektion_id")},isMultiItem:function(){return api.CZR_Helpers.isMultiItemModule(null,this)},isCrud:function(){return api.CZR_Helpers.isCrudModule(null,this)}});var CZRModuleMths=CZRModuleMths||{};$.extend(CZRModuleMths,{populateSavedItemCollection:function(){var a=this;if(!_.isArray(a().items))throw new Error("The saved items collection must be an array in module :"+a.id);_.each(a().items,function(b,c){a.instantiateItem(b).ready()}),_.each(a().items,function(b){if(_.isUndefined(_.findWhere(a.itemCollection(),b.id)))throw new Error("The saved items have not been properly populated in module : "+a.id)}),a.trigger("items-collection-populated")},instantiateItem:function(a,b){var c=this;if(item_candidate=c.prepareItemForAPI(a),!_.has(item_candidate,"id"))throw new Error("CZRModule::instantiateItem() : an item has no id and could not be added in the collection of : "+this.id);if(c.czr_Item.has(item_candidate.id))throw new Error("CZRModule::instantiateItem() : the following item id "+item_candidate.id+" already exists in module.czr_Item() for module "+this.id);if(c.czr_Item.add(item_candidate.id,new c.itemConstructor(item_candidate.id,item_candidate)),!c.czr_Item.has(item_candidate.id))throw new Error("CZRModule::instantiateItem() : instantiation failed for item id "+item_candidate.id+" for module "+this.id);return c.czr_Item(item_candidate.id)},prepareItemForAPI:function(a){var b=this,c={};return a=_.isObject(a)?a:{},_.each(b.defaultAPIitemModel,function(d,e){var f=a[e];switch(e){case"id":_.isEmpty(f)?c[e]=b.generateItemId(b.module_type):c[e]=f;break;case"initial_item_model":_.each(b.getDefaultModel(),function(b,c){_.has(a,c)||(a[c]=b)}),c[e]=a;break;case"defaultItemModel":c[e]=_.clone(b.defaultItemModel);break;case"control":c[e]=b.control;break;case"module":c[e]=b;break;case"is_added_by_user":c[e]=!!_.isBoolean(f)&&f}}),_.has(c,"id")||(c.id=b.generateItemId(b.module_type)),c.initial_item_model.id=c.id,c},generateItemId:function(a,b,c){if(c=c||1,c>100)throw new Error("Infinite loop when generating of a module id.");var d=this;b=b||d._getNextItemKeyInCollection();var e=a+"_"+b;if(!_.has(d,"itemCollection")||!_.isArray(d.itemCollection()))throw new Error("The item collection does not exist or is not properly set in module : "+d.id);return d.isItemRegistered(e)?(b++,c++,d.generateItemId(a,b,c)):e},_getNextItemKeyInCollection:function(){var a=this,b={},c=0;return _.isEmpty(a.itemCollection())||(b=_.max(a.itemCollection(),function(a){return parseInt(a.id.replace(/[^\/\d]/g,""),10)}),c=parseInt(b.id.replace(/[^\/\d]/g,""),10)+1),c},isItemRegistered:function(a){var b=this;return!_.isUndefined(_.findWhere(b.itemCollection(),{id:a}))},updateItemsCollection:function(a){var b=this,c=b.itemCollection();if(_new_collection=_.clone(c),_.has(a,"collection"))return void b.itemCollection.set(a.collection);if(!_.has(a,"item"))throw new Error("updateItemsCollection, no item provided "+b.control.id+". Aborting");var d=_.clone(a.item);_.findWhere(_new_collection,{id:d.id})?_.each(c,function(a,b){a.id==d.id&&(_new_collection[b]=d)}):_new_collection.push(d),b.itemCollection.set(_new_collection)},_getSortedDOMItemCollection:function(){var a=this,b=_.clone(a.itemCollection()),c=[];if($("."+a.control.css_attr.single_item,a.container).each(function(a){var d=_.findWhere(b,{id:$(this).attr("data-id")});d&&(c[a]=d)}),b.length!=c.length)throw new Error("There was a problem when re-building the item collection from the DOM in module : "+a.id);return c}});var CZRModuleMths=CZRModuleMths||{};$.extend(CZRModuleMths,{getDefaultModel:function(a){var b=this;return $.extend(_.clone(b.defaultItemModel),{id:a||""})},_initNewItem:function(a,b){var c,d=this,e={id:""};return b="undefined"!=typeof b?b:_.size(d.itemCollection()),_.isNumber(b)?c=d.module_type+"_"+b:(c=b,b=0),e=a&&!_.isEmpty(a)?$.extend(a,{id:c}):this.getDefaultModel(c),_.has(e,"id")&&d._isItemIdPossible(c)?(_.map(d.getDefaultModel(),function(a,b){_.has(e,b)||(e[b]=a)}),e):d._initNewItem(e,b+1)}});var CZRModuleMths=CZRModuleMths||{};$.extend(CZRModuleMths,{renderModuleParts:function(){var a=this,b=a.isInSektion()?$(a.container).find(".czr-mod-content"):$(a.container);if(a.isCrud()){if(0===$("#tmpl-"+a.crudModulePart).length)throw new Error("No crud Module Part template for module "+a.id+". The template script id should be : #tmpl-"+a.crudModulePart);b.append($(wp.template(a.crudModulePart)({})))}var c=$("<ul/>",{"class":[a.control.css_attr.items_wrapper,a.module_type,a.isMultiItem()?"multi-item-mod":"mono-item-mod",a.isCrud()?"crud-mod":"not-crud-mod"].join(" ")});return b.append(c),$(c,b)},getTemplateEl:function(a,b){var c,d=this;switch(a){case"rudItemPart":c=d.rudItemPart;break;case"ruItemPart":c=d.ruItemPart;break;case"itemInputList":c=d.itemInputList}if(_.isEmpty(c))throw new Error("No valid template has been found in getTemplateEl() "+d.id+". Aborting");return c},getViewEl:function(a){var b=this;return $('[data-id = "'+a+'"]',b.container)},closeAllItems:function(a){var b=this,c=_.clone(b.itemCollection()),d=_.filter(c,function(b){return b.id!=a});_.each(d,function(a){b.czr_Item.has(a.id)&&"expanded"==b.czr_Item(a.id)._getViewState(a.id)&&b.czr_Item(a.id).czr_ItemState.set("closed")})},_adjustScrollExpandedBlock:function(a,b){if(a.length&&!_.isUndefined(this.getModuleSection())){var c,d=this,e=$(".accordion-section-content",d.section.container),f=e.scrollTop(),g=b||90;setTimeout(function(){a.offset().top+a.height()+g>$(window.top).height()&&(c=a.offset().top+a.height()+g-$(window.top).height(),c>0&&e.animate({scrollTop:f+c},500))},50)}},closeAllAlerts:function(){var a=this;$("."+a.control.css_attr.remove_alert_wrapper,a.container).each(function(){$(this).hasClass("open")&&$(this).slideToggle({duration:100,done:function(){$(this).toggleClass("open",!1),$(this).siblings().find("."+a.control.css_attr.display_alert_btn).toggleClass("active",!1)}})})},_makeItemsSortable:function(a){if(!wp.media.isTouchDevice&&$.fn.sortable){var b=this;$("."+b.control.css_attr.items_wrapper,b.container).sortable({handle:"."+b.control.css_attr.item_sort_handle,start:function(){_.has(api,"czrModulePanelState")&&api.czrModulePanelState.set(!1),_.has(api,"czrSekSettingsPanelState")&&api.czrSekSettingsPanelState.set(!1)},update:function(a,c){b.itemCollection.set(b._getSortedDOMItemCollection(),{item_collection_sorted:!0}),"postMessage"!=api(b.control.id).transport||api.CZR_Helpers.has_part_refresh(b.control.id)||_.delay(function(){api.previewer.refresh()},100)}})}}});var CZRDynModuleMths=CZRDynModuleMths||{};$.extend(CZRDynModuleMths,{initialize:function(a,b){var c=this;api.CZRModule.prototype.initialize.call(c,a,b),$.extend(c,{itemPreAddEl:""}),c.itemAddedMessage=serverControlParams.translatedStrings.successMessage,c.userEventMap=new api.Value([{trigger:"click keydown",selector:["."+c.control.css_attr.open_pre_add_btn,"."+c.control.css_attr.cancel_pre_add_btn].join(","),name:"pre_add_item",actions:["renderPreItemView","setPreItemViewVisibility"]},{trigger:"click keydown",selector:"."+c.control.css_attr.add_new_btn,name:"add_item",actions:["closeAllItems","addItem"]}])},ready:function(){var a=this;api.consoleLog("MODULE READY IN DYN MODULE CLASS : ",a.id),a.setupDOMListeners(a.userEventMap(),{dom_el:a.container}),a.preItem=new api.Value(a.getDefaultModel()),a.preItemEmbedded=$.Deferred(),a.preItemEmbedded.done(function(){a.setupPreItemInputCollection()}),a.preItemExpanded=new api.Value((!1)),a.preItemExpanded.callbacks.add(function(b,c){a._togglePreItemViewExpansion(b)}),api.CZRModule.prototype.ready.call(a)},setupPreItemInputCollection:function(){var a=this;a.preItem.czr_Input=new api.Values,$("."+a.control.css_attr.pre_add_wrapper,a.container).find("."+a.control.css_attr.sub_set_wrapper).each(function(b){var c=$(this).find("[data-type]").attr("data-type")||"sub_set_"+b;a.preItem.czr_Input.add(c,new a.inputConstructor(c,{id:c,type:$(this).attr("data-input-type"),container:$(this),item:a.preItem,module:a,is_preItemInput:!0})),a.preItem.czr_Input(c).ready()})},addItem:function(a){var b=this,c=b.preItem(),d=function(){b.preItemExpanded.set(!1),b._resetPreItemInputs(),b.toggleSuccessMessage("off")};if(_.isEmpty(c)||!_.isObject(c))throw new Error("addItem : an item should be an object and not empty. In : "+b.id+". Aborted.");d=_.debounce(d,2e3),b.instantiateItem(c,!0).ready(),b.czr_Item(c.id).isReady.then(function(){b.toggleSuccessMessage("on"),d(),b.trigger("item_added",c),"postMessage"!=api(b.control.id).transport||!_.has(a,"dom_event")||_.has(a.dom_event,"isTrigger")||api.CZR_Helpers.has_part_refresh(b.control.id)||b.control.previewer.refresh()})},_resetPreItemInputs:function(){var a=this;a.preItem.set(a.getDefaultModel()),a.preItem.czr_Input.each(function(b){var c=b.id;_.has(a.getDefaultModel(),c)&&b.set(a.getDefaultModel()._input_id)})}});var CZRDynModuleMths=CZRDynModuleMths||{};$.extend(CZRDynModuleMths,{renderPreItemView:function(a){var b=this;if("pending"==b.preItemEmbedded.state()){if(!_.has(b,"itemPreAddEl")||0===$("#tmpl-"+b.itemPreAddEl).length)return this;var c=wp.template(b.itemPreAddEl);if(!c||!b.container)return this;var d=$("."+b.control.css_attr.pre_add_item_content,b.container);d.prepend(c()),b.preItemEmbedded.resolve()}},_getPreItemView:function(){var a=this;return $("."+a.control.css_attr.pre_add_item_content,a.container)},setPreItemViewVisibility:function(a){var b=this;b.closeAllItems(),b.preItemExpanded.set(!b.preItemExpanded())},_togglePreItemViewExpansion:function(a){var b=this,c=$("."+b.control.css_attr.pre_add_item_content,b.container);c.slideToggle({duration:200,done:function(){var c=$("."+b.control.css_attr.open_pre_add_btn,b.container);$(this).toggleClass("open",a),a?c.find(".fa").removeClass("fa-plus-square").addClass("fa-minus-square"):c.find(".fa").removeClass("fa-minus-square").addClass("fa-plus-square"),c.toggleClass("active",a),$(b.container).toggleClass(b.control.css_attr.adding_new,a),b._adjustScrollExpandedBlock($(this),120)}})},toggleSuccessMessage:function(a){var b=this,c=b.itemAddedMessage,d=$("."+b.control.css_attr.pre_add_wrapper,b.container);return $_success_wrapper=$("."+b.control.css_attr.pre_add_success,b.container),"on"==a?($_success_wrapper.find("p").text(c),$_success_wrapper.css("z-index",1000001).css("height",d.height()+"px").css("line-height",d.height()+"px")):$_success_wrapper.attr("style",""),b.container.toggleClass("czr-model-added","on"==a),this}});var CZRSektionMths=CZRSektionMths||{};$.extend(CZRSektionMths,{initialize:function(a,b){var c=this;api.CZRDynModule.prototype.initialize.call(c,a,b),$.extend(c,{itemPreAddEl:"czr-module-sektion-pre-add-view-content",rudItemPart:"czr-module-sektion-rud-item-part",itemInputList:"czr-module-sektion-view-content"}),c.defaultItemModel={id:"","sektion-layout":1,columns:[]},c.bind("pre_item_dom_remove",function(a){c.removeSektion(a)}),c.defaultDBColumnModel={id:"",sektion_id:"",modules:[]},c.defaultAPIcolumnModel={id:"",modules:[],sektion:{},module_id:"",control_id:"",is_added_by_user:!1},c.czr_Column=new api.Values,c.czr_columnCollection=new api.Value,c.czr_columnCollection.set([]),c.czr_columnCollection.callbacks.add(function(){return c.columnCollectionReact.apply(c,arguments)}),c.itemConstructor=api.CZRItem.extend(c.CZRSektionItem||{}),_.has(c,"modsDragInstance")||c.initModulesDragula(),api.czrModulePanelState=api.czrModulePanelState||new api.Value((!1)),api.czrModulePanelEmbedded=api.czrModulePanelEmbedded||$.Deferred(),c.userEventMap.set(_.union(c.userEventMap(),[{trigger:"click keydown",selector:".add-new-module",name:"add_new_module",actions:"toggleModuleListPanel"},{trigger:"click keydown",selector:"."+c.control.css_attr.open_pre_add_btn,name:"close_module_panel",actions:function(){api.czrModulePanelState(!1)}}])),api.consoleLog("SEKTION MODULE INIT",c.control.params.czr_skope),_.has(api,"czr_activeSkopeId")&&api.consoleLog("SEKTION MODULE INIT",api.czr_activeSkopeId()),api.czrModulePanelBinded=api.czrModulePanelBinded||$.Deferred(),"pending"==api.czrModulePanelBinded.state()&&(api.czrModulePanelState.bind(function(a){var b=api.CZR_Helpers.build_setId(c.control.params.syncCollection),d=api.control(b).syncSektionModule();if($("body").toggleClass("czr-adding-module",a),a)d.renderModulePanel(),api.consoleLog("REACT TO MODULE PANEL STATE",a,c.control.params.syncCollection,d()),api.consoleLog("WHEN DOES THIS ACTION OCCUR?",api.czrModulePanelBinded.state()),d.modsDragInstance.containers.push($("#czr-available-modules-list")[0]);else{var e=$.extend(!0,[],d.modsDragInstance.containers);e=_.filter(e,function(a){return"czr-available-modules-list"!=$(a).attr("id")}),d.modsDragInstance.containers=e,$("#czr-module-list-panel").remove()}}),api.czrModulePanelBinded.resolve()),api.czrSekSettingsPanelState=api.SekSettingsPanelState||new api.Value((!1)),api.czrSekSettingsPanelEmbedded=api.SekSettingsPanelEmbedded||$.Deferred(),c.userEventMap.set(_.union(c.userEventMap(),[{trigger:"click keydown",selector:".czr-edit-sek-settings",name:"edit_sek_settings",actions:"toggleSekSettingsPanel"},{trigger:"click keydown",selector:"."+c.control.css_attr.open_pre_add_btn,name:"close_sektion_panel",actions:function(){api.czrSekSettingsPanelState.set(!1)}}])),api.czrSekSettingsPanelEmbedded.done(function(){api.czrSekSettingsPanelState.callbacks.add(function(){return c.reactToSekSettingPanelState.apply(c,arguments)})}),api.section(c.control.section()).expanded.bind(function(a){api.consoleLog("FIRE SEKTION MODULE!",c.id),c.fireSektionModule()})},fireSektionModule:function(){var a=this;"resolved"!=a.isReady.state()&&(a.ready(),a.control.getSyncCollectionControl().syncSektionModule.set(a))},removeSektion:function(a){var b=this;_.each(a.columns,function(a){_.each(a.modules,function(a){b.control.getSyncCollectionControl().removeModule(a)}),b.czr_Column.has(a.id)&&"resolved"==b.czr_Column(a.id).embedded.state()&&b.czr_Column(a.id).container.remove(),b.removeColumnFromCollection(a)})},closeAllOtherSektions:function(a){var b=this;_clicked_sektion_id=a.closest(".czr-single-item").attr("data-id"),b.czr_Item.each(function(a){_clicked_sektion_id!=a.id?a.czr_ItemState.set("closed"):a.czr_ItemState.set("expanded"!=a.czr_ItemState()?"expanded_noscroll":"expanded")})}});var CZRSektionMths=CZRSektionMths||{};$.extend(CZRSektionMths,{CZRSektionItem:{initialize:function(a,b){var c=this;api.CZRItem.prototype.initialize.call(c,null,b),c.userEventMap.set(_.union(c.userEventMap(),[{trigger:"click keydown",selector:["."+c.module.control.css_attr.edit_view_btn,"."+c.module.control.css_attr.display_alert_btn,"."+c.module.control.css_attr.item_title].join(","),name:"close_module_panel",actions:function(){api.czrModulePanelState.set(!1)}},{trigger:"mouseenter",selector:".czr-item-header",name:"hovering_sek",actions:function(a){c.module.control.previewer.send("start_hovering_sek",{id:c.id})}},{trigger:"mouseleave",selector:".czr-item-header",name:"hovering_sek",actions:function(a){c.module.control.previewer.send("stop_hovering_sek",{id:c.id})}},{trigger:"click keydown",selector:["."+c.module.control.css_attr.edit_view_btn,"."+c.module.control.css_attr.item_title].join(","),name:"send_edit_view",actions:function(a){c.module.control.previewer.send("edit_sek",{id:c.id})}}]));var d=c(),e=b.module;if(!_.has(d,"sektion-layout"))throw new Error("In Sektion Item initialize, no layout provided for "+c.id+".");c.isReady.done(function(){if(_.isEmpty(c().columns)){var a=parseInt(d["sektion-layout"]||1,10);for(i=1;i<a+1;i++){var b=$.extend(!0,{},e.defaultDBColumnModel),f={id:"",sektion_id:c.id};f=$.extend(b,f),e.instantiateColumn($.extend(f,{sektion:c}))}}else _.each(c().columns,function(a){var b=$.extend(!0,{},a);e.instantiateColumn($.extend(b,{sektion:c}))})})},itemReact:function(a,b){var c=this,d=$.extend(!0,{},a);d=c.prepareSekItemForDB(d),api.CZRItem.prototype.itemReact.call(c,d)},prepareSekItemForDB:function(a){var b=this,c={};return _.each(b.module.defaultItemModel,function(d,e){var f=a[e];switch(e){case"id":if(!_.isString(f)||_.isEmpty(f))throw new Error("The sekItem id property must be a not empty string");c[e]=f;break;case"sektion-layout":if(!_.isNumber(parseInt(f,10))||parseInt(f,10)<1)throw new Error("The sekItem layout property must be an int number > 0");c[e]=f;break;case"columns":if(!_.isArray(f))throw new Error("The sekItem columns property must be an array");var g=[];_.each(f,function(a){var c=b.module.prepareColumnForDB(a);g.push(c)}),c[e]=g}}),c}}});var CZRSektionMths=CZRSektionMths||{};$.extend(CZRSektionMths,{prepareColumnForDB:function(a){var b=this,c={};return _.each(b.defaultDBColumnModel,function(b,d){var e=a[d];switch(d){case"id":if(!_.isString(e)||_.isEmpty(e))throw new Error("The column id property must be a not empty string");c[d]=e;break;case"sektion_id":if(_.isString(e)&&!_.isEmpty(e))c[d]=e;else{if(!_.has(a,"sektion"))throw new Error("The column sektion-id property must be a not empty string");c[d]=a.sektion.id}break;case"modules":if(!_.isArray(e))throw new Error("The column modules property must be an array");c[d]=e}}),c},instantiateColumn:function(a,b){var c=this,d=_.clone(a);if(!_.isEmpty(d.id)&&c.czr_Column.has(d.id))throw new Error("The column id already exists in the collection in module : "+c.id);d=c.prepareColumnForAPI(d),c.czr_Column.add(d.id,new api.CZRColumn(d.id,d)),c.czr_Column(d.id).ready()},prepareColumnForAPI:function(a){var b=this,c={};if(!_.isObject(a))throw new Error("Sektion Module::prepareColumnForAPI : a column must be an object to be instantiated.");return _.each(b.defaultAPIcolumnModel,function(d,e){var f=a[e];switch(e){case"id":_.isEmpty(f)?c[e]=b.generateColId():c[e]=f;break;case"modules":if(!_.isArray(f))throw new Error("Sektion Module::prepareColumnForAPI : a collection of modules must be an array. Error in column "+a.id);c[e]=f;break;case"sektion":if(!_.isObject(f)||_.isEmpty(f))throw new Error("Sektion Module::prepareColumnForAPI : a sektion instance is missing for column "+a.id);c[e]=f;break;case"module_id":c[e]=b.id;break;case"control_id":c[e]=b.control.id;break;case"is_added_by_user":c[e]=!!_.isBoolean(f)&&f}}),c},updateColumnCollection:function(a){var b=this,c=b.czr_columnCollection();if(_new_collection=$.extend(!0,[],c),api.consoleLog("in update column collection",b.id,b.czr_columnCollection()),_.has(a,"collection"))return void b.czr_columnCollection.set(a.collection);if(!_.has(a,"column"))throw new Error("updateColumnCollection, no column provided in module "+b.id+". Aborting");var d=_.clone(a.column);if(!_.has(d,"id"))throw new Error("updateColumnCollection, no id provided for a column in module"+b.id+". Aborting");_.findWhere(_new_collection,{id:d.id})?_.each(c,function(a,b){a.id==d.id&&(_new_collection[b]=d)}):_new_collection.push(d),b.czr_columnCollection.set(_new_collection)},removeColumnFromCollection:function(a){var b=this,c=b.czr_columnCollection(),d=$.extend(!0,[],c);d=_.filter(d,function(b){return b.id!=a.id}),b.czr_columnCollection.set(d)},columnCollectionReact:function(a,b){var c=this,d=_.size(b)<_.size(a),e=_.size(b)>_.size(a),f=_.size(b)==_.size(a),g={},h={};if(f&&_.each(a,function(a,c){_.isEqual(a,b[c])||(g=a.sektion(),h=$.extend(!0,{},g),_.each(g.columns,function(b,c){b.id==a.id&&(h.columns[c]=a)}),a.sektion.set(h))}),d){var i=_.filter(a,function(a){return _.isUndefined(_.findWhere(b,{id:a.id}))});i=i[0],g=i.sektion(),_.isUndefined(_.findWhere(g.columns,{id:i.id}))&&(h=$.extend(!0,{},g),h.columns.push(i),i.sektion.set(h))}if(e){var j=_.filter(b,function(b){return _.isUndefined(_.findWhere(a,{id:b.id}))});j=j[0],g=j.sektion(),h=$.extend(!0,{},g),h.columns=_.filter(h.columns,function(a){return a.id!=j.id}),j.sektion.set(h),c.czr_Column.remove(j.id)}},generateColId:function(a,b){if(b=b||1,b>100)throw new Error("Infinite loop when generating of a column id.");var c=this;a=a||c._getNextColKeyInCollection();var d="col_"+a;if(!_.has(c,"czr_columnCollection")||!_.isArray(c.czr_columnCollection()))throw new Error("The column collection does not exist or is not properly set in module : "+c.id);return c.czr_Column.has(d)?c.generateColId(a++,b++):d},_getNextColKeyInCollection:function(){var a=this,b={},c=0;return _.isEmpty(a.czr_columnCollection())||(b=_.max(a.czr_columnCollection(),function(a){return parseInt(a.id.replace(/[^\/\d]/g,""),10)}),c=parseInt(b.id.replace(/[^\/\d]/g,""),10)+1),c},moduleExistsInOneColumnMax:function(a){return 2>this.getModuleColumn(a).length},getModuleColumn:function(a){var b=this,c=[];return _.each(b.czr_columnCollection(),function(b,d){_.findWhere(b.modules,{id:a})&&c.push(b.id)}),c}});var CZRSektionMths=CZRSektionMths||{};$.extend(CZRSektionMths,{initModulesDragula:function(){var a=this;a.modsDragInstance=dragula({copy:function(a,b){return $(a).hasClass("czr-module-candidate")},moves:function(a,b,c,d){return _.contains(c.className.split(" "),"czr-mod-drag-handler")},accepts:function(a,b,c,d){return!_.isUndefined(b)&&"czr-available-modules-list"!=$(b).attr("id")},isContainer:function(a){return!1}}),a.modsDragInstance.on("drag",function(b,c){a.czr_Item.each(function(a){a.czr_ItemState.set("expanded"!=a.czr_ItemState()?"expanded_noscroll":"expanded")})}).on("dragend",function(a,b){}).on("drop",function(b,c,d,e){var f=$(b).attr("data-module-id"),g=$(b).attr("data-module-type"),h=$(c).closest(".czr-column").attr("data-id"),i=$(d).closest(".czr-column").attr("data-id"),j=h==i,k=$(b).hasClass("czr-module-candidate");if(k){if(_.isUndefined(h)||_.isUndefined(g))return;a.userAddedModule(h,g),a.reorderModulesInColumn(h)}else j?a.reorderModulesInColumn(h):a.control.getSyncCollectionControl().czr_Module(f).modColumn.set(h)});autoScroller([a.control.container.closest(".accordion-section-content")[0]],{direction:"vertical",margin:20,pixels:100,scrollWhenOutside:!0,autoScroll:function(){return a.modsDragInstance.dragging}})},userAddedModule:function(a,b){var c=this,d=c.control.getSyncCollectionControl(),e=_.clone(d.getDefaultModuleApiModel());d.trigger("user-module-candidate",$.extend(e,{module_type:b,column_id:a,sektion:c.czr_Column(a).sektion,sektion_id:c.czr_Column(a).sektion.id,is_added_by_user:!0}))},reorderModulesInColumn:function(a){var b=this,c=b.czr_Column(a).getColumnModuleCollectionFromDom(a);b.czr_Column(a).updateColumnModuleCollection({collection:c})},moveModuleFromTo:function(a,b,c){api.consoleLog("ALORS CE BUG?",this(),this.czr_columnCollection());var d=this,e=d.czr_Column(c).getColumnModuleCollectionFromDom(b);_.has(api,"czrModulePanelState")&&api.czrModulePanelState(!1),d.czr_Column(c).updateColumnModuleCollection({collection:e}),d.czr_Column(b).removeModuleFromColumnCollection(a)}});var CZRSektionMths=CZRSektionMths||{};$.extend(CZRSektionMths,{toggleModuleListPanel:function(a){var b=this;api.czrSekSettingsPanelState.set(!1),api.czrModulePanelState.set(!api.czrModulePanelState()),api.czrModulePanelState()?b.czr_Item.each(function(a){a.czr_ItemState.set("expanded"!=a.czr_ItemState()?"expanded_noscroll":"expanded")}):b.closeAllOtherSektions($(a.dom_event.currentTarget,a.dom_el))},renderModulePanel:function(){if(0===$("#tmpl-czr-available-modules").length)throw new Error("No template found to render the module panel list");$("#widgets-left").after($(wp.template("czr-available-modules")())),_.each(api.czrModuleMap,function(a,b){var c=$("<li/>",{"class":"czr-module-candidate","data-module-type":b,html:'<h3><span class="czr-mod-drag-handler fa fa-arrows-alt"></span>'+a.name+"</h3>"});$("#czr-available-modules-list").append(c)})}});var CZRColumnMths=CZRColumnMths||{};$.extend(CZRColumnMths,{initialize:function(a,b){var c=this;api.Value.prototype.initialize.call(c,null,b),$.extend(c,b||{}),c.isReady=$.Deferred(),c.embedded=$.Deferred(),c.czr_columnModuleCollection=new api.Value,c.czr_columnModuleCollection.set(c.modules),c.set(b),c.defautModuleModelInColumn={id:""},api.consoleLog("column.sektion.contentRendered.state()",c.sektion.contentRendered.state()),c.sektion.contentRendered.done(function(){c.container=c.render(),api.consoleLog("COLUMN CONTAINER?",c.container),c.embedded.resolve()}),c.embedded.done(function(){c.mayBeInstantiateColumnModules(),c.callbacks.add(function(){return c.columnReact.apply(c,arguments)}),c.czr_columnModuleCollection.callbacks.add(function(){return c.columnModuleCollectionReact.apply(c,arguments)}),api.CZR_Helpers.setupDOMListeners(c.column_event_map,{dom_el:c.container},c);var a=api.control(c.control_id).getSyncCollectionControl();api.consoleLog("////////////////////////////////////////////////////"),api.consoleLog("column.container?",c.container),api.consoleLog("syncCollectionControl.syncSektionModule()",a.syncSektionModule()()),api.consoleLog("////////////////////////////////////////////////////"),a.syncSektionModule().modsDragInstance.containers.push($(".czr-module-collection-wrapper",c.container)[0])})},ready:function(){var a=this;a.isReady.resolve(),a.sektion.module.updateColumnCollection({column:a()})},mayBeInstantiateColumnModules:function(){var a=this,b=a.sektion.control.getSyncCollectionControl();$.when(b.moduleCollectionReady.promise()).then(function(){_.each(a.czr_columnModuleCollection(),function(a){b.czr_Module.has(a.id)||$.when(_.findWhere(b.czr_moduleCollection(),{id:a.id})).done(function(c){if(_.isUndefined(c)||_.isEmpty(c))throw new Error("Module "+a.id+" was not found in the module collection.");b.instantiateModule(c,{}).ready()})})},function(){},function(){api.consoleLog("NOT SYNCHRONIZED YET")})},render:function(){var a=this;return $view=$(wp.template("czr-sektion-column")({id:a.id})),$view.appendTo($(".czr-column-wrapper",a.sektion.container)),$view},columnReact:function(a,b){this.sektion.module.updateColumnCollection({column:a})}});var CZRColumnMths=CZRColumnMths||{};$.extend(CZRColumnMths,{updateColumnModuleCollection:function(a){var b=this,c=b.czr_columnModuleCollection();if(_new_collection=$.extend(!0,[],c),api.consoleLog("column.czr_columnModuleCollection()",b.czr_columnModuleCollection()),_.has(a,"collection"))return void b.czr_columnModuleCollection.set(a.collection);if(!_.has(a,"module"))throw new Error("updateColumnModuleCollection, no module provided in column "+b.id+". Aborting");var d=b.prepareModuleForColumnAPI(_.clone(a.module));_.findWhere(_new_collection,{id:d.id})?_.each(c,function(a,b){a.id==d.id&&(_new_collection[b]=d)}):_new_collection.push(d),b.czr_columnModuleCollection.set(_new_collection)},columnModuleCollectionReact:function(a,b){var c=this,d=c(),e=_.clone(d),f=[];_.each(a,function(a,b){f[b]={id:a.id}}),e.modules=f,c.set(e)},removeModuleFromColumnCollection:function(a){var b=this,c=b.czr_columnModuleCollection();_new_collection=$.extend(!0,[],c),_new_collection=_.filter(_new_collection,function(b){return b.id!=a.id;
|
14 |
-
}),b.czr_columnModuleCollection.set(_new_collection)},prepareModuleForColumnAPI:function(a){if(!_.isObject(a))throw new Error("prepareModuleForColumnAPI : a module must be an object.");var b=this,c={};return _.each(b.defautModuleModelInColumn,function(d,e){var f=a[e];switch(e){case"id":if(!_.isString(f)||_.isEmpty(f))throw new Error("prepareModuleForColumnAPI : a module id must a string not empty");if(!b.sektion.module.moduleExistsInOneColumnMax(a.id))throw new Error("A module can not be embedded in more than one column at a time. Module "+a.id+" exists in several columns : "+b.sektion.module.getModuleColumn(a.id).join(","));c[e]=f}}),c},getColumnModuleCollectionFromDom:function(a){var b=this,c=$(".czr-module-collection-wrapper",b.container),d=b.sektion.module.czr_Column(a).czr_columnModuleCollection(),e=[];if(api.consoleLog("in GET COLUMN MODULE COLLECTION FROM DOM",a,c,b.container),$(".czr-single-module",c).each(function(c){if(!_.isUndefined(_.findWhere(b.czr_columnModuleCollection(),{id:$(this).attr("data-module-id")})))return void(e[c]=_.findWhere(b.czr_columnModuleCollection(),{id:$(this).attr("data-module-id")}));var f=_.findWhere(d,{id:$(this).attr("data-module-id")});if(!f)throw new Error("The module : "+$(this).attr("data-module-id")+" was not found in the collection of its previous column "+a);e[c]=b.prepareModuleForColumnAPI(f)}),_.isEmpty(e))throw new Error("There was a problem when re-building the column module collection from the DOM in column : "+b.id);return e}});var CZRSektionMths=CZRSektionMths||{};$.extend(CZRSektionMths,{toggleSekSettingsPanel:function(a){var b=this;"pending"==api.czrSekSettingsPanelEmbedded.state()&&$.when(b.renderSekSettingsPanel()).done(function(){api.czrSekSettingsPanelEmbedded.resolve()}),api.czrModulePanelState.set(!1),api.czrSekSettingsPanelState.set(!api.czrSekSettingsPanelState()),b.closeAllOtherSektions($(a.dom_event.currentTarget,a.dom_el))},reactToSekSettingPanelState:function(a){$("body").toggleClass("czr-editing-sektion",a)},renderSekSettingsPanel:function(){var a="";if(0===$("#tmpl-czr-sektion-settings-panel").length)throw new Error("No template found to render the sektion setting panel");try{a=wp.template("czr-sektion-settings-panel")()}catch(b){throw new Error("Error when parsing the template of the sektion setting panel"+b)}$("#widgets-left").after($(a))}});var CZRSocialModuleMths=CZRSocialModuleMths||{};$.extend(CZRSocialModuleMths,{initialize:function(a,b){var c=this;api.CZRDynModule.prototype.initialize.call(c,a,b),$.extend(c,{itemPreAddEl:"czr-module-social-pre-add-view-content",itemInputList:"czr-module-social-item-content"}),this.social_icons=["500px","adn","amazon","android","angellist","apple","behance","behance-square","bitbucket","bitbucket-square","black-tie","btc","buysellads","chrome","codepen","codiepie","connectdevelop","contao","dashcube","delicious","delicious","deviantart","digg","dribbble","dropbox","drupal","edge","empire","expeditedssl","facebook","facebook","facebook-f (alias)","facebook-official","facebook-square","firefox","flickr","fonticons","fort-awesome","forumbee","foursquare","get-pocket","gg","gg-circle","git","github","github","github-alt","github-square","git-square","google","google","google-plus","google-plus-circle","google-plus-official","google-plus-square","google-wallet","gratipay","hacker-news","houzz","instagram","internet-explorer","ioxhost","joomla","jsfiddle","lastfm","lastfm-square","leanpub","linkedin","linkedin","linkedin-square","linux","maxcdn","meanpath","medium","mixcloud","modx","odnoklassniki","odnoklassniki-square","opencart","openid","opera","optin-monster","pagelines","paypal","pied-piper","pied-piper-alt","pinterest","pinterest-p","pinterest-square","product-hunt","qq","rebel","reddit","reddit-alien","reddit-square","renren","rss","rss-square","safari","scribd","sellsy","share-alt","share-alt-square","shirtsinbulk","simplybuilt","skyatlas","skype","slack","slideshare","snapchat","soundcloud","spotify","stack-exchange","stack-overflow","steam","steam-square","stumbleupon","stumbleupon","stumbleupon-circle","telegram","tencent-weibo","trello","tripadvisor","tumblr","tumblr-square","twitch","twitter","twitter","twitter-square","usb","viacoin","vimeo","vimeo-square","vine","vk","weibo","weixin","whatsapp","wikipedia-w","windows","wordpress","xing","xing-square","yahoo","yahoo","y-combinator","yelp","youtube","youtube-play","youtube-square"],c.inputConstructor=api.CZRInput.extend(c.CZRSocialsInputMths||{}),c.itemConstructor=api.CZRItem.extend(c.CZRSocialsItem||{}),this.defaultItemModel={id:"",title:"","social-icon":"","social-link":"","social-color":serverControlParams.social_el_params.defaultSocialColor,"social-target":1},this.itemAddedMessage=serverControlParams.translatedStrings.socialLinkAdded,_.has(api,"czr_activeSectionId")&&c.control.section()==api.czr_activeSectionId()&&"resolved"!=c.isReady.state()&&c.ready(),api.section(c.control.section()).expanded.bind(function(a){"resolved"!=c.isReady.state()&&c.ready()}),c.isReady.then(function(){c.preItem.bind(function(a,b){_.has(a,"social-icon")&&(_.isEqual(a["social-icon"],b["social-icon"])||c.updateItemModel(c.preItem,!0))})})},updateItemModel:function(a,b){var c=a;if(b=b||!1,_.has(c(),"social-icon")&&!_.isEmpty(c()["social-icon"])){var d=$.extend(!0,{},c()),e=api.CZR_Helpers.capitalize(d["social-icon"].replace("fa-","")),f=serverControlParams.social_el_params.defaultSocialColor;e=[serverControlParams.translatedStrings.followUs,e].join(" "),b?(d=$.extend(d,{title:e,"social-color":f}),c.set(d)):(c.czr_Input("title").set(e),c.czr_Input("social-link").set(""),c.czr_Input("social-color").set(f))}},CZRSocialsInputMths:{setupSelect:function(){function a(a){if(!a.id)return a.text;var b=$('<span class="fa '+a.element.value.toLowerCase()+'"> '+a.text+"</span>");return b}var b=this,c=b.item,d=b.module,e=d.social_icons,f=c();_.isEmpty(f.id)&&(e=_.union([serverControlParams.translatedStrings.selectSocialIcon],e)),_.each(e,function(a,c){var d=0===c?"":"fa-"+a.toLowerCase(),e={value:d,html:api.CZR_Helpers.capitalize(a)};d==f["social-icon"]&&$.extend(e,{selected:"selected"}),$('select[data-type="social-icon"]',b.container).append($("<option>",e))}),$('select[data-type="social-icon"]',b.container).select2({templateResult:a,templateSelection:a})},setupIcheck:function(a){var b=this;$("input[type=checkbox]",b.container).each(function(a){0===$(this).closest('div[class^="icheckbox"]').length&&$(this).iCheck({checkboxClass:"icheckbox_flat-grey",checkedClass:"checked",radioClass:"iradio_flat-grey"}).on("ifChanged",function(a){$(this).val(!1===$(this).is(":checked")?0:1),$(a.currentTarget).trigger("change")})})},setupColorPicker:function(a){var b=this,c=(b.item,b.module);$('input[data-type="social-color"]',b.container).wpColorPicker({defaultColor:"rgba(255,255,255,0.7)",change:function(a,b){_.has(b,"color")&&16777215==b.color._color?$(this).val("rgba(255,255,255,0.7)"):$(this).val(b.color.toString()),$(this).trigger("colorpickerchange").trigger("change")}}),$('input[data-type="social-color"]',b.container).closest("div").on("click keydown",function(){c._adjustScrollExpandedBlock(b.container)})}},CZRSocialsItem:{ready:function(){var a=this;api.CZRItem.prototype.ready.call(a),a.bind("social-icon:changed",function(){a.module.updateItemModel(a)})},_buildTitle:function(a,b,c){var d=this,e=d.module;return a=a||("string"==typeof b?api.CZR_Helpers.capitalize(b.replace("fa-","")):""),a=api.CZR_Helpers.truncate(a,20),b=b||"fa-"+e.social_icons[0],c=c||serverControlParams.social_el_params.defaultSocialColor,'<div><span class="fa '+b+'" style="color:'+c+'"></span> '+a+"</div>"},writeItemViewTitle:function(a){var b=this,c=b.module,d=a||b(),e=api.CZR_Helpers.capitalize(d["social-icon"].replace("fa-",""));$("."+c.control.css_attr.item_title,b.container).html(b._buildTitle(e,d["social-icon"],d["social-color"]))}}});var CZRWidgetAreaModuleMths=CZRWidgetAreaModuleMths||{};$.extend(CZRWidgetAreaModuleMths,{initialize:function(a,b){var c=this;api.CZRDynModule.prototype.initialize.call(this,a,b),$.extend(c,{itemPreAddEl:"czr-module-widgets-pre-add-view-content",itemInputList:"czr-module-widgets-item-input-list",itemInputListReduced:"czr-module-widgets-item-input-list-reduced",ruItemPart:"czr-module-widgets-ru-item-part"}),c.inputConstructor=api.CZRInput.extend(c.CZRWZonesInputMths||{}),c.itemConstructor=api.CZRItem.extend(c.CZRWZonesItem||{}),c.serverParams=serverControlParams.widget_area_el_params||{},c.contexts=_.has(c.serverParams,"sidebar_contexts")?c.serverParams.sidebar_contexts:{},c.context_match_map={is_404:"404",is_category:"archive-category",is_home:"home",is_page:"page",is_search:"search",is_single:"single"},c.locations=_.has(c.serverParams,"sidebar_locations")?c.serverParams.sidebar_locations:{},c.defaultItemModel={id:"",title:serverControlParams.translatedStrings.widgetZone,contexts:_.without(_.keys(c.contexts),"_all_"),locations:[c.serverParams.defaultWidgetLocation],description:""},this.itemAddedMessage=serverControlParams.translatedStrings.widgetZoneAdded,this.listenToSidebarInsights(),api.czr_widgetZoneSettings.bind(function(a,b){c.isReady.then(function(){_.each(a,function(a,b){api.sidebar_insights(b).set(a)})})}),c.preItem_location_alert_view_state=new api.Value("closed"),c.preItem_location_alert_view_state.callbacks.add(function(a,b){c._toggleLocationAlertExpansion(c.container,a)}),c.bind("item_added",function(a){c.addWidgetSidebar(a)}),c.bind("pre_item_api_remove",function(a){c.removeWidgetSidebar(a)});var d=new api.Values;d.create("fixed_for_current_session"),d.create("value"),api.section(c.serverParams.dynWidgetSection).fixTopMargin=d,api.section(c.serverParams.dynWidgetSection).fixTopMargin("fixed_for_current_session").set(!1),api.panel("widgets").expanded.callbacks.add(function(a,b){c.widgetPanelReact(),"resolved"!=c.isReady.state()&&c.ready()})},ready:function(){var a=this;api.CZRDynModule.prototype.ready.call(a),a.preItemExpanded.callbacks.add(function(b,c){b&&(a.preItem.czr_Input("locations")._setupLocationSelect(!0),a.preItem.czr_Input("locations").mayBeDisplayModelAlert())})},initializeModuleModel:function(a){var b=this;return a.items=_.union(_.has(b.serverParams,"default_zones")?b.serverParams.default_zones:[],a.items),a},CZRWZonesInputMths:{ready:function(){var a=this;a.bind("locations:changed",function(){a.mayBeDisplayModelAlert()}),api.CZRInput.prototype.ready.call(a)},setupSelect:function(){"locations"==this.id&&this._setupLocationSelect(),"contexts"==this.id&&this._setupContextSelect()},_setupContextSelect:function(){var a=this,b=a(),c=(a.item,a.module);_.each(c.contexts,function(c,d){var e={value:d,html:c};(d==b||_.contains(b,d))&&$.extend(e,{selected:"selected"}),$('select[data-type="contexts"]',a.container).append($("<option>",e))}),$('select[data-type="contexts"]',a.container).select2()},_setupLocationSelect:function(a){function b(a){if(!a.id)return a.text;if(_.contains(f,a.element.value))return a.text;var b=$('<span class="czr-unavailable-location fa fa-ban" title="'+serverControlParams.translatedStrings.unavailableLocation+'"> '+a.text+"</span>");return b}var c=this,d=c(),e=(c.item,c.module),f=api.sidebar_insights("available_locations")();$('select[data-type="locations"]',c.container).children().length||_.each(e.locations,function(a,b){var e={value:b,html:a};(b==d||_.contains(d,b))&&$.extend(e,{selected:"selected"}),$('select[data-type="locations"]',c.container).append($("<option>",e))}),a&&$('select[data-type="locations"]',c.container).select2("destroy"),$('select[data-type="locations"]',c.container).select2({templateResult:b,templateSelection:b})},mayBeDisplayModelAlert:function(){var a=this,b=a.item,c=a.module;if(_.has(b(),"locations")&&!_.isEmpty(b().locations)){var d=$('select[data-type="locations"]',a.container).val(),e=api.sidebar_insights("available_locations")(),f=_.filter(d,function(a){return!_.contains(e,a)});!_.has(b(),"id")||_.isEmpty(b().id)?c.preItem_location_alert_view_state.set(_.isEmpty(f)?"closed":"expanded"):b.czr_itemLocationAlert.set(_.isEmpty(f)?"closed":"expanded")}}},CZRWZonesItem:{initialize:function(a,b){var c=this;c.module;c.czr_itemLocationAlert=new api.Value,api.CZRItem.prototype.initialize.call(c,null,b)},itemWrapperViewSetup:function(){var a=this,b=a.module;api.CZRItem.prototype.itemWrapperViewSetup.call(a),a.czr_itemLocationAlert.set("closed"),a.czr_itemLocationAlert.callbacks.add(function(c,d){b._toggleLocationAlertExpansion(a.container,c)}),a.writeSubtitleInfos(a()),a.czr_ItemState.callbacks.add(function(b,c){-1!=b.indexOf("expanded")&&a.contentRendered.then(function(){a.czr_Input("locations")._setupLocationSelect(!0),a.czr_Input("locations").mayBeDisplayModelAlert()})})},itemReact:function(a,b){var c=this;api.CZRItem.prototype.itemReact.call(c,a,b),c.writeSubtitleInfos(a),c.updateSectionTitle(a).setModelUpdateTimer()},writeSubtitleInfos:function(a){var b=this,c=b.module,d=_.clone(a||b()),e=[],f=[],g="";if(!b.container.length)return this;d.locations=_.isString(d.locations)?[d.locations]:d.locations,_.each(d.locations,function(a){_.has(c.locations,a)?e.push(c.locations[a]):e.push(a)}),d.contexts=_.isString(d.contexts)?[d.contexts]:d.contexts,b._hasModelAllContexts(a)?f.push(c.contexts._all_):_.each(d.contexts,function(a){_.has(c.contexts,a)?f.push(c.contexts[a]):f.push(a)});var h=serverControlParams.translatedStrings.locations,i=serverControlParams.translatedStrings.contexts,j=serverControlParams.translatedStrings.notset;if(e=_.isEmpty(e)?'<span style="font-weight: bold;">'+j+"</span>":e.join(", "),f=_.isEmpty(f)?'<span style="font-weight: bold;">'+j+"</span>":f.join(", "),g="<u>"+h+"</u> : "+e+" <strong>|</strong> <u>"+i+"</u> : "+f,$(".czr-zone-infos",b.container).length)$(".czr-zone-infos",b.container).html(g);else{var k=$("<div/>",{"class":["czr-zone-infos",c.control.css_attr.item_sort_handle].join(" "),html:g});$("."+c.control.css_attr.item_btns,b.container).after(k)}return this},updateSectionTitle:function(a){var b="sidebar-widgets-"+a.id,c=a.title;return api.section.has(b)?($(".accordion-section-title",api.section(b).container).text(c),$(".customize-section-title h3",api.section(b).container).html('<span class="customize-action">'+api.section(b).params.customizeAction+"</span>"+c),this):this},setModelUpdateTimer:function(){var a=this,b=a.module;clearTimeout($.data(this,"modelUpdateTimer")),$.data(this,"modelUpdateTimer",setTimeout(function(){b.control.refreshPreview()},1e3))},_hasModelAllContexts:function(a){var b=this,c=b.module,d=_.keys(c.contexts);if(a=a||this(),_.has(a,"contexts"))return!!_.contains(a.contexts,"_all_")||_.isEmpty(_.difference(_.without(d,"_all_"),a.contexts))},_getMatchingContexts:function(a){var b=this,c=api.czr_wp_conditionals()||{},d=_.filter(b.context_match_map,function(a,b){return!0===c[b]});return _.isEmpty(d)?a:d}},addWidgetSidebar:function(a,b){if(!_.isObject(a)&&_.isEmpty(b))throw new Error("No valid input were provided to add a new Widget Zone.");var c=this,d=_.isEmpty(a)?b:_.clone(a),e=_.isEmpty(a)?b:$.extend(_.clone(_.findWhere(api.Widgets.data.registeredSidebars,{id:c.serverParams.defaultWidgetSidebar})),{name:d.title,id:d.id});api.Widgets.registeredSidebars.add(e);var f=$.extend(_.clone(api.section("sidebar-widgets-"+c.serverParams.defaultWidgetSidebar).params),{id:"sidebar-widgets-"+d.id,instanceNumber:_.max(api.settings.sections,function(a){return a.instanceNumber}).instanceNumber+1,sidebarId:e.id,title:e.name,description:"undefined"!=typeof b?b.description:api.section("sidebar-widgets-"+c.serverParams.defaultWidgetSidebar).params.description,priority:_.max(_.omit(api.settings.sections,c.serverParams.dynWidgetSection),function(a){return a.instanceNumber}).priority+1});api.section.add(f.id,new api.sectionConstructor[f.type](f.id,{params:f})),api.settings.sections[f.id]=f.id;var g="sidebars_widgets["+d.id+"]",h=$.extend(_.clone(api.settings.settings["sidebars_widgets["+c.serverParams.defaultWidgetSidebar+"]"]),{value:[]});api.settings.settings[g]=h,api.create(g,g,h.value,{transport:h.transport,previewer:api.previewer,dirty:!1});var i=$.extend(_.clone(api.settings.controls["sidebars_widgets["+c.serverParams.defaultWidgetSidebar+"]"]),{settings:{"default":g}}),j={};_.each(i,function(a,b){"string"==typeof a&&(a=a.replace(c.serverParams.defaultWidgetSidebar,d.id)),j[b]=a}),j.instanceNumber=_.max(api.settings.controls,function(a){return a.instanceNumber}).instanceNumber+1,api.settings.controls[g]=j,api.control.add(g,new api.controlConstructor[j.type](g,{params:j,previewer:api.previewer})),_.has(this,"container")&&this.container.trigger("widget_zone_created",{model:d,section_id:"sidebar-widgets-"+d.id,setting_id:g})},removeWidgetSidebar:function(a){var b=this;if(!_.isObject(a)||_.isEmpty(a))throw new Error("No valid data were provided to remove a Widget Zone.");api.Widgets.registeredSidebars.remove(a.id),api.section.has("sidebar-widgets-"+a.id)&&(api.section("sidebar-widgets-"+a.id).container.remove(),api.section.remove("sidebar-widgets-"+a.id),delete api.settings.sections["sidebar-widgets-"+a.id]),api.has("sidebars_widgets["+a.id+"]")&&(api.remove("sidebars_widgets["+a.id+"]"),delete api.settings.settings["sidebars_widgets["+a.id+"]"]),api.control.has("sidebars_widgets["+a.id+"]")&&(api.control("sidebars_widgets["+a.id+"]").container.remove(),api.control.remove("sidebars_widgets["+a.id+"]"),delete api.settings.controls["sidebars_widgets["+a.id+"]"]);var c=function(){api.previewer.refresh()};c=_.debounce(c,500),$.when(c()).done(function(){b.trigger("widget_zone_removed",{model:a,section_id:"sidebar-widgets-"+a.id,setting_id:"sidebars_widgets["+a.id+"]"})})},widgetPanelReact:function(){var a=this,b=api.panel("widgets").container.find(".control-panel-content").css("margin-top");api.section(a.serverParams.dynWidgetSection).fixTopMargin("value").set(b);var c=api.section(a.serverParams.dynWidgetSection).container.find(".accordion-section-content"),d=api.panel("widgets").container.find(".control-panel-content"),e=function(){c.css("margin-top",""),d.css("margin-top",api.section(a.serverParams.dynWidgetSection).fixTopMargin("value")())};api.bind("pane-contents-reflowed",_.debounce(function(){e()},150)),a.closeAllItems(),_.has(a,"preItemExpanded")&&a.preItemExpanded.set(!1)},widgetSectionReact:function(a,b){var c=this,d=api.section(c.serverParams.dynWidgetSection),e=d.container.closest(".wp-full-overlay-sidebar-content"),f=d.container.find(".accordion-section-content"),g=d.container.closest(".wp-full-overlay"),h=(d.container.find(".customize-section-back"),d.container.find(".accordion-section-title").first());$("#customize-header-actions").height();a&&(g.removeClass("section-open"),f.css("height","auto"),h.attr("tabindex","0"),f.css("margin-top",""),e.scrollTop(0)),c.closeAllItems(),f.slideToggle()},listenToSidebarInsights:function(){var a=this;api.sidebar_insights("registered").callbacks.add(function(b){var c=_.clone(a.itemCollection());_.map(c,function(c){a.getViewEl(c.id).length&&a.getViewEl(c.id).css("display",_.contains(b,c.id)?"block":"none")})}),api.sidebar_insights("inactives").callbacks.add(function(b){var c=_.clone(a.itemCollection());_.map(c,function(c){a.getViewEl(c.id).length&&(_.contains(b,c.id)?(a.getViewEl(c.id).addClass("inactive"),a.getViewEl(c.id).find(".czr-inactive-alert").length||a.getViewEl(c.id).find(".czr-item-title").append($("<span/>",{"class":"czr-inactive-alert",html:" [ "+serverControlParams.translatedStrings.inactiveWidgetZone+" ]"}))):(a.getViewEl(c.id).removeClass("inactive"),a.getViewEl(c.id).find(".czr-inactive-alert").length&&a.getViewEl(c.id).find(".czr-inactive-alert").remove()))})}),api.sidebar_insights("candidates").callbacks.add(function(b){_.isArray(b)&&_.map(b,function(b){_.isObject(b)&&(api.section.has("sidebar-widgets-"+b.id)||(a.addWidgetSidebar({},b),_.has(api.sidebar_insights("actives")(),b.id)&&api.section.has("sidebar-widgets-"+b.id)&&api.section("sidebar-widgets-"+b.id).activate()))})})},_adjustScrollExpandedBlock:function(a,b){if(a.length){var c,d=$(".wp-full-overlay-sidebar-content").scrollTop(),e=b||90;setTimeout(function(){a.offset().top+a.height()+e>$(window.top).height()&&(c=a.offset().top+a.height()+e-$(window.top).height(),$(".wp-full-overlay-sidebar-content").animate({scrollTop:d+c},600))},50)}},getDefaultModel:function(a){var b=this,c=b.itemCollection(),d=_.clone(b.defaultItemModel);d.contexts;return $.extend(d,{title:"Widget Zone "+(1*_.size(c)+1)})},getTemplateEl:function(a,b){var c,d=this;switch("rudItemPart"==a?a=_.has(b,"is_builtin")&&b.is_builtin?"ruItemPart":a:"itemInputList"==a&&(a=_.has(b,"is_builtin")&&b.is_builtin?"itemInputListReduced":a),a){case"rudItemPart":c=d.rudItemPart;break;case"ruItemPart":c=d.ruItemPart;break;case"itemInputList":c=d.itemInputList;break;case"itemInputListReduced":c=d.itemInputListReduced}if(_.isEmpty(c))throw new Error("No valid template has been found in getTemplateEl()");return c},_toggleLocationAlertExpansion:function(a,b){var c=a.find(".czr-location-alert");if(!c.length){var d=["<span>"+serverControlParams.translatedStrings.locationWarning+"</span>",api.CZR_Helpers.getDocSearchLink(serverControlParams.translatedStrings.locationWarning)].join("");c=$("<div/>",{"class":"czr-location-alert",html:d,style:"display:none"}),$('select[data-type="locations"]',a).closest("div").after(c)}c.toggle("expanded"==b)}});var CZRFeaturedPageModuleMths=CZRFeaturedPageModuleMths||{};$.extend(CZRFeaturedPageModuleMths,{initialize:function(a,b){var c=this;api.CZRDynModule.prototype.initialize.call(c,a,b),$.extend(c,{itemPreAddEl:"czr-module-fp-pre-add-view-content",itemInputList:"czr-module-fp-view-content"}),c.inputConstructor=api.CZRInput.extend(c.CZRFeaturedPagesInputMths||{}),c.itemConstructor=api.CZRItem.extend(c.CZRFeaturedPagesItem||{}),this.defaultItemModel={id:"",title:"","fp-post":"","fp-title":"","fp-text":"","fp-image":""},this.itemAddedMessage=serverControlParams.translatedStrings.featuredPageAdded,api.section(c.control.section()).expanded.bind(function(a){"resolved"!=c.isReady.state()&&c.ready()})},addItem:function(a){var b=this,c=b.preItem,d=c();if(_.isEmpty(d)||!_.isObject(d))throw new Error("addItem : an item should be an object and not empty. In : "+b.id+". Aborted.");var e=d["fp-post"];if("undefined"!=typeof e){e=e[0];var f=function(e){c.set($.extend(d,e)),api.CZRDynModule.prototype.addItem.call(b,a)};b.CZRFeaturedPagesItem.setContentAjaxInfo(e.id,{},f)}},CZRFeaturedPagesInputMths:{ready:function(){var a=this;a.bind("fp-post:changed",function(){a.updateItemModel()}),a.bind("fp-title:changed",function(){a.updateItemTitle()}),api.CZRInput.prototype.ready.call(a)},setupImageUploader:function(){var a=this;a.container.bind("fp-image:content_rendered",function(){a.addResetDefaultButton()}),a.container.on("click keydown",".default-fpimage-button",function(){a.setThumbnailAjax()}),api.CZRInput.prototype.setupImageUploader.call(a)},updateItemModel:function(a){var b=this,c=this.item,d=_.has(b,"is_preItemInput")&&b.is_preItemInput;if(_.has(c(),"fp-post")&&!_.isEmpty(c()["fp-post"])){var e=_.clone(c()),f=e["fp-post"][0],g=f.title;d?b.module.preItemInput:c.czr_Input;if(d)$.extend(e,{title:g,"fp-title":g}),c.set(e);else{var h=function(a){_.each(a,function(a,b){c.czr_Input(b).set(a)})};c.setContentAjaxInfo(f.id,{"fp-title":g},h)}}},updateItemTitle:function(a){var b=this,c=this.item,d=_.has(b,"is_preItemInput")&&b.is_preItemInput;if(!d){var e=_.clone(c()),f="undefined"!=typeof e["fp-title"]?e["fp-title"]:"";$.extend(e,{title:f}),c.set(e)}},setThumbnailAjax:function(){var a,b=this.item,c=b.czr_Input("fp-post")();"undefined"!=typeof c&&(c=c[0],a=c.id,$(".fpimage-reset-messages p").hide(),request=wp.ajax.post("get-fp-post-tb",{wp_customize:"on",id:a,CZRFPNonce:serverControlParams.CZRFPNonce}),request.done(function(a){var c=a,d=b.czr_Input("fp-image");0!==c.length?($(".fpimage-reset-messages .success",d.container).show("fast").fadeOut(),d.set(c)):$(".fpimage-reset-messages .warning",d.container).show("fast").delay(2e3).fadeOut()}),request.fail(function(a){"undefined"!=typeof console&&console.error&&console.error(a)}))},addResetDefaultButton:function(a){var b=this,c=(b.item,serverControlParams.translatedStrings.featuredPageImgReset),d=serverControlParams.translatedStrings.featuredPageResetSucc,e=serverControlParams.translatedStrings.featuredPageResetErr,f='<div class="fpimage-reset-messages" style="clear:both"><p class="success" style="display:none">'+d+'</p><p class="warning" style="display:none">'+e+"</p></div>";$(".actions",b.container).append('<button type="button" class="button default-fpimage-button">'+c+"</button>"),$(".fpimage-reset-messages",b.container).detach(),$(b.container).append(f)}},CZRFeaturedPagesItem:{setContentAjaxInfo:function(a,b,c){var d=b||{};return request=wp.ajax.post("get-fp-post",{wp_customize:"on",id:a,CZRFPNonce:serverControlParams.CZRFPNonce}),request.done(function(a){var b=a.post_info;0!==b.length&&($.extend(d,{"fp-image":b.thumbnail,"fp-text":b.excerpt}),"function"==typeof c&&c(d))}),request.fail(function(a){"undefined"!=typeof console&&console.error&&console.error(a)}),request},writeItemViewTitle:function(a){var b=this,c=b.module,d=a||b(),e=d.title?d.title:serverControlParams.translatedStrings.featuredPageTitle;e=api.CZR_Helpers.truncate(e,25),$("."+c.control.css_attr.item_title,b.container).html(e)}}});var CZRTextModuleMths=CZRTextModuleMths||{};$.extend(CZRTextModuleMths,{initialize:function(a,b){var c=this;api.CZRModule.prototype.initialize.call(c,a,b),$.extend(c,{itemInputList:"czr-module-text-view-content"}),c.defaultItemModel={id:"",text:""}}});var CZRSlideModuleMths=CZRSlideModuleMths||{};$.extend(CZRSlideModuleMths,{initialize:function(a,b){var c=this;api.CZRDynModule.prototype.initialize.call(c,a,b),$.extend(c,{itemPreAddEl:"czr-module-slide-pre-item-input-list",itemInputList:"czr-module-slide-item-input-list"}),c.inputConstructor=api.CZRInput.extend(c.CZRSliderInputMths||{}),c.itemConstructor=api.CZRItem.extend(c.CZRSliderItem||{}),this.defaultItemModel={id:"",title:"","slide-background":"","slide-title":"","slide-subtitle":""},this.itemAddedMessage=serverControlParams.translatedStrings.slideAdded},CZRSliderInputMths:{ready:function(){var a=this;a.bind("slide-title:changed",function(){a.updateItemTitle()}),api.CZRInput.prototype.ready.call(a)},updateItemTitle:function(a){var b=this,c=this.item,d=(_.has(b,"is_preItemInput")&&b.is_preItemInput,_.clone(c())),e=d["slide-title"];$.extend(d,{title:e}),c.set(d)}},CZRSliderItem:{writeItemViewTitle:function(a){var b=this,c=b.module,d=a||b(),e=d.title?d.title:serverControlParams.translatedStrings.slideTitle;e=api.CZR_Helpers.truncate(e,25),$("."+c.control.css_attr.item_title,b.container).html(e)}}});var CZRTextEditorModuleMths=CZRTextEditorModuleMths||{};$.extend(CZRTextEditorModuleMths,{initialize:function(a,b){var c=this;api.CZRModule.prototype.initialize.call(c,a,b),$.extend(c,{itemInputList:"czr-module-text_editor-item-content"}),c.inputConstructor=api.CZRInput.extend(c.CZRTextEditorInputMths||{}),c.itemConstructor=api.CZRItem.extend(c.CZRTextEditorItem||{}),this.defaultItemModel={id:"",text:""}},CZRTextEditorInputMths:{},CZRTextEditorItem:{}});var CZRBodyBgModuleMths=CZRBodyBgModuleMths||{};$.extend(CZRBodyBgModuleMths,{initialize:function(a,b){var c=this;api.CZRModule.prototype.initialize.call(c,a,b),$.extend(c,{itemInputList:"czr-module-bodybg-item-content"}),c.inputConstructor=api.CZRInput.extend(c.CZRBodyBgInputMths||{}),c.itemConstructor=api.CZRItem.extend(c.CZBodyBgItemMths||{}),c.defaultItemModel={"background-color":"#eaeaea","background-image":"","background-repeat":"no-repeat","background-attachment":"fixed","background-position":"center center","background-size":"cover"},api.consoleLog("module ID",c.id),_.has(api,"czr_activeSectionId")&&c.control.section()==api.czr_activeSectionId()&&"resolved"!=c.isReady.state()&&c.ready(),api.section(c.control.section()).expanded.bind(function(a){"resolved"!=c.isReady.state()&&c.ready()})},CZRBodyBgInputMths:{setupSelect:function(){var a=this,b={"background-repeat":"bg_repeat_options","background-attachment":"bg_attachment_options","background-position":"bg_position_options"},c=(a.item,serverControlParams.body_bg_module_params),d={};a.module;_.has(b,a.id)&&(_.isUndefined(c)||_.isUndefined(c[b[a.id]])||(d=c[b[a.id]],_.isEmpty(d)||(_.each(d,function(b,c){var d={value:c,html:b};(c==a()||_.contains(a(),c))&&$.extend(d,{selected:"selected"}),$("select[data-type]",a.container).append($("<option>",d))}),$("select[data-type]",a.container).select2())))}},CZBodyBgItemMths:{ready:function(){var a=this;api.CZRItem.prototype.ready.call(a),a.czr_Input("background-image").isReady.done(function(b){var c=function(b){var c=!_.isEmpty(b)||_.isNumber(b);_.each(["background-repeat","background-attachment","background-position","background-size"],function(b){a.czr_Input(b).container.toggle(c||!1)})};c(b()),a.bind("background-image:changed",function(){c(a.czr_Input("background-image")())})})}}});var CZRBaseControlMths=CZRBaseControlMths||{};$.extend(CZRBaseControlMths,{initialize:function(a,b){var c=this;c.css_attr=_.has(serverControlParams,"css_attr")?serverControlParams.css_attr:{},api.Control.prototype.initialize.call(c,a,b)},refreshPreview:function(a){this.previewer.refresh()}});var CZRBaseModuleControlMths=CZRBaseModuleControlMths||{};$.extend(CZRBaseModuleControlMths,{initialize:function(a,b){var c=this;c.czr_Module=new api.Values,c.czr_moduleCollection=new api.Value,c.czr_moduleCollection.set([]),c.moduleCollectionReady=$.Deferred(),c.moduleCollectionReady.done(function(a){!c.isMultiModuleControl(b.params),c.czr_moduleCollection.callbacks.add(function(){return c.moduleCollectionReact.apply(c,arguments)})}),c.isMultiModuleControl(b.params)&&(c.syncSektionModule=new api.Value),api.CZRBaseControl.prototype.initialize.call(c,a,b)},ready:function(){var a=this;if(a.isMultiModuleControl())a.syncSektionModule.bind(function(b,c){"resolved"!=a.moduleCollectionReady.state()&&(a.registerModulesOnInit(b),a.moduleCollectionReady.resolve())});else{var b={};_.each(a.getSavedModules(),function(c,d){b=c,a.instantiateModule(c,{}),a.container.attr("data-module",c.id)}),a.moduleCollectionReady.resolve(b)}a.bind("user-module-candidate",function(b){a.instantiateModule(b,{}).ready(b.is_added_by_user)})},getDefaultModuleApiModel:function(){var a={id:"",module_type:"",items:[],crud:!1,multi_item:!1,control:{}};return this.isMultiModuleControl()?$.extend(a,{column_id:"",sektion:{},sektion_id:"",is_added_by_user:!1,dirty:!1}):$.extend(a,{section:""})},getDefaultModuleDBModel:function(){var a={items:[]};return this.isMultiModuleControl()?$.extend(a,{id:"",module_type:"",column_id:"",sektion_id:"",dirty:!1}):a},isMultiModuleControl:function(a){return"czr_multi_module"==(a||this.params).type},getSyncCollectionControl:function(){var a=this;if(_.isUndefined(a.params.syncCollection))throw new Error("Control "+a.id+" has no synchronized sektion control defined.");return api.control(api.CZR_Helpers.build_setId(a.params.syncCollection))},getSavedModules:function(){var a=this,b=[],c=a.params.module_type;if(a.isMultiModuleControl())b=$.extend(!0,[],api(a.id)());else{!api.CZR_Helpers.isMultiItemModule(c)||_.isEmpty(api(a.id)())||_.isObject(api(a.id)())||api.consoleLog("Module Control Init for "+a.id+" : a mono item module control value should be an object if not empty.");var d=_.isArray(api(a.id)())?api(a.id)():[api(a.id)()];b.push({id:api.CZR_Helpers.getOptionName(a.id)+"_"+a.params.type,module_type:a.params.module_type,section:a.section(),items:$.extend(!0,[],d)})}return b},isModuleRegistered:function(a){var b=this;return!_.isUndefined(_.findWhere(b.czr_moduleCollection(),{id:a}))}});var CZRBaseModuleControlMths=CZRBaseModuleControlMths||{};$.extend(CZRBaseModuleControlMths,{instantiateModule:function(a,b){if(!_.has(a,"id"))throw new Error("CZRModule::instantiateModule() : a module has no id and could not be added in the collection of : "+this.id+". Aborted.");var c=this;if((_.isUndefined(b)||_.isEmpty(b))&&(b=c.getModuleConstructor(a)),
|
15 |
-
!_.isEmpty(a.id)&&c.czr_Module.has(a.id))throw new Error("The module id already exists in the collection in control : "+c.id);var d=c.prepareModuleForAPI(a);if(c.czr_Module.add(d.id,new b(d.id,d)),!c.czr_Module.has(d.id))throw new Error("instantiateModule() : instantiation failed for module id "+d.id+" in control "+c.id);return c.czr_Module(d.id)},getModuleConstructor:function(a){var b=this,c={},d={};if(!_.has(a,"module_type"))throw new Error("CZRModule::getModuleConstructor : no module type found for module "+a.id);if(!_.has(api.czrModuleMap,a.module_type))throw new Error("Module type "+a.module_type+" is not listed in the module map api.czrModuleMap.");var e=api.czrModuleMap[a.module_type].mthds,f=api.czrModuleMap[a.module_type].crud,g=f?api.CZRDynModule:api.CZRModule;if(_.isEmpty(a.sektion_id)?d=g.extend(e):(c=g.extend(e),d=c.extend(b.getMultiModuleExtender(c))),_.isUndefined(d)||_.isEmpty(d)||!d)throw new Error("CZRModule::getModuleConstructor : no constructor found for module type : "+a.module_type+".");return d},prepareModuleForAPI:function(a){if(!_.isObject(a))throw new Error("prepareModuleForAPI : a module must be an object to be instantiated.");var b=this,c={};return _.each(b.getDefaultModuleApiModel(),function(d,e){var f=a[e];switch(e){case"id":_.isEmpty(f)?c[e]=b.generateModuleId(a.module_type):c[e]=f;break;case"module_type":if(!_.isString(f)||_.isEmpty(f))throw new Error("prepareModuleForAPI : a module type must a string not empty");c[e]=f;break;case"items":if(!_.isArray(f))throw new Error("prepareModuleForAPI : a module item list must be an array");c[e]=f;break;case"crud":if(_.has(api.czrModuleMap,a.module_type))f=api.czrModuleMap[a.module_type].crud;else if(!_.isUndefined(f)&&!_.isBoolean(f))throw new Error('prepareModuleForAPI : the module param "crud" must be a boolean');c[e]=f||!1;break;case"multi_item":if(_.has(api.czrModuleMap,a.module_type))f=api.czrModuleMap[a.module_type].crud||api.czrModuleMap[a.module_type].multi_item;else if(!_.isUndefined(f)&&!_.isBoolean(f))throw new Error('prepareModuleForAPI : the module param "multi_item" must be a boolean');c[e]=f||!1;break;case"control":c[e]=b;break;case"section":if(!_.isString(f)||_.isEmpty(f))throw new Error("prepareModuleForAPI : a module section must be a string not empty");c[e]=f;break;case"column_id":if(!_.isString(f)||_.isEmpty(f))throw new Error("prepareModuleForAPI : a module column id must a string not empty");c[e]=f;break;case"sektion":if(!_.isObject(f)||_.isEmpty(f))throw new Error("prepareModuleForAPI : a module sektion must be an object not empty");c[e]=f;break;case"sektion_id":if(!_.isString(f)||_.isEmpty(f))throw new Error("prepareModuleForAPI : a module sektion id must be a string not empty");c[e]=f;break;case"is_added_by_user":if(!_.isUndefined(f)&&!_.isBoolean(f))throw new Error('prepareModuleForAPI : the module param "is_added_by_user" must be a boolean');c[e]=f||!1;break;case"dirty":c[e]=f||!1}}),c},generateModuleId:function(a,b,c){if(c=c||1,c>100)throw new Error("Infinite loop when generating of a module id.");var d=this;b=b||d._getNextModuleKeyInCollection();var e=a+"_"+b;if(!_.has(d,"czr_moduleCollection")||!_.isArray(d.czr_moduleCollection()))throw new Error("The module collection does not exist or is not properly set in control : "+d.id);return d.isModuleRegistered(e)?(b++,c++,d.generateModuleId(a,b,c)):e},_getNextModuleKeyInCollection:function(){var a=this,b={},c=0;return _.isEmpty(a.czr_moduleCollection())||(b=_.max(a.czr_moduleCollection(),function(a){return parseInt(a.id.replace(/[^\/\d]/g,""),10)}),c=parseInt(b.id.replace(/[^\/\d]/g,""),10)+1),c}});var CZRBaseModuleControlMths=CZRBaseModuleControlMths||{};$.extend(CZRBaseModuleControlMths,{registerModulesOnInit:function(a){var b=this,c=[];_.each(b.getSavedModules(),function(d,e){if(!a.czr_Item.has(d.sektion_id))return api.consoleLog("Warning Module "+d.id+" is orphan : it has no sektion to be embedded to. It Must be removed."),void c.push(d);var f=a.czr_Item(d.sektion_id);if(_.isUndefined(f))throw new Error("sektion instance missing. Impossible to instantiate module : "+d.id);$.extend(d,{sektion:f}),b.updateModulesCollection({module:d})}),b.moduleCollectionReady.then(function(){_.isEmpty(c)||b.moduleCollectionReact(b.czr_moduleCollection(),[],{orphans_module_removal:c})})},updateModulesCollection:function(a){var b=this,c=b.czr_moduleCollection(),d=$.extend(!0,[],c);if(_.has(a,"collection"))return void b.czr_moduleCollection.set(a.collection,a.data||{});if(!_.has(a,"module"))throw new Error("updateModulesCollection, no module provided "+b.id+". Aborting");var e=b.prepareModuleForAPI(_.clone(a.module));_.findWhere(d,{id:e.id})?_.each(c,function(a,b){a.id==e.id&&(d[b]=e)}):d.push(e);var f={};_.has(a,"data")&&(f=$.extend(!0,{},a.data),$.extend(f,{module:e})),b.czr_moduleCollection.set(d,f)},moduleCollectionReact:function(a,b,c){var d=this,e=_.size(a)>_.size(b),f=_.size(b)>_.size(a);_.size(b)==_.size(a);if(is_collection_sorted=!1,f){var g=_.filter(b,function(b){return _.isUndefined(_.findWhere(a,{id:b.id}))});g=g[0],d.czr_Module.remove(g.id)}_.isObject(c)&&_.has(c,"module")&&(c.module=d.prepareModuleForDB($.extend(!0,{},c.module))),!d.isMultiModuleControl()&&e||api(this.id).set(d.filterModuleCollectionBeforeAjax(a),c)},filterModuleCollectionBeforeAjax:function(a){var b=this,c=$.extend(!0,[],a);if(_.each(a,function(a,d){var e=$.extend(!0,{},a);c[d]=b.prepareModuleForDB(e)}),b.isMultiModuleControl())return c;if(_.size(a)>1)throw new Error("There should not be several modules in the collection of control : "+b.id);if(!_.isArray(a)||_.isEmpty(a)||!_.has(a[0],"items"))throw new Error("The setting value could not be populated in control : "+b.id);var d=a[0].id;if(!b.czr_Module.has(d))throw new Error("The single module control ("+b.id+") has no module registered with the id "+d);var e=b.czr_Module(d);if(!_.isArray(e().items))throw new Error("The module "+d+" should be an array in control : "+b.id);return e.isMultiItem()?e().items:e().items[0]||[]},prepareModuleForDB:function(a){if(!_.isObject(a))throw new Error("MultiModule Control::prepareModuleForDB : a module must be an object. Aborting.");var b=this,c={};return _.each(b.getDefaultModuleDBModel(),function(d,e){if(!_.has(a,e))throw new Error("MultiModule Control::prepareModuleForDB : a module is missing the property : "+e+" . Aborting.");var f=a[e];switch(e){case"items":if(!_.isArray(f))throw new Error("prepareModuleForDB : a module item list must be an array");c[e]=f;break;case"id":if(!_.isString(f)||_.isEmpty(f))throw new Error("prepareModuleForDB : a module id must a string not empty");c[e]=f;break;case"module_type":if(!_.isString(f)||_.isEmpty(f))throw new Error("prepareModuleForDB : a module type must a string not empty");c[e]=f;break;case"column_id":if(!_.isString(f)||_.isEmpty(f))throw new Error("prepareModuleForDB : a module column id must a string not empty");c[e]=f;break;case"sektion_id":if(!_.isObject(a.sektion)||!_.has(a.sektion,"id"))throw new Error("prepareModuleForDB : a module sektion must be an object with an id.");c[e]=a.sektion.id;break;case"dirty":if(b.czr_Module.has(a.id)?c[e]=b.czr_Module(a.id).isDirty():c[e]=f,!_.isBoolean(c[e]))throw new Error("prepareModuleForDB : a module dirty state must be a boolean.")}}),c}});var CZRMultiModuleControlMths=CZRMultiModuleControlMths||{};$.extend(CZRMultiModuleControlMths,{initialize:function(a,b){var c=this;api.consoleLog("IN MULTI MODULE INITIALIZE ? ",b),api(a).callbacks.add(function(){return c.syncColumn.apply(c,arguments)}),api.CZRBaseModuleControl.prototype.initialize.call(c,a,b)},ready:function(){var a=this;api.consoleLog("MODULE-COLLECTION CONTROL READY",this.id),api.CZRBaseModuleControl.prototype.ready.apply(a,arguments)},syncColumn:function(a,b,c){if(api.consoleLog("IN SYNC COLUMN",a,b,c),(_.isUndefined(c)||!c.silent)&&(api.consoleLog("IN SYNXXX",api.control("hu_theme_options[module-collection]").syncSektionModule()(),this.syncSektionModule()(),this.id),!_.has(c,"orphans_module_removal"))){var d=api.control(this.id),e=_.filter(a,function(a,c){return!_.findWhere(b,{id:a.id})});_.isEmpty(e)||(api.consoleLog("ADDED MODULE?",e),_.each(e,function(a){d.syncSektionModule().czr_Column(a.column_id).updateColumnModuleCollection({module:a})}));var f=_.filter(b,function(b,c){return!_.findWhere(a,{id:b.id})});_.isEmpty(f)||_.each(f,function(a){d.syncSektionModule().czr_Column(a.column_id).removeModuleFromColumnCollection(a)}),_.size(b)==_.size(a)&&_.has(c,"module")&&_.has(c,"source_column")&&_.has(c,"target_column")&&$.when(d.syncSektionModule().moveModuleFromTo(c.module,c.source_column,c.target_column)).done(function(){d.syncSektionModule().control.trigger("module-moved",{module:c.module,source_column:c.source_column,target_column:c.target_column})}),d.trigger("columns-synchronized",a)}},removeModule:function(a){var b=this;b.czr_Module.has(a.id)&&"resolved"==b.czr_Module(a.id).embedded.state()&&b.czr_Module(a.id).container.remove(),b.removeModuleFromCollection(a)},removeModuleFromCollection:function(a){var b=this,c=b.czr_moduleCollection(),d=$.extend(!0,[],c);d=_.filter(d,function(b){return b.id!=a.id}),b.czr_moduleCollection.set(d)}});var CZRMultiModuleControlMths=CZRMultiModuleControlMths||{};$.extend(CZRMultiModuleControlMths,{getMultiModuleExtender:function(a){var b=this;return $.extend(b.CZRModuleExtended,{initialize:function(b,c){var d=this;a.prototype.initialize.call(d,b,c),api.consoleLog("MODULE INSTANTIATED : ",d.id),$.extend(d,{singleModuleWrapper:"czr-single-module-wrapper",sektionModuleTitle:"czr-module-sektion-title-part",ruModuleEl:"czr-ru-module-sektion-content"}),d.czr_ModuleState=new api.Value((!1)),d.isReady.done(function(){d.setupModuleView()}),d.moduleTitleEmbedded=$.Deferred(),d.modColumn=new api.Value,d.modColumn.set(c.column_id),d.modColumn.bind(function(a,b){api.consoleLog("MODULE "+d.id+" HAS BEEN MOVED TO COLUMN",a,d());var c=d(),e=$.extend(!0,{},c);e.column_id=a,d.set(e,{target_column:a,source_column:b})})},ready:function(b){var c=this;api.consoleLog("MODULE READY IN EXTENDED MODULE CLASS : ",c.id),$.when(c.renderModuleWrapper(b)).done(function(a){if(_.isUndefined(a)||!1===a.length)throw new Error("Module container has not been embedded for module :"+c.id);c.container=a,c.embedded.resolve()}),a.prototype.ready.call(c)}}),b.CZRModuleExtended},CZRModuleExtended:{renderModuleWrapper:function(a){var b=this;if("resolved"==b.embedded.state())return b.container;if(0===$("#tmpl-"+b.singleModuleWrapper).length)throw new Error("No template for module "+b.id+". The template script id should be : #tmpl-"+b.singleModuleWrapper);var c=wp.template(b.singleModuleWrapper),d={id:b.id,type:b.module_type},e=$(c(d));return a?$.when($(".czr-module-collection-wrapper",b._getColumn().container).find(".czr-module-candidate").after(e)).done(function(){$(".czr-module-collection-wrapper",b._getColumn().container).find(".czr-module-candidate").remove()}):$(".czr-module-collection-wrapper",b._getColumn().container).append(e),e},setupModuleView:function(){var a=this;a.view_event_map=[{trigger:"click keydown",selector:[".czr-remove-mod","."+a.control.css_attr.cancel_alert_btn].join(","),name:"toggle_remove_alert",actions:["toggleModuleRemoveAlert"]},{trigger:"click keydown",selector:"."+a.control.css_attr.remove_view_btn,name:"remove_module",actions:["removeModule"]},{trigger:"click keydown",selector:".czr-edit-mod",name:"edit_module",actions:["setModuleViewVisibility","sendEditModule"]},{trigger:"click keydown",selector:".czr-module-back",name:"back_to_column",actions:["setModuleViewVisibility"]},{trigger:"mouseenter",selector:".czr-mod-header",name:"hovering_module",actions:function(b){a.control.previewer.send("start_hovering_module",{id:a.id})}},{trigger:"mouseleave",selector:".czr-mod-header",name:"hovering_module",actions:function(b){a.control.previewer.send("stop_hovering_module",{id:a.id})}}],a.embedded.done(function(){a.czr_ModuleState.callbacks.add(function(){return a.setupModuleViewStateListeners.apply(a,arguments)}),api.CZR_Helpers.setupDOMListeners(a.view_event_map,{module:{id:a.id},dom_el:a.container},a)})},setModuleViewVisibility:function(a,b){var c=this;c.czr_ModuleState(!c.czr_ModuleState()),api.czrModulePanelState.set(!1),api.czrSekSettingsPanelState.set(!1),c.control.syncSektionModule().closeAllOtherSektions($(a.dom_event.currentTarget,a.dom_el))},sendEditModule:function(a){var b=this;b.control.previewer.send("edit_module",{id:b.id})},setupModuleViewStateListeners:function(a){var b=this;api.czr_isModuleExpanded=api.czr_isModuleExpanded||new api.Value,a?api.czr_isModuleExpanded(b):api.czr_isModuleExpanded(!1),$.when(b.toggleModuleViewExpansion(a)).done(function(){a?(b.renderModuleTitle(),b.populateSavedItemCollection()):b.czr_Item.each(function(a){a.czr_ItemState.set("closed"),a._destroyView(0),b.czr_Item.remove(a.id)})})},renderModuleTitle:function(){var a=this;if("resolved"!=a.moduleTitleEmbedded.state()){if(0===$("#tmpl-"+a.sektionModuleTitle).length)throw new Error("No sektion title Module Part template for module "+a.id+". The template script id should be : #tmpl-"+a.sektionModuleTitle);$.when($(a.container).find(".czr-mod-content").prepend($(wp.template(a.sektionModuleTitle)({id:a.id})))).done(function(){a.moduleTitleEmbedded.resolve()})}},toggleModuleViewExpansion:function(a,b){var c=this;$(".czr-mod-content",c.container).slideToggle({duration:b||200,done:function(){var b=c.container.closest(".wp-full-overlay"),d=c.container.find(".czr-module-back"),e=c.container.find(".czr-module-title");c.container.toggleClass("open",a),b.toggleClass("czr-module-open",a),e.attr("tabindex",a?"-1":"0"),d.attr("tabindex",a?"0":"-1"),a?d.focus():e.focus(),a&&c._adjustScrollExpandedBlock(c.container)}})},toggleModuleRemoveAlert:function(a){var b=this,c=this.control,d=$("."+b.control.css_attr.remove_alert_wrapper,b.container).first(),e=(a.dom_event,c.syncSektionModule().czr_Column(b.column_id).container);if(_.has(b,"preItem")&&c.syncSektionModule().preItemExpanded.set(!1),$("."+b.control.css_attr.remove_alert_wrapper,e).not(d).each(function(){$(this).hasClass("open")&&$(this).slideToggle({duration:200,done:function(){$(this).toggleClass("open",!1),$(this).siblings().find("."+b.control.css_attr.display_alert_btn).toggleClass("active",!1)}})}),!wp.template(b.AlertPart)||!b.container)throw new Error("No removal alert template available for module :"+b.id);d.html(wp.template(b.AlertPart)({title:b().title||b.id})),d.slideToggle({duration:200,done:function(){var c=!$(this).hasClass("open")&&$(this).is(":visible");$(this).toggleClass("open",c),$(a.dom_el).find("."+b.control.css_attr.display_alert_btn).toggleClass("active",c),c&&b._adjustScrollExpandedBlock(b.container)}})},removeModule:function(a){this.control.removeModule(a.module)},_getColumn:function(){var a=this;return a.control.syncSektionModule().czr_Column(a.modColumn())},_getSektion:function(){}}});var CZRMultiplePickerMths=CZRMultiplePickerMths||{};$.extend(CZRMultiplePickerMths,{ready:function(){var a=this,b=this.container.find("select");b.on("change",function(b){0===$(this).find("option:selected").length&&a.setting.set([])})}});var CZRCroppedImageMths=CZRCroppedImageMths||{};!function(a,b,c){"function"==typeof wp.media.controller.Cropper&&"function"==typeof a.CroppedImageControl&&(wp.media.controller.CZRCustomizeImageCropper=wp.media.controller.Cropper.extend({doCrop:function(a){var b=a.get("cropDetails"),c=this.get("control");return b.dst_width=c.params.dst_width,b.dst_height=c.params.dst_height,wp.ajax.post("crop-image",{wp_customize:"on",nonce:a.get("nonces").edit,id:a.get("id"),context:c.id,cropDetails:b})}}),b.extend(CZRCroppedImageMths,{initFrame:function(){var a=_wpMediaViewsL10n;this.frame=wp.media({button:{text:a.select,close:!1},states:[new wp.media.controller.Library({title:this.params.button_labels.frame_title,library:wp.media.query({type:"image"}),multiple:!1,date:!1,priority:20,suggestedWidth:this.params.width,suggestedHeight:this.params.height}),new wp.media.controller.CZRCustomizeImageCropper({imgSelectOptions:this.calculateImageSelectOptions,control:this})]}),this.frame.on("select",this.onSelect,this),this.frame.on("cropped",this.onCropped,this),this.frame.on("skippedcrop",this.onSkippedCrop,this)},onSelect:function(){var a=this.frame.state().get("selection").first().toJSON();return a.mime&&a.mime.indexOf("image")>-1?void(c.contains(["image/svg+xml","image/gif"],a.mime)||this.params.width===a.width&&this.params.height===a.height&&!this.params.flex_width&&!this.params.flex_height?(this.setImageFromAttachment(a),this.frame.close()):this.frame.setState("cropper")):void this.frame.trigger("content:error")}}))}(wp.customize,jQuery,_);var CZRUploadMths=CZRUploadMths||{};$.extend(CZRUploadMths,{ready:function(){var a=this;this.params.removed=this.params.removed||"",this.success=$.proxy(this.success,this),this.uploader=$.extend({container:this.container,browser:this.container.find(".czr-upload"),success:this.success,plupload:{},params:{}},this.uploader||{}),a.params.extensions&&(a.uploader.plupload.filters=[{title:api.l10n.allowedFiles,extensions:a.params.extensions}]),a.params.context&&(a.uploader.params["post_data[context]"]=this.params.context),api.settings.theme.stylesheet&&(a.uploader.params["post_data[theme]"]=api.settings.theme.stylesheet),this.uploader=new wp.Uploader(this.uploader),this.remover=this.container.find(".remove"),this.remover.on("click keydown",function(b){"keydown"===b.type&&13!==b.which||(a.setting.set(a.params.removed),b.preventDefault())}),this.removerVisibility=$.proxy(this.removerVisibility,this),this.setting.bind(this.removerVisibility),this.removerVisibility(this.setting())},success:function(a){this.setting.set(a.get("id"))},removerVisibility:function(a){this.remover.toggle(a!=this.params.removed)}});var CZRLayoutSelectMths=CZRLayoutSelectMths||{};$.extend(CZRLayoutSelectMths,{ready:function(){this.setupSelect()},setupSelect:function(a){function b(a){if(!a.id)return a.text;if(_.has(c.params.layouts,a.element.value)){var b=c.params.layouts[a.element.value],d=b.src,e=b.label,f=$('<img src="'+d+'" class="czr-layout-img" title="'+e+'" /><span class="czr-layout-title">'+e+"</span>");return f}}var c=this;$_select=this.container.find("select"),$_select.select2({templateResult:b,templateSelection:b,minimumResultsForSearch:1/0})}}),function(a,b,c){b.extend(CZRBaseControlMths,a.Events),b.extend(CZRModuleMths,a.Events),b.extend(CZRItemMths,a.Events),b.extend(CZRSkopeBaseMths,a.Events),b.extend(CZRSkopeMths,a.Events),b.extend(CZRBaseControlMths,a.CZR_Helpers),b.extend(CZRInputMths,a.CZR_Helpers),b.extend(CZRModuleMths,a.CZR_Helpers),b.extend(CZRSkopeMths,a.CZR_Helpers),a.CZR_skopeBase=a.Class.extend(CZRSkopeBaseMths),a.CZR_skopeSave=a.Class.extend(CZRSkopeSaveMths),a.CZR_skopeReset=a.Class.extend(CZRSkopeResetMths),a.CZR_skope=a.Value.extend(CZRSkopeMths),c.has(a,"HeaderTool")&&(a.czr_HeaderTool=b.extend(!0,{},a.HeaderTool)),a.CZRInput=a.Value.extend(CZRInputMths),a.CZRItem=a.Value.extend(CZRItemMths),a.CZRModule=a.Value.extend(CZRModuleMths),a.CZRDynModule=a.CZRModule.extend(CZRDynModuleMths),a.CZRColumn=a.Value.extend(CZRColumnMths),a.CZRBaseControl=a.Control.extend(CZRBaseControlMths),a.CZRBaseModuleControl=a.CZRBaseControl.extend(CZRBaseModuleControlMths),a.CZRMultiModuleControl=a.CZRBaseModuleControl.extend(CZRMultiModuleControlMths),a.CZRUploadControl=a.Control.extend(CZRUploadMths),a.CZRLayoutControl=a.Control.extend(CZRLayoutSelectMths),a.CZRMultiplePickerControl=a.Control.extend(CZRMultiplePickerMths),b.extend(a.controlConstructor,{czr_upload:a.CZRUploadControl,czr_module:a.CZRBaseModuleControl,czr_multi_module:a.CZRMultiModuleControl,czr_multiple_picker:a.CZRMultiplePickerControl,czr_layouts:a.CZRLayoutControl}),a.czrModuleMap=a.czrModuleMap||{},b.extend(a.czrModuleMap,{czr_widget_areas_module:{mthds:CZRWidgetAreaModuleMths,crud:!0,sektion_allowed:!1,name:"Widget Areas"},czr_social_module:{mthds:CZRSocialModuleMths,crud:!0,name:"Social Icons"},czr_sektion_module:{mthds:CZRSektionMths,crud:!0,name:"Sektions"},czr_fp_module:{mthds:CZRFeaturedPageModuleMths,crud:!0,name:"Featured Pages"},czr_slide_module:{mthds:CZRSlideModuleMths,crud:!0,name:"Slider"},czr_text_module:{mthds:CZRTextModuleMths,crud:!1,multi_item:!1,name:"Simple Text"},czr_text_editor_module:{mthds:CZRTextEditorModuleMths,crud:!1,multi_item:!1,name:"WP Text Editor"},czr_background:{mthds:CZRBodyBgModuleMths,crud:!1,multi_item:!1,name:"Slider"}}),"function"==typeof a.CroppedImageControl&&(a.CZRCroppedImageControl=a.CroppedImageControl.extend(CZRCroppedImageMths),b.extend(a.controlConstructor,{czr_cropped_image:a.CZRCroppedImageControl}))}(wp.customize,jQuery,_),function(a,b,c){var d=serverControlParams.translatedStrings||{};a.czr_CrtlDependenciesReady=b.Deferred(),a.bind("ready",function(){c.has(a,"czr_ctrlDependencies")||(serverControlParams.isSkopOn?a.czr_skopeReady.done(function(){a.czr_ctrlDependencies=new a.CZR_ctrlDependencies,a.czr_CrtlDependenciesReady.resolve()}):(a.czr_ctrlDependencies=new a.CZR_ctrlDependencies,a.czr_CrtlDependenciesReady.resolve()))}),a.CZR_ctrlDependencies=a.Class.extend({dominiDeps:[],initialize:function(){var b=this;if(this.defaultDominusParams={dominus:"",servi:[],visibility:null,actions:null,onSectionExpand:!0},this.dominiDeps=c.extend(this.dominiDeps,this._getControlDeps()),!c.isArray(b.dominiDeps))throw new Error("Visibilities : the dominos dependency array is not an array.");a.czr_activeSectionId.bind(function(d){!c.isEmpty(d)&&a.section.has(d)&&b.setServiDependencies(d)}),a.bind("awaken-section",function(d){serverControlParams.isSkopOn&&c.has(a,"czr_skopeBase")?a.czr_skopeBase.processSilentUpdates({candidates:{},section_id:d.target,refresh:!1}).then(function(){b.setServiDependencies(d.target,d.source)}):b.setServiDependencies(d.target,d.source)}),this._handleFaviconNote()},setServiDependencies:function(d,e,f){var g=this,h=b.Deferred();if(f=f||!1,c.isUndefined(d)||!a.section.has(d))throw new Error("Control Dependencies : the targetSectionId is missing or not registered : "+d);if(a.section(d).czr_ctrlDependenciesReady=a.section(d).czr_ctrlDependenciesReady||b.Deferred(),!f&&"resolved"==a.section(d).czr_ctrlDependenciesReady.state())return h.resolve().promise();c.each(g.dominiDeps,function(b){if(!c.has(b,"dominus")||!c.isString(b.dominus)||c.isEmpty(b.dominus))throw new Error("Control Dependencies : a dominus control id must be a not empty string.");var e=a.CZR_Helpers.build_setId(b.dominus);a.control(e).section()==d&&(b=g._prepareDominusParams(b),g._processDominusCallbacks(b.dominus,b,f).fail(function(){a.consoleLog("self._processDominusCallbacks fail for section "+d),h.reject()}).done(function(){h.resolve()}))});var i=a.CZR_Helpers.getSectionControlIds(d),j=function(a){var b=[];return c.each(g.dominiDeps,function(d){if(!c.has(d,"servi")||!c.isArray(d.servi)||!c.has(d,"dominus")||c.isEmpty(d.dominus))throw new Error("Control Dependencies : wrong params in _getServusDomini.");c.contains(d.servi,a)&&!c.contains(b,d.dominus)&&(d=g._prepareDominusParams(d),b.push(d.dominus))}),c.isArray(b)?b:[]},k=[];return c.each(i,function(a){c.isEmpty(j(a))||(k=c.union(k,j(a)))}),c.each(k,function(b){var c=a.CZR_Helpers.build_setId(b);a.control(c).section()!=d&&e!=a.control(c).section()&&a.trigger("awaken-section",{target:a.control(c).section(),source:d})}),h.always(function(){a.section(d).czr_ctrlDependenciesReady.resolve()}),h.promise()},_deferCallbackForControl:function(d,e,f){var g=b.Deferred();if(c.isEmpty(d)||!c.isString(d))throw new Error("_deferCallbackForControl : the control id is missing.");if(!c.isFunction(e))throw new Error("_deferCallbackForControl : callback must be a funtion.");return f=c.isUndefined(f)||!c.isArray(f)?[]:f,a.control.has(d)?"resolved"==a.control(d).deferred.embedded.state()?b.when(e.apply(null,f)).fail(function(){g.reject()}).done(function(){g.resolve()}):a.control(d).deferred.embedded.then(function(){b.when(e.apply(null,f)).fail(function(){g.reject()}).done(function(){g.resolve()})}):a.control.when(d,function(){a.control(d).deferred.embedded.then(function(){b.when(e.apply(null,f)).fail(function(){g.reject()}).done(function(){g.resolve()})})}),g.promise()},_processDominusCallbacks:function(d,e,f){var g=this,h=a.CZR_Helpers.build_setId(d),i=a(h),j=b.Deferred(),k=!1;return c.each(e.servi,function(b){if(a.control.has(a.CZR_Helpers.build_setId(b))){var d=function(a,b,d,e){var f=arguments;c.each(d,function(a,b){switch(b){case"visibility":g._setVisibility.apply(null,f);break;case"actions":c.isFunction(a)&&a.apply(null,f)}})},f=function(c){c=c||i();var f=a.CZR_Helpers.build_setId(b);g._deferCallbackForControl(f,d,[c,b,e]).always(function(){k=!0}).fail(function(){j.reject()}).done(function(){j.resolve()})};f(),c.has(i,"czr_visibilityServi")||(i.czr_visibilityServi=new a.Value([]));var h=i.czr_visibilityServi();c.contains(h,b)||(i.bind(function(a){f(a)}),i.czr_visibilityServi(c.union(h,[b])))}}),k?j.promise():j.resolve().promise()},_setVisibility:function(b,d,e,f){var g=a.CZR_Helpers.build_setId(d),h=e.visibility(b,d,e.dominus);if(f=f||!1,c.isBoolean(h)&&("unchanged"!=h||f)){var i=function(){a.state.has("silent-update-processing")&&!a.state("silent-update-processing")()&&(a.control(g,function(a){var b={duration:"fast",completeCallback:function(){},unchanged:!1};c.has(a,"active")&&(h=h&&a.active()),c.has(a,"defaultActiveArguments")&&(b=control.defaultActiveArguments),a.onChangeActive(h,a.defaultActiveArguments)}),a.state("silent-update-processing").unbind(i))};a.state.has("silent-update-processing")&&a.state("silent-update-processing")()?a.state("silent-update-processing").bind(i):i()}},_getControlDeps:function(){return{}},_prepareDominusParams:function(b){var d=this,e={};if(!c.isObject(b))throw new Error("Visibilities : a dominus param definition must be an object.");if(!c.has(b,"visibility")&&!c.has(b,"actions"))throw new Error("Visibilities : a dominus definition must include a visibility or an actions callback.");if(!c.has(b,"dominus")||!c.isString(b.dominus)||c.isEmpty(b.dominus))throw new Error("Visibilities : a dominus control id must be a not empty string.");var f=a.CZR_Helpers.build_setId(b.dominus);if(!a.control.has(f))throw new Error("Visibilities : a dominus control id is not registered : "+f);if(!c.has(b,"servi")||c.isUndefined(b.servi)||!c.isArray(b.servi)||c.isEmpty(b.servi))throw new Error("Visibilities : servi must be set as an array not empty.");return c.each(d.defaultDominusParams,function(a,d){var f=b[d];switch(d){case"visibility":if(!c.isUndefined(f)&&!c.isEmpty(f)&&!c.isFunction(f))throw new Error("Visibilities : a dominus visibility callback must be a function : "+b.dominus);break;case"actions":if(!c.isUndefined(f)&&!c.isEmpty(f)&&!c.isFunction(f))throw new Error("Visibilities : a dominus actions callback must be a function : "+b.dominus);break;case"onSectionExpand":if(!c.isUndefined(f)&&!c.isEmpty(f)&&!c.isBoolean(f))throw new Error("Visibilities : a dominus onSectionExpand param must be a boolean : "+b.dominus)}e[d]=f}),e},_handleFaviconNote:function(){var b=this,c=a.CZR_Helpers.build_setId(serverControlParams.faviconOptionName);if(!(!a.has("site_icon")||!a.control("site_icon")||a.has(c)&&0===+a(c)()||+a("site_icon")()>0)){var e=a.control("site_icon").params.description;_newDes=["<strong>",d.faviconNote||"","</strong><br/><br/>"].join("")+e,b._printFaviconNote(_newDes),a("site_icon").callbacks.add(function(d){+d>0?(a.control("site_icon").container.find(".description").text(e),a.has(c)&&a(c).set("")):b._printFaviconNote(_newDes)})}},_printFaviconNote:function(b){a.control("site_icon").container.find(".description").html(b)}})}(wp.customize,jQuery,_),function(a,b){b(function(b){function c(a){var c=a.siblings(".open");0!==c.length&&c.offset().top<0&&b(".wp-full-overlay-sidebar-content").animate({scrollTop:-b("#customize-theme-controls").offset().top-c.height()+a.offset().top+b(".wp-full-overlay-sidebar-content").offset().top},700)}var d=a.customize||d;b(".accordion-section").not(".control-panel").click(function(){c(b(this))}),d.czrSetupCheckbox=function(a,c){b("input[type=checkbox]",d.control(a).container).each(function(){0===b(this).val()||"0"==b(this).val()||"off"==b(this).val()||_.isEmpty(b(this).val())?b(this).prop("checked",!1):b(this).prop("checked",!0),0===b(this).closest('div[class^="icheckbox"]').length&&b(this).iCheck({checkboxClass:"icheckbox_flat-grey",radioClass:"iradio_flat-grey"}).on("ifChanged",function(a){b(this).val(!1===b(this).is(":checked")?0:1),b(a.currentTarget).trigger("change")})})},d.czrSetupSelect=function(a,c){b("select[data-customize-setting-link]",d.control(a).container).not(".no-selecter-js").each(function(){b(this).selecter({})})},d.czrSetupStepper=function(a,c){b('input[type="number"]',d.control(a).container).each(function(){b(this).stepper()})},d.control.each(function(a){_.has(a,"id")&&("widget_"!=a.id.substring(0,"widget_".length)&&"nav_menu"!=a.id.substring(0,"nav_menu".length)&&d.czrSetupCheckbox(a.id),"nav_menu_locations"!=a.id.substring(0,"nav_menu_locations".length)&&d.czrSetupSelect(a.id),d.czrSetupStepper(a.id))}),b(".control-panel-widgets").find(".accordion-section-title").first().length&&b(".control-panel-widgets").find(".accordion-section-title").first().prepend(b("<span/>",{"class":"fa fa-magic"}));var e=function(){var a=b("<span/>",{"class":"customize-controls-home fa fa-home",html:'<span class="screen-reader-text">Home</span>'});b.when(b("#customize-header-actions").append(a)).done(function(){a.keydown(function(a){9!==a.which&&(13===a.which&&this.click(),a.preventDefault())}).on("click.customize-controls-home",function(){d.section.has(d.czr_activeSectionId())?d.section(d.czr_activeSectionId()).expanded(!1):d.section.each(function(a){a.expanded(!1)}),d.panel.each(function(a){a.expanded(!1)})})})};e()})}(wp,jQuery);
|
6 |
Array.prototype.map||(Array.prototype.map=function(a,b){var c,d,e;if(null===this)throw new TypeError(" this is null or not defined");var f=Object(this),g=f.length>>>0;if("function"!=typeof a)throw new TypeError(a+" is not a function");for(arguments.length>1&&(c=b),d=new Array(g),e=0;e<g;){var h,i;e in f&&(h=f[e],i=a.call(c,h,e,f),d[e]=i),e++}return d}),/*! iCheck v1.0.1 by Damir Sultanov, http://git.io/arlzeA, MIT Licensed */
|
7 |
"function"!=typeof jQuery.fn.iCheck&&!function(a){function b(a,b,e){var f=a[0],g=/er/.test(e)?p:/bl/.test(e)?n:l,h=e==q?{checked:f[l],disabled:f[n],indeterminate:"true"==a.attr(p)||"false"==a.attr(o)}:f[g];if(/^(ch|di|in)/.test(e)&&!h)c(a,g);else if(/^(un|en|de)/.test(e)&&h)d(a,g);else if(e==q)for(g in h)h[g]?c(a,g,!0):d(a,g,!0);else b&&"toggle"!=e||(b||a[u]("ifClicked"),h?f[r]!==k&&d(a,g):c(a,g))}function c(b,c,e){var q=b[0],u=b.parent(),v=c==l,x=c==p,y=c==n,z=x?o:v?m:"enabled",A=f(b,z+g(q[r])),B=f(b,c+g(q[r]));if(!0!==q[c]){if(!e&&c==l&&q[r]==k&&q.name){var C=b.closest("form"),D='input[name="'+q.name+'"]',D=C.length?C.find(D):a(D);D.each(function(){this!==q&&a(this).data(i)&&d(a(this),c)})}x?(q[c]=!0,q[l]&&d(b,l,"force")):(e||(q[c]=!0),v&&q[p]&&d(b,p,!1)),h(b,v,c,e)}q[n]&&f(b,w,!0)&&u.find("."+j).css(w,"default"),u[s](B||f(b,c)||""),y?u.attr("aria-disabled","true"):u.attr("aria-checked",x?"mixed":"true"),u[t](A||f(b,z)||"")}function d(a,b,c){var d=a[0],e=a.parent(),i=b==l,k=b==p,q=b==n,u=k?o:i?m:"enabled",v=f(a,u+g(d[r])),x=f(a,b+g(d[r]));!1!==d[b]&&((k||!c||"force"==c)&&(d[b]=!1),h(a,i,u,c)),!d[n]&&f(a,w,!0)&&e.find("."+j).css(w,"pointer"),e[t](x||f(a,b)||""),q?e.attr("aria-disabled","false"):e.attr("aria-checked","false"),e[s](v||f(a,u)||"")}function e(b,c){b.data(i)&&(b.parent().html(b.attr("style",b.data(i).s||"")),c&&b[u](c),b.off(".i").unwrap(),a(v+'[for="'+b[0].id+'"]').add(b.closest(v)).off(".i"))}function f(a,b,c){return a.data(i)?a.data(i).o[b+(c?"":"Class")]:void 0}function g(a){return a.charAt(0).toUpperCase()+a.slice(1)}function h(a,b,c,d){d||(b&&a[u]("ifToggled"),a[u]("ifChanged")[u]("if"+g(c)))}var i="iCheck",j=i+"-helper",k="radio",l="checked",m="un"+l,n="disabled",o="determinate",p="in"+o,q="update",r="type",s="addClass",t="removeClass",u="trigger",v="label",w="cursor",x=/ipad|iphone|ipod|android|blackberry|windows phone|opera mini|silk/i.test(navigator.userAgent);a.fn[i]=function(f,g){var h='input[type="checkbox"], input[type="'+k+'"]',m=a(),o=function(b){b.each(function(){var b=a(this);m=b.is(h)?m.add(b):m.add(b.find(h))})};if(/^(check|uncheck|toggle|indeterminate|determinate|disable|enable|update|destroy)$/i.test(f))return f=f.toLowerCase(),o(this),m.each(function(){var c=a(this);"destroy"==f?e(c,"ifDestroyed"):b(c,!0,f),a.isFunction(g)&&g()});if("object"!=typeof f&&f)return this;var w=a.extend({checkedClass:l,disabledClass:n,indeterminateClass:p,labelHover:!0,aria:!1},f),y=w.handle,z=w.hoverClass||"hover",A=w.focusClass||"focus",B=w.activeClass||"active",C=!!w.labelHover,D=w.labelHoverClass||"hover",E=0|(""+w.increaseArea).replace("%","");return("checkbox"==y||y==k)&&(h='input[type="'+y+'"]'),-50>E&&(E=-50),o(this),m.each(function(){var f=a(this);e(f);var g=this,h=g.id,m=-E+"%",o=100+2*E+"%",o={position:"absolute",top:m,left:m,display:"block",width:o,height:o,margin:0,padding:0,background:"#fff",border:0,opacity:0},m=x?{position:"absolute",visibility:"hidden"}:E?o:{position:"absolute",opacity:0},p="checkbox"==g[r]?w.checkboxClass||"icheckbox":w.radioClass||"i"+k,y=a(v+'[for="'+h+'"]').add(f.closest(v)),F=!!w.aria,G=i+"-"+Math.random().toString(36).substr(2,6),H='<div class="'+p+'" '+(F?'role="'+g[r]+'" ':"");F&&y.each(function(){H+='aria-labelledby="',this.id?H+=this.id:(this.id=G,H+=G),H+='"'}),H=f.wrap(H+"/>")[u]("ifCreated").parent().append(w.insert),o=a('<ins class="'+j+'"/>').css(o).appendTo(H),f.data(i,{o:w,s:f.attr("style")}).css(m),w.inheritClass&&H[s](g.className||""),w.inheritID&&h&&H.attr("id",i+"-"+h),"static"==H.css("position")&&H.css("position","relative"),b(f,!0,q),y.length&&y.on("click.i mouseover.i mouseout.i touchbegin.i touchend.i",function(c){var d=c[r],e=a(this);if(!g[n]){if("click"==d){if(a(c.target).is("a"))return;b(f,!1,!0)}else C&&(/ut|nd/.test(d)?(H[t](z),e[t](D)):(H[s](z),e[s](D)));if(!x)return!1;c.stopPropagation()}}),f.on("click.i focus.i blur.i keyup.i keydown.i keypress.i",function(a){var b=a[r];return a=a.keyCode,"click"!=b&&("keydown"==b&&32==a?(g[r]==k&&g[l]||(g[l]?d(f,l):c(f,l)),!1):void("keyup"==b&&g[r]==k?!g[l]&&c(f,l):/us|ur/.test(b)&&H["blur"==b?t:s](A)))}),o.on("click mousedown mouseup mouseover mouseout touchbegin.i touchend.i",function(a){var c=a[r],d=/wn|up/.test(c)?B:z;if(!g[n]){if("click"==c?b(f,!1,!0):(/wn|er|in/.test(c)?H[s](d):H[t](d+" "+B),y.length&&C&&d==z&&y[/ut|nd/.test(c)?t:s](D)),!x)return!1;a.stopPropagation()}})})}}(window.jQuery||window.Zepto),"function"!=typeof jQuery.fn.selecter&&!function(a,b){"use strict";function c(b){b=a.extend({},x,b||{}),null===w&&(w=a("body"));for(var c=a(this),e=0,f=c.length;f>e;e++)d(c.eq(e),b);return c}function d(b,c){if(!b.hasClass("selecter-element")){c=a.extend({},c,b.data("selecter-options")),c.external&&(c.links=!0);var d=b.find("option, optgroup"),g=d.filter("option"),h=g.filter(":selected"),n=""!==c.label?-1:g.index(h),p=c.links?"nav":"div";c.tabIndex=b[0].tabIndex,b[0].tabIndex=-1,c.multiple=b.prop("multiple"),c.disabled=b.is(":disabled");var q="<"+p+' class="selecter '+c.customClass;v?q+=" mobile":c.cover&&(q+=" cover"),q+=c.multiple?" multiple":" closed",c.disabled&&(q+=" disabled"),q+='" tabindex="'+c.tabIndex+'">',c.multiple||(q+='<span class="selecter-selected'+(""!==c.label?" placeholder":"")+'">',q+=a("<span></span").text(r(""!==c.label?c.label:h.text(),c.trim)).html(),q+="</span>"),q+='<div class="selecter-options">',q+="</div>",q+="</"+p+">",b.addClass("selecter-element").after(q);var s=b.next(".selecter"),u=a.extend({$select:b,$allOptions:d,$options:g,$selecter:s,$selected:s.find(".selecter-selected"),$itemsWrapper:s.find(".selecter-options"),index:-1,guid:t++},c);e(u),o(n,u),void 0!==a.fn.scroller&&u.$itemsWrapper.scroller(),u.$selecter.on("touchstart.selecter click.selecter",".selecter-selected",u,f).on("click.selecter",".selecter-item",u,j).on("close.selecter",u,i).data("selecter",u),u.$select.on("change.selecter",u,k),v||(u.$selecter.on("focus.selecter",u,l).on("blur.selecter",u,m),u.$select.on("focus.selecter",u,function(a){a.data.$selecter.trigger("focus")}))}}function e(b){for(var c="",d=b.links?"a":"span",e=0,f=0,g=b.$allOptions.length;g>f;f++){var h=b.$allOptions.eq(f);if("OPTGROUP"===h[0].tagName)c+='<span class="selecter-group',h.is(":disabled")&&(c+=" disabled"),c+='">'+h.attr("label")+"</span>";else{var i=h.val();h.attr("value")||h.attr("value",i),c+="<"+d+' class="selecter-item',h.is(":selected")&&""===b.label&&(c+=" selected"),h.is(":disabled")&&(c+=" disabled"),c+='" ',c+=b.links?'href="'+i+'"':'data-value="'+i+'"',c+=">"+a("<span></span>").text(r(h.text(),b.trim)).html()+"</"+d+">",e++}}b.$itemsWrapper.html(c),b.$items=b.$selecter.find(".selecter-item")}function f(c){c.preventDefault(),c.stopPropagation();var d=c.data;if(!d.$select.is(":disabled"))if(a(".selecter").not(d.$selecter).trigger("close.selecter",[d]),v){var e=d.$select[0];if(b.document.createEvent){var f=b.document.createEvent("MouseEvents");f.initMouseEvent("mousedown",!1,!0,b,0,0,0,0,0,!1,!1,!1,!1,0,null),e.dispatchEvent(f)}else e.fireEvent&&e.fireEvent("onmousedown")}else d.$selecter.hasClass("closed")?g(c):d.$selecter.hasClass("open")&&i(c)}function g(b){b.preventDefault(),b.stopPropagation();var c=b.data;if(!c.$selecter.hasClass("open")){var d=c.$selecter.offset(),e=w.outerHeight(),f=c.$itemsWrapper.outerHeight(!0),g=c.index>=0?c.$items.eq(c.index).position():{left:0,top:0};d.top+f>e&&c.$selecter.addClass("bottom"),c.$itemsWrapper.show(),c.$selecter.removeClass("closed").addClass("open"),w.on("click.selecter-"+c.guid,":not(.selecter-options)",c,h),void 0!==a.fn.scroller?c.$itemsWrapper.scroller("scroll",c.$itemsWrapper.find(".scroller-content").scrollTop()+g.top,0).scroller("reset"):c.$itemsWrapper.scrollTop(c.$itemsWrapper.scrollTop()+g.top)}}function h(b){b.preventDefault(),b.stopPropagation(),0===a(b.currentTarget).parents(".selecter").length&&i(b)}function i(a){a.preventDefault(),a.stopPropagation();var b=a.data;b.$selecter.hasClass("open")&&(b.$itemsWrapper.hide(),b.$selecter.removeClass("open bottom").addClass("closed"),w.off(".selecter-"+b.guid))}function j(b){b.preventDefault(),b.stopPropagation();var c=a(this),d=b.data;if(!d.$select.is(":disabled")){if(d.$itemsWrapper.is(":visible")){var e=d.$items.index(c);o(e,d),p(d)}d.multiple||i(b)}}function k(b,c){var d=a(this),e=b.data;if(!c&&!e.multiple){var f=e.$options.index(e.$options.filter("[value='"+s(d.val())+"']"));o(f,e),p(e)}}function l(b){b.preventDefault(),b.stopPropagation();var c=b.data;c.$select.is(":disabled")||c.multiple||(c.$selecter.addClass("focus").on("keydown.selecter"+c.guid,c,n),a(".selecter").not(c.$selecter).trigger("close.selecter",[c]))}function m(b){b.preventDefault(),b.stopPropagation();var c=b.data;c.$selecter.removeClass("focus").off("keydown.selecter"+c.guid+" keyup.selecter"+c.guid),a(".selecter").not(c.$selecter).trigger("close.selecter",[c])}function n(b){var c=b.data;if(13===b.keyCode)c.$selecter.hasClass("open")&&(i(b),o(c.index,c)),p(c);else if(!(9===b.keyCode||b.metaKey||b.altKey||b.ctrlKey||b.shiftKey)){b.preventDefault(),b.stopPropagation();var d=c.$items.length-1,e=c.index<0?0:c.index;if(a.inArray(b.keyCode,u?[38,40,37,39]:[38,40])>-1)e+=38===b.keyCode||u&&37===b.keyCode?-1:1,0>e&&(e=0),e>d&&(e=d);else{var f,g,h=String.fromCharCode(b.keyCode).toUpperCase();for(g=c.index+1;d>=g;g++)if(f=c.$options.eq(g).text().charAt(0).toUpperCase(),f===h){e=g;break}if(0>e)for(g=0;d>=g;g++)if(f=c.$options.eq(g).text().charAt(0).toUpperCase(),f===h){e=g;break}}e>=0&&o(e,c)}}function o(a,b){var c=b.$items.eq(a),d=c.hasClass("selected"),e=c.hasClass("disabled");if(!e){if(-1===a&&""!==b.label)b.$selected.html(b.label);else if(d)b.multiple&&(b.$options.eq(a).prop("selected",null),c.removeClass("selected"));else{var f=c.html();c.data("value"),b.multiple?b.$options.eq(a).prop("selected",!0):(b.$selected.html(f).removeClass("placeholder"),b.$items.filter(".selected").removeClass("selected"),b.$select[0].selectedIndex=a),c.addClass("selected")}(!d||b.multiple)&&(b.index=a)}}function p(a){a.links?q(a):(a.callback.call(a.$selecter,a.$select.val(),a.index),a.$select.trigger("change",[!0]))}function q(a){var c=a.$select.val();a.external?b.open(c):b.location.href=c}function r(a,b){return 0===b?a:a.length>b?a.substring(0,b)+"...":a}function s(a){return a.replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1")}var t=0,u=b.navigator.userAgent.toLowerCase().indexOf("firefox")>-1,v=/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(b.navigator.userAgent||b.navigator.vendor||b.opera),w=null,x={callback:a.noop,cover:!1,customClass:"",label:"",external:!1,links:!1,trim:0},y={defaults:function(b){return x=a.extend(x,b||{}),a(this)},disable:function(b){return a(this).each(function(c,d){var e=a(d).next(".selecter").data("selecter");if(e)if("undefined"!=typeof b){var f=e.$items.index(e.$items.filter("[data-value="+b+"]"));e.$items.eq(f).addClass("disabled"),e.$options.eq(f).prop("disabled",!0)}else e.$selecter.hasClass("open")&&e.$selecter.find(".selecter-selected").trigger("click.selecter"),e.$selecter.addClass("disabled"),e.$select.prop("disabled",!0)})},enable:function(b){return a(this).each(function(c,d){var e=a(d).next(".selecter").data("selecter");if(e)if("undefined"!=typeof b){var f=e.$items.index(e.$items.filter("[data-value="+b+"]"));e.$items.eq(f).removeClass("disabled"),e.$options.eq(f).prop("disabled",!1)}else e.$selecter.removeClass("disabled"),e.$select.prop("disabled",!1)})},destroy:function(){return a(this).each(function(b,c){var d=a(c).next(".selecter").data("selecter");d&&(d.$selecter.hasClass("open")&&d.$selecter.find(".selecter-selected").trigger("click.selecter"),void 0!==a.fn.scroller&&d.$selecter.find(".selecter-options").scroller("destroy"),d.$select[0].tabIndex=d.tabIndex,d.$select.off(".selecter").removeClass("selecter-element").show(),d.$selecter.off(".selecter").remove())})},refresh:function(){return a(this).each(function(b,c){var d=a(c).next(".selecter").data("selecter");if(d){var f=d.index;d.$allOptions=d.$select.find("option, optgroup"),d.$options=d.$allOptions.filter("option"),d.index=-1,f=d.$options.index(d.$options.filter(":selected")),e(d),o(f,d)}})}};a.fn.selecter=function(a){return y[a]?y[a].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof a&&a?this:c.apply(this,arguments)},a.selecter=function(a){"defaults"===a&&y.defaults.apply(this,Array.prototype.slice.call(arguments,1))}}(jQuery,window),"function"!=typeof jQuery.fn.stepper&&!function(a){"use strict";function b(b){b=a.extend({},k,b||{});for(var d=a(this),e=0,f=d.length;f>e;e++)c(d.eq(e),b);return d}function c(b,c){if(!b.hasClass("stepper-input")){c=a.extend({},c,b.data("stepper-options"));var e=parseFloat(b.attr("min")),f=parseFloat(b.attr("max")),g=parseFloat(b.attr("step"))||1;b.addClass("stepper-input").wrap('<div class="stepper '+c.customClass+'" />').after('<span class="stepper-arrow up">'+c.labels.up+'</span><span class="stepper-arrow down">'+c.labels.down+"</span>");var h=b.parent(".stepper"),j=a.extend({$stepper:h,$input:b,$arrow:h.find(".stepper-arrow"),min:void 0!==typeof e&&!isNaN(e)&&e,max:void 0!==typeof f&&!isNaN(f)&&f,step:void 0===typeof g||isNaN(g)?1:g,timer:null},c);j.digits=i(j.step),b.is(":disabled")&&h.addClass("disabled"),h.on("touchstart.stepper mousedown.stepper",".stepper-arrow",j,d).data("stepper",j)}}function d(b){b.preventDefault(),b.stopPropagation(),e(b);var c=b.data;if(!c.$input.is(":disabled")&&!c.$stepper.hasClass("disabled")){var d=a(b.target).hasClass("up")?c.step:-c.step;c.timer=g(c.timer,125,function(){f(c,d,!1)}),f(c,d),a("body").on("touchend.stepper mouseup.stepper",c,e)}}function e(b){b.preventDefault(),b.stopPropagation();var c=b.data;h(c.timer),a("body").off(".stepper")}function f(a,b){var c=parseFloat(a.$input.val()),d=b;void 0===typeof c||isNaN(c)?d=a.min!==!1?a.min:0:a.min!==!1&&c<a.min?d=a.min:d+=c;var e=(d-a.min)%a.step;0!==e&&(d-=e),a.min!==!1&&d<a.min&&(d=a.min),a.max!==!1&&d>a.max&&(d-=a.step),d!==c&&(d=j(d,a.digits),a.$input.val(d).trigger("change"))}function g(a,b,c){return h(a),setInterval(c,b)}function h(a){a&&(clearInterval(a),a=null)}function i(a){var b=String(a);return b.indexOf(".")>-1?b.length-b.indexOf(".")-1:0}function j(a,b){var c=Math.pow(10,b);return Math.round(a*c)/c}var k={customClass:"",labels:{up:"Up",down:"Down"}},l={defaults:function(b){return k=a.extend(k,b||{}),a(this)},destroy:function(){return a(this).each(function(){var b=a(this).data("stepper");b&&(b.$stepper.off(".stepper").find(".stepper-arrow").remove(),b.$input.unwrap().removeClass("stepper-input"))})},disable:function(){return a(this).each(function(){var b=a(this).data("stepper");b&&(b.$input.attr("disabled","disabled"),b.$stepper.addClass("disabled"))})},enable:function(){return a(this).each(function(){var b=a(this).data("stepper");b&&(b.$input.attr("disabled",null),b.$stepper.removeClass("disabled"))})}};a.fn.stepper=function(a){return l[a]?l[a].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof a&&a?this:b.apply(this,arguments)},a.stepper=function(a){"defaults"===a&&l.defaults.apply(this,Array.prototype.slice.call(arguments,1))}}(jQuery,this),/*! Select2 4.0.1 | https://github.com/select2/select2/blob/master/LICENSE.md */!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return u.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=s.map,p=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(a=a.split("/"),g=a.length-1,s.nodeIdCompat&&w.test(a[g])&&(a[g]=a[g].replace(w,"")),a=n.slice(0,n.length-1).concat(a),k=0;k<a.length;k+=1)if(m=a[k],"."===m)a.splice(k,1),k-=1;else if(".."===m){if(1===k&&(".."===a[2]||".."===a[0]))break;k>0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||p)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&p&&p[d]&&(i=p[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=v.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),n.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){q[a]=b}}function j(a){if(e(r,a)){var c=r[a];delete r[a],t[a]=!0,m.apply(b,c)}if(!e(q,a)&&!e(t,a))throw new Error("No "+a);return q[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return function(){return s&&s.config&&s.config[a]||{}}}var m,n,o,p,q={},r={},s={},t={},u=Object.prototype.hasOwnProperty,v=[].slice,w=/\.js$/;o=function(a,b){var c,d=k(a),e=d[0];return a=d[1],e&&(e=f(e,b),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(b)):f(a,b):(a=f(a,b),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},p={require:function(a){return g(a)},exports:function(a){var b=q[a];return"undefined"!=typeof b?b:q[a]={}},module:function(a){return{id:a,uri:"",exports:q[a],config:l(a)}}},m=function(a,c,d,f){var h,k,l,m,n,s,u=[],v=typeof d;if(f=f||a,"undefined"===v||"function"===v){for(c=!c.length&&d.length?["require","exports","module"]:c,n=0;n<c.length;n+=1)if(m=o(c[n],f),k=m.f,"require"===k)u[n]=p.require(a);else if("exports"===k)u[n]=p.exports(a),s=!0;else if("module"===k)h=u[n]=p.module(a);else if(e(q,k)||e(r,k)||e(t,k))u[n]=j(k);else{if(!m.p)throw new Error(a+" missing "+k);m.p.load(m.n,g(f,!0),i(k),{}),u[n]=q[k]}l=d?d.apply(q[a],u):void 0,a&&(h&&h.exports!==b&&h.exports!==q[a]?q[a]=h.exports:l===b&&s||(q[a]=l))}else a&&(q[a]=d)},a=c=n=function(a,c,d,e,f){if("string"==typeof a)return p[a]?p[a](c):j(o(a,c).f);if(!a.splice){if(s=a,s.deps&&n(s.deps,s.callback),!c)return;c.splice?(a=c,c=d,d=null):a=b}return c=c||function(){},"function"==typeof d&&(d=e,e=f),e?m(b,a,c,d):setTimeout(function(){m(b,a,c,d)},4),n},n.config=function(a){return n(a)},a._defined=q,d=function(a,b,c){if("string"!=typeof a)throw new Error("See almond README: incorrect module build, no module name");b.splice||(c=b,b=[]),e(q,a)||e(r,a)||(r[a]=[a,b,c])},d.amd={jQuery:!0}}(),b.requirejs=a,b.require=c,b.define=d}}(),b.define("almond",function(){}),b.define("jquery",[],function(){var b=a||$;return null==b&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),b}),b.define("select2/utils",["jquery"],function(a){function b(a){var b=a.prototype,c=[];for(var d in b){var e=b[d];"function"==typeof e&&"constructor"!==d&&c.push(d)}return c}var c={};c.Extend=function(a,b){function c(){this.constructor=a}var d={}.hasOwnProperty;for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},c.Decorate=function(a,c){function d(){var b=Array.prototype.unshift,d=c.prototype.constructor.length,e=a.prototype.constructor;d>0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;h<g.length;h++){var i=g[h];d.prototype[i]=a.prototype[i]}for(var j=(function(a){var b=function(){};a in d.prototype&&(b=d.prototype[a]);var e=c.prototype[a];return function(){var a=Array.prototype.unshift;return a.call(arguments,b),e.apply(this,arguments)}}),k=0;k<f.length;k++){var l=f[k];d.prototype[l]=j(l)}return d};var d=function(){this.listeners={}};return d.prototype.on=function(a,b){this.listeners=this.listeners||{},a in this.listeners?this.listeners[a].push(b):this.listeners[a]=[b]},d.prototype.trigger=function(a){var b=Array.prototype.slice;this.listeners=this.listeners||{},a in this.listeners&&this.invoke(this.listeners[a],b.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},d.prototype.invoke=function(a,b){for(var c=0,d=a.length;d>c;c++)a[c].apply(this,b)},c.Observable=d,c.generateChars=function(a){for(var b="",c=0;a>c;c++){var d=Math.floor(36*Math.random());b+=d.toString(36)}return b},c.bind=function(a,b){return function(){a.apply(b,arguments)}},c._convertData=function(a){for(var b in a){var c=b.split("-"),d=a;if(1!==c.length){for(var e=0;e<c.length;e++){var f=c[e];f=f.substring(0,1).toLowerCase()+f.substring(1),f in d||(d[f]={}),e==c.length-1&&(d[f]=a[b]),d=d[f]}delete a[b]}}return a},c.hasScroll=function(b,c){var d=a(c),e=c.style.overflowX,f=c.style.overflowY;return(e!==f||"hidden"!==f&&"visible"!==f)&&("scroll"===e||"scroll"===f||(d.innerHeight()<c.scrollHeight||d.innerWidth()<c.scrollWidth))},c.escapeMarkup=function(a){var b={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<ul class="select2-results__options" role="tree"></ul>');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a('<li role="treeitem" aria-live="assertive" class="select2-results__option"></li>'),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c<a.results.length;c++){var d=a.results[c],e=this.option(d);b.push(e)}this.$results.append(b)},c.prototype.position=function(a,b){var c=b.find(".select2-results");c.append(a)},c.prototype.sort=function(a){var b=this.options.get("sorter");return b(a)},c.prototype.setClasses=function(){var b=this;this.data.current(function(c){var d=a.map(c,function(a){return a.id.toString()}),e=b.$results.find(".select2-results__option[aria-selected]");e.each(function(){var b=a(this),c=a.data(this,"data"),e=""+c.id;null!=c.element&&c.element.selected||null==c.element&&a.inArray(e,d)>-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")});var f=e.filter("[aria-selected=true]");f.length>0?f.first().trigger("mouseenter"):e.first().trigger("mouseenter")})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group",a(h),this.template(b,h);for(var i=[],j=0;j<b.children.length;j++){var k=b.children[j],l=this.option(k);i.push(l)}var m=a("<ul></ul>",{"class":"select2-results__options select2-results__options--nested"});m.append(i),g.append(h),g.append(m)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b,c){var d=this,e=b.id+"-results";this.$results.attr("id",e),b.on("results:all",function(a){d.clear(),d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("results:append",function(a){d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("query",function(a){d.hideMessages(),d.showLoading(a)}),b.on("select",function(){b.isOpen()&&d.setClasses()}),b.on("unselect",function(){b.isOpen()&&d.setClasses()}),b.on("open",function(){d.$results.attr("aria-expanded","true"),d.$results.attr("aria-hidden","false"),d.setClasses(),d.ensureHighlightVisible()}),b.on("close",function(){d.$results.attr("aria-expanded","false"),d.$results.attr("aria-hidden","true"),d.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=d.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=d.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a);if(0!==c){var e=c-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top,h=f.offset().top,i=d.$results.scrollTop()+(h-g);0===e?d.$results.scrollTop(0):0>h-g&&d.$results.scrollTop(i)}}),b.on("results:next",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a),e=c+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top+d.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=d.$results.scrollTop()+h-g;0===e?d.$results.scrollTop(0):h>g&&d.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){d.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=d.$results.scrollTop(),c=d.$results.get(0).scrollHeight-d.$results.scrollTop()+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=d.$results.height();e?(d.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(d.$results.scrollTop(d.$results.get(0).scrollHeight-d.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var c=a(this),e=c.data("data");return"true"===c.attr("aria-selected")?void(d.options.get("multiple")?d.trigger("unselect",{originalEvent:b,data:e}):d.trigger("close",{})):void d.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted"),d.trigger("results:focus",{data:c,element:a(this)})})},c.prototype.getHighlightedResults=function(){var a=this.$results.find(".select2-results__option--highlighted");return a},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),2>=c?this.$results.scrollTop(0):(g>this.$results.outerHeight()||0>g)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){var a={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46};return a}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a('<span class="select2-selection" role="combobox" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a,b){var d=this,e=(a.id+"-container",a.id+"-results");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",e),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),d.$selection.focus(),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2"),e=a(".select2.select2-container--open");e.each(function(){var b=a(this);if(this!=d[0]){var c=b.data("element");c.select2("close")}})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){var c=b.find(".selection");c.append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d),this.$selection.attr("aria-labelledby",d),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("blur",function(a){}),a.on("selection:update",function(a){c.update(a.data)})},e.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},e.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},e.prototype.selectionContainer=function(){return a("<span></span>")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.$selection.find(".select2-selection__rendered"),d=this.display(b,c);c.empty().append(d),c.prop("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html('<ul class="select2-selection__rendered"></ul>'),a},d.prototype.bind=function(b,c){
|
8 |
var e=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){e.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!e.options.get("disabled")){var c=a(this),d=c.parent(),f=d.data("data");e.trigger("unselect",{originalEvent:b,data:f})}})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},d.prototype.selectionContainer=function(){var b=a('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">×</span></li>');return b},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d<a.length;d++){var e=a[d],f=this.selectionContainer(),g=this.display(e,f);f.append(g),f.prop("title",e.title||e.text),f.data("data",e),b.push(f)}var h=this.$selection.find(".select2-selection__rendered");c.appendMany(h,b)}},d}),b.define("select2/selection/placeholder",["../utils"],function(a){function b(a,b,c){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c)}return b.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},b.prototype.createPlaceholder=function(a,b){var c=this.selectionContainer();return c.html(this.display(b)),c.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),c},b.prototype.update=function(a,b){var c=1==b.length&&b[0].id!=this.placeholder.id,d=b.length>1;if(d||c)return a.call(this,b);this.clear();var e=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(e)},b}),b.define("select2/selection/allowClear",["jquery","../keys"],function(a,b){function c(){}return c.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},c.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var c=this.$selection.find(".select2-selection__clear");if(0!==c.length){b.stopPropagation();for(var d=c.data("data"),e=0;e<d.length;e++){var f={data:d[e]};if(this.trigger("unselect",f),f.prevented)return}this.$element.val(this.placeholder.id).trigger("change"),this.trigger("toggle",{})}}},c.prototype._handleKeyboardClear=function(a,c,d){d.isOpen()||(c.which==b.DELETE||c.which==b.BACKSPACE)&&this._handleClear(c)},c.prototype.update=function(b,c){if(b.call(this,c),!(this.$selection.find(".select2-selection__placeholder").length>0||0===c.length)){var d=a('<span class="select2-selection__clear">×</span>');d.data("data",c),this.$selection.find(".select2-selection__rendered").prepend(d)}},c}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a('<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" aria-autocomplete="list" /></li>');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented();var b=a.which;if(b===c.BACKSPACE&&""===e.$search.val()){var d=e.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var f=d.data("data");e.searchRemoveChoice(f),a.preventDefault()}}});var f=document.documentMode,g=f&&11>=f;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){return g?void e.$selection.off("input.search input.searchcheck"):void e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(g&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{var b=this.$search.val().length+1;a=.75*b+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){var a={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};return a}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),d+=null!=c.id?"-"+c.id.toString():"-"+a.generateChars(4)},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f<a.length;f++){var g=a[f].id;-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")});else{var d=a.id;this.$element.val(d),this.$element.trigger("change")}},d.prototype.unselect=function(a){var b=this;if(this.$element.prop("multiple"))return a.selected=!1,c(a.element).is("option")?(a.element.selected=!1,void this.$element.trigger("change")):void this.current(function(d){for(var e=[],f=0;f<d.length;f++){var g=d[f].id;g!==a.id&&-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")})},d.prototype.bind=function(a,b){var c=this;this.container=a,a.on("select",function(a){c.select(a.data)}),a.on("unselect",function(a){c.unselect(a.data)})},d.prototype.destroy=function(){this.$element.find("*").each(function(){c.removeData(this,"data")})},d.prototype.query=function(a,b){var d=[],e=this,f=this.$element.children();f.each(function(){var b=c(this);if(b.is("option")||b.is("optgroup")){var f=e.item(b),g=e.matches(a,f);null!==g&&d.push(g)}}),b({results:d})},d.prototype.addOptions=function(a){b.appendMany(this.$element,a)},d.prototype.option=function(a){var b;a.children?(b=document.createElement("optgroup"),b.label=a.text):(b=document.createElement("option"),void 0!==b.textContent?b.textContent=a.text:b.innerText=a.text),a.id&&(b.value=a.id),a.disabled&&(b.disabled=!0),a.selected&&(b.selected=!0),a.title&&(b.title=a.title);var d=c(b),e=this._normalizeItem(a);return e.element=b,c.data(b,"data",e),d},d.prototype.item=function(a){var b={};if(b=c.data(a[0],"data"),null!=b)return b;if(a.is("option"))b={id:a.val(),text:a.text(),disabled:a.prop("disabled"),selected:a.prop("selected"),title:a.prop("title")};else if(a.is("optgroup")){b={text:a.prop("label"),children:[],title:a.prop("title")};for(var d=a.children("option"),e=[],f=0;f<d.length;f++){var g=c(d[f]),h=this.item(g);e.push(h)}b.children=e}return b=this._normalizeItem(b),b.element=a[0],c.data(a[0],"data",b),b},d.prototype._normalizeItem=function(a){c.isPlainObject(a)||(a={id:a,text:a}),a=c.extend({},{text:""},a);var b={selected:!1,disabled:!1};return null!=a.id&&(a.id=a.id.toString()),null!=a.text&&(a.text=a.text.toString()),null==a._resultId&&a.id&&null!=this.container&&(a._resultId=this.generateResultId(this.container,a)),c.extend({},b,a)},d.prototype.matches=function(a,b){var c=this.options.get("matcher");return c(a,b)},d}),b.define("select2/data/array",["./select","../utils","jquery"],function(a,b,c){function d(a,b){var c=b.get("data")||[];d.__super__.constructor.call(this,a,b),this.addOptions(this.convertToOptions(c))}return b.Extend(d,a),d.prototype.select=function(a){var b=this.$element.find("option").filter(function(b,c){return c.value==a.id.toString()});0===b.length&&(b=this.option(a),this.addOptions(b)),d.__super__.select.call(this,a)},d.prototype.convertToOptions=function(a){function d(a){return function(){return c(this).val()==a.id}}for(var e=this,f=this.$element.find("option"),g=f.map(function(){return e.item(c(this)).id}).get(),h=[],i=0;i<a.length;i++){var j=this._normalizeItem(a[i]);if(c.inArray(j.id,g)>=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},l,j),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&""!==a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");if(void 0!==f&&(this.createTag=f),b.call(this,c,d),a.isArray(e))for(var g=0;g<e.length;g++){var h=e[g],i=this._normalizeItem(h),j=this.option(i);this.$element.append(j)}}return b.prototype.query=function(a,b,c){function d(a,f){for(var g=a.results,h=0;h<g.length;h++){var i=g[h],j=null!=i.children&&!d({results:i.children},!0),k=i.text===b.term;if(k||j)return!f&&(a.data=g,void c(a))}if(f)return!0;var l=e.createTag(b);if(null!=l){var m=e.option(l);m.attr("data-select2-tag",!0),e.addOptions([m]),e.insertTag(g,l)}a.results=g,c(a)}var e=this;return this._removeOldTags(),null==b.term||null!=b.page?void a.call(this,b,c):void a.call(this,b,d)},b.prototype.createTag=function(b,c){var d=a.trim(c.term);return""===d?null:{id:d,text:d}},b.prototype.insertTag=function(a,b,c){b.unshift(c)},b.prototype._removeOldTags=function(b){var c=(this._lastTag,this.$element.find("option[data-select2-tag]"));c.each(function(){this.selected||a(this).remove()})},b}),b.define("select2/data/tokenizer",["jquery"],function(a){function b(a,b,c){var d=c.get("tokenizer");void 0!==d&&(this.tokenizer=d),a.call(this,b,c)}return b.prototype.bind=function(a,b,c){a.call(this,b,c),this.$search=b.dropdown.$search||b.selection.$search||c.find(".select2-search__field")},b.prototype.query=function(a,b,c){function d(a){e.trigger("select",{data:a})}var e=this;b.term=b.term||"";var f=this.tokenizer(b,this.options,d);f.term!==b.term&&(this.$search.length&&(this.$search.val(f.term),this.$search.focus()),b.term=f.term),a.call(this,b,c)},b.prototype.tokenizer=function(b,c,d,e){for(var f=d.get("tokenSeparators")||[],g=c.term,h=0,i=this.createTag||function(a){return{id:a.term,text:a.term}};h<g.length;){var j=g[h];if(-1!==a.inArray(j,f)){var k=g.substr(0,h),l=a.extend({},c,{term:k}),m=i(l);null!=m?(e(m),g=g.substr(h+1)||"",h=0):h++}else h++}return{term:g}},b}),b.define("select2/data/minimumInputLength",[],function(){function a(a,b,c){this.minimumInputLength=c.get("minimumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",b.term.length<this.minimumInputLength?void this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumInputLength",[],function(){function a(a,b,c){this.maximumInputLength=c.get("maximumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",this.maximumInputLength>0&&b.term.length>this.maximumInputLength?void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;return d.maximumSelectionLength>0&&f>=d.maximumSelectionLength?void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}}):void a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<span class="select2-dropdown"><span class="select2-results"></span></span>');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" /></span>');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){var b=e.showSearch(a);b?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){var c=e.$results.offset().top+e.$results.outerHeight(!1),d=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1);c+50>=d&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('<li class="select2-results__option select2-results__option--load-more"role="treeitem" aria-disabled="true"></li>'),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a("<span></span>"),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id,h=this.$container.parents().filter(b.hasScroll);h.off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=(this.$container.position(),this.$container.offset());f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.top<f.top-h.height,k=i.bottom>f.bottom+h.height,l={left:f.left,top:g.bottom};if("static"!==this.$dropdownParent[0].style.position){var m=this.$dropdownParent.offset();l.top-=m.top,l.left-=m.left}c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d<b.length;d++){var e=b[d];e.children?c+=a(e.children):c++}return c}function b(a,b,c,d){this.minimumResultsForSearch=c.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),a.call(this,b,c,d)}return b.prototype.showSearch=function(b,c){return!(a(c.data.results)<this.minimumResultsForSearch)&&b.call(this,c)},b}),b.define("select2/dropdown/selectOnClose",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("close",function(){d._handleSelectOnClose()})},a.prototype._handleSelectOnClose=function(){var a=this.getHighlightedResults();if(!(a.length<1)){var b=a.data("data");null!=b.element&&b.element.selected||null==b.element&&b.selected||this.trigger("select",{data:b})}},a}),b.define("select2/dropdown/closeOnSelect",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("select",function(a){d._selectTriggered(a)}),b.on("unselect",function(a){d._selectTriggered(a)})},a.prototype._selectTriggered=function(a,b){var c=b.originalEvent;c&&c.ctrlKey||this.trigger("close",{})},a}),b.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(a){var b=a.input.length-a.maximum,c="Please delete "+b+" character";return 1!=b&&(c+="s"),c},inputTooShort:function(a){var b=a.minimum-a.input.length,c="Please enter "+b+" or more characters";return c},loadingMore:function(){return"Loading more results…"},maximumSelected:function(a){var b="You can only select "+a.maximum+" item";return 1!=a.maximum&&(b+="s"),b},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),b.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C){function D(){
|
9 |
+
this.reset()}D.prototype.apply=function(l){if(l=a.extend({},this.defaults,l),null==l.dataAdapter){if(null!=l.ajax?l.dataAdapter=o:null!=l.data?l.dataAdapter=n:l.dataAdapter=m,l.minimumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),(null!=l.tokenSeparators||null!=l.tokenizer)&&(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L<K.length;L++){var M=K[L],N={};try{N=k.loadPath(M)}catch(O){try{M=this.defaults.amdLanguageBase+M,N=k.loadPath(M)}catch(P){l.debug&&window.console&&console.warn&&console.warn('Select2: The language file for "'+M+'" could not be automatically loaded. A fallback will be used instead.');continue}}J.extend(N)}l.translations=J}else{var Q=k.loadPath(this.defaults.amdLanguageBase+"en"),R=new k(l.language);R.extend(Q),l.translations=R}return l},D.prototype.reset=function(){function b(a){function b(a){return l[a]||a}return a.replace(/[^\u0000-\u007E]/g,b)}function c(d,e){if(""===a.trim(d.term))return e;if(e.children&&e.children.length>0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){var h=e.children[g],i=c(d,h);null==i&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var j=b(e.text).toUpperCase(),k=b(d.term).toUpperCase();return j.indexOf(k)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)};var E=new D;return E}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return 0>=e?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;i>h;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this._sync=c.bind(this._syncAttributes,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._sync);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._sync)}),this._observer.observe(this.$element[0],{attributes:!0,subtree:!1})):this.$element[0].addEventListener&&this.$element[0].addEventListener("DOMAttrModified",b._sync,!1)},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),(null==a||0===a.length)&&(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._sync),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&this.$element[0].removeEventListener("DOMAttrModified",this._sync,!1),this._sync=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null},e.prototype.render=function(){var b=a('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),b.define("jquery-mousewheel",["jquery"],function(a){return a}),b.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(a,b,c,d){if(null==a.fn.select2){var e=["open","close","destroy"];a.fn.select2=function(b){if(b=b||{},"object"==typeof b)return this.each(function(){var d=a.extend(!0,{},b);new c(a(this),d)}),this;if("string"==typeof b){var d;return this.each(function(){var c=a(this).data("select2");null==c&&window.console&&console.error&&console.error("The select2('"+b+"') method was called on an element that is not using Select2.");var e=Array.prototype.slice.call(arguments,1);d=c[b].apply(c,e)}),a.inArray(b,e)>-1?this:d}throw new Error("Invalid arguments for Select2: "+b)}}return null==a.fn.select2.defaults&&(a.fn.select2.defaults=d),c}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,c});var czr_debug={log:function(a){debug.queue.push(["log",arguments,debug.stack.slice(0)]),window.console&&"function"==typeof window.console.log&&window.console.log(a)},error:function(a){debug.queue.push(["error",arguments,debug.stack.slice(0)]),window.console&&"function"==typeof window.console.error&&window.console.error(a)},queue:[],stack:[]},api=api||wp.customize,$=$||jQuery;!function(a,b,c){a.consoleLog=function(){c.isUndefined(console)&&"function"!=typeof window.console.log||!serverControlParams.isDevMode||console.log.apply(console,arguments)},a.czr_isSkopOn=function(){return serverControlParams.isSkopOn&&c.has(a,"czr_skopeBase")},a.czr_isChangeSetOn=function(){return serverControlParams.isChangeSetOn&&!0},a.czr_wp_conditionals=new a.Value,a.czr_widgetZoneSettings=new a.Value,a.sidebar_insights=new a.Values,a.sidebar_insights.create("candidates"),a.sidebar_insights.create("actives"),a.sidebar_insights.create("inactives"),a.sidebar_insights.create("registered"),a.sidebar_insights.create("available_locations"),a.czr_partials=new a.Value,a.czr_activeSectionId=new a.Value(""),a.czr_activePanelId=new a.Value(""),a.bind("ready",function(){if("function"!=typeof a.Section)throw new Error("Your current version of WordPress does not support the customizer sections needed for this theme. Please upgrade WordPress to the latest version.");var b=function(b,c){a.czr_activeSectionId(b?c:"")};a.section.each(function(a){a.expanded.bind(function(c){b(c,a.id)})}),a.section.bind("add",function(c){a.trigger("czr-paint",{active_panel_id:c.panel()}),c.expanded.bind(function(a){b(a,c.id)})});var d=function(b,d){a.czr_activePanelId(b?d:""),c.isEmpty(a.czr_activePanelId())&&a.czr_activeSectionId("")};a.panel.each(function(a){a.expanded.bind(function(b){d(b,a.id)})}),a.panel.bind("add",function(a){a.expanded.bind(function(b){d(b,a.id)})})}),a.bind("ready",function(){var d=function(){a.section("themes").active.bind(function(d){c.has(serverControlParams,"isThemeSwitchOn")&&c.isEmpty(serverControlParams.isThemeSwitchOn)&&(a.section("themes").active(!1),a.section("themes").active.callbacks=b.Callbacks())})};a.section.has("themes")?d():a.section.when("themes",function(a){d()})}),a.czr_skopeReady=b.Deferred(),a.bind("ready",function(){serverControlParams.isSkopOn&&(a.czr_isLoadingSkope=new a.Value((!1)),a.czr_isLoadingSkope.bind(function(a){d(a)}),a.czr_skopeBase=new a.CZR_skopeBase,a.czr_skopeSave=new a.CZR_skopeSave,a.czr_skopeReset=new a.CZR_skopeReset,a.trigger("czr-skope-started"),a.czr_skopeReady.done(function(){a.trigger("czr-skope-ready")}),setTimeout(function(){"pending"==a.czr_skopeReady.state()&&(a.czr_skopeBase.toggleTopNote(!0,{title:"There was a problem when trying to load the customizer.",message:'Please open your <a href="http://docs.presscustomizr.com/article/272-inspect-your-webpages-in-your-browser-with-the-development-tools" target="_blank">browser debug tool</a>, and report any error message (in red) printed in the javascript console in the <a href="https://wordpress.org/support/theme/hueman" target="_blank">Hueman theme forum</a>.',selfCloseAfter:4e4}),a.czr_isLoadingSkope(!1))},15e3)),serverControlParams.isChangeSetOn&&(a.settings.timeouts.changesetAutoSave=1e4)}),c.has(a,"_latestRevision")||(a._latestRevision=0,a._latestSettingRevisions={},a.bind("change",function(b){a._latestRevision+=1,a._latestSettingRevisions[b.id]=a._latestRevision}),a.bind("ready",function(){a.bind("add",function(b){b._dirty&&(a._latestRevision+=1,a._latestSettingRevisions[b.id]=a._latestRevision)})}));var d=function(d){d=!!c.isUndefined(d)||d;var e,f=function(){var a=b.Deferred();try{_tmpl=wp.template("czr-skope-pane")({is_skope_loading:!0})}catch(c){throw new Error("Error when parsing the the reset skope template : "+c)}return b.when(b("#customize-preview").after(b(_tmpl))).always(function(){a.resolve(b("#czr-skope-pane"))}),a.promise()},g=function(){c.delay(function(){b.when(b("body").removeClass("czr-skope-pane-open")).done(function(){c.delay(function(){b.when(b("body").removeClass("czr-skop-loading")).done(function(){!1!==b("#czr-skope-pane").length&&setTimeout(function(){b("#czr-skope-pane").remove()},400)})},200)})},50)};"pending"==a.czr_skopeReady.state()&&d&&(b("body").addClass("czr-skop-loading"),f().done(function(a){e=a}).then(function(){e.length&&c.delay(function(){var a=b("#customize-preview").height();e.css("line-height",a+"px").css("height",a+"px"),b("body").addClass("czr-skope-pane-open")},50)})),a.czr_skopeReady.done(function(){g()}),d||g()}}(wp.customize,jQuery,_);var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{globalSettingVal:{},initialize:function(){var a=this;a.skope_colors={global:"rgb(255, 255, 255)",special_group:"rgba(173, 213, 247, 0.55)",group:"rgba(173, 213, 247, 0.55)",local:"rgba(78, 122, 199, 0.35)"},api.czr_isPreviewerSkopeAware=$.Deferred(),api.czr_initialSkopeCollectionPopulated=$.Deferred(),a.skopeWrapperEmbedded=$.Deferred(),api.czr_skope=new api.Values,api.czr_skopeCollection=new api.Value([]),api.czr_currentSkopesCollection=new api.Value([]),api.czr_activeSkopeId=new api.Value,api.czr_dirtyness=new api.Value((!1)),api.czr_isResettingSkope=new api.Value((!1)),api.state.create("switching-skope")(!1),api.czr_dirtyness.callbacks.add(function(){return a.apiDirtynessReact.apply(a,arguments)}),api.czr_isLoadingSkope(!0),a.bindAPISettings(),api.state.bind("change",function(){a.setSaveButtonStates()}),"pending"==a.skopeWrapperEmbedded.state()&&$.when(a.embedSkopeWrapper()).done(function(){a.skopeWrapperEmbedded.resolve()}),api.previewer.bind("czr-skopes-synced",function(b){if(serverControlParams.isSkopOn){var c=this,d=api.czr_currentSkopesCollection();if(!_.has(b,"czr_skopes"))throw new Error("Missing skopes in the server data");api.czr_skopeBase.updateSkopeCollection(b.czr_skopes,c.channel()),api.czr_initialSkopeCollectionPopulated.then(function(){var c=_.isUndefined(_.findWhere(api.czr_currentSkopesCollection(),{id:api.czr_activeSkopeId()}));api.czr_skopeBase.reactWhenSkopeSyncedDone(b).done(function(){if(c)api.czr_activeSkopeId(a.getActiveSkopeId()).done(function(){api.consoleLog("INITIAL ACTIVE SKOPE SET : "+arguments[1]+" => "+arguments[0]),"pending"==api.czr_skopeReady.state()&&api.czr_skopeReady.resolve(a.getActiveSkopeId()),a._writeCurrentSkopeTitle()});else if(!_.isEmpty(d)){var e=_.findWhere(d,{skope:"local"}).opt_name,f=_.findWhere(b.czr_skopes,{skope:"local"}).opt_name;f!==e&&"resolved"==api.czr_skopeReady.state()&&a._writeCurrentSkopeTitle()}})})}}),api.czr_currentSkopesCollection.bind(function(b,c){return a.currentSkopesCollectionReact(b,c)},{deferred:!0}),api.czr_initialSkopeCollectionPopulated.done(function(){api.czr_activeSkopeId.bind(function(b,c){return a.activeSkopeReact(b,c)},{deferred:!0}),api.czr_activeSectionId.callbacks.add(function(){return a.activeSectionReact.apply(a,arguments)}),api.czr_activePanelId.callbacks.add(function(){return a.activePanelReact.apply(a,arguments)})}),api.bind("skope-switched",function(b,c){api.czr_skopeReady.then(function(){api.czr_CrtlDependenciesReady.then(function(){_.isUndefined(api.czr_activeSectionId())||_.isEmpty(api.czr_activeSectionId())||api.czr_ctrlDependencies.setServiDependencies(api.czr_activeSectionId(),null,!0)}),a.updateCtrlSkpNot(api.CZR_Helpers.getSectionControlIds()),api.czr_skope.has(c)&&$("#customize-controls").removeClass(["czr-",api.czr_skope(c)().skope,"-skope-level"].join("")),api.czr_skope.has(b)&&$("#customize-controls").addClass(["czr-",api.czr_skope(b)().skope,"-skope-level"].join(""))})}),api.czr_serverNotification=new api.Value({status:"success",message:"",expanded:!0}),api.czr_serverNotification.bind(function(b,c){a.toggleServerNotice(b)}),api.czr_topNoteVisible=new api.Value((!1)),api.czr_skopeReady.then(function(){api.czr_topNoteVisible.bind(function(b){var c={},d={title:"",message:"",actions:"",selfCloseAfter:2e4};c=$.extend(d,serverControlParams.topNoteParams),c.actions=function(){var a=$.extend(api.previewer.query(),{nonce:api.previewer.nonce.save});wp.ajax.post("czr_dismiss_top_note",a).always(function(){}).fail(function(b){api.consoleLog("czr_dismiss_top_note failed",a,b)}).done(function(a){})},a.toggleTopNote(b,c)}),_.delay(function(){api.czr_topNoteVisible(!_.isEmpty(serverControlParams.isTopNoteOn)||1==serverControlParams.isTopNoteOn)},2e3)}),a.scopeSwitcherEventMap=[{trigger:"click keydown",selector:".czr-dismiss-notification",name:"dismiss-notification",actions:function(){api.czr_serverNotification({expanded:!1})}},{trigger:"click keydown",selector:".czr-toggle-title-notice",name:"toggle-title-notice",actions:function(b){_.isUndefined(a.skopeTitleNoticeVisible)&&(a.skopeTitleNoticeVisible=new api.Value((!1)),a.skopeTitleNoticeVisible.bind(function(a){b.dom_el.find(".czr-skope-title").toggleClass("notice-visible",a)})),a.skopeTitleNoticeVisible(!a.skopeTitleNoticeVisible())}}],api.CZR_Helpers.setupDOMListeners(a.scopeSwitcherEventMap,{dom_el:$(".czr-scope-switcher")},a),a.refreshedControls=["czr_cropped_image"],a.initWidgetSidebarSpecifics(),api.bind("czr-paint",function(b){api.czr_skopeReady.then(function(){a.wash(b).paint(b)})})},embedSkopeWrapper:function(){var a=this;$("#customize-header-actions").append($("<div/>",{"class":"czr-scope-switcher",html:'<div class="czr-skopes-wrapper"></div>'})),$("body").addClass("czr-skop-on");var b=[{trigger:"click keydown",selector:".czr-skope-switch",name:"control_skope_switch",actions:function(a){var b=$(a.dom_event.currentTarget,a.dom_el).attr("data-skope-id");!_.isEmpty(b)&&api.czr_skope.has(b)&&api.czr_activeSkopeId(b)}}];api.CZR_Helpers.setupDOMListeners(b,{dom_el:$(".czr-scope-switcher")},a)},apiDirtynessReact:function(a){$("body").toggleClass("czr-api-dirty",a),api.state("saved")(!a)},setSaveButtonStates:function(){api.state.has("saving")||(api.state.create("saving"),api.state("saving").bind(function(a){$(document.body).toggleClass("saving",a)}));var a=$("#save"),b=$(".customize-controls-close"),c=api.state("saved"),d=api.state("saving"),e=api.state("activated"),f=api.state.has("changesetStatus")?api.state("changesetStatus")():"auto-draft";api.czr_dirtyness()||!c()?(a.val(api.l10n.save),b.find(".screen-reader-text").text(api.l10n.cancel)):(a.val(api.l10n.saved),b.find(".screen-reader-text").text(api.l10n.close));var g=!(d()||e()&&c()||"publish"===f);a.prop("disabled",!g)}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{toggleServerNotice:function(a){if(a=_.isObject(a)?a:{},a=_.extend({status:"success",expanded:!0,message:"",auto_collapse:!1},a),"changeset_already_published"!=a.message&&serverControlParams.isDevMode){this.serverNoticeEmbedded=this.serverNoticeEmbedded||$.Deferred();var b=this,c=function(){$(".czr-scope-switcher").prepend($("<div/>",{"class":"czr-server-notice",html:'<span class="czr-server-message"></span><span class="fa fa-times-circle czr-dismiss-notification"></span>'}))},d=function(){var c,d,e=$(".czr-server-notice",".czr-scope-switcher"),f=$(".wp-full-overlay-header"),g=($(".wp-full-overlay-sidebar .wp-full-overlay-sidebar-content"),function(a){return!0});b.skopeTitleNoticeVisible&&b.skopeTitleNoticeVisible(!1),a.expanded?(e.toggleClass("czr-server-error","error"==a.status),"error"==a.status?$(".czr-server-message",e).html(_.isEmpty(a.message)?"Server Problem.":a.message):$(".czr-server-message",e).html(_.isEmpty(a.message)?"Success.":a.message),d=$(".czr-server-notice",".czr-scope-switcher").outerHeight(),c=f.outerHeight()+d,setTimeout(function(){$.when(g(c)).done(function(){e.fadeIn({duration:200,complete:function(){$(this).css("height","auto")}})})},400)):(e.fadeOut({duration:200,complete:function(){}}),setTimeout(function(){g()},200))};"pending"==b.serverNoticeEmbedded.state()?$.when(c()).done(function(){setTimeout(function(){b.serverNoticeEmbedded.resolve(),d()},200)}):d(),_.delay(function(){api.czr_serverNotification({expanded:!1})},"success"==a.status||!1!==a.auto_collapse?4e3:5e3)}},buildServerResponse:function(a){var b=!1;if(_.isObject(a)&&(!_.has(a,"responseJSON")||_.isUndefined(a.responseJSON.data)||_.isEmpty(a.responseJSON.data)?_.has(a,"statusText")&&!_.isEmpty(a.statusText)&&(b=a.statusText):b=a.responseJSON.data),_.isObject(a)&&!b)try{JSON.stringify(a)}catch(c){b="Server Error"}else b?"-1"===a&&(b="Identification issue detected, please refresh your page."):b="0"===a?"Not logged in.":a;return b}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{toggleTopNote:function(a,b){b=_.isObject(b)?b:{};var c=this,d={title:"",message:"",actions:"",selfCloseAfter:2e4},e=function(){$.when(c.renderTopNoteTmpl(b)).done(function(a){c.welcomeNote=a,_.delay(function(){$("body").addClass("czr-top-note-open")},200),api.CZR_Helpers.setupDOMListeners([{trigger:"click keydown",selector:".czr-top-note-close",name:"close-top-note",actions:function(){f().done(function(){_.isFunction(b.actions)&&b.actions()})}}],{dom_el:c.welcomeNote},c)})},f=function(){var a=$.Deferred();return $("body").removeClass("czr-top-note-open"),c.welcomeNote.length?_.delay(function(){c.welcomeNote.remove(),a.resolve()},300):a.resolve(),a.promise()};b=$.extend(d,b),a?e():f(),_.delay(function(){f()},b.selfCloseAfter||2e4)},renderTopNoteTmpl:function(a){if($("#czr-top-note").length)return $("#czr-top-note");var b="",c=a.title||"",d=a.message||"";try{b=wp.template("czr-top-note")({title:c})}catch(e){throw new Error("Error when parsing the the top note template : "+e)}return $("#customize-preview").after($(b)),$(".czr-note-message","#czr-top-note").html(d),$("#czr-top-note")}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{bindAPISettings:function(a){var b=this,c=function(a,c,d){var e,f=this.id;_.has(api,"czr_activeSkopeId")&&!_.isUndefined(api.czr_activeSkopeId())||api.consoleLog("The api.czr_activeSkopeId() is undefined in the api.previewer._new_refresh() method."),api(f)._dirty&&(e=b.isSettingSkopeEligible(f)?api.czr_activeSkopeId():b.getGlobalSkopeId(),api.czr_skope(e).updateSkopeDirties(f,a)),_.has(api.control(f),"czr_states")&&!api.control(f).czr_states("isResetting")()&&api.control(f).czr_states("resetVisible")(!1),b.isSettingSkopeEligible(f)&&b.updateCtrlSkpNot(f)};_.isUndefined(a)?api.each(function(a){a.bind(c)}):api(a).bind(c);var d=function(a){a.callbacks.has(c)||a.bind(c)};api.topics.change.has(d)||api.bind("change",d)}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{reactWhenSkopeSyncedDone:function(a){var b=$.Deferred();if(!_.has(a,"czr_skopes")||_.isEmpty(a.czr_skopes))throw new Error("Missing skope data after refresh",a);api.czr_dirtyness()||api.czr_dirtyness(!!_.isBoolean(a.isChangesetDirty)&&a.isChangesetDirty);var c=a.czr_skopes;return _.each(api.czr_skopeCollection(),function(a){var b=_.findWhere(c,{opt_name:a.opt_name});if(!_.isUndefined(b)){var d=_.isEmpty(b.changeset||{})?{}:b.changeset,e={};_.each(d,function(a,b){api.has(b)||api.consoleLog("In reactWhenSkopeSyncedDone : attempting to update the changeset with a non registered setting : "+b),e[b]=a}),api.czr_skope(a.id).changesetValues(e)}}),_.each(api.czr_skopeCollection(),function(a){var b=_.findWhere(c,{opt_name:a.opt_name});if(!_.isUndefined(b)){var d=$.extend(!0,{},api.czr_skope(a.id).dbValues()),e=$.extend(d,b.db||{}),f={};_.each(e,function(a,b){api.has(b)||api.consoleLog("In reactWhenSkopeSyncedDone : attempting to update the db values with a non registered setting : "+b),f[b]=a}),api.czr_skope(a.id).dbValues(f)}}),_.delay(function(){b.resolve()},500),b.promise()}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{_maybeSetupAssignedMenuLocations:function(a){(_.isUndefined(a)||_.isEmpty(a)||!api.section.has(a.id))&&api.consoleLog("In _maybeSetupAssignedMenuLocations : no valid section_id provided.");if(a.assignedLocations){var b=function(a){};a.assignedLocations.callbacks.has(b)||a.assignedLocations.bind(b)}},activeSectionReact:function(a,b){"add_menu"!=a&&api.trigger("czr-paint",{active_section_id:a});var c=this,d=function(a){var b=api.CZR_Helpers.getSectionControlIds(a);_.each(b,function(a){if(api.has(a)&&!_.isUndefined(api.control(a))){var b=api.control(a);_.has(b,"czr_states")&&(b.czr_states("noticeVisible")(!1),b.czr_states("resetVisible")(!1))}})},e=function(a,b){c.setupActiveSkopedControls({section_id:b}),c.processSilentUpdates({section_id:b}).fail(function(){throw new Error("Fail to process silent updates after initial skope collection has been populated")}).done(function(){c.isExcludedSidebarsWidgets()||c.forceSidebarDirtyRefresh(b,api.czr_activeSkopeId())}),_.has(api.topics,"active-section-setup")||api.bind("active-section-setup",function(a){var b={controls:[],section_id:""};a=_.extend(b,a),c._maybeSetupAssignedMenuLocations(a)}),api.czr_skopeReady.then(function(){var a=function(a){api.czr_serverNotification({status:"success",message:[a,"can only be customized site wide."].join(" ")}),api.czr_activeSkopeId(c.getGlobalSkopeId())};"global"!=api.czr_skope(api.czr_activeSkopeId())().skope&&(!c.isExcludedWPCustomCss()||"custom_css"!=b&&"admin_sec"!=b||a(api.section(b).params.title),"nav_menu["!=b.substring(0,"nav_menu[".length)&&"add_menu"!=b||api.czr_serverNotification({status:"success",message:["Menus are created site wide."].join(" ")}))}),api.trigger("active-section-setup",a)};api.czr_initialSkopeCollectionPopulated.then(function(){api.section.when(a,function(b){b.deferred.embedded.then(function(){e(b,a)})}),!_.isEmpty(b)&&api.section.has(b)&&d(b);
|
10 |
+
})},activePanelReact:function(a,b){var c=this;api.czr_initialSkopeCollectionPopulated.then(function(){api.trigger("czr-paint",{active_panel_id:a});api.czr_skopeReady.then(function(){"global"!=api.czr_skope(api.czr_activeSkopeId())().skope&&c.isExcludedSidebarsWidgets()&&"widgets"==a&&api.czr_serverNotification({status:"success",message:["Widgets are created site wide."].join(" ")})}),api.czr_skopeReady.then(function(){"nav_menus"==a&&_.each(api.panel(a).sections(),function(a){c.processSilentUpdates({section_id:a.id,awake_if_not_active:!0})})})})}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{wash:function(a){var b=function(a){_.has(a,"el")&&a.el.length&&$.when(a.el.removeClass("czr-painted")).done(function(){$(this).css("background","").css("color","")})};return api.czr_skopeBase.paintedElements&&(_.each(api.czr_skopeBase.paintedElements(),function(a){b(a)}),api.czr_skopeBase.paintedElements([])),this},paint:function(a){var b="inherit",c={active_panel_id:api.czr_activePanelId(),active_section_id:api.czr_activeSectionId(),is_skope_switch:!1},d=[];a=$.extend(c,a),!_.isUndefined(api.czr_activeSkopeId())&&api.czr_skope.has(api.czr_activeSkopeId())&&(b=api.czr_skope(api.czr_activeSkopeId()).color);var e=function(c){_.has(c,"el")&&c.el.length&&(a.is_skope_switch?$.when(c.el.addClass("czr-painted")).done(function(){$(this).css("background",c.bgColor||b)}):c.el.css("background",c.bgColor||b),"global"!=api.czr_skope(api.czr_activeSkopeId())().skope&&c.el.css("color","#000"))};return api.czr_skopeBase.paintedElements=api.czr_skopeBase.paintedElements||new api.Value([]),_.isEmpty(a.active_panel_id)&&_.isEmpty(a.active_section_id)&&(d.push({el:$("#customize-info").find(".accordion-section-title").first()}),api.panel.each(function(a){d.push({el:a.container.find(".accordion-section-title").first()})}),api.section.each(function(a){_.isEmpty(a.panel())&&d.push({el:a.container.find(".accordion-section-title").first()})})),!_.isEmpty(a.active_panel_id)&&_.isEmpty(a.active_section_id)&&api.panel.when(a.active_panel_id,function(a){a.deferred.embedded.then(function(){d.push({el:a.container.find(".accordion-section-title, .customize-panel-back")})})}),_.isEmpty(a.active_section_id)||api.section.when(a.active_section_id,function(a){a.deferred.embedded.then(function(){d.push({el:a.container.find(".customize-section-title, .customize-section-back"),bgColor:"inherit"},{el:a.container}),api.czr_isChangeSetOn()||d.push({el:a.container.find(".accordion-section-content")})})}),_.each(d,function(a){e(a)}),api.czr_skopeBase.paintedElements(d),this}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{isSkopeRegisteredInCollection:function(a,b){return b=b||api.czr_skopeCollection(),!_.isUndefined(_.findWhere(b,{id:a}))},isSkopeRegisteredInCurrentCollection:function(a,b){return b=b||api.czr_currentSkopesCollection(),!_.isUndefined(_.findWhere(b,{id:a}))},isGlobalSkopeRegistered:function(){var a=_.findWhere(api.czr_currentSkopesCollection(),{skope:"global"});return _.isObject(a)&&_.has(a,"id")},getGlobalSkopeId:function(){if(!_.has(api,"czr_skope"))return"";var a="";return api.czr_skope.each(function(b){"global"==b().skope&&(a=b().id)}),a},getChangedGlobalDBSettingValues:function(a){var b={};return _.each(a,function(a,c){_wpSetId=api.CZR_Helpers.build_setId(c),_.has(api.settings.settings,_wpSetId)&&(_.isEqual(a,api.settings.settings[_wpSetId].value)||(b[c]=a))}),b},getActiveSkopeId:function(a){a=a||api.czr_currentSkopesCollection();var b=!_.isEmpty(api.czr_activeSkopeId())&&api.czr_skope.has(api.czr_activeSkopeId())?api.czr_skope(api.czr_activeSkopeId())().skope:serverControlParams.isLocalSkope?"local":"global",c=_.findWhere(a,{skope:b});if(_skpId=_.isUndefined(c)?_.findWhere(a,{skope:"global"}).id:c.id,_.isUndefined(_skpId))throw new Error("No default skope was found in getActiveSkopeId ",a);return _skpId},getActiveSkopeName:function(){return api.czr_skope.has(api.czr_activeSkopeId())?api.czr_skope(api.czr_activeSkopeId())().skope:"global"},isSettingSkopeEligible:function(a){var b=this,c=api.CZR_Helpers.getOptionName(a);return _.isUndefined(a)||!api.has(a)?(api.consoleLog("THE SETTING "+a+" IS NOT ELIGIBLE TO SKOPE BECAUSE UNDEFINED OR NOT REGISTERED IN THE API."),!1):!b.isExcludedWPBuiltinSetting(a)&&(!_.contains(serverControlParams.skopeExcludedSettings,c)&&(b.isThemeSetting(a),!0))},isSettingResetEligible:function(a){var b=this;api.CZR_Helpers.getOptionName(a);if(_.isUndefined(a)||!api.has(a))return void api.consoleLog("THE SETTING "+a+" IS NOT ELIGIBLE TO RESET BECAUSE UNDEFINED OR NOT REGISTERED IN THE API.");if(!b.isExcludedWPBuiltinSetting(a))return!(!b.isThemeSetting(a)&&!b.isWPAuthorizedSetting(a))||void api.consoleLog("THE SETTING "+a+" IS NOT ELIGIBLE TO RESET BECAUSE NOT PART OF THE THEME OPTIONS AND NOT WP AUTHORIZED BUILT IN OPTIONS")},isThemeSetting:function(a){return _.isString(a)&&-1!==a.indexOf(serverControlParams.themeOptions)},isWPAuthorizedSetting:function(a){return _.isString(a)&&_.contains(serverControlParams.wpBuiltinSettings,a)},isExcludedWPBuiltinSetting:function(a){var b=this;if(_.isUndefined(a))return!0;if("active_theme"==a)return!0;if(_.contains(serverControlParams.wpBuiltinSettings,a))return!1;var c=["widget_","nav_menu","sidebars_","custom_css","nav_menu[","nav_menu_item","nav_menus_created_posts","nav_menu_locations"],d=!1;return _.each(c,function(c){switch(c){case"widget_":case"sidebars_":c==a.substring(0,c.length)&&(d=b.isExcludedSidebarsWidgets());break;case"nav_menu[":case"nav_menu_item":case"nav_menus_created_posts":c==a.substring(0,c.length)&&(d=!0);break;case"nav_menu_locations":c==a.substring(0,c.length)&&(d=b.isExcludedNavMenuLocations());break;case"custom_css":c==a.substring(0,c.length)&&(d=b.isExcludedWPCustomCss())}}),d},isExcludedSidebarsWidgets:function(){var a=serverControlParams.isSidebarsWigetsSkoped;return!(!_.isUndefined(a)&&!_.isEmpty(a)&&!1!==a)},isExcludedNavMenuLocations:function(){if(!api.czr_isChangeSetOn())return!0;var a=serverControlParams.isNavMenuLocationsSkoped;return!(!_.isUndefined(a)&&!_.isEmpty(a)&&!1!==a)},isExcludedWPCustomCss:function(){var a=serverControlParams.isWPCustomCssSkoped;return!(!_.isUndefined(a)&&!_.isEmpty(a)&&!1!==a)},_getDBSettingVal:function(a,b){var c=api.CZR_Helpers.getOptionName(a),d=api.CZR_Helpers.build_setId(a);return api.czr_skope.has(b)?_.has(api.czr_skope(b).dbValues(),d)?api.czr_skope(b).dbValues()[d]:_.has(api.czr_skope(b).dbValues(),c)?api.czr_skope(b).dbValues()[c]:"_no_db_val":(api.consoleLog("_getDBSettingVal : the requested skope id is not registered : "+b),"_no_db_val")},getSkopeDirties:function(a,b){if(!api.czr_skope.has(a))return{};b=b||{},b=_.extend({unsaved:!0},b);var c={};return _.each(api.czr_skope(a).dirtyValues(),function(a,d){var e;api.czr_isChangeSetOn()&&(e=api._latestSettingRevisions[d],api.state("changesetStatus").get()&&b&&b.unsaved&&(_.isUndefined(e)||e<=api._lastSavedRevision))||(c[d]=a)}),c},getSkopeExcludedDirties:function(){var a=this,b={};api.each(function(a,c){a._dirty&&(b[c]=a())});var c=a.getGlobalSkopeId();a.getSkopeDirties(c);return _.omit(b,function(b,c){return a.isSettingSkopeEligible(c)})},parseWidgetId:function(a,b){var c,d={number:null,id_base:null};return c=a.match(/^(.+)-(\d+)$/),c?(d.id_base=c[1],d.number=parseInt(c[2],10)):d.id_base=a,_.isUndefined(b)||(d.id_base=d.id_base.replace(b,"")),d},widgetIdToSettingId:function(a,b){var c,d=this.parseWidgetId(a,b);return c=d.id_base,d.number&&(c+="["+d.number+"]"),c},isWidgetRegisteredGlobally:function(a){var b=this;return registered=!1,_.each(_wpCustomizeWidgetsSettings.registeredWidgets,function(c,d){registered||"widget_"+b.widgetIdToSettingId(d)!=a||(registered=!0)}),registered}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{getAppliedPrioritySkopeId:function(a,b){if(!api.has(api.CZR_Helpers.build_setId(a)))throw new Error("getAppliedPrioritySkopeId : the requested setting id does not exist in the api : "+api.CZR_Helpers.build_setId(a));if(!api.czr_skope.has(b))throw new Error("getAppliedPrioritySkopeId : the requested skope id is not registered : "+b);var c=this,d=_.findWhere(api.czr_currentSkopesCollection(),{skope:"local"}).id;if(_.isUndefined(d)||b==d)return b;var e=function(d){var f=api.CZR_Helpers.build_setId(a),g="___",h=api.czr_skope(d)();if(d==b)return b;if(api.czr_skope(d).getSkopeSettingAPIDirtyness(f))return h.id;if(api.czr_isChangeSetOn()&&api.czr_skope(d).getSkopeSettingChangesetDirtyness(f))return h.id;var i=c._getDBSettingVal(a,d);return"_no_db_val"!=i?h.id:"global"==h.skope?h.id:"___"!=g?h.title:e(c._getParentSkopeId(h))};return e(d)},getOverridenSkopeTitles:function(){var a=a||api.czr_activeSkopeId();if(!api.czr_skope.has(a))throw new Error("getInheritedSkopeTitles : the requested skope id is not registered : "+a);var b=this,c=_.findWhere(api.czr_currentSkopesCollection(),{skope:"local"}).id;if(!_.isUndefined(c)&&a!=c){var d=function(c,e){e=e||[];var f=api.czr_skope(c)();return c==a?e:(e.unshift(c),d(b._getParentSkopeId(f),e))};return _.map(d(c),function(a){return b.buildSkopeLink(a)}).join(" and ")}},getInheritedSkopeId:function(a,b){if(!api.has(api.CZR_Helpers.build_setId(a)))throw new Error("getInheritedSkopeId : the requested setting id does not exist in the api : "+api.CZR_Helpers.build_setId(a));if(!api.czr_skope.has(b))throw new Error("getInheritedSkopeId : the requested skope id is not registered : "+b);var c,d=this,e=api.CZR_Helpers.build_setId(a),f="___",g=api.czr_skope(b)();if(c=_.has(api.settings.settings,e)?api.settings.settings[e].value:null,api.czr_skope(b).getSkopeSettingAPIDirtyness(e))return b;if(api.czr_isChangeSetOn()&&api.czr_skope(b).getSkopeSettingChangesetDirtyness(e))return b;var h=d._getDBSettingVal(a,b);return"_no_db_val"!=h?b:"global"==g.skope?b:"___"!=f?b:d.getInheritedSkopeId(a,d._getParentSkopeId(g))},getInheritedSkopeTitles:function(a,b){if(a=a||api.czr_activeSkopeId(),!api.czr_skope.has(a))throw new Error("getInheritedSkopeTitles : the requested skope id is not registered : "+a);b=b||[];var c=this,d=api.czr_skope(a)();return a!==api.czr_activeSkopeId()&&b.unshift(a),"global"!==d.skope?c.getInheritedSkopeTitles(c._getParentSkopeId(d),b):_.map(b,function(a){return c.buildSkopeLink(a)}).join(" and ")},buildSkopeLink:function(a){if(!api.czr_skope.has(a))throw new Error("buildSkopeLink : the requested skope id is not registered : "+a);var b="Switch to scope : "+api.czr_skope(a)().title;return['<span class="czr-skope-switch" title=" '+b+'" data-skope-id="'+a+'">',api.czr_skope(a)().title,"</span>"].join("")},getSkopeSettingVal:function(a,b){if(!api.has(api.CZR_Helpers.build_setId(a)))throw new Error("getSkopeSettingVal : the requested setting id does not exist in the api : "+api.CZR_Helpers.build_setId(a));if(!api.czr_skope.has(b))throw new Error("getSkopeSettingVal : the requested skope id is not registered : "+b);var c,d=this,e=api.CZR_Helpers.build_setId(a),f="___",g=api.czr_skope(b)();if(c=_.has(api.settings.settings,e)?api.settings.settings[e].value:null,api.czr_skope(b).getSkopeSettingAPIDirtyness(e))return api.czr_skope(b).dirtyValues()[e];if(api.czr_isChangeSetOn()&&api.czr_skope(b).getSkopeSettingChangesetDirtyness(e))return api.czr_skope(b).changesetValues()[e];var h=d._getDBSettingVal(a,b);return"_no_db_val"!=h?h:"global"==g.skope?"___"==f?c:f:"___"!=f?f:d.getSkopeSettingVal(a,d._getParentSkopeId(g))},applyDirtyCustomizedInheritance:function(a,b){b=b||api.czr_activeSkopeId()||api.czr_skopeBase.getGlobalSkopeId(),a=a||{};var c=this,d=api.czr_skope(b)();if("global"==d.skope)return a;var e=c._getParentSkopeId(d),f=api.czr_skope(e).dirtyValues();return _.each(f,function(b,c){var e=api.CZR_Helpers.getOptionName(c);_.isUndefined(a[c])&&_.isUndefined(api.czr_skope(d.id).dbValues()[e])&&(a[c]=b)}),"global"==api.czr_skope(e)().skope?a:c.applyDirtyCustomizedInheritance(a,e)},_getParentSkopeId:function(a,b){var c=this,d=["local","group","special_group","global"],e=b||1*(_.findIndex(d,function(b){return a.skope==b})+1),f=d[e];return _.isUndefined(f)?_.findWhere(api.czr_currentSkopesCollection(),{skope:"global"}).id:_.isUndefined(_.findWhere(api.czr_currentSkopesCollection(),{skope:f}))?c._getParentSkopeId(a,e+1):_.findWhere(api.czr_currentSkopesCollection(),{skope:f}).id},_getChildSkopeId:function(a,b){var c=this,d=["local","group","special_group","global"],e=b||1*(_.findIndex(d,function(b){return a.skope==b})-1),f=d[e];return _.isUndefined(f)?_.findWhere(api.czr_currentSkopesCollection(),{skope:"local"}).id:_.isUndefined(_.findWhere(api.czr_currentSkopesCollection(),{skope:f}))?c._getParentSkopeId(a,e-1):_.findWhere(api.czr_currentSkopesCollection(),{skope:f}).id}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{updateSkopeCollection:function(a,b){var c=this;if(_api_ready_collection=[],_.each(a,function(a,b){var d=$.extend(!0,{},a);_api_ready_collection.push(c.prepareSkopeForAPI(d))}),c.isGlobalSkopeRegistered()){var d=[],e=$.extend(!0,{},api.czr_skope(c.getGlobalSkopeId())());_.each(_api_ready_collection,function(a,b){"global"==a.skope?d.push(e):d.push(a)}),_api_ready_collection=d}api.czr_currentSkopesCollection(_api_ready_collection)},prepareSkopeForAPI:function(a){if(!_.isObject(a))throw new Error("prepareSkopeForAPI : a skope must be an object to be API ready");var b=this,c={};if(_.each(serverControlParams.defaultSkopeModel,function(b,d){var e=a[d];switch(d){case"title":if(!_.isString(e))throw new Error("prepareSkopeForAPI : a skope title property must a string");c[d]=e;break;case"long_title":if(!_.isString(e))throw new Error("prepareSkopeForAPI : a skope title property must a string");c[d]=e;break;case"skope":if(!_.isString(e)||_.isEmpty(e))throw new Error('prepareSkopeForAPI : a skope "skope" property must a string not empty');c[d]=e;break;case"level":if(!_.isString(e)||_.isEmpty(e))throw new Error("prepareSkopeForAPI : a skope level must a string not empty for skope "+e.skope);c[d]=e;break;case"dyn_type":if(!_.isString(e)||!_.contains(serverControlParams.skopeDynTypes,e))throw new Error("prepareSkopeForAPI : missing or invalid dyn type for skope "+a);c[d]=e;break;case"opt_name":if(!_.isString(e)||_.isEmpty(e))throw new Error('prepareSkopeForAPI : invalid "opt_name" property for skope '+e.skope);c[d]=e;break;case"obj_id":if(!_.isString(e))throw new Error('prepareSkopeForAPI : invalid "obj_id" for skope '+e.skope);c[d]=e;break;case"is_winner":if(!_.isUndefined(e)&&!_.isBoolean(e))throw new Error('prepareSkopeForAPI : skope property "is_winner" must be a boolean');c[d]=e;break;case"is_forced":if(!_.isUndefined(e)&&!_.isBoolean(e))throw new Error('prepareSkopeForAPI : skope property "is_primary" must be a boolean');c[d]=e;break;case"db":if((_.isArray(e)||_.isEmpty(e))&&(e={}),_.isUndefined(e)||!_.isObject(e))throw new Error('prepareSkopeForAPI : skope property "db" must be an object');c[d]=e;break;case"changeset":if((_.isArray(e)||_.isEmpty(e))&&(e={}),_.isUndefined(e)||!_.isObject(e))throw new Error('prepareSkopeForAPI : skope property "changeset" must be an object');c[d]=e;break;case"has_db_val":if(!_.isUndefined(e)&&!_.isBoolean(e))throw new Error('prepareSkopeForAPI : skope property "has_db_val" must be a boolean');c[d]=e}}),c.color=b.skope_colors[c.skope]||"rgb(255, 255, 255)",c.id=c.skope+"_"+c.level,!_.isString(c.id)||_.isEmpty(c.id))throw new Error("prepareSkopeForAPI : a skope id must a string not empty");return _.isString(c.title)&&!_.isEmpty(c.title)||(c.title=id,c.long_title=id),c},currentSkopesCollectionReact:function(a,b){var c=this,d=$.extend(!0,[],a)||[],e=($.extend(!0,[],b)||[],$.Deferred()),f=[];_.each(d,function(a){api.czr_skope.has(a.id)||f.push(a)}),_.each(f,function(a){a=$.extend(!0,{},a),api.czr_skope.add(a.id,new api.CZR_skope(a.id,a))}),_.each(f,function(a){if(!api.czr_skope.has(a.id))throw new Error("Skope id : "+a.id+" has not been instantiated.");"pending"==api.czr_skope(a.id).isReady.state()&&api.czr_skope(a.id).ready()});var g=_.size(d),h=function(a){var b=a.container.attr("class").split(" ");_.each(a.container.attr("class").split(" "),function(a){"width-"==a.substring(0,6)&&(b=_.without(b,a))}),$.when(a.container.attr("class",b.join(" "))).done(function(){a.container.addClass("width-"+Math.round(100/g))})};return api.czr_skope.each(function(a){if(_.isUndefined(_.findWhere(d,{id:a().id})))a.visible(!1),a.isReady.then(function(){a.container.toggleClass("active-collection",!1)});else{a.visible(!0);var b=function(){h(a),a.container.toggleClass("active-collection",!0)};"pending"==a.isReady.state()?a.isReady.then(function(){b()}):b()}}),_.isEmpty(b)&&!_.isEmpty(a)&&api.czr_initialSkopeCollectionPopulated.resolve(),c.maybeSynchronizeGlobalSkope(),e.resolve("changed").promise()},maybeSynchronizeGlobalSkope:function(a){if(a=a||{},!_.isObject(a))throw new Error("maybeSynchronizeGlobalSkope : args must be an object");var b,c,d,e=this,f=$.Deferred();_.extend({isGlobalReset:!1,isSetting:!1,settingIdToReset:"",isSkope:!1,skopeIdToReset:""},a);if(e.isGlobalSkopeRegistered()){var g=api.czr_skope(e.getGlobalSkopeId()).dbValues();if(_.each(g,function(a,b){api.has(b)&&!_.isEqual(api.settings.settings[b].value,a)&&(api.settings.settings[b].value=a)}),a.isGlobalReset&&a.isSetting){if(b=a.settingIdToReset,c=api.CZR_Helpers.getOptionName(b),d=serverControlParams.defaultOptionsValues[c],_.isUndefined(api.settings.settings[b])||_.isUndefined(d))return;d!=api.settings.settings[b].value&&(api.settings.settings[b].value=d)}a.isGlobalReset&&a.isSkope&&_.each(api.settings.settings,function(a,b){e.isThemeSetting(b)&&(c=api.CZR_Helpers.getOptionName(b),_.has(serverControlParams.defaultOptionsValues,c)&&(api.settings.settings[b].value=serverControlParams.defaultOptionsValues[c]))})}return f.resolve().promise()}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{activeSkopeReact:function(a,b){var c=this,d=$.Deferred();if(!_.isUndefined(b)&&api.czr_skope.has(b))api.czr_skope(b).active(!1);else if(!_.isUndefined(b))throw new Error("listenToActiveSkope : previous scope does not exist in the collection",b);if(_.isUndefined(a)||!api.czr_skope.has(a))throw new Error("listenToActiveSkope : requested scope "+a+" does not exist in the collection");api.czr_skope(a).active(!0);var e=function(a){return api.czr_activeSkopeId(c.getGlobalSkopeId()),api.czr_serverNotification({status:"success",message:[a,"can only be customized site wide."].join(" ")}),d.resolve().promise()};if(c.isExcludedSidebarsWidgets()&&"widgets"==api.czr_activePanelId()&&a!=c.getGlobalSkopeId()&&api.czr_serverNotification({status:"success",message:["Widgets are created site wide."].join(" ")}),c.isExcludedWPCustomCss()&&"custom_css"==api.czr_activeSectionId()&&a!=c.getGlobalSkopeId())return e(api.section(api.czr_activeSectionId()).params.title);if("admin_sec"==api.czr_activeSectionId()&&a!=c.getGlobalSkopeId())return e(api.section(api.czr_activeSectionId()).params.title);if("nav_menu"!=api.czr_activeSectionId().substring(0,"nav_menu".length)&&"add_menu"!=api.czr_activeSectionId()||a==c.getGlobalSkopeId()||api.czr_serverNotification({status:"success",message:["Menus are created site wide."].join(" ")}),"nav_menus"==api.czr_activePanelId()&&_.each(api.panel(api.czr_activePanelId()).sections(),function(a){c.processSilentUpdates({section_id:a.id,awake_if_not_active:!0})}),api.state("switching-skope")(!0),c._writeCurrentSkopeTitle(a),api.trigger("czr-paint",{is_skope_switch:!0}),_.isUndefined(api.czr_activeSectionId()))return api.state("switching-skope")(!1),api.previewer.refresh(),d.resolve().promise();_.has(api,"czrModulePanelState")&&api.czrModulePanelState(!1);var f=c._getSilentUpdateCandidates();_.isUndefined(b)||_.each(api.czr_skope(b).dirtyValues(),function(a,b){_.contains(f,b)||f.push(b)}),_.isUndefined(a)||_.each(api.czr_skope(a).dirtyValues(),function(a,b){_.contains(f,b)||f.push(b)});var g=function(){c.processSilentUpdates({candidates:f,section_id:null,refresh:!1}).fail(function(){throw d.reject(),api.state("switching-skope")(!1),new Error("Fail to process silent updates in _debouncedProcessSilentUpdates")}).done(function(c){api.previewer.refresh().always(function(){api.trigger("skope-switched",a,b),d.resolve(),api.state("switching-skope")(!1)})})};return _.has(api,"czr_isModuleExpanded")&&!1!==api.czr_isModuleExpanded()?(api.czr_isModuleExpanded().setupModuleViewStateListeners(!1),(g=_.debounce(g,400))()):g(),d.promise()},_writeCurrentSkopeTitle:function(a){var b=this,c=api.czr_skope(a||api.czr_activeSkopeId())().long_title,d=function(){var d=b.getInheritedSkopeTitles(),e=b.getOverridenSkopeTitles();return $.trim(['<span class="czr-main-title"><span class="czr-toggle-title-notice fa fa-info-circle"></span>',"global"==api.czr_skope(a||api.czr_activeSkopeId())().skope?c:["Customizing",c].join(" "),"</span>",'<span class="czr-skope-inherits-from">',"In this context :",_.isEmpty(d)?" ":"inherits from",d,_.isEmpty(d)?"":_.isEmpty(e)?".":", and",_.isEmpty(e)?" ":"overridden by",e,_.isEmpty(e)?"":".","</span>"].join(" "))},e=function(a){a?$(".czr-scope-switcher").find(".spinner").fadeIn():$(".czr-scope-switcher").find(".spinner").fadeOut()};b.skopeWrapperEmbedded.then(function(){$(".czr-scope-switcher").find(".czr-current-skope-title").length?$.when($(".czr-scope-switcher").find(".czr-skope-title").fadeOut(200)).done(function(){$(this).html(d()).fadeIn(200)}):$(".czr-scope-switcher").prepend($("<h2/>",{"class":"czr-current-skope-title",html:['<span class="czr-skope-title">','<span class="spinner">',d(),"</span>","</span>"].join("")})),_.isUndefined(api.state("switching-skope").isBound)&&(api.state("switching-skope").bind(e),api.state("switching-skope").isBound=!0)})}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{processSilentUpdates:function(a){a=_.isString(a)?{candidates:[a]}:a||{};var b=this,c={candidates:[],section_id:api.czr_activeSectionId(),refresh:!0,awake_if_not_active:!1},d=$.Deferred();if(a=$.extend(c,a),_.isString(a.candidates)&&(a.candidates=[a.candidates]),_.isEmpty(a.candidates)&&(a.candidates=b._getSilentUpdateCandidates(a.section_id,a.awake_if_not_active)),!_.isArray(a.candidates))throw new Error("processSilentUpdates : the update candidates must be an array.");if(_.isEmpty(a.candidates))return d.resolve([]).promise();var e=function(){b.silentlyUpdateSettings(a.candidates,a.refresh).fail(function(){d.reject()}).done(function(c){_.delay(function(){b.setupActiveSkopedControls({section_id:a.section_id})},1e3),d.resolve(c)})};return"pending"==api.czr_skopeReady.state()?(d.resolve([]),api.czr_skopeReady.done(function(){e()})):e(),d.promise()},silentlyUpdateSettings:function(a,b){api.state.has("silent-update-processing")||api.state.create("silent-update-processing")(!1),api.state("silent-update-processing")(!0);var c=this,d={},e=$.Deferred();b=!!_.isUndefined(b)||b,(_.isUndefined(a)||_.isEmpty(a))&&(a=c._getSilentUpdateCandidates()),_.isString(a)&&(a=[a]),_.each(a,function(a){api.control.has(a)&&"czr_multi_module"==api.control(a).params.type||(d[a]=c.getSettingUpdatePromise(a))});var f=[],g=[];return _.each(d,function(a,b){a.done(function(a){var c=api.CZR_Helpers.build_setId(b),d=api.czr_skope(api.czr_activeSkopeId()).getSkopeSettingDirtyness(b);_.isEqual(api(c)(),a)||g.push(b),api(c).silent_set(a,d)}),f.push(a)}),$.when.apply(null,f).fail(function(){throw e.reject(),new Error("silentlyUpdateSettings FAILED. Candidates : "+a)}).always(function(){api.state("silent-update-processing")(!1)}).then(function(){_.each(f,function(b){if(_.isObject(b)&&"resolved"!==b.state())throw new Error("a silent update promise is unresolved : "+a)}),b&&!_.isEmpty(g)?api.previewer.refresh().always(function(){e.resolve(g)}):e.resolve(g)}),e.promise()},getSettingUpdatePromise:function(a){if(_.isUndefined(a))throw new Error("getSettingUpdatePromise : the provided setId is not defined");if(!api.has(api.CZR_Helpers.build_setId(a)))throw new Error("getSettingUpdatePromise : the provided wpSetId is not registered : "+api.CZR_Helpers.build_setId(a));var b=this,c=api.CZR_Helpers.build_setId(a),d=api(c)(),e=$.Deferred(),f=!1,g=api.czr_activeSkopeId(),h=api.czr_skopeBase.getSkopeSettingVal(a,g);if(_.isEqual(d,h))return e.resolve(h).promise();if(api.control.has(c)){var i=api.control(c).params.type,j=api.settings.controls[c];switch(i){case"czr_cropped_image":f=b._getCzrCroppedImagePromise(c,j);break;case"czr_module":b._processCzrModuleSilentActions(c,i,g,j)}}return _.has(api.settings.controls,"header_image")&&"header_image"==c&&(f=b._getHeaderImagePromise(c,g)),f&&_.isObject(f)?f.always(function(){e.resolve(h)}):e.resolve(h),e.promise()},_getSilentUpdateCandidates:function(a,b){var c=this,d=[];if(a=_.isUndefined(a)||_.isNull(a)?api.czr_activeSectionId():a,_.isEmpty(api.czr_activeSectionId())&&!b)return[];if(_.isUndefined(a))return api.consoleLog("_getSilentUpdateCandidates : No active section provided"),[];if(!api.section.has(a))throw new Error("_getSilentUpdateCandidates : The section "+a+" is not registered in the API.");var e=api.CZR_Helpers.getSectionSettingIds(a);return e=_.filter(e,function(a){return c.isSettingSkopeEligible(a)}),_.each(e,function(a){d.push(a)}),d}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{_processCzrModuleSilentActions:function(a,b,c,d){var e,f,g,h,i,j=_.has(api.control(a).params,"syncCollection")?api.control(a).params.syncCollection:"",k=api.CZR_Helpers.build_setId(a),l=api.czr_skopeBase.getSkopeSettingVal(k,c),m=api.czr_skope(api.czr_activeSkopeId());_.isEmpty(j)||_.isUndefined(j)||(e=api.CZR_Helpers.build_setId(j),f=api.czr_skopeBase.getSkopeSettingVal(e,c),g=api.settings.controls[e],h=api.controlConstructor.czr_multi_module,i=api.control(e).syncSektionModule()().id,api.control(e).container.remove(),api.control.remove(e),api(e).silent_set(f,m.getSkopeSettingDirtyness(e)),$.extend(g,{czr_skope:c}),api.control.add(e,new h(e,{params:g,previewer:api.previewer}))),_constructor=api.controlConstructor[b],api.control(a).container.remove(),api.control.remove(a),api(a).silent_set(l,m.getSkopeSettingDirtyness(k)),$.extend(d,{czr_skope:c}),api.control.add(a,new _constructor(a,{params:d,previewer:api.previewer})),_.isEmpty(j)||_.isUndefined(j)||(api.consoleLog("FIRE SEKTION MODULE?",i,api.control(a).czr_Module(i).isReady.state()),api.control(a).czr_Module(i).fireSektionModule())},_getCzrCroppedImagePromise:function(a,b){var c=api.controlConstructor.czr_cropped_image,d=$.Deferred(),e=api.has(a)?api(a)():null;return e=null===e?"":e,wp.media.attachment(e).fetch().done(function(){api.control(a).container.remove(),api.control.remove(a),b.attachment=this.attributes,api.control.add(a,new c(a,{params:b,previewer:api.previewer})),d.resolve()}).fail(function(){api.control(a).container.remove(),api.control.remove(a),b=_.omit(b,"attachment"),api.control.add(a,new c(a,{params:b,previewer:api.previewer})),d.reject()}),d.promise()},_getHeaderImagePromise:function(a,b){var c=$.Deferred();if(!_.has(api.settings.controls,"header_image")||"header_image"!=a)return c.resolve().promise();var d=api.controlConstructor.header,e=$.extend(!0,{},api.settings.controls.header_image);header_image_data=null===api.czr_skopeBase.getSkopeSettingVal("header_image_data",b)?"":api.czr_skopeBase.getSkopeSettingVal("header_image_data",b);var f,g=function(a){a=a||e,api.control("header_image").container.remove(),api.control.remove("header_image"),api.HeaderTool.UploadsList=api.czr_HeaderTool.UploadsList,api.HeaderTool.DefaultsList=api.czr_HeaderTool.DefaultsList,api.HeaderTool.CombinedList=api.czr_HeaderTool.CombinedList;var b=function(){api.control.add("header_image",new d("header_image",{params:a,previewer:api.previewer}))};(b=_.debounce(b,800))()};return _.has(header_image_data,"attachment_id")?(f=header_image_data.attachment_id,wp.media.attachment(f).fetch().done(function(){e.attachment=this.attributes,g(e),c.resolve()}).fail(function(){e=_.omit(e,"attachment"),api.control("header_image").container.remove(),api.control.remove("header_image"),api.HeaderTool.UploadsList=api.czr_HeaderTool.UploadsList,api.HeaderTool.DefaultsList=api.czr_HeaderTool.DefaultsList,api.HeaderTool.CombinedList=api.czr_HeaderTool.CombinedList,api.control.add("header_image",new d("header_image",{params:e,previewer:api.previewer})),c.reject()})):(g(),c.resolve()),c.promise()}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{setupActiveSkopedControls:function(a){var b,c,d,e,f=this;if(defaultSetupParams={controls:[],section_id:api.czr_activeSectionId()},d=$.extend(defaultSetupParams,a),!_.isObject(d)||!_.has(d,"controls")||!_.has(d,"section_id"))throw new Error("SetupControlsReset : the setupParams param must be an object with properties controls and section_id.");b=d.section_id,c=d.controls,e=[],!_.isEmpty(b)&&_.isString(b)||(b=api.czr_activeSectionId()),_.isEmpty(c)&&(c=api.CZR_Helpers.getSectionControlIds(b)),c=_.isString(c)?[c]:c,e=_.filter(c,function(a){var b=api.CZR_Helpers.getControlSettingId(a);return b&&!f.isSettingSkopeEligible(b)&&api.control(a).container.addClass("czr-not-skoped"),b&&f.isWPAuthorizedSetting(b)&&api.control(a).container.addClass("is-wp-authorized-setting"),b&&f.isSettingSkopeEligible(b)}),"nav_menu["!=b.substring(0,"nav_menu[".length)&&(_.isEmpty(c)||api.czr_skopeReady.then(function(){$.when(f.renderControlsSingleReset(e)).done(function(){f.listenSkopedControls(c)})}),f.renderCtrlSkpNotIcon(c))},listenSkopedControls:function(a){var b=this;_.each(a,function(a){if(api.has(a)&&!_.isUndefined(api.control(a))){var c=api.control(a),d=api.CZR_Helpers.getControlSettingId(a),e=(api.CZR_Helpers.getOptionName(d),{hasDBVal:!1,isDirty:!1,noticeVisible:!1,resetVisible:!1,isResetting:!1});_.has(c,"czr_states")||(c.czr_states=new api.Values,_.each(e,function(a,b){c.czr_states.create(b)}),b.bindControlStates(c)),c.czr_states("hasDBVal")(api.czr_skope(api.czr_activeSkopeId()).hasSkopeSettingDBValues(d)),c.czr_states("isDirty")(api.czr_skope(api.czr_activeSkopeId()).getSkopeSettingDirtyness(d)),_.has(c,"userEventMap")||(c.userEventMap=[{trigger:"click keydown",selector:".czr-setting-reset, .czr-cancel-button",name:"control_reset_warning",actions:function(){(c.czr_states("isDirty")()||c.czr_states("hasDBVal")())&&(_.each(_.without(api.CZR_Helpers.getSectionControlIds(c.section()),a),function(a){_.has(api.control(a),"czr_states")&&api.control(a).czr_states("resetVisible")(!1)}),c.czr_states("resetVisible")(!c.czr_states("resetVisible")()),c.czr_states("resetVisible")()&&c.czr_states("noticeVisible")(!1))}},{trigger:"click keydown",selector:".czr-control-do-reset",name:"control_do_reset",actions:function(){b.doResetSetting(a)}},{trigger:"click keydown",selector:".czr-skope-switch",name:"control_skope_switch",actions:function(a){var b=$(a.dom_event.currentTarget,a.dom_el).attr("data-skope-id");!_.isEmpty(b)&&api.czr_skope.has(b)&&api.czr_activeSkopeId(b)}},{trigger:"click keydown",selector:".czr-toggle-notice",name:"control_toggle_notice",actions:function(a){c.czr_states("noticeVisible")(!c.czr_states("noticeVisible")()),c.czr_states("noticeVisible")()&&c.czr_states("resetVisible")(!1)}}],api.CZR_Helpers.setupDOMListeners(c.userEventMap,{dom_el:c.container},b))}})},bindControlStates:function(a){if(!api.control.has(a.id))throw new Error("in bindControlStates, the provided ctrl id is not registered in the api : "+a.id);var b=this;api.CZR_Helpers.getControlSettingId(a.id);a.czr_states("hasDBVal").bind(function(b){a.container.toggleClass("has-db-val",b),b?_title="Reset your customized ( and published ) value":a.czr_states("isDirty")()?_title="Reset your customized ( but not yet published ) value":_title="Not customized yet, nothing to reset",a.container.find(".czr-setting-reset").attr("title",_title)}),a.czr_states("isDirty").bind(function(b){a.container.toggleClass("is-dirty",b);var c;c=b?"Reset your customized ( but not yet published ) value":a.czr_states("hasDBVal")()?"Reset your customized ( and published ) value":"Not customized yet, nothing to reset",a.container.find(".czr-setting-reset").attr("title",c)}),a.czr_states("noticeVisible").bind(function(c){
|
11 |
+
a.container.toggleClass("czr-notice-visible",c);var d=a.getNotificationsContainerElement();!1!==d&&!1!==d.length&&(c?(b.updateCtrlSkpNot(a.id),d.stop().slideDown("fast",null,function(){$(this).css("height","auto")})):$.when(d.stop().slideUp("fast",null,function(){$(this).css("height","auto")})).done(function(){b.removeCtrlSkpNot(a.id)}))}),a.czr_states("resetVisible").bind(function(c){a.section()||api.czr_activeSectionId();c?$.when(b.renderControlResetWarningTmpl(a.id)).done(function(b){_.isEmpty(b)||(a.czr_resetDialogContainer=b.container,b.container.slideToggle("fast"),b.is_authorized||_.delay(function(){$.when(a.czr_resetDialogContainer.slideToggle("fast")).done(function(){a.czr_resetDialogContainer.remove()})},3e3))}):_.has(a,"czr_resetDialogContainer")&&a.czr_resetDialogContainer.length&&$.when(a.czr_resetDialogContainer.slideToggle("fast")).done(function(){a.czr_resetDialogContainer.remove()})})}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{renderControlsSingleReset:function(a){var b=this,c=$.Deferred();(_.isUndefined(a)||_.isEmpty(a))&&(a=api.CZR_Helpers.getSectionControlIds(api.czr_activeSectionId()),a=_.filter(a,function(a){var c=api.CZR_Helpers.getControlSettingId(a);return c&&b.isSettingSkopeEligible(c)}));var d=_.isArray(a)?a:[a],e=function(a){return _.isEmpty(a)?void c.resolve():void _.each(a,function(a){api.control.when(a,function(){var b=api.control(a);api.CZR_Helpers.getControlSettingId(a);return $(".czr-setting-reset",b.container).length?void c.resolve():void b.deferred.embedded.then(function(){$.when(b.container.find(".customize-control-title").first().prepend($("<span/>",{"class":"czr-setting-reset fa fa-refresh",title:""}))).done(function(){b.container.addClass("czr-skoped"),$(".czr-setting-reset",b.container).fadeIn(400),c.resolve()})})})})};return e=_.debounce(e,200),e(d),c.promise()},renderControlResetWarningTmpl:function(a){if(!api.control.has(a))return{};var b,c,d=api.control(a),e=api.CZR_Helpers.getControlSettingId(a),f="",g=function(){return!!_.contains(serverControlParams.wpBuiltinSettings,api.CZR_Helpers.getOptionName(e))||!_.contains(serverControlParams.themeSettingList,api.CZR_Helpers.getOptionName(e))}();d.czr_states("isDirty")()?(b=["Please confirm that you want to reset your current customizations for this option in ",api.czr_skope(api.czr_activeSkopeId())().title,"."].join(""),c="Your customizations have been reset."):g&&"global"==api.czr_skope(api.czr_activeSkopeId())().skope?b="This WordPress setting can not be reset site wide.":(b=["Please confirm that you want to reset this option in ",api.czr_skope(api.czr_activeSkopeId())().title,"."].join(""),c="The options have been reset.");var h=!(g&&"global"==api.czr_skope(api.czr_activeSkopeId())().skope&&!d.czr_states("isDirty")()),i={warning_message:b,success_message:c,is_authorized:h};try{f=wp.template("czr-reset-control")(i)}catch(j){throw new Error("Error when parsing the the reset control template : "+j)}return $(".customize-control-title",d.container).first().after($(f)),{container:$(".czr-ctrl-reset-warning",d.container),is_authorized:h}},doResetSetting:function(a){var b=this,c=api.CZR_Helpers.getControlSettingId(a),d=api.control(a),e=api.czr_activeSkopeId(),f=d.czr_states("isDirty")()?"_resetControlDirtyness":"_resetControlAPIVal",g=function(a,b){b=!_.isUndefined(b)&&b,a.czr_states("resetVisible")(!1),a.czr_states("isResetting")(!1),a.container.removeClass("czr-resetting-control")},h=function(a){var h=function(){api.czr_skopeBase.processSilentUpdates({candidates:a,refresh:!1}).fail(function(){api.consoleLog("Silent update failed after resetting control : "+a)}).done(function(){$.when($(".czr-crtl-reset-dialog",d.container).fadeOut("300")).done(function(){$.when($(".czr-reset-success",d.container).fadeIn("300")).done(function(c){_.delay(function(){$.when(c.fadeOut("300")).done(function(){g(d),b.setupActiveSkopedControls({controls:[a]}),_.delay(function(){d.czr_states("noticeVisible")(!0)},300),_.delay(function(){d.czr_states("noticeVisible")(!1)},4e3)})},1e3)})})})};b[f](a).done(function(){api.consoleLog("REFRESH AFTER A SETTING RESET"),api.previewer.refresh().fail(function(a){api.consoleLog("SETTING RESET REFRESH FAILED",a)}).done(function(a){if("global"==api.czr_skope(e)().skope&&"_resetControlAPIVal"==f){var b,d={},g=api.czr_skope(e)().opt_name;!_.isUndefined(a.skopesServerData)&&_.has(a.skopesServerData,"czr_skopes")&&(b=a.skopesServerData.czr_skopes,_.isUndefined(_.findWhere(b,{opt_name:g}))&&(d=_.findWhere(b,{opt_name:g}).db||{})),api.czr_skopeBase.maybeSynchronizeGlobalSkope({isGlobalReset:!0,isSetting:!0,settingIdToReset:c}).done(function(){h()})}else h()})})};d.czr_states("isResetting")(!0),d.container.addClass("czr-resetting-control"),api.czr_skopeReset[d.czr_states("isDirty")()?"resetChangeset":"resetPublished"]({skope_id:e,setId:c,is_setting:!0}).done(function(b){h(a)}).fail(function(c){$.when($(".czr-crtl-reset-dialog",d.container).fadeOut("300")).done(function(){$.when($(".czr-reset-fail",d.container).fadeIn("300")).done(function(){$(".czr-reset-fail",d.container).append("<p>"+c+"</p>"),_.delay(function(){g(d),b.setupActiveSkopedControls({controls:[a]})},2e3)})})})},_resetControlDirtyness:function(a){var b=api.CZR_Helpers.getControlSettingId(a),c=api.czr_skope(api.czr_activeSkopeId()),d=$.extend(!0,{},c.dirtyValues()),e={},f=$.extend(!0,{},c.changesetValues()),g={},h=$.Deferred();return e=_.omit(d,b),g=_.omit(f,b),c.dirtyValues(e),c.changesetValues(e),h.resolve().promise()},_resetControlAPIVal:function(a){var b=api.CZR_Helpers.getControlSettingId(a),c=api.czr_skope(api.czr_activeSkopeId()).dbValues(),d=$.extend(!0,{},c),e=$.Deferred();return _.has(api.control(a),"czr_states")&&(api.control(a).czr_states("hasDBVal")(!1),api.czr_skope(api.czr_activeSkopeId()).dbValues(_.omit(d,b))),e.resolve().promise()}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{renderCtrlSkpNotIcon:function(a){var b=_.isArray(a)?a:[a];_.each(b,function(a){api.control.when(a,function(){var b=api.control(a);b.deferred.embedded.then(function(){$(".czr-toggle-notice",b.container).length||$.when(b.container.find(".customize-control-title").first().append($("<span/>",{"class":"czr-toggle-notice fa fa-info-circle",title:"Display informations about the scope of this option."}))).done(function(){$(".czr-toggle-notice",b.container).fadeIn(400)})})})})},updateCtrlSkpNot:function(a){var b=this,c=_.isArray(a)?a:[a],d=function(a){return a&&b.isSettingSkopeEligible(a)},e=function(a,c){var e,f,g=api.czr_activeSkopeId(),h=b.getInheritedSkopeId(a,g),i=b.getAppliedPrioritySkopeId(a,g),j=[];return d(a)?(h==i&&api.czr_skope.has(h)&&g==h&&(e=!_.isUndefined(api.czr_skope(g).dirtyValues()[a]),f=!_.isUndefined(api.czr_skope(g).dbValues()[a]),e?"global"==api.czr_skope(h)().skope?j.push(["Customized. Will be published site wide."].join(" ")):j.push(["Customized. Will be published for :",api.czr_skope(h)().title].join(" ")):f?"global"==api.czr_skope(h)().skope?j.push(["Customized and published site wide."].join(" ")):j.push(["Customized and published for :",api.czr_skope(h)().title].join(" ")):j.push("Default website value published site wide.")),h!==g&&api.czr_skope.has(h)&&(e=!_.isUndefined(api.czr_skope(h).dirtyValues()[a]),f=!_.isUndefined(api.czr_skope(h).dbValues()[a]),e||f?j.push("Inherited from : "+b.buildSkopeLink(h)):j.push("Default website value")),i!==g&&api.czr_skope.has(i)&&(e=!_.isUndefined(api.czr_skope(i).dirtyValues()[a]),j.push([e?"The value that will be published for":"The value currently published for",api.czr_skope(c)().title,e?"is customized in scope :":"is set in scope :",b.buildSkopeLink(i),e?", and will override this one once published because it has a higher priority.":", because it has a higher priority than this one."].join(" "))),j.join(" | ")):(j.push(["This option is always customized site wide and can't be reset."].join(" ")),j.join(" | "))};_.each(c,function(a){api.control.when(a,function(){var b=api.control(a),c=api.CZR_Helpers.getControlSettingId(a);_.has(b,"czr_states")&&b.czr_states("noticeVisible")()&&b.deferred.embedded.then(function(){var a=_.findWhere(api.czr_currentSkopesCollection(),{skope:"local"}).id,d=b.getNotificationsContainerElement();if(d&&d.length&&!_.isUndefined(a)){_html=e(c,a);var f=$(".czr-skope-notice",d);f.length?f.html(_html):d.append(['<span class="czr-notice czr-skope-notice">',_html,"</span>"].join(""))}})})})},removeCtrlSkpNot:function(a){var b=_.isArray(a)?a:[a];_.each(b,function(a){api.control.when(a,function(){var b=api.control(a);b.deferred.embedded.then(function(){var a=b.getNotificationsContainerElement();if(a&&a.length){var c=$(".czr-skope-notice",a);c.length&&c.remove()}})})})}});var CZRSkopeSaveMths=CZRSkopeSaveMths||{};$.extend(CZRSkopeSaveMths,{initialize:function(){this.changesetStatus="publish",this.saveBtn=$("#save")},save:function(a){var b,c=this,d=api.state("processing"),e=new api.Messenger({url:api.settings.url.parent,channel:"loader"});c.globalSaveDeferred=$.Deferred(),c.previewer=api.previewer,c.globalSkopeId=api.czr_skopeBase.getGlobalSkopeId(),c.saveArgs=a,a&&a.status&&(c.changesetStatus=a.status),api.state("saving")()&&c.globalSaveDeferred.reject("already_saving");var f=function(a,b){api.state("saving")(!1),api.state("processing").set(0),c.saveBtn.prop("disabled",!1),!_.isUndefined(a)&&a.setting_validities&&api._handleSettingValidities({settingValidities:a.setting_validities,focusInvalidControl:!0}),"pending"==b&&api.czr_serverNotification({message:a,status:"error"})},g=function(a){var b,d=$.Deferred();return api.state("saving")(!0),c.fireAllSubmission(a).always(function(a){b=a.response,f(b,this.state())}).fail(function(a){b=a.response,api.consoleLog("ALL SUBMISSIONS FAILED",b),c.globalSaveDeferred.reject(b),api.trigger("error",b),d.resolve(a.hasNewMenu)}).done(function(a){b=a.response,api.previewer.refresh({waitSkopeSynced:!0}).fail(function(a){c.globalSaveDeferred.reject(c.previewer,[b]),api.consoleLog("SAVE REFRESH FAIL",a)}).done(function(f){if(api.previewer.send("saved",b),b=_.extend({changeset_status:"publish"},b||{}),api.czr_isChangeSetOn()){var g=api._latestRevision;api.state("changesetStatus").set(b.changeset_status),"publish"===b.changeset_status&&(api.each(function(a){a._dirty&&(_.isUndefined(api._latestSettingRevisions[a.id])||api._latestSettingRevisions[a.id]<=g)&&(a._dirty=!1)}),api.state("changesetStatus").set(""),api.settings.changeset.uuid=b.next_changeset_uuid,e.send("changeset-uuid",api.settings.changeset.uuid))}else api.each(function(a){a._dirty=!1});f=_.extend({previewer:f.previewer||c.previewer,skopesServerData:f.skopesServerData||{}},f),c.reactWhenSaveDone(f.skopesServerData),c.globalSaveDeferred.resolveWith(c.previewer,[b]),api.trigger("saved",b||{}),d.resolve(a.hasNewMenu)})}),d.promise()};return 0===d()?g().done(function(a){a&&g({saveGlobal:!1,saveSkopes:!0})}):(b=function(){0===d()&&(api.state.unbind("change",b),g())},api.state.bind("change",b)),c.globalSaveDeferred.promise()}});var CZRSkopeSaveMths=CZRSkopeSaveMths||{};$.extend(CZRSkopeSaveMths,{getSubmitPromise:function(a){var b=this,c=$.Deferred(),d={};if(_.isEmpty(a)||!api.czr_skope.has(a))return api.consoleLog("getSubmitPromise : no skope id requested OR skope_id not registered : "+a),c.resolve().promise();var e=api.czr_skope(a)();return api.czr_skope(a).dirtyness()||a===b.globalSkopeId?(_.each(api.czr_skopeBase.getSkopeDirties(a),function(a,b){d[b]=_.extend({value:a})}),this.submit({skope_id:a,customize_changeset_data:d,dyn_type:e.dyn_type}).done(function(a){c.resolve(a)}).fail(function(b){api.consoleLog("GETSUBMIT FAILED PROMISE FOR SKOPE : ",a,b),c.reject(b)}),c.promise()):c.resolve().promise()},submit:function(a){var b,c=this,d={skope_id:null,the_dirties:{},customize_changeset_data:{},dyn_type:null,opt_name:null},e=[],f=$.Deferred();if(a=$.extend(d,a),_.isNull(a.skope_id))throw new Error("OVERRIDEN SAVE::submit : MISSING skope_id");if(_.isNull(a.the_dirties))throw new Error("OVERRIDEN SAVE::submit : MISSING the_dirties");if(_.has(api,"Notification")&&(api.each(function(a){a.notifications.each(function(b){"error"===b.type&&api.consoleLog("NOTIFICATION ERROR on SUBMIT SAVE",b),"error"!==b.type||b.data&&b.data.from_server||(e.push(a.id),settingInvalidities[a.id]||(settingInvalidities[a.id]={}),settingInvalidities[a.id][b.code]=b)})}),b=api.findControlsForSettings(e),!_.isEmpty(b)))return _.values(b)[0][0].focus(),f.rejectWith(c.previewer,[{setting_invalidities:settingInvalidities}]).promise();var g={skope_id:a.skope_id,action:"save",the_dirties:a.the_dirties,dyn_type:a.dyn_type,opt_name:a.opt_name};api.czr_isChangeSetOn()&&$.extend(g,{excludeCustomizedSaved:!1});var h=$.extend(c.previewer.query(g),{nonce:c.previewer.nonce.save,customize_changeset_status:c.changesetStatus,customize_changeset_data:JSON.stringify(a.customize_changeset_data)});api.czr_isChangeSetOn()&&(c.saveArgs&&c.saveArgs.date&&(h.customize_changeset_date=c.saveArgs.date),c.saveArgs&&c.saveArgs.title&&(h.customize_changeset_title=c.saveArgs.title));var i=wp.ajax.post("global"!==h.skope?"customize_skope_changeset_save":"customize_save",h);return c.saveBtn.prop("disabled",!0),api.trigger("save",i),i.fail(function(b){api.consoleLog("SUBMIT REQUEST FAIL",a.skope_id,b),"0"===b?b="not_logged_in":"-1"===b&&(b="invalid_nonce"),"invalid_nonce"===b?c.previewer.cheatin():"not_logged_in"===b&&(c.previewer.preview.iframe.hide(),c.previewer.login().done(function(){c.previewer.save(),c.previewer.preview.iframe.show()})),api.trigger("error",b),f.reject(b)}),i.done(function(a){f.resolve(a)}),f.promise()}});var CZRSkopeSaveMths=CZRSkopeSaveMths||{};$.extend(CZRSkopeSaveMths,{fireAllSubmission:function(a){var b=this,c=$.Deferred(),d=[],e=$.Deferred(),f={},g=[],h=[],i={saveGlobal:!0,saveSkopes:!0};a=$.extend(i,a),_.each(api.czr_skopeCollection(),function(a){"global"!==a.skope&&d.push(a.id)});var j=function(a){if(_.isUndefined(d[a+1])&&g.length==d.length){if(_.isEmpty(h))e.resolve(f);else{var b=function(){var a=[];return _.each(h,function(b){a.push(api.czr_skopeBase.buildServerResponse(b))}),$.trim(a.join(" | "))};e.reject(b())}return!0}},k=function(a){return a=a||0,_.isUndefined(d[a])&&(api.consoleLog("Undefined Skope in Save recursive call ",a,_skopesToUpdate,_skopesToUpdate[a]),e.resolve(f)),b.getSubmitPromise(d[a]).always(function(){g.push(a)}).fail(function(b){h.push(b),api.consoleLog("RECURSIVE PUSH FAIL FOR SKOPE : ",d[a]),j(a)||k(a+1)}).done(function(b){b=b||{},f=_.isEmpty(f)?b||{}:$.extend(f,b),j(a)||k(a+1)}),e.promise()},l=!1;_.each(api.czr_skope("global__all_").dirtyValues(),function(a,b){"nav_menu["==b.substring(0,"nav_menu[".length)&&(l=!0)});var m=function(){b.getSubmitPromise(b.globalSkopeId).fail(function(a){api.consoleLog("GLOBAL SAVE SUBMIT FAIL",a),a=api.czr_skopeBase.buildServerResponse(a),c.reject(a)}).done(function(a){f=_.isEmpty(f)?a||{}:$.extend(f,a),c.resolve({response:f,hasNewMenu:l})})};return l&&a.saveGlobal?m():a.saveGlobal&&a.saveSkopes?k().fail(function(a){api.consoleLog("RECURSIVE SAVE CALL FAIL",a),c.reject(a)}).done(function(a){b.cleanSkopeChangesetMetas().always(function(){m()})}):a.saveGlobal&&!a.saveSkopes?m():!a.saveGlobal&&a.saveSkopes&&k().fail(function(a){api.consoleLog("RECURSIVE SAVE CALL FAIL",a),c.reject(a)}).done(function(a){f=_.isEmpty(f)?a||{}:$.extend(f,a),b.cleanSkopeChangesetMetas().always(function(){c.resolve({response:f,hasNewMenu:l})})}),c.promise()},cleanSkopeChangesetMetas:function(){var a=$.Deferred();return _query=$.extend(api.previewer.query(),{nonce:api.previewer.nonce.save}),wp.ajax.post("czr_clean_skope_changeset_metas_after_publish",_query).always(function(){a.resolve()}).fail(function(a){api.consoleLog("cleanSkopeChangesetMetas failed",_query,a)}).done(function(a){api.consoleLog("cleanSkopeChangesetMetas done",_query,a)}),a.promise()}});var CZRSkopeSaveMths=CZRSkopeSaveMths||{};$.extend(CZRSkopeSaveMths,{reactWhenSaveDone:function(a){var b={};a=_.extend({czr_skopes:[],isChangesetDirty:!1},a),_.each(api.czr_skopeCollection(),function(a){b[a.opt_name]=api.czr_skopeBase.getSkopeDirties(a.id),api.czr_skope(a.id).dirtyValues({}),api.czr_skope(a.id).changesetValues({})});var c=[],d=a.czr_skopes;api.consoleLog("REACT WHEN SAVE DONE",b,d),_.each(b,function(a,b){_.each(a,function(a,e){if(!_.isUndefined(_.findWhere(d,{opt_name:b}))&&api.czr_skopeBase.isSettingSkopeEligible(e)){var f=_.findWhere(d,{opt_name:b}).db,g=_.findWhere(d,{opt_name:b}).skope,h=api.CZR_Helpers.build_setId(e),i=api.CZR_Helpers.getOptionName(e),j=f[h];_.isUndefined(j)&&"global"==g&&a===serverControlParams.defaultOptionsValues[i]||!_.isUndefined(j)&&_.isEqual(j,a)||c.push({opt_name:b,setId:h,server_val:j,api_val:a})}})}),_.isEmpty(c)?api.consoleLog("ALL RIGHT, SERVER AND API ARE SYNCHRONIZED AFTER SAVE"):api.consoleLog("SOME SETTINGS HAVE NOT BEEN PROPERLY SAVED : ",c),api.czr_skopeBase.maybeSynchronizeGlobalSkope(),api.czr_skopeBase.updateCtrlSkpNot(api.CZR_Helpers.getSectionControlIds())}});var CZRSkopeResetMths=CZRSkopeResetMths||{};$.extend(CZRSkopeResetMths,{initialize:function(){var a=this;a.previewer=api.previewer,api.state.create("czr-resetting")(!1),api.state("czr-resetting").bind(function(a){$(document.body).toggleClass("czr-resetting",!1!==a)})},resetChangeset:function(a){var b,c,d,e,f,g=$.Deferred(),h=this,i=api.state("processing"),j={is_setting:!1,is_skope:!1,skope_id:api.czr_activeSkopeId()||"",setId:""};a=_.extend(j,a);var k=a.skope_id,l=a.setId;return api.czr_isChangeSetOn()?(c=function(b,c){if(_.isUndefined(b))throw new Error("RESET: MISSING skope_id");if(api.state("czr-resetting")(!0),e={skope_id:b,action:"reset"},f=$.extend(h.previewer.query(e),{nonce:h.previewer.nonce.save}),a.is_setting)$.extend(f,{setting_id:c}),d="czr_changeset_setting_reset";else{if(!a.is_skope)return g.reject("reset_ajax_action_not_specified").promise();d="czr_changeset_skope_reset"}wp.ajax.post(d,f).always(function(){api.state("czr-resetting")(!1)}).fail(function(b){"0"===b?b="not_logged_in":"-1"===b&&(b="invalid_nonce"),"invalid_nonce"===b?h.previewer.cheatin():"not_logged_in"===b&&(h.previewer.preview.iframe.hide(),h.previewer.login().done(function(){h.resetChangeset(a),h.previewer.preview.iframe.show()})),api.consoleLog(d+" failed ",f,b),b=api.czr_skopeBase.buildServerResponse(b),api.trigger("error",b),api.czr_serverNotification({message:b,status:"error"}),g.reject(b)}).done(function(a){g.resolve(a)})},0===i()&&!1===api.state("czr-resetting")()?c(k,l):(b=function(){0===i()&&!1===api.state("czr-resetting")()&&(api.state.unbind("change",b),c(k,l))},api.state.bind("change",b)),g.promise()):g.resolve().promise()},resetPublished:function(a){var b,c,d,e,f,g=$.Deferred(),h=this,i=api.state("processing"),j={is_setting:!1,is_skope:!1,skope_id:api.czr_activeSkopeId()||"",setId:""};a=_.extend(j,a);var k=a.skope_id,l=a.setId;return c=function(b,c){if(_.isUndefined(b))throw new Error("RESET: MISSING skope_id");if(api.state("czr-resetting")(!0),e={skope_id:b,action:"reset"},f=$.extend(h.previewer.query(e),{nonce:h.previewer.nonce.save}),a.is_setting)$.extend(f,{setting_id:c}),d="czr_published_setting_reset";else{if(!a.is_skope)return g.reject("reset_ajax_action_not_specified").promise();d="czr_published_skope_reset"}api.consoleLog("in czr_reset submit : ",b,f),wp.ajax.post(d,f).always(function(){api.state("czr-resetting")(!1)}).fail(function(b){"0"===b?b="not_logged_in":"-1"===b&&(b="invalid_nonce"),"invalid_nonce"===b?h.previewer.cheatin():"not_logged_in"===b&&(h.previewer.preview.iframe.hide(),h.previewer.login().done(function(){h.resetChangeset(a),h.previewer.preview.iframe.show()})),api.consoleLog(d+" failed ",f,b),b=api.czr_skopeBase.buildServerResponse(b),api.trigger("error",b),api.czr_serverNotification({message:b,status:"error"}),g.reject(b)}).done(function(a){g.resolve(a)})},0===i()&&!1===api.state("czr-resetting")()?c(k,l):(b=function(){0===i()&&!1===api.state("czr-resetting")()&&(api.state.unbind("change",b),c(k,l))},api.state.bind("change",b)),g.promise()}});var CZRSkopeBaseMths=CZRSkopeBaseMths||{};$.extend(CZRSkopeBaseMths,{initWidgetSidebarSpecifics:function(){var a=this;a.isExcludedSidebarsWidgets()||api.czr_activeSkopeId.bind(function(b){a.forceSidebarDirtyRefresh(api.czr_activeSectionId(),b)}),$(document).bind("widget-added",function(b,c){if(!a.isExcludedSidebarsWidgets()){var d=c.closest(".customize-control").attr("id"),e=api.czr_skopeBase.widgetIdToSettingId(d,"customize-control-");if(!api.has(e))throw new Error("AN ADDED WIDGET COULD NOT BE BOUND IN SKOPE. "+e);a.listenAPISettings(e)}})},forceSidebarDirtyRefresh:function(a,b){var c=this;if(!c.isExcludedSidebarsWidgets()){var d=api.state("saved")(),e=function(){if(api.section.has(a)&&"sidebar"==api.section(a).params.type){var b=b||api.czr_activeSkopeId(),e="sidebars_widgets["+api.section(a).params.sidebarId+"]",f=c.getSkopeSettingVal(e,b);api.czr_skope(b).updateSkopeDirties(e,f),api.previewer.refresh({the_dirties:api.czr_skope(b).dirtyValues()}).done(function(){api.state("saved")(d)})}};e=_.debounce(e,500),e()}}});var CZRSkopeMths=CZRSkopeMths||{};$.extend(CZRSkopeMths,{initialize:function(a,b){var c=this;api.Value.prototype.initialize.call(c,null,b),c.isReady=$.Deferred(),c.embedded=$.Deferred(),c.el="czr-scope-"+a,$.extend(c,b||{}),c.visible=new api.Value((!0)),c.winner=new api.Value((!1)),c.priority=new api.Value,c.active=new api.Value((!1)),c.dirtyness=new api.Value((!1)),c.skopeResetDialogVisibility=new api.Value((!1)),c.hasDBValues=new api.Value((!1)),c.dirtyValues=new api.Value({}),c.dbValues=new api.Value({}),c.changesetValues=new api.Value({}),c.userEventMap=new api.Value([{trigger:"click keydown",selector:".czr-scope-switch, .czr-skp-switch-link",name:"skope_switch",actions:function(){api.czr_activeSkopeId(c().id)}},{trigger:"click keydown",selector:".czr-scope-reset",name:"skope_reset_warning",actions:"reactOnSkopeResetUserRequest"}]),c.skopeResetDialogVisibility.bind(function(a,b){return c.skopeResetDialogReact(a)},{deferred:!0}),c.dirtyValues.callbacks.add(function(){return c.dirtyValuesReact.apply(c,arguments)}),c.changesetValues.callbacks.add(function(){return c.changesetValuesReact.apply(c,arguments)}),c.dbValues.callbacks.add(function(){return c.dbValuesReact.apply(c,arguments)}),c.callbacks.add(function(){return c.skopeReact.apply(c,arguments)}),c.set(_.omit(b,function(a,b){return _.contains(["db","changeset","has_db_val"],b)})),c.embedded.fail(function(){throw new Error("The container of skope "+c().id+" has not been embededd")}).done(function(){c.setupDOMListeners(c.userEventMap(),{dom_el:c.container}),c.visible.bind(function(a){c.container.toggle(a)}),c.active.callbacks.add(function(){return c.activeStateReact.apply(c,arguments)}),c.dirtyness.callbacks.add(function(){return c.dirtynessReact.apply(c,arguments)}),c.hasDBValues.callbacks.add(function(){return c.hasDBValuesReact.apply(c,arguments)}),c.winner.callbacks.add(function(){return c.winnerReact.apply(c,arguments)}),c.dirtyness(!_.isEmpty(b.changeset)),c.hasDBValues(!_.isEmpty(b.db)),c.winner(b.is_winner),c.isReady.resolve()})},ready:function(){var a=this;$.when(a.embedSkopeDialogBox()).done(function(b){!1!==b.length?(b.css("background-color",a.color),a.container=b,a.embedded.resolve(b)):a.embedded.reject()})},dirtyValuesReact:function(a,b){var c=this;c.dirtyness(!_.isEmpty(a)),api.czr_dirtyness(!_.isEmpty(a));var d=[];_.each(b,function(b,c){_.has(a,c)||d.push(c)}),c().id==api.czr_activeSkopeId()&&(_.each(d,function(a){_.has(api.control(a),"czr_states")&&api.control(a).czr_states("isDirty")(!1)}),_.each(a,function(a,b){_.has(api.control(b),"czr_states")&&api.control(b).czr_states("isDirty")(!0)}))},changesetValuesReact:function(a,b){var c=this,d=$.extend(!0,{},c.dirtyValues());c.dirtyValues($.extend(d,a))},dbValuesReact:function(a,b){var c=this;c.hasDBValues(!_.isEmpty("global"!=c().skope?a:_.omit(a,function(a,b){return!api.czr_skopeBase.isThemeSetting(b)})));var d=[];_.each(b,function(b,c){_.has(a,c)||d.push(c)}),c().id==api.czr_activeSkopeId()&&(_.each(d,function(a){_.has(api.control(a),"czr_states")&&api.control(a).czr_states("hasDBVal")(!1)}),_.each(a,function(a,b){_.has(api.control(b),"czr_states")&&api.control(b).czr_states("hasDBVal")(!0)}))},skopeReact:function(a,b){var c=this,d=[],e=[];api.czr_skopeBase.isSkopeRegisteredInCollection(a.id)?(d=$.extend(!0,[],api.czr_skopeCollection()),e=d,_.each(d,function(b,d){b.id==c().id&&(e[d]=a)}),api.czr_skopeCollection(e)):(d=$.extend(!0,[],api.czr_skopeCollection()),d.push(a),api.czr_skopeCollection(d))},activeStateReact:function(a,b){var c=this;c.container.toggleClass("inactive").toggleClass("active",a),$(".czr-scope-switch",c.container).toggleClass("fa-toggle-on",a).toggleClass("fa-toggle-off",!a)},dirtynessReact:function(a,b){var c=this;$.when(this.container.toggleClass("dirty",a)).done(function(){a?$(".czr-scope-reset",c.container).fadeIn("slow").attr("title",["Reset the current customizations for",c().title].join(" ")):c.hasDBValues()||$(".czr-scope-reset",c.container).fadeOut("fast")})},hasDBValuesReact:function(a,b){var c=this;$.when(c.container.toggleClass("has-db-val",a)).done(function(){a?$(".czr-scope-reset",c.container).fadeIn("slow").attr("title",["global"==c().skope?"Reset the theme options published site wide":"Reset your website published options for","global"==c().skope?"":c().title].join(" ")):c.dirtyness()||$(".czr-scope-reset",c.container).fadeOut("fast")})},winnerReact:function(a){var b=this;this.container.toggleClass("is_winner",a),a&&_.each(api.czr_currentSkopesCollection(),function(a){if(a.id!=b().id){var c=$.extend(!0,{},a);$.extend(c,{is_winner:!1}),api.czr_skope(a.id)(c)}})},updateSkopeDirties:function(a,b){var c=this;api.CZR_Helpers.getOptionName(a);if(!api.czr_skopeBase.isSettingSkopeEligible(a)&&"global"!=c().skope)return api.czr_skope(api.czr_skopeBase.getGlobalSkopeId()).updateSkopeDirties(a,b);var d=$.extend(!0,{},c.dirtyValues()),e={};return e[a]=b,c.dirtyValues.set($.extend(d,e)),c.dirtyValues()},getSkopeSettingDirtyness:function(a){var b=this;return b.getSkopeSettingAPIDirtyness(a)||b.getSkopeSettingChangesetDirtyness(a)},getSkopeSettingAPIDirtyness:function(a){var b=this;return _.has(b.dirtyValues(),api.CZR_Helpers.build_setId(a))},getSkopeSettingChangesetDirtyness:function(a){var b=this;return api.czr_isChangeSetOn()?_.has(b.changesetValues(),api.CZR_Helpers.build_setId(a)):b.getSkopeSettingAPIDirtyness(a)},hasSkopeSettingDBValues:function(a){var b=api.CZR_Helpers.build_setId(a);return!_.isUndefined(api.czr_skope(api.czr_activeSkopeId()).dbValues()[b])}});var CZRSkopeMths=CZRSkopeMths||{};$.extend(CZRSkopeMths,{embedSkopeDialogBox:function(){var a=this,b=$.extend(!0,{},a()),c="";if(!$("#customize-header-actions").find(".czr-scope-switcher").length)throw new Error("The skope switcher wrapper is not printed, the skope can not be embedded.");try{c=wp.template("czr-skope")(_.extend(b,{el:a.el}))}catch(d){throw new Error("Error when parsing the template of a skope"+d)}return $(".czr-skopes-wrapper","#customize-header-actions").append($(c)),$("."+a.el,".czr-skopes-wrapper")},renderResetWarningTmpl:function(){var a,b,c=this,d=$.extend(!0,{},c()),e="";c.dirtyness()?(a=["Please confirm that you want to reset your current customizations for : ",c().title,"."].join(""),b=["Your customizations have been reset for ",c().title,"."].join("")):(a=["Please confirm that you want to reset your published customizations to defaults for : ",c().title,"."].join(""),b=["The options have been reset to defaults for ",c().title,"."].join(""));try{e=wp.template("czr-skope-pane")(_.extend(d,{el:c.el,warning_message:a,success_message:b}))}catch(f){throw new Error("Error when parsing the the reset skope template : "+f)}return $("#customize-preview").after($(e)),$("#czr-skope-pane")},getEl:function(){var a=this;return $(a.el,"#customize-header-actions")}});var CZRSkopeMths=CZRSkopeMths||{};$.extend(CZRSkopeMths,{reactOnSkopeResetUserRequest:function(){var a=this,b=function(){api.state("czr-resetting")(!0),api.czr_activeSkopeId()!=a().id?api.czr_activeSkopeId(a().id).done(function(){a.skopeResetDialogVisibility(!a.skopeResetDialogVisibility()).done(function(){api.state("czr-resetting")(!1)})}):a.skopeResetDialogVisibility(!a.skopeResetDialogVisibility()).done(function(){api.state("czr-resetting")(!1)})};return api.state("czr-resetting")()||0!==api.state("processing")()?void api.czr_serverNotification({message:"Slow down, you move too fast !",status:"success",auto_collapse:!0}):void(api.czr_activeSkopeId()!=a().id&&api.czr_skope(api.czr_activeSkopeId()).skopeResetDialogVisibility()?api.czr_skope(api.czr_activeSkopeId()).skopeResetDialogVisibility(!1).done(function(){b()}):b())},skopeResetDialogReact:function(a){var b=this,c=$.Deferred();return b.userResetEventMap=b.userResetEventMap||new api.Value([{trigger:"click keydown",selector:".czr-scope-reset-cancel",name:"skope_reset_cancel",actions:function(){b.skopeResetDialogVisibility(!b.skopeResetDialogVisibility())}},{trigger:"click keydown",selector:".czr-scope-do-reset",name:"skope_do_reset",actions:"doResetSkopeValues"}]),a?(api.czr_isResettingSkope(b().id),$.when(b.renderResetWarningTmpl()).done(function(a){b.resetPanel=a,b.resetPanel.addClass(b.dirtyness()?"dirty-reset":"db-reset"),b.setupDOMListeners(b.userResetEventMap(),{dom_el:b.resetPanel})}).then(function(){setTimeout(function(){var a=$("#customize-preview").height();b.resetPanel.css("line-height",a+"px").css("height",a+"px"),$("body").addClass("czr-skope-pane-open")},50)})):$.when($("body").removeClass("czr-skope-pane-open")).done(function(){_.has(b,"resetPanel")&&!1!==b.resetPanel.length&&setTimeout(function(){b.resetPanel.remove(),api.czr_isResettingSkope(!1)},300)}),_.delay(function(){c.resolve()},350),c.promise()},doResetSkopeValues:function(){var a=this,b=a().id,c=a.dirtyness()?"_resetSkopeDirties":"_resetSkopeAPIValues",d=function(){var d=function(){api.czr_skopeBase.processSilentUpdates({refresh:!1}).fail(function(){api.consoleLog("Silent update failed after resetting skope : "+b)}).done(function(){$.when($(".czr-reset-warning",a.resetPanel).fadeOut("300")).done(function(){$.when($(".czr-reset-success",a.resetPanel).fadeIn("300")).done(function(){_.delay(function(){api.czr_isResettingSkope(!1),a.skopeResetDialogVisibility(!1)},2e3)})})})};a[c]().done(function(){api.previewer.refresh().fail(function(a){api.consoleLog("SKOPE RESET REFRESH FAILED",a)}).done(function(a){if("global"==api.czr_skope(b)().skope&&"_resetSkopeAPIValues"==c){var e,f={},g=api.czr_skope(b)().opt_name;!_.isUndefined(a.skopesServerData)&&_.has(a.skopesServerData,"czr_skopes")&&(e=a.skopesServerData.czr_skopes,_.isUndefined(_.findWhere(e,{opt_name:g}))&&(f=_.findWhere(e,{opt_name:g}).db||{})),api.czr_skopeBase.maybeSynchronizeGlobalSkope({isGlobalReset:!0,isSkope:!0,skopeIdToReset:b}).done(function(){d()})}else d()})})};$("body").addClass("czr-resetting-skope"),api.czr_skopeReset[a.dirtyness()?"resetChangeset":"resetPublished"]({skope_id:a().id,is_skope:!0}).always(function(){$("body").removeClass("czr-resetting-skope")}).done(function(a){d()}).fail(function(b){a.skopeResetDialogVisibility(!1),api.consoleLog("Skope reset failed",b)})},_resetSkopeDirties:function(){var a=this,b=$.Deferred();return a.dirtyValues({}),a.changesetValues({}),b.resolve().promise()},_resetSkopeAPIValues:function(){var a=this,b=$.Deferred();return a.dbValues({}),b.resolve().promise()}}),function(a,b,c){serverControlParams.isSkopOn&&(a.Value.prototype.set=function(d,e){var f=this._value,g=b.Deferred(),h=this,i=[];return d=this._setter.apply(this,arguments),d=this.validate(d),null===d||c.isEqual(f,d)?this:(this._value=d,this._dirty=!0,this._deferreds?(c.each(h._deferreds,function(a){i.push(a.apply(null,[d,f,e]))}),b.when.apply(null,i).fail(function(){a.consoleLog("A deferred callback failed in api.Value::set()")}).then(function(){h.callbacks.fireWith(h,[d,f,e]),g.resolveWith(h,[d,f,e])}),g.promise(h)):(this.callbacks.fireWith(this,[d,f,e]),g.resolveWith(h,[d,f,e]).promise(h)))},a.Value.prototype.bind=function(){var a=this,d=!1,e=[];
|
12 |
+
return b.each(arguments,function(a,b){d||(d=c.isObject(b)&&b.deferred),c.isFunction(b)&&e.push(b)}),d?(a._deferreds=a._deferreds||[],c.each(e,function(b){c.contains(b,a._deferreds)||a._deferreds.push(b)})):a.callbacks.add.apply(a.callbacks,arguments),this},a.Setting.prototype.silent_set=function(b,d){var e=this._value,f=a.state("saved")();return b=this._setter.apply(this,arguments),b=this.validate(b),null===b||c.isEqual(e,b)?this:(this._value=b,this._dirty=c.isUndefined(d)||!c.isBoolean(d)?this._dirty:d,this.callbacks.fireWith(this,[b,e,{silent:!0}]),a.state("saved")(f),this)})}(wp.customize,jQuery,_),function(a,b,c){a.bind("ready",function(){if(serverControlParams.isSkopOn){var d=a.previewer.query;a.previewer.query=function(e){if(!c.has(a,"czr_skope"))return a.consoleLog("QUERY : SKOPE IS NOT ON. FALLING BACK ON CORE QUERY"),d.apply(this);if("pending"==a.czr_initialSkopeCollectionPopulated.state())return a.consoleLog("QUERY : INITIAL SKOPE COLLECTION NOT POPULATED YET. FALLING BACK ON CORE QUERY"),d.apply(this);if("pending"==a.czr_isPreviewerSkopeAware.state()&&a.czr_isPreviewerSkopeAware.resolve(),!c.isObject(e)&&"resolved"==a.czr_initialSkopeCollectionPopulated.state()&&"resolved"==a.czr_initialSkopeCollectionPopulated.state())return d.apply(this);!c.isUndefined(e.skope_id)&&c.isString(e.skope_id)||(e.skope_id=a.czr_activeSkopeId()||a.czr_skopeBase.getGlobalSkopeId());var f,g={},h={},i={skope_id:null,action:null,the_dirties:{},dyn_type:null,opt_name:null};if(e=b.extend(i,e),!c.isObject(e.the_dirties))throw a.consoleLog("QUERY PARAMS : ",e),new Error("QUERY DIRTIES MUST BE AN OBJECT. Requested action : "+e.action);if("pending"!=a.czr_isPreviewerSkopeAware.state()&&c.isNull(e.skope_id))throw a.consoleLog("QUERY PARAMS : ",e),new Error("OVERRIDEN QUERY : NO SKOPE ID. FALLING BACK ON CORE QUERY. Requested action : "+e.action);if(!c.contains([null,"refresh","save","reset","changeset_update"],e.action))throw a.consoleLog("QUERY PARAMS : ",e),new Error("A REQUESTED QUERY HAS NO AUTHORIZED ACTION. Requested action : "+e.action);var j=function(){if("pending"==a.czr_initialSkopeCollectionPopulated.state())return{};var b={};return c.each(a.czr_currentSkopesCollection(),function(c){"global"!=c.skope&&(b[c.id]=a.czr_skopeBase.getSkopeDirties(c.id))}),b};switch(c.isNull(e.the_dirties)||c.isEmpty(e.the_dirties)?(g=a.dirtyValues({unsaved:e.excludeCustomizedSaved||!1}),h=j()):"global"==a.czr_skopeBase.getActiveSkopeName()?g=e.the_dirties:h[a.czr_activeSkopeId()]=e.the_dirties,e.action){case null:case"refresh":break;case"changeset_update":if(c.isUndefined(e.opt_name))throw new Error("Missing opt_name param in the changeset_update query for skope : "+e.skope_id);break;case"save":if(c.isNull(e.dyn_type)&&(e.dyn_type=a.czr_skope(e.skope_id)().dyn_type),c.isNull(e.dyn_type)||c.isUndefined(e.dyn_type))throw new Error("QUERY : A SAVE QUERY MUST HAVE A VALID DYN TYPE."+e.skope_id);break;case"reset":if(c.isNull(e.dyn_type)&&(e.dyn_type=a.czr_skope(e.skope_id)().dyn_type),c.isNull(e.dyn_type)||c.isUndefined(e.dyn_type))throw new Error("QUERY : A RESET QUERY MUST HAVE A VALID DYN TYPE."+e.skope_id)}var k={};return c.each(a.czr_currentSkopesCollection(),function(a){k[a.skope]={id:a.id,opt_name:a.opt_name}}),f={wp_customize:"on",customized:"{}"==JSON.stringify(g)?'{"__not_customized__"}':JSON.stringify(g),skopeCustomized:JSON.stringify(h),nonce:this.nonce.preview,skope:a.czr_skope(e.skope_id)().skope,level_id:a.czr_skope(e.skope_id)().level,skope_id:e.skope_id,dyn_type:e.dyn_type,opt_name:c.isNull(e.opt_name)?a.czr_skope(e.skope_id)().opt_name:e.opt_name,obj_id:a.czr_skope(e.skope_id)().obj_id,current_skopes:JSON.stringify(k)||{},channel:this.channel(),revisionIndex:a._latestRevision},f=a.czr_isChangeSetOn()?b.extend(f,{customize_theme:a.settings.theme.stylesheet,customize_changeset_uuid:a.settings.changeset.uuid}):b.extend(f,{theme:a.settings.theme.stylesheet})}}})}(wp.customize,jQuery,_),function(a,b,c){a.bind("czr-skope-started",function(){a.previewer.save=function(b){return a.czr_skopeSave.save()}})}(wp.customize,jQuery,_),function(a,b,c){if(serverControlParams.isSkopOn){a.Element.synchronizer.checkbox.update=function(a){this.element.prop("checked",a),this.element.iCheck("update")};var d=a.Element.synchronizer.val.update;a.Element.synchronizer.val.update=function(b){var c=this,e=function(){c.element.is("select")?c.element.val(b).trigger("change"):c.element.hasClass("wp-color-picker")?c.element.val(b).trigger("change"):c.element.val(b)};if(serverControlParams.isSkopOn){if("pending"==a.czr_skopeReady.state())return d.call(c,b);a.czr_skopeReady.then(function(){e()})}else e()},a.Element.synchronizer.val.refresh=function(){var a=this;return this.element.is("select")&&c.isNull(this.element.val())?c.isArray(a())?[]:c.isObject(a())?{}:"":this.element.val()}}}(wp.customize,jQuery,_),function(a,b,c){var d=a.Previewer.prototype.refresh,e=function(f){f=c.extend({waitSkopeSynced:!0,the_dirties:{}},f),c.has(a,"czr_activeSkopeId")&&!c.isUndefined(a.czr_activeSkopeId())||a.consoleLog("The api.czr_activeSkopeId() is undefined in the api.previewer._new_refresh() method.");var g=this,h=b.Deferred();if(!c.has(a,"czr_activeSkopeId")&&"pending"==a.czr_skopeReady.state())return a.czr_skopeReady.done(function(){e.apply(a.previewer,f)}),d.apply(g),h.resolve().promise();g.send("loading-initiated"),g.abort();var i=a.czr_getSkopeQueryParams({skope_id:a.czr_activeSkopeId(),action:"refresh",the_dirties:f.the_dirties||{}});return g.loading=new a.PreviewFrame({url:g.url(),previewUrl:g.previewUrl(),query:g.query(i)||{},container:g.container,signature:"WP_CUSTOMIZER_SIGNATURE"}),g.settingsModifiedWhileLoading={},onSettingChange=function(a){g.settingsModifiedWhileLoading[a.id]=!0},a.bind("change",onSettingChange),g.loading.always(function(){a.unbind("change",onSettingChange)}),a.czr_isChangeSetOn()||(g._previousPreview=g._previousPreview||g.preview),g.loading.done(function(b){var c,d=this;g.preview=d,g.targetWindow(d.targetWindow()),g.channel(d.channel()),c=function(b){d.unbind("synced",c),d.unbind("czr-skopes-synced",c),g._previousPreview?g._previousPreview.destroy():g.preview&&g.preview.destroy(),g._previousPreview=g.preview,g.deferred.active.resolve(),delete g.loading,a.trigger("pre_refresh_done",{previewer:g,skopesServerData:b||{}}),h.resolve({previewer:g,skopesServerData:b||{}})},a.czr_isChangeSetOn()||g.send("sync",{scroll:g.scroll,settings:a.get()}),f.waitSkopeSynced?d.bind("czr-skopes-synced",c):d.bind("synced",c),g.trigger("ready",b)}),g.loading.fail(function(b,c){a.consoleLog("LOADING FAILED : ",arguments),g.send("loading-failed"),a.czr_isChangeSetOn()||"redirect"===b&&c&&g.previewUrl(c),"logged out"===b&&(g.preview&&(g.preview.destroy(),delete g.preview),g.login().done(g.refresh)),"cheatin"===b&&g.cheatin(),h.reject(b)}),h.promise()};a.bind("czr-skope-started",function(){czr_override_refresh_for_skope(),a.Previewer.prototype.refresh=e}),a.czr_getSkopeQueryParams=function(d){if(!a.czr_isChangeSetOn())return d;d=c.isObject(d)?d:{};var e=d.action||"refresh";switch(e){case"refresh":d=b.extend(d,{excludeCustomizedSaved:!0})}return d},czr_override_refresh_for_skope=function(){serverControlParams.isSkopOn&&(a.previewer.refresh=function(d){var f=b.Deferred(),g=function(b){var c,d=function(){return 0===a.state("processing").get()},g=function(){e.call(a.previewer,b).done(function(a){f.resolve(a)})};d()?g():(c=function(){d()&&(g(),a.state("processing").unbind(c))},a.state("processing").bind(c))};return g=c.debounce(g,a.previewer.refreshBuffer),g(d),f.promise()})}}(wp.customize,jQuery,_),function(a,b,c){serverControlParams.isSkopOn&&(a.dirtyValues=function(b){return a.czr_skopeBase.getSkopeDirties(a.czr_skopeBase.getGlobalSkopeId(),b)})}(wp.customize,jQuery,_),function(a,b,c){if(serverControlParams.isSkopOn&&a.czr_isChangeSetOn()){var d=a.requestChangesetUpdate;a.requestChangesetUpdate=function(e){var f=b.Deferred(),g=[],h=[],i=e||{},j=[],k=[],l=b.Deferred();(0===a._lastSavedRevision||c.isEmpty(a.state("changesetStatus")()))&&(i=c.extend(i,{blogname:{dummy_change:"dummy_change"}})),c.each(a.czr_currentSkopesCollection(),function(a){"global"!=a.skope&&g.push(a.id)});var m=function(d){if(c.isUndefined(g[d+1])&&h.length==g.length){if(c.isEmpty(j))l.resolve(k);else{var e=function(){var d=[];return c.each(j,function(b){d.push(a.czr_skopeBase.buildServerResponse(b))}),b.trim(d.join(" | "))};l.reject(e())}return!0}},n=function(b){return(c.isUndefined(b)||0==b)&&a.state("processing").set(1),b=b||0,c.isUndefined(g[b])?(a.consoleLog("Undefined Skope in changeset recursive call ",b,g,g[b]),l.resolve(k).promise()):(a._requestSkopeChangetsetUpdate(e,g[b]).always(function(){h.push(b)}).fail(function(c){j.push(c),a.consoleLog("CHANGESET UPDATE RECURSIVE FAIL FOR SKOPE : ",g[b]),m(b)||n(b+1)}).done(function(a){k.push(a),m(b)||n(b+1)}),l.promise())},o=a._lastSavedRevision;return d(i).fail(function(b){a.consoleLog("WP requestChangesetUpdateFail",b,a.czr_skopeBase.buildServerResponse(b)),a._lastSavedRevision=Math.max(a._latestRevision,a._lastSavedRevision),a.state("processing").set(0),f.reject(b),b=a.czr_skopeBase.buildServerResponse(b),a.czr_serverNotification({message:b,status:"error"})}).done(function(b){"pending"==a.czr_initialSkopeCollectionPopulated.state()&&f.resolve(b),a._lastSavedRevision=o,n().always(function(){a._lastSavedRevision=Math.max(a._latestRevision,a._lastSavedRevision),a.state("processing").set(0)}).fail(function(b){f.reject(b),a.consoleLog("CHANGESET UPDATE RECURSIVE PUSH FAIL",b,k),a.trigger("changeset-error",b),a.czr_serverNotification({message:b,status:"error"})}).done(function(){f.resolve(b)})}),f.promise()},a._requestSkopeChangetsetUpdate=function(d,e){if(c.isUndefined(e)||!a.czr_skope.has(e))throw new Error("In api._requestSkopeChangetsetUpdate() : a valid and registered skope_id must be provided");var f,g=new b.Deferred,h={};if(e=e||a.czr_activeSkopeId(),d&&c.extend(h,d),c.each(a.czr_skopeBase.getSkopeDirties(e),function(a,b){d&&null===d[b]||(h[b]=c.extend({},h[b]||{},{value:a}))}),c.isEmpty(h))return g.resolve({}),g.promise();if(a._latestRevision<=a._lastSavedRevision)return g.resolve({}),g.promise();a.trigger("skope-changeset-save",h);var i={skope_id:e,action:"changeset_update",opt_name:a.czr_skope(e).opt_name};return f=a.previewer.query(c.extend(i,{excludeCustomizedSaved:!0})),delete f.customized,c.extend(f,{nonce:a.settings.nonce.save,customize_changeset_data:JSON.stringify(h)}),wp.ajax.post("customize_skope_changeset_save",f).done(function(a){g.resolve(a)}).fail(function(b){a.consoleLog("SKOPE CHANGESET FAIL FOR SKOPE "+b.skope_id,b),g.reject(b)}).always(function(b){b.setting_validities&&a._handleSettingValidities({settingValidities:b.setting_validities})}),g.promise()}}}(wp.customize,jQuery,_),function(a,b,c){if(serverControlParams.isSkopOn){var d=a.Setting.prototype.preview;a.Setting.prototype.preview=function(b,e,f){if(c.has(a,"czr_isPreviewerSkopeAware")&&"pending"==a.czr_isPreviewerSkopeAware.state()&&this.previewer.refresh(),!c.has(f,"silent")||!1===f.silent)return d.call(this)}}}(wp.customize,jQuery,_),function(a,b,c){if("function"==typeof a.Section){var d=a.Section.prototype.initialize;a.Section.prototype.initialize=function(a,e){d.apply(this,[a,e]);var f=this;this.expanded.callbacks.add(function(a){if(a){var d=f.container.closest(".wp-full-overlay-sidebar-content"),e=f.container.find(".accordion-section-content");_resizeContentHeight=function(){e.css("height",d.innerHeight())},_resizeContentHeight(),b(window).on("resize.customizer-section",c.debounce(_resizeContentHeight,110))}})}}}(wp.customize,jQuery,_),function(a,b,c){a.CZR_Helpers=a.CZR_Helpers||{},a.CZR_Helpers=b.extend(a.CZR_Helpers,{getControlSettingId:function(b,d){if(d="default",!a.control.has(b))throw new Error("The requested control_id is not registered in the api yet : "+b);if(c.has(a.control(b),"settings")&&!c.isEmpty(a.control(b).settings)){if(!c.has(a.control(b).settings,d))throw new Error("The requested control_id does not have the requested setting type : "+b+" , "+d);if(c.isUndefined(a.control(b).settings[d].id))throw new Error("The requested control_id has no setting id assigned : "+b);return a.control(b).settings[d].id}},getDocSearchLink:function(a){a=c.isString(a)?a:"";var b=a.replace(/ /g,"+"),d=[serverControlParams.docURL,"search?query=",b].join("");return['<a href="'+d+'" title="'+serverControlParams.translatedStrings.readDocumentation+'" target="_blank">'," ",'<span class="fa fa-question-circle-o"></span>'].join("")},build_setId:function(a){return c.contains(serverControlParams.wpBuiltinSettings,a)?a:c.contains(serverControlParams.themeSettingList,a)&&-1==a.indexOf(serverControlParams.themeOptions)?[serverControlParams.themeOptions+"[",a,"]"].join(""):a},getOptionName:function(a){return-1==a.indexOf(serverControlParams.themeOptions)?a:a.replace(/\[|\]/g,"").replace(serverControlParams.themeOptions,"")},has_part_refresh:function(b){if(c.has(a,"czr_partials"))return c.contains(c.map(a.czr_partials(),function(a,d){return c.contains(a.settings,b)}),!0)},getSectionControlIds:function(b){return b=b||a.czr_activeSectionId(),a.section.has(b)?c.map(a.section(b).controls(),function(a){return a.id}):[]},getSectionSettingIds:function(b){if(b=b||a.czr_activeSectionId(),a.section.has(b)){var d=this,e=[],f=d.getSectionControlIds(b);return c.each(f,function(b){c.each(a.control(b).settings,function(a,b){e.push(a.id)})}),e}},capitalize:function(a){return c.isString(a)?a.charAt(0).toUpperCase()+a.slice(1):a},truncate:function(a,b,d){if(c.isUndefined(a))return"";var e=a.length>b,f=e?a.substr(0,b-1):a;return f=d&&e?f.substr(0,f.lastIndexOf(" ")):f,e?f+"...":f},isMultiItemModule:function(b,d){if(!c.isUndefined(b)||c.isObject(d)){if(c.isObject(d)&&c.has(d,"module_type"))b=d.module_type;else if(c.isUndefined(b)||c.isNull(b))return;if(c.has(a.czrModuleMap,b))return a.czrModuleMap[b].crud||a.czrModuleMap[b].multi_item||!1}},isCrudModule:function(b,d){if(!c.isUndefined(b)||c.isObject(d)){if(c.isObject(d)&&c.has(d,"module_type"))b=d.module_type;else if(c.isUndefined(b)||c.isNull(b))return;if(c.has(a.czrModuleMap,b))return a.czrModuleMap[b].crud||!1}}})}(wp.customize,jQuery,_),function(a,b,c){a.CZR_Helpers=a.CZR_Helpers||{},a.CZR_Helpers=b.extend(a.CZR_Helpers,{addActions:function(a,b,d){var e=this;d=d||e,d[a]=d[a]||[],new_event_map=c.clone(d[a]),d[a]=c.union(new_event_map,c.isArray(b)?b:[b])},doActions:function(a,b,c){b.trigger(a,c)},setupDOMListeners:function(d,e,f){var g=this;f=f||g,c.map(d,function(d){if(!c.isString(d.selector)||c.isEmpty(d.selector))throw new Error("setupDOMListeners : selector must be a string not empty. Aborting setup of action(s) : "+d.actions.join(","));e.dom_el.on(d.trigger,d.selector,function(h,i){if(h.stopPropagation(),!a.utils.isKeydownButNotEnterEvent(h)){h.preventDefault();var j=c.clone(e);c.has(j,"model")&&c.has(j.model,"id")&&(c.has(f,"get")?j.model=f():j.model=f.getModel(j.model.id)),b.extend(j,{event:d,dom_event:h}),b.extend(j,i),g.executeEventActionChain(j,f)}})})},executeEventActionChain:function(a,b){var d=this;if(!c.has(a,"event")||!c.has(a.event,"actions"))throw new Error("executeEventActionChain : No obj.event or no obj.event.actions properties found");if("function"==typeof a.event.actions)return a.event.actions(a);c.isArray(a.event.actions)||(a.event.actions=[a.event.actions]);var e=!1;c.map(a.event.actions,function(f){if(!e){if("function"!=typeof b[f])throw new Error("executeEventActionChain : the action : "+f+" has not been found when firing event : "+a.event.selector);var g=c.has(a,"dom_el")&&-1!=a.dom_el.length?a.dom_el:d.container;g.trigger("before_"+f,c.omit(a,"event"));var h=b[f](a);!1===h&&(e=!0),g.trigger("after_"+f,c.omit(a,"event"))}})}})}(wp.customize,jQuery,_),function(a,b,c){a.bind("ready",function(){a.previewer.bind("houston-widget-settings",function(b){var d=c.filter(b.registeredSidebars,function(a){return!c.findWhere(_wpCustomizeWidgetsSettings.registeredSidebars,{id:a.id})}),e=c.filter(b.registeredSidebars,function(a){return!c.has(b.renderedSidebars,a.id)});e=c.map(e,function(a){return a.id});var f=c.map(b.registeredSidebars,function(a){return a.id});a.czr_widgetZoneSettings.set({actives:b.renderedSidebars,inactives:e,registered:f,candidates:d,available_locations:b.availableWidgetLocations})}),a.previewer.bind("czr-wp-conditional-ready",function(b){a.czr_wp_conditionals.set(b)}),a.previewer.bind("czr-partial-refresh",function(b){a.czr_partials.set(b)})})}(wp.customize,jQuery,_);var CZRInputMths=CZRInputMths||{};$.extend(CZRInputMths,{initialize:function(a,b){if(_.isUndefined(b.item)||_.isEmpty(b.item))throw new Error("No item assigned to input "+b.id+". Aborting");if(_.isUndefined(b.module))throw new Error("No module assigned to input "+b.id+". Aborting");api.Value.prototype.initialize.call(this,null,b);var c=this;if($.extend(c,b||{}),c.isReady=$.Deferred(),_.isUndefined(b.input_value)||c.set(b.input_value),c.type_map={text:"",textarea:"",check:"setupIcheck",select:"setupSelect",upload:"setupImageUploader",color:"setupColorPicker",content_picker:"setupContentPicker",text_editor:"setupTextEditor",password:""},_.has(c.type_map,c.type)){var d=c.type_map[c.type];_.isFunction(c[d])&&c[d]()}var e={text:"keyup",textarea:"keyup",password:"keyup",color:"colorpickerchange",range:"input propertychange"};c.input_event_map=[{trigger:$.trim(["change",e[c.type]||""].join(" ")),selector:"input[data-type], select[data-type], textarea[data-type]",name:"set_input_value",actions:function(a){if(!_.has(c.item,"syncElements")||!_.has(c.item.syncElements,c.id))throw new Error("WARNING : THE INPUT "+c.id+" HAS NO SYNCED ELEMENT.")}}]},ready:function(){var a=this;a.setupDOMListeners(a.input_event_map,{dom_el:a.container},a),a.callbacks.add(function(){return a.inputReact.apply(a,arguments)}),$.when(a.setupSynchronizer()).done(function(){a.isReady.resolve(a)})},setupSynchronizer:function(){var a=this,b=a.item,c=a.container.find("[data-type]"),d=a.container.find("[data-type]").is("textarea");if(d)throw new Error("TO DO : THE TEXTAREA INPUT ARE NOT READY IN THE SYNCHRONIZER!");var e=new api.Element(c);b.syncElements=b.syncElements||{},b.syncElements[a.id]=e,e.sync(a),e.set(a())},inputReact:function(a,b){var c=this,d=c.item(),e=_.clone(d);e=!_.isObject(e)||_.isEmpty(e)?{}:e,e[c.id]=a,c.item.set(e),_.has(c,"is_preItemInput")||c.item.trigger(c.id+":changed",a)}});var CZRInputMths=CZRInputMths||{};$.extend(CZRInputMths,{setupImageUploader:function(){var a=this,b=a();return a.attachment={},a.container?(this.contentRendered=$.Deferred(),this.setupContentRendering(b,{}),void this.contentRendered.done(function(){a.czrImgUploaderBinding()})):this},setupContentRendering:function(a,b){var c=this;c.attachment.id!=a&&b!==a?(a||(c.attachment={},c.renderImageUploaderTemplate()),wp.media.attachment(a).fetch().done(function(){c.attachment=this.attributes,c.renderImageUploaderTemplate()})):c.attachment.id&&c.attachment.id!==a||c.renderImageUploaderTemplate()},czrImgUploaderBinding:function(){var a=this;_.bindAll(a,"czrImgUploadRemoveFile","czrImgUploadOpenFrame","czrImgUploadSelect"),a.container.on("click keydown",".upload-button",a.czrImgUploadOpenFrame),a.container.on("click keydown",".thumbnail-image img",a.czrImgUploadOpenFrame),a.container.on("click keydown",".remove-button",a.czrImgUploadRemoveFile),a.bind(a.id+":changed",function(b,c){a.contentRendered=$.Deferred(),a.setupContentRendering(b,c)})},czrImgUploadOpenFrame:function(a){api.utils.isKeydownButNotEnterEvent(a)||(a.preventDefault(),this.frame||this.czrImgUploadInitFrame(),this.frame.open())},czrImgUploadInitFrame:function(){var a=this,b=this.getUploaderLabels();a.frame=wp.media({button:{text:b.frame_button},states:[new wp.media.controller.Library({title:b.frame_title,library:wp.media.query({type:"image"}),multiple:!1,date:!1})]}),a.frame.on("select",a.czrImgUploadSelect)},czrImgUploadRemoveFile:function(a){var b=this;api.utils.isKeydownButNotEnterEvent(a)||(a.preventDefault(),b.attachment={},b.set(""))},czrImgUploadSelect:function(){var a=this,b=a.frame.state().get("selection").first().toJSON();window._wpmejsSettings||{};a.attachment=b,a.set(b.id)},renderImageUploaderTemplate:function(){var a=this;if(0!==$("#tmpl-czr-input-img-uploader-view-content").length){var b=wp.template("czr-input-img-uploader-view-content");if(b&&a.container){var c=a.container.find("."+a.module.control.css_attr.img_upload_container);if(c.length){var d={button_labels:a.getUploaderLabels(),settings:a.id,attachment:a.attachment,canUpload:!0};return c.html(b(d)),a.contentRendered.resolve(),a.container.trigger(a.id+":content_rendered"),!0}}}},getUploaderLabels:function(){var a=serverControlParams.translatedStrings,b={select:a.select_image,change:a.change_image,remove:a.remove_image,"default":a.default_image,placeholder:a.placeholder_image,frame_title:a.frame_title_image,frame_button:a.frame_button_image};return _.each(b,function(a,b){if(_.isUndefined(a)){var c=this;throw new Error("A translated string is missing ( "+b+" ) for the image uploader input in module : "+c.module.id)}}),b}}),$.extend(CZRInputMths,{setupColorPicker:function(){var a=this;a.container.find("input").wpColorPicker({change:function(a,b){$(this).val($(this).wpColorPicker("color")).trigger("colorpickerchange").trigger("change")}})}}),$.extend(CZRInputMths,{setupSelect:function(){var a=this;$("select",a.container).not(".no-selecter-js").each(function(){$(this).selecter({})})}});var CZRInputMths=CZRInputMths||{};$.extend(CZRInputMths,{setupContentPicker:function(){var a=this,b=[];a.object=["post"],a.type="post_type",a.container.find(".czr-input").append('<select data-select-type="content-picker-select" class="js-example-basic-simple"></select>'),b=[{trigger:"change",selector:"select[data-select-type]",name:"set_input_value",actions:"updateContentPickerModel"}],a.setupDOMListeners(b,{dom_el:a.container},a),a.setupContentSelecter()},setupContentSelecter:function(){var a=this;a.container.find("select").select2({placeholder:{id:"-1",title:"Select"},data:a.setupSelectedContents(),ajax:{url:serverControlParams.AjaxUrl,type:"POST",dataType:"json",delay:250,debug:!0,data:function(b){var c=b.page?b.page-1:0;return c=b.term?b.page:c,{action:b.term?"search-available-content-items-customizer":"load-available-content-items-customizer",search:b.term,wp_customize:"on",page:c,type:a.type,object:a.object,CZRCpNonce:serverControlParams.CZRCpNonce}},processResults:function(a,b){if(!a.success)return{results:[]};var c=a.data.items,d=[];return _.each(c,function(a){d.push({id:a.id,title:a.title,type_label:a.type_label,object_type:a.object})}),{results:d,pagination:{more:10==a.data.items.length}}}},templateSelection:a.czrFormatContentSelected,templateResult:a.czrFormatContentSelected,escapeMarkup:function(a){return a}})},czrFormatContentSelected:function(a){if(a.loading)return a.text;var b="<div class='content-picker-item clearfix'><div class='content-item-bar'><span class='item-title'>"+a.title+"</span>";return a.type_label&&(b+="<span class='item-type'>"+a.type_label+"</span>"),b+="</div></div>"},setupSelectedContents:function(){var a=this,b=a();return b},updateContentPickerModel:function(a){var b=this,c=$(a.dom_event.currentTarget,a.dom_el),d=$(c,a.dom_el).select2("data");d.length&&(d=_.map(d,function(a){return{id:a.id,type_label:a.type_label,title:a.title,object_type:a.object_type}})),b.set(d)}});var CZRInputMths=CZRInputMths||{};$.extend(CZRInputMths,{setupTextEditor:function(){var a=this;a();if(!a.container)throw new Error("The input container is not set for WP text editor in module."+a.module.id);a.czrRenderInputTextEditorTemplate()&&(a.editor=tinyMCE("czr-customize-content_editor"),a.textarea=$("#czr-customize-content_editor"),a.editorPane=$("#czr-customize-content_editor-pane"),a.dragbar=$("#czr-customize-content_editor-dragbar"),a.editorFrame=$("#czr-customize-content_editor_ifr"),a.mceTools=$("#wp-czr-customize-content_editor-tools"),a.mceToolbar=a.editorPane.find(".mce-toolbar-grp"),a.mceStatusbar=a.editorPane.find(".mce-statusbar"),a.preview=$("#customize-preview"),a.collapse=$(".collapse-sidebar"),a.textpreview=a.container.find("textarea"),a.toggleButton=a.container.find("button.text_editor-button"),a.editorExpanded=new api.Value((!1)),a.czrUpdateTextPreview(),a.czrSetToggleButtonText(a.editorExpanded()),a.czrTextEditorBinding(),a.czrResizeEditorOnUserRequest())},czrTextEditorBinding:function(){var a=this,b=a.editor,c=a.textarea,d=a.toggleButton,e=(a.editorExpanded,a.editorPane);a.bind(a.id+":changed",a.czrUpdateTextPreview),_.bindAll(a,"czrOnVisualEditorChange","czrOnTextEditorChange","czrResizeEditorOnWindowResize"),d.on("click",function(){a.editorExpanded.set(!a.editorExpanded()),a.editorExpanded()&&b.focus()}),a.module.czr_ModuleState.bind(function(b){"expanded"!=b&&a.editorExpanded.set(!1)}),a.editorExpanded.bind(function(d){api.consoleLog("in input.editorExpanded",d,a()),b.locker&&b.locker!==a&&(b.locker.editorExpanded.set(!1),b.locker=null),b.locker&&b.locker!==a||($(document.body).toggleClass("czr-customize-content_editor-pane-open",d),b.locker=a),a.czrSetToggleButtonText(d),d?(b.setContent(wp.editor.autop(a())),b.on("input change keyup",a.czrOnVisualEditorChange),c.on("input",a.czrOnTextEditorChange),a.czrResizeEditor(window.innerHeight-e.height()),$(window).on("resize",a.czrResizeEditorOnWindowResize)):(b.off("input change keyup",a.czrOnVisualEditorChange),c.off("input",a.czrOnTextEditorChange),$(window).off("resize",a.czrResizeEditorOnWindowResize),a.czrResizeReset())})},czrOnVisualEditorChange:function(){var a,b=this,c=b.editor;a=wp.editor.removep(c.getContent()),b.set(a)},czrOnTextEditorChange:function(){var a,b=this,c=b.textarea;a=c.val(),b.set(a)},czrUpdateTextPreview:function(){var a,b=this,c=b();a=c.replace(/(<([^>]+)>)/gi,""),a.length>30&&(a=a.substring(0,34)+"..."),b.textpreview.val(a)},czrRenderInputTextEditorTemplate:function(){var a=this;if(0===$("#tmpl-czr-input-text_editor-view-content").length)throw new Error("Missing js template for text editor input in module : "+a.module.id);var b=wp.template("czr-input-text_editor-view-content"),c=a.container.find("input");if(b&&a.container)return api.consoleLog("Model injected in text editor tmpl : ",a()),c.after(b(a())),!0},czrIsEditorExpanded:function(){return $(document.body).hasClass("czr-customize-content_editor-pane-open")},czrResizeReset:function(){var a=this,b=a.preview,c=a.collapse,d=a.container.closest("ul.accordion-section-content");d.css("padding-bottom",""),b.css("bottom",""),c.css("bottom","")},czrResizeEditor:function(a){var b=window.innerHeight,c=window.innerWidth,d=40,e=1,f=782,g=56,h=8,i=4,j={},k=this,l=k.container.closest("ul.accordion-section-content"),m=k.mceTools,n=k.mceToolbar,o=k.mceStatusbar,p=k.preview,q=k.collapse,r=k.editorPane,s=k.editorFrame;k.editorExpanded()&&(_.isNaN(a)||(resizeHeight=b-a),j.height=resizeHeight,j.components=m.outerHeight()+n.outerHeight()+o.outerHeight(),resizeHeight<d&&(j.height=d),resizeHeight>b-e&&(j.height=b-e),b<r.outerHeight()&&(j.height=b),p.css("bottom",j.height),r.css("height",j.height),s.css("height",j.height-j.components),q.css("bottom",j.height+h),g>b-j.height&&q.css("bottom",o.outerHeight()+i),c<=f?l.css("padding-bottom",j.height):l.css("padding-bottom",""))},czrResizeEditorOnWindowResize:function(){var a=this,b=50,c=a.editorPane;a.editorExpanded()&&_.delay(function(){a.czrResizeEditor(window.innerHeight-c.height())},b)},czrResizeEditorOnUserRequest:function(){var a=this,b=a.dragbar,c=a.editorFrame;b.on("mousedown",function(){a.editorExpanded()&&$(document).on("mousemove.czr-customize-content_editor",function(b){b.preventDefault(),$(document.body).addClass("czr-customize-content_editor-pane-resize"),c.css("pointer-events","none"),a.czrResizeEditor(b.pageY)})}),b.on("mouseup",function(){a.editorExpanded()&&($(document).off("mousemove.czr-customize-content_editor"),$(document.body).removeClass("czr-customize-content_editor-pane-resize"),c.css("pointer-events",""))})},czrSetToggleButtonText:function(a){var b=this;b.toggleButton.text(serverControlParams.translatedStrings[a?"textEditorClose":"textEditorOpen"])}});var CZRItemMths=CZRItemMths||{};$.extend(CZRItemMths,{initialize:function(a,b){if(_.isUndefined(b.module)||_.isEmpty(b.module))throw new Error("No module assigned to item "+a+". Aborting");var c=this;api.Value.prototype.initialize.call(c,null,b),c.isReady=$.Deferred(),c.embedded=$.Deferred(),c.contentRendered=$.Deferred(),$.extend(c,b||{}),c.defaultItemModel=_.clone(b.defaultItemModel)||{id:"",title:""};var d=$.extend(c.defaultItemModel,b.initial_item_model);c.set(d),c.userEventMap=new api.Value([{trigger:"click keydown",selector:["."+c.module.control.css_attr.display_alert_btn,"."+c.module.control.css_attr.cancel_alert_btn].join(","),name:"toggle_remove_alert",actions:["toggleRemoveAlertVisibility"]},{trigger:"click keydown",selector:"."+c.module.control.css_attr.remove_view_btn,name:"remove_item",actions:["removeItem"]},{trigger:"click keydown",selector:["."+c.module.control.css_attr.edit_view_btn,"."+c.module.control.css_attr.item_title].join(","),name:"edit_view",actions:["setViewVisibility"]}]),c.isReady.done(function(){c.module.updateItemsCollection({item:c()}),c.callbacks.add(function(){return c.itemReact.apply(c,arguments)}),c.mayBeRenderItemWrapper(),c.embedded.done(function(){c.itemWrapperViewSetup(d)}),c.contentRendered.done(function(){_.has(c,"czr_Input")||c.setupInputCollectionFromDOM()})})},ready:function(){this.isReady.resolve()},itemReact:function(a,b){var c=this,d=c.module;d.updateItemsCollection({item:a}),c.writeItemViewTitle(a),_.isEmpty(b)&&_.isUndefined(b)||(api.consoleLog("DO WE REALLY NEED TO SEND THIS TO THE PREVIEW WITH _sendItem(to, from) ?"),c._sendItem(a,b))}});var CZRItemMths=CZRItemMths||{};$.extend(CZRItemMths,{setupInputCollectionFromDOM:function(){var a=this,b=a.module;if(a.czr_Input=new api.Values,a.inputConstructor=b.inputConstructor,_.isEmpty(a.defaultItemModel)||_.isUndefined(a.defaultItemModel))throw new Error("No default model found in item "+a.id+". Aborting");var c=$.extend(!0,{},a());c=_.isObject(c)?$.extend(a.defaultItemModel,c):a.defaultItemModel;var d={};$("."+b.control.css_attr.sub_set_wrapper,a.container).each(function(e){var f=$(this).find("[data-type]").attr("data-type"),g=_.has(c,f)?c[f]:"";if(!_.isUndefined(f)&&!_.isEmpty(f)){if(!_.has(c,f))throw new Error("The item property : "+f+" has been found in the DOM but not in the item model : "+a.id+". The input can not be instantiated.");a.czr_Input.add(f,new a.inputConstructor(f,{id:f,type:$(this).attr("data-input-type"),input_value:g,container:$(this),item:a,module:b})),a.czr_Input(f).ready(),d[f]=g}})},removeInputCollection:function(){var a=this;a.czr_Input.each(function(b){a.czr_Input.remove(b.id)})}});var CZRItemMths=CZRItemMths||{};$.extend(CZRItemMths,{_sendItem:function(a,b){var c=this,d=c.module,e=[];_.each(b,function(b,c){b!=a[c]&&e.push(c)}),_.each(e,function(b){d.control.previewer.send("sub_setting",{set_id:d.control.id,id:a.id,changed_prop:b,value:a[b]}),d.trigger("item_sent",{item:a,dom_el:c.container,changed_prop:b})})},removeItem:function(){var a=this,b=this.module,c=_.clone(b.itemCollection());b.trigger("pre_item_dom_remove",a()),a._destroyView(),c=_.without(c,_.findWhere(c,{id:a.id})),b.itemCollection.set(c),b.trigger("pre_item_api_remove",a()),b.czr_Item.remove(a.id)},getModel:function(a){return this()}});var CZRItemMths=CZRItemMths||{};$.extend(CZRItemMths,{mayBeRenderItemWrapper:function(){var a=this;"pending"==a.embedded.state()&&$.when(a.renderItemWrapper()).done(function(b){if(a.container=b,_.isUndefined(a.container)||!a.container.length)throw new Error("In mayBeRenderItemWrapper the Item view has not been rendered : "+a.id);a.embedded.resolve()})},itemWrapperViewSetup:function(a){var b=this;this.module;a=b()||b.initial_item_model,b.czr_ItemState=new api.Value,b.czr_ItemState.set("closed"),b.writeItemViewTitle();var c=function(a,c,d){if(_.isUndefined(a)||!1===a.length)throw new Error("Module : "+b.module.id+", the item content has not been rendered for "+b.id);
|
13 |
+
b.contentRendered.resolve(),b.toggleItemExpansion(c,d)};b.module.isMultiItem()?b.czr_ItemState.callbacks.add(function(d,e){return"resolved"==b.contentRendered.state()?void b.toggleItemExpansion(d,e):void $.when(b.renderItemContent(a)).done(function(a){(c=_.debounce(c,400))(a,d,e)})}):(b.czr_ItemState.callbacks.add(function(a,c){b.toggleItemExpansion.apply(b,arguments)}),$.when(b.renderItemContent(a)).done(function(a){c(a,!0)})),api.CZR_Helpers.setupDOMListeners(b.userEventMap(),{model:a,dom_el:b.container},b)},renderItemWrapper:function(a){var b=this,c=b.module;if(a=a||b(),$_view_el=$("<li>",{"class":c.control.css_attr.single_item,"data-id":a.id,id:a.id}),c.itemsWrapper.append($_view_el),c.isMultiItem()){var d=c.getTemplateEl("rudItemPart",a);if(0===$("#tmpl-"+d).length)throw new Error("Missing template for item "+b.id+". The provided template script has no been found : #tmpl-"+c.getTemplateEl("rudItemPart",a));$_view_el.append($(wp.template(d)(a)))}return $_view_el.append($("<div/>",{"class":c.control.css_attr.item_content})),$_view_el},renderItemContent:function(a){var b=this,c=this.module;if(a=a||b(),0===$("#tmpl-"+c.getTemplateEl("itemInputList",a)).length)throw new Error("No item content template defined for module "+c.id+". The template script id should be : #tmpl-"+c.getTemplateEl("itemInputList",a));var d=wp.template(c.getTemplateEl("itemInputList",a));return d?($(d(a)).appendTo($("."+c.control.css_attr.item_content,b.container)),$($(d(a)),b.container)):this},writeItemViewTitle:function(a){var b=this,c=b.module,d=a||b(),e=_.has(d,"title")?api.CZR_Helpers.capitalize(d.title):d.id;e=api.CZR_Helpers.truncate(e,20),$("."+c.control.css_attr.item_title,b.container).text(e),api.CZR_Helpers.doActions("after_writeViewTitle",b.container,d,b)},setViewVisibility:function(a,b){var c=this,d=this.module;b?c.czr_ItemState.set("expanded_noscroll"):(d.closeAllItems(c.id),_.has(d,"preItem")&&d.preItemExpanded.set(!1),c.czr_ItemState.set("expanded"==c._getViewState()?"closed":"expanded"))},_getViewState:function(){return-1==this.czr_ItemState().indexOf("expanded")?"closed":"expanded"},toggleItemExpansion:function(a,b,c){var d=this,e=this.module;$("."+e.control.css_attr.item_content,d.container).first().slideToggle({duration:c||200,done:function(){var b="closed"!=a;d.container.toggleClass("open",b),e.closeAllAlerts();var c=$(this).siblings().find("."+e.control.css_attr.edit_view_btn);c.toggleClass("active",b),b?c.removeClass("fa-pencil").addClass("fa-minus-square").attr("title",serverControlParams.translatedStrings.close):c.removeClass("fa-minus-square").addClass("fa-pencil").attr("title",serverControlParams.translatedStrings.edit),"expanded"==a&&e._adjustScrollExpandedBlock(d.container)}})},toggleRemoveAlertVisibility:function(a){var b=this,c=this.module,d=$("."+c.control.css_attr.remove_alert_wrapper,b.container).first();a.dom_event;if(c.closeAllItems(),_.has(c,"preItem")&&c.preItemExpanded.set(!1),$("."+c.control.css_attr.remove_alert_wrapper,b.container).not(d).each(function(){$(this).hasClass("open")&&$(this).slideToggle({duration:200,done:function(){$(this).toggleClass("open",!1),$(this).siblings().find("."+c.control.css_attr.display_alert_btn).toggleClass("active",!1)}})}),!wp.template(c.AlertPart)||!b.container)throw new Error("No removal alert template available for items in module :"+c.id);d.html(wp.template(c.AlertPart)({title:b().title||b.id})),d.slideToggle({duration:200,done:function(){var d=!$(this).hasClass("open")&&$(this).is(":visible");$(this).toggleClass("open",d),$(a.dom_el).find("."+c.control.css_attr.display_alert_btn).toggleClass("active",d),d&&c._adjustScrollExpandedBlock(b.container)}})},_destroyView:function(a){this.container.fadeOut({duration:a||400,done:function(){$(this).remove()}})}});var CZRModuleMths=CZRModuleMths||{};$.extend(CZRModuleMths,{initialize:function(a,b){if(_.isUndefined(b.control)||_.isEmpty(b.control))throw new Error("No control assigned to module "+a);var c=this;api.Value.prototype.initialize.call(this,null,b),c.isReady=$.Deferred(),$.extend(c,b||{}),$.extend(c,{crudModulePart:"czr-crud-module-part",rudItemPart:"czr-rud-item-part",ruItemPart:"czr-ru-item-part",itemInputList:"",AlertPart:"czr-rud-item-alert-part"}),c.embedded=$.Deferred(),c.isInSektion()||(c.container=$(c.control.selector),c.embedded.resolve()),c.embedded.done(function(){$.when(c.renderModuleParts()).done(function(a){if(!1===a.length)throw new Error("The items wrapper has not been rendered for module : "+c.id);c.itemsWrapper=a})}),c.itemCollection=new api.Value,c.itemCollection.set([]),c.defaultAPIitemModel={id:"",initial_item_model:{},defaultItemModel:{},control:{},module:{},is_added_by_user:!1},c.defaultItemModel={id:"",title:""},c.itemConstructor=api.CZRItem,c.czr_Item=new api.Values,c.inputConstructor=api.CZRInput,c.isReady.done(function(){c.isDirty=new api.Value(b.dirty||!1),c.set(c.initializeModuleModel(b)),c.callbacks.add(function(){return c.moduleReact.apply(c,arguments)}),c.control.isModuleRegistered(c.id)||c.control.updateModulesCollection({module:b,is_registered:!1}),c.bind("items-collection-populated",function(a){c.itemCollection.callbacks.add(function(){return c.itemCollectionReact.apply(c,arguments)}),c.isMultiItem()&&c._makeItemsSortable(),api.consoleLog("SAVED ITEM COLLECTION OF MODULE "+c.id+" IS READY")}),c.isInSektion()||c.populateSavedItemCollection()})},ready:function(){var a=this;a.isReady.resolve(),api.consoleLog("MODULE READY IN BASE MODULE CLASS : ",a.id)},initializeModuleModel:function(a){var b=this;if(!b.isMultiItem()&&!b.isCrud()&&_.isEmpty(a.items)){var c=_.clone(b.defaultItemModel);a.items=[$.extend(c,{id:b.id})]}return a},itemCollectionReact:function(a,b,c){var d=this,e=d(),f=$.extend(!0,{},e);f.items=a,d.isDirty.set(!0),d.set(f,c||{})},moduleReact:function(a,b,c){var d=this,e=d.control,f=(_.size(b.items)==_.size(a.items)&&!_.isEmpty(_.difference(a.items,b.items)),a.column_id!=b.column_id,_.has(c,"item_collection_sorted")&&c.item_collection_sorted),g=function(){d.control.previewer.refresh()};f&&(_.has(d,"preItem")&&d.preItemExpanded.set(!1),d.closeAllItems(),d.closeAllAlerts()),"postMessage"==api(d.control.id).transport&&f&&!api.CZR_Helpers.has_part_refresh(d.control.id)&&(g=_.debounce(g,500))(),e.updateModulesCollection({module:$.extend(!0,{},a),data:c})},getModuleSection:function(){return this.section},isInSektion:function(){var a=this;return _.has(a,"sektion_id")},isMultiItem:function(){return api.CZR_Helpers.isMultiItemModule(null,this)},isCrud:function(){return api.CZR_Helpers.isCrudModule(null,this)}});var CZRModuleMths=CZRModuleMths||{};$.extend(CZRModuleMths,{populateSavedItemCollection:function(){var a=this;if(!_.isArray(a().items))throw new Error("The saved items collection must be an array in module :"+a.id);_.each(a().items,function(b,c){a.instantiateItem(b).ready()}),_.each(a().items,function(b){if(_.isUndefined(_.findWhere(a.itemCollection(),b.id)))throw new Error("The saved items have not been properly populated in module : "+a.id)}),a.trigger("items-collection-populated")},instantiateItem:function(a,b){var c=this;if(item_candidate=c.prepareItemForAPI(a),!_.has(item_candidate,"id"))throw new Error("CZRModule::instantiateItem() : an item has no id and could not be added in the collection of : "+this.id);if(c.czr_Item.has(item_candidate.id))throw new Error("CZRModule::instantiateItem() : the following item id "+item_candidate.id+" already exists in module.czr_Item() for module "+this.id);if(c.czr_Item.add(item_candidate.id,new c.itemConstructor(item_candidate.id,item_candidate)),!c.czr_Item.has(item_candidate.id))throw new Error("CZRModule::instantiateItem() : instantiation failed for item id "+item_candidate.id+" for module "+this.id);return c.czr_Item(item_candidate.id)},prepareItemForAPI:function(a){var b=this,c={};return a=_.isObject(a)?a:{},_.each(b.defaultAPIitemModel,function(d,e){var f=a[e];switch(e){case"id":_.isEmpty(f)?c[e]=b.generateItemId(b.module_type):c[e]=f;break;case"initial_item_model":_.each(b.getDefaultModel(),function(b,c){_.has(a,c)||(a[c]=b)}),c[e]=a;break;case"defaultItemModel":c[e]=_.clone(b.defaultItemModel);break;case"control":c[e]=b.control;break;case"module":c[e]=b;break;case"is_added_by_user":c[e]=!!_.isBoolean(f)&&f}}),_.has(c,"id")||(c.id=b.generateItemId(b.module_type)),c.initial_item_model.id=c.id,c},generateItemId:function(a,b,c){if(c=c||1,c>100)throw new Error("Infinite loop when generating of a module id.");var d=this;b=b||d._getNextItemKeyInCollection();var e=a+"_"+b;if(!_.has(d,"itemCollection")||!_.isArray(d.itemCollection()))throw new Error("The item collection does not exist or is not properly set in module : "+d.id);return d.isItemRegistered(e)?(b++,c++,d.generateItemId(a,b,c)):e},_getNextItemKeyInCollection:function(){var a=this,b={},c=0;return _.isEmpty(a.itemCollection())||(b=_.max(a.itemCollection(),function(a){return parseInt(a.id.replace(/[^\/\d]/g,""),10)}),c=parseInt(b.id.replace(/[^\/\d]/g,""),10)+1),c},isItemRegistered:function(a){var b=this;return!_.isUndefined(_.findWhere(b.itemCollection(),{id:a}))},updateItemsCollection:function(a){var b=this,c=b.itemCollection();if(_new_collection=_.clone(c),_.has(a,"collection"))return void b.itemCollection.set(a.collection);if(!_.has(a,"item"))throw new Error("updateItemsCollection, no item provided "+b.control.id+". Aborting");var d=_.clone(a.item);_.findWhere(_new_collection,{id:d.id})?_.each(c,function(a,b){a.id==d.id&&(_new_collection[b]=d)}):_new_collection.push(d),b.itemCollection.set(_new_collection)},_getSortedDOMItemCollection:function(){var a=this,b=_.clone(a.itemCollection()),c=[];if($("."+a.control.css_attr.single_item,a.container).each(function(a){var d=_.findWhere(b,{id:$(this).attr("data-id")});d&&(c[a]=d)}),b.length!=c.length)throw new Error("There was a problem when re-building the item collection from the DOM in module : "+a.id);return c}});var CZRModuleMths=CZRModuleMths||{};$.extend(CZRModuleMths,{getDefaultModel:function(a){var b=this;return $.extend(_.clone(b.defaultItemModel),{id:a||""})},_initNewItem:function(a,b){var c,d=this,e={id:""};return b="undefined"!=typeof b?b:_.size(d.itemCollection()),_.isNumber(b)?c=d.module_type+"_"+b:(c=b,b=0),e=a&&!_.isEmpty(a)?$.extend(a,{id:c}):this.getDefaultModel(c),_.has(e,"id")&&d._isItemIdPossible(c)?(_.map(d.getDefaultModel(),function(a,b){_.has(e,b)||(e[b]=a)}),e):d._initNewItem(e,b+1)}});var CZRModuleMths=CZRModuleMths||{};$.extend(CZRModuleMths,{renderModuleParts:function(){var a=this,b=a.isInSektion()?$(a.container).find(".czr-mod-content"):$(a.container);if(a.isCrud()){if(0===$("#tmpl-"+a.crudModulePart).length)throw new Error("No crud Module Part template for module "+a.id+". The template script id should be : #tmpl-"+a.crudModulePart);b.append($(wp.template(a.crudModulePart)({})))}var c=$("<ul/>",{"class":[a.control.css_attr.items_wrapper,a.module_type,a.isMultiItem()?"multi-item-mod":"mono-item-mod",a.isCrud()?"crud-mod":"not-crud-mod"].join(" ")});return b.append(c),$(c,b)},getTemplateEl:function(a,b){var c,d=this;switch(a){case"rudItemPart":c=d.rudItemPart;break;case"ruItemPart":c=d.ruItemPart;break;case"itemInputList":c=d.itemInputList}if(_.isEmpty(c))throw new Error("No valid template has been found in getTemplateEl() "+d.id+". Aborting");return c},getViewEl:function(a){var b=this;return $('[data-id = "'+a+'"]',b.container)},closeAllItems:function(a){var b=this,c=_.clone(b.itemCollection()),d=_.filter(c,function(b){return b.id!=a});_.each(d,function(a){b.czr_Item.has(a.id)&&"expanded"==b.czr_Item(a.id)._getViewState(a.id)&&b.czr_Item(a.id).czr_ItemState.set("closed")})},_adjustScrollExpandedBlock:function(a,b){if(a.length&&!_.isUndefined(this.getModuleSection())){var c,d=this,e=$(".accordion-section-content",d.section.container),f=e.scrollTop(),g=b||90;setTimeout(function(){a.offset().top+a.height()+g>$(window.top).height()&&(c=a.offset().top+a.height()+g-$(window.top).height(),c>0&&e.animate({scrollTop:f+c},500))},50)}},closeAllAlerts:function(){var a=this;$("."+a.control.css_attr.remove_alert_wrapper,a.container).each(function(){$(this).hasClass("open")&&$(this).slideToggle({duration:100,done:function(){$(this).toggleClass("open",!1),$(this).siblings().find("."+a.control.css_attr.display_alert_btn).toggleClass("active",!1)}})})},_makeItemsSortable:function(a){if(!wp.media.isTouchDevice&&$.fn.sortable){var b=this;$("."+b.control.css_attr.items_wrapper,b.container).sortable({handle:"."+b.control.css_attr.item_sort_handle,start:function(){_.has(api,"czrModulePanelState")&&api.czrModulePanelState.set(!1),_.has(api,"czrSekSettingsPanelState")&&api.czrSekSettingsPanelState.set(!1)},update:function(a,c){b.itemCollection.set(b._getSortedDOMItemCollection(),{item_collection_sorted:!0}),"postMessage"!=api(b.control.id).transport||api.CZR_Helpers.has_part_refresh(b.control.id)||_.delay(function(){api.previewer.refresh()},100)}})}}});var CZRDynModuleMths=CZRDynModuleMths||{};$.extend(CZRDynModuleMths,{initialize:function(a,b){var c=this;api.CZRModule.prototype.initialize.call(c,a,b),$.extend(c,{itemPreAddEl:""}),c.itemAddedMessage=serverControlParams.translatedStrings.successMessage,c.userEventMap=new api.Value([{trigger:"click keydown",selector:["."+c.control.css_attr.open_pre_add_btn,"."+c.control.css_attr.cancel_pre_add_btn].join(","),name:"pre_add_item",actions:["renderPreItemView","setPreItemViewVisibility"]},{trigger:"click keydown",selector:"."+c.control.css_attr.add_new_btn,name:"add_item",actions:["closeAllItems","addItem"]}])},ready:function(){var a=this;api.consoleLog("MODULE READY IN DYN MODULE CLASS : ",a.id),a.setupDOMListeners(a.userEventMap(),{dom_el:a.container}),a.preItem=new api.Value(a.getDefaultModel()),a.preItemEmbedded=$.Deferred(),a.preItemEmbedded.done(function(){a.setupPreItemInputCollection()}),a.preItemExpanded=new api.Value((!1)),a.preItemExpanded.callbacks.add(function(b,c){a._togglePreItemViewExpansion(b)}),api.CZRModule.prototype.ready.call(a)},setupPreItemInputCollection:function(){var a=this;a.preItem.czr_Input=new api.Values,$("."+a.control.css_attr.pre_add_wrapper,a.container).find("."+a.control.css_attr.sub_set_wrapper).each(function(b){var c=$(this).find("[data-type]").attr("data-type")||"sub_set_"+b;a.preItem.czr_Input.add(c,new a.inputConstructor(c,{id:c,type:$(this).attr("data-input-type"),container:$(this),item:a.preItem,module:a,is_preItemInput:!0})),a.preItem.czr_Input(c).ready()})},addItem:function(a){var b=this,c=b.preItem(),d=function(){b.preItemExpanded.set(!1),b._resetPreItemInputs(),b.toggleSuccessMessage("off")};if(_.isEmpty(c)||!_.isObject(c))throw new Error("addItem : an item should be an object and not empty. In : "+b.id+". Aborted.");d=_.debounce(d,2e3),b.instantiateItem(c,!0).ready(),b.czr_Item(c.id).isReady.then(function(){b.toggleSuccessMessage("on"),d(),b.trigger("item_added",c),"postMessage"!=api(b.control.id).transport||!_.has(a,"dom_event")||_.has(a.dom_event,"isTrigger")||api.CZR_Helpers.has_part_refresh(b.control.id)||b.control.previewer.refresh()})},_resetPreItemInputs:function(){var a=this;a.preItem.set(a.getDefaultModel()),a.preItem.czr_Input.each(function(b){var c=b.id;_.has(a.getDefaultModel(),c)&&b.set(a.getDefaultModel()._input_id)})}});var CZRDynModuleMths=CZRDynModuleMths||{};$.extend(CZRDynModuleMths,{renderPreItemView:function(a){var b=this;if("pending"==b.preItemEmbedded.state()){if(!_.has(b,"itemPreAddEl")||0===$("#tmpl-"+b.itemPreAddEl).length)return this;var c=wp.template(b.itemPreAddEl);if(!c||!b.container)return this;var d=$("."+b.control.css_attr.pre_add_item_content,b.container);d.prepend(c()),b.preItemEmbedded.resolve()}},_getPreItemView:function(){var a=this;return $("."+a.control.css_attr.pre_add_item_content,a.container)},setPreItemViewVisibility:function(a){var b=this;b.closeAllItems(),b.preItemExpanded.set(!b.preItemExpanded())},_togglePreItemViewExpansion:function(a){var b=this,c=$("."+b.control.css_attr.pre_add_item_content,b.container);c.slideToggle({duration:200,done:function(){var c=$("."+b.control.css_attr.open_pre_add_btn,b.container);$(this).toggleClass("open",a),a?c.find(".fa").removeClass("fa-plus-square").addClass("fa-minus-square"):c.find(".fa").removeClass("fa-minus-square").addClass("fa-plus-square"),c.toggleClass("active",a),$(b.container).toggleClass(b.control.css_attr.adding_new,a),b._adjustScrollExpandedBlock($(this),120)}})},toggleSuccessMessage:function(a){var b=this,c=b.itemAddedMessage,d=$("."+b.control.css_attr.pre_add_wrapper,b.container);return $_success_wrapper=$("."+b.control.css_attr.pre_add_success,b.container),"on"==a?($_success_wrapper.find("p").text(c),$_success_wrapper.css("z-index",1000001).css("height",d.height()+"px").css("line-height",d.height()+"px")):$_success_wrapper.attr("style",""),b.container.toggleClass("czr-model-added","on"==a),this}});var CZRSektionMths=CZRSektionMths||{};$.extend(CZRSektionMths,{initialize:function(a,b){var c=this;api.CZRDynModule.prototype.initialize.call(c,a,b),$.extend(c,{itemPreAddEl:"czr-module-sektion-pre-add-view-content",rudItemPart:"czr-module-sektion-rud-item-part",itemInputList:"czr-module-sektion-view-content"}),c.defaultItemModel={id:"","sektion-layout":1,columns:[]},c.bind("pre_item_dom_remove",function(a){c.removeSektion(a)}),c.defaultDBColumnModel={id:"",sektion_id:"",modules:[]},c.defaultAPIcolumnModel={id:"",modules:[],sektion:{},module_id:"",control_id:"",is_added_by_user:!1},c.czr_Column=new api.Values,c.czr_columnCollection=new api.Value,c.czr_columnCollection.set([]),c.czr_columnCollection.callbacks.add(function(){return c.columnCollectionReact.apply(c,arguments)}),c.itemConstructor=api.CZRItem.extend(c.CZRSektionItem||{}),_.has(c,"modsDragInstance")||c.initModulesDragula(),api.czrModulePanelState=api.czrModulePanelState||new api.Value((!1)),api.czrModulePanelEmbedded=api.czrModulePanelEmbedded||$.Deferred(),c.userEventMap.set(_.union(c.userEventMap(),[{trigger:"click keydown",selector:".add-new-module",name:"add_new_module",actions:"toggleModuleListPanel"},{trigger:"click keydown",selector:"."+c.control.css_attr.open_pre_add_btn,name:"close_module_panel",actions:function(){api.czrModulePanelState(!1)}}])),api.consoleLog("SEKTION MODULE INIT",c.control.params.czr_skope),_.has(api,"czr_activeSkopeId")&&api.consoleLog("SEKTION MODULE INIT",api.czr_activeSkopeId()),api.czrModulePanelBinded=api.czrModulePanelBinded||$.Deferred(),"pending"==api.czrModulePanelBinded.state()&&(api.czrModulePanelState.bind(function(a){var b=api.CZR_Helpers.build_setId(c.control.params.syncCollection),d=api.control(b).syncSektionModule();if($("body").toggleClass("czr-adding-module",a),a)d.renderModulePanel(),api.consoleLog("REACT TO MODULE PANEL STATE",a,c.control.params.syncCollection,d()),api.consoleLog("WHEN DOES THIS ACTION OCCUR?",api.czrModulePanelBinded.state()),d.modsDragInstance.containers.push($("#czr-available-modules-list")[0]);else{var e=$.extend(!0,[],d.modsDragInstance.containers);e=_.filter(e,function(a){return"czr-available-modules-list"!=$(a).attr("id")}),d.modsDragInstance.containers=e,$("#czr-module-list-panel").remove()}}),api.czrModulePanelBinded.resolve()),api.czrSekSettingsPanelState=api.SekSettingsPanelState||new api.Value((!1)),api.czrSekSettingsPanelEmbedded=api.SekSettingsPanelEmbedded||$.Deferred(),c.userEventMap.set(_.union(c.userEventMap(),[{trigger:"click keydown",selector:".czr-edit-sek-settings",name:"edit_sek_settings",actions:"toggleSekSettingsPanel"},{trigger:"click keydown",selector:"."+c.control.css_attr.open_pre_add_btn,name:"close_sektion_panel",actions:function(){api.czrSekSettingsPanelState.set(!1)}}])),api.czrSekSettingsPanelEmbedded.done(function(){api.czrSekSettingsPanelState.callbacks.add(function(){return c.reactToSekSettingPanelState.apply(c,arguments)})}),api.section(c.control.section()).expanded.bind(function(a){api.consoleLog("FIRE SEKTION MODULE!",c.id),c.fireSektionModule()})},fireSektionModule:function(){var a=this;"resolved"!=a.isReady.state()&&(a.ready(),a.control.getSyncCollectionControl().syncSektionModule.set(a))},removeSektion:function(a){var b=this;_.each(a.columns,function(a){_.each(a.modules,function(a){b.control.getSyncCollectionControl().removeModule(a)}),b.czr_Column.has(a.id)&&"resolved"==b.czr_Column(a.id).embedded.state()&&b.czr_Column(a.id).container.remove(),b.removeColumnFromCollection(a)})},closeAllOtherSektions:function(a){var b=this;_clicked_sektion_id=a.closest(".czr-single-item").attr("data-id"),b.czr_Item.each(function(a){_clicked_sektion_id!=a.id?a.czr_ItemState.set("closed"):a.czr_ItemState.set("expanded"!=a.czr_ItemState()?"expanded_noscroll":"expanded")})}});var CZRSektionMths=CZRSektionMths||{};$.extend(CZRSektionMths,{CZRSektionItem:{initialize:function(a,b){var c=this;api.CZRItem.prototype.initialize.call(c,null,b),c.userEventMap.set(_.union(c.userEventMap(),[{trigger:"click keydown",selector:["."+c.module.control.css_attr.edit_view_btn,"."+c.module.control.css_attr.display_alert_btn,"."+c.module.control.css_attr.item_title].join(","),name:"close_module_panel",actions:function(){api.czrModulePanelState.set(!1)}},{trigger:"mouseenter",selector:".czr-item-header",name:"hovering_sek",actions:function(a){c.module.control.previewer.send("start_hovering_sek",{id:c.id})}},{trigger:"mouseleave",selector:".czr-item-header",name:"hovering_sek",actions:function(a){c.module.control.previewer.send("stop_hovering_sek",{id:c.id})}},{trigger:"click keydown",selector:["."+c.module.control.css_attr.edit_view_btn,"."+c.module.control.css_attr.item_title].join(","),name:"send_edit_view",actions:function(a){c.module.control.previewer.send("edit_sek",{id:c.id})}}]));var d=c(),e=b.module;if(!_.has(d,"sektion-layout"))throw new Error("In Sektion Item initialize, no layout provided for "+c.id+".");c.isReady.done(function(){if(_.isEmpty(c().columns)){var a=parseInt(d["sektion-layout"]||1,10);for(i=1;i<a+1;i++){var b=$.extend(!0,{},e.defaultDBColumnModel),f={id:"",sektion_id:c.id};f=$.extend(b,f),e.instantiateColumn($.extend(f,{sektion:c}))}}else _.each(c().columns,function(a){var b=$.extend(!0,{},a);e.instantiateColumn($.extend(b,{sektion:c}))})})},itemReact:function(a,b){var c=this,d=$.extend(!0,{},a);d=c.prepareSekItemForDB(d),api.CZRItem.prototype.itemReact.call(c,d)},prepareSekItemForDB:function(a){var b=this,c={};return _.each(b.module.defaultItemModel,function(d,e){var f=a[e];switch(e){case"id":if(!_.isString(f)||_.isEmpty(f))throw new Error("The sekItem id property must be a not empty string");c[e]=f;break;case"sektion-layout":if(!_.isNumber(parseInt(f,10))||parseInt(f,10)<1)throw new Error("The sekItem layout property must be an int number > 0");c[e]=f;break;case"columns":if(!_.isArray(f))throw new Error("The sekItem columns property must be an array");var g=[];_.each(f,function(a){var c=b.module.prepareColumnForDB(a);g.push(c)}),c[e]=g}}),c}}});var CZRSektionMths=CZRSektionMths||{};$.extend(CZRSektionMths,{prepareColumnForDB:function(a){var b=this,c={};return _.each(b.defaultDBColumnModel,function(b,d){var e=a[d];switch(d){case"id":if(!_.isString(e)||_.isEmpty(e))throw new Error("The column id property must be a not empty string");c[d]=e;break;case"sektion_id":if(_.isString(e)&&!_.isEmpty(e))c[d]=e;else{if(!_.has(a,"sektion"))throw new Error("The column sektion-id property must be a not empty string");c[d]=a.sektion.id}break;case"modules":if(!_.isArray(e))throw new Error("The column modules property must be an array");c[d]=e}}),c},instantiateColumn:function(a,b){var c=this,d=_.clone(a);if(!_.isEmpty(d.id)&&c.czr_Column.has(d.id))throw new Error("The column id already exists in the collection in module : "+c.id);d=c.prepareColumnForAPI(d),c.czr_Column.add(d.id,new api.CZRColumn(d.id,d)),c.czr_Column(d.id).ready()},prepareColumnForAPI:function(a){var b=this,c={};if(!_.isObject(a))throw new Error("Sektion Module::prepareColumnForAPI : a column must be an object to be instantiated.");return _.each(b.defaultAPIcolumnModel,function(d,e){var f=a[e];switch(e){case"id":_.isEmpty(f)?c[e]=b.generateColId():c[e]=f;break;case"modules":if(!_.isArray(f))throw new Error("Sektion Module::prepareColumnForAPI : a collection of modules must be an array. Error in column "+a.id);c[e]=f;break;case"sektion":if(!_.isObject(f)||_.isEmpty(f))throw new Error("Sektion Module::prepareColumnForAPI : a sektion instance is missing for column "+a.id);c[e]=f;break;case"module_id":c[e]=b.id;break;case"control_id":c[e]=b.control.id;break;case"is_added_by_user":c[e]=!!_.isBoolean(f)&&f}}),c},updateColumnCollection:function(a){var b=this,c=b.czr_columnCollection();if(_new_collection=$.extend(!0,[],c),api.consoleLog("in update column collection",b.id,b.czr_columnCollection()),_.has(a,"collection"))return void b.czr_columnCollection.set(a.collection);if(!_.has(a,"column"))throw new Error("updateColumnCollection, no column provided in module "+b.id+". Aborting");var d=_.clone(a.column);if(!_.has(d,"id"))throw new Error("updateColumnCollection, no id provided for a column in module"+b.id+". Aborting");_.findWhere(_new_collection,{id:d.id})?_.each(c,function(a,b){a.id==d.id&&(_new_collection[b]=d)}):_new_collection.push(d),b.czr_columnCollection.set(_new_collection)},removeColumnFromCollection:function(a){var b=this,c=b.czr_columnCollection(),d=$.extend(!0,[],c);d=_.filter(d,function(b){return b.id!=a.id}),b.czr_columnCollection.set(d)},columnCollectionReact:function(a,b){var c=this,d=_.size(b)<_.size(a),e=_.size(b)>_.size(a),f=_.size(b)==_.size(a),g={},h={};if(f&&_.each(a,function(a,c){_.isEqual(a,b[c])||(g=a.sektion(),h=$.extend(!0,{},g),_.each(g.columns,function(b,c){b.id==a.id&&(h.columns[c]=a)}),a.sektion.set(h))}),d){var i=_.filter(a,function(a){return _.isUndefined(_.findWhere(b,{id:a.id}))});i=i[0],g=i.sektion(),_.isUndefined(_.findWhere(g.columns,{id:i.id}))&&(h=$.extend(!0,{},g),h.columns.push(i),i.sektion.set(h))}if(e){var j=_.filter(b,function(b){return _.isUndefined(_.findWhere(a,{id:b.id}))});j=j[0],g=j.sektion(),h=$.extend(!0,{},g),h.columns=_.filter(h.columns,function(a){return a.id!=j.id}),j.sektion.set(h),c.czr_Column.remove(j.id)}},generateColId:function(a,b){if(b=b||1,b>100)throw new Error("Infinite loop when generating of a column id.");var c=this;a=a||c._getNextColKeyInCollection();var d="col_"+a;if(!_.has(c,"czr_columnCollection")||!_.isArray(c.czr_columnCollection()))throw new Error("The column collection does not exist or is not properly set in module : "+c.id);return c.czr_Column.has(d)?c.generateColId(a++,b++):d},_getNextColKeyInCollection:function(){var a=this,b={},c=0;return _.isEmpty(a.czr_columnCollection())||(b=_.max(a.czr_columnCollection(),function(a){return parseInt(a.id.replace(/[^\/\d]/g,""),10)}),c=parseInt(b.id.replace(/[^\/\d]/g,""),10)+1),c},moduleExistsInOneColumnMax:function(a){return 2>this.getModuleColumn(a).length},getModuleColumn:function(a){var b=this,c=[];return _.each(b.czr_columnCollection(),function(b,d){_.findWhere(b.modules,{id:a})&&c.push(b.id)}),c}});var CZRSektionMths=CZRSektionMths||{};$.extend(CZRSektionMths,{initModulesDragula:function(){var a=this;a.modsDragInstance=dragula({copy:function(a,b){return $(a).hasClass("czr-module-candidate")},moves:function(a,b,c,d){return _.contains(c.className.split(" "),"czr-mod-drag-handler")},accepts:function(a,b,c,d){return!_.isUndefined(b)&&"czr-available-modules-list"!=$(b).attr("id")},isContainer:function(a){return!1}}),a.modsDragInstance.on("drag",function(b,c){a.czr_Item.each(function(a){a.czr_ItemState.set("expanded"!=a.czr_ItemState()?"expanded_noscroll":"expanded")})}).on("dragend",function(a,b){}).on("drop",function(b,c,d,e){var f=$(b).attr("data-module-id"),g=$(b).attr("data-module-type"),h=$(c).closest(".czr-column").attr("data-id"),i=$(d).closest(".czr-column").attr("data-id"),j=h==i,k=$(b).hasClass("czr-module-candidate");if(k){if(_.isUndefined(h)||_.isUndefined(g))return;a.userAddedModule(h,g),a.reorderModulesInColumn(h)}else j?a.reorderModulesInColumn(h):a.control.getSyncCollectionControl().czr_Module(f).modColumn.set(h)});autoScroller([a.control.container.closest(".accordion-section-content")[0]],{direction:"vertical",margin:20,pixels:100,scrollWhenOutside:!0,autoScroll:function(){return a.modsDragInstance.dragging}})},userAddedModule:function(a,b){var c=this,d=c.control.getSyncCollectionControl(),e=_.clone(d.getDefaultModuleApiModel());d.trigger("user-module-candidate",$.extend(e,{module_type:b,column_id:a,sektion:c.czr_Column(a).sektion,sektion_id:c.czr_Column(a).sektion.id,is_added_by_user:!0}))},reorderModulesInColumn:function(a){var b=this,c=b.czr_Column(a).getColumnModuleCollectionFromDom(a);b.czr_Column(a).updateColumnModuleCollection({collection:c})},moveModuleFromTo:function(a,b,c){api.consoleLog("ALORS CE BUG?",this(),this.czr_columnCollection());var d=this,e=d.czr_Column(c).getColumnModuleCollectionFromDom(b);_.has(api,"czrModulePanelState")&&api.czrModulePanelState(!1),d.czr_Column(c).updateColumnModuleCollection({collection:e}),d.czr_Column(b).removeModuleFromColumnCollection(a)}});var CZRSektionMths=CZRSektionMths||{};$.extend(CZRSektionMths,{toggleModuleListPanel:function(a){var b=this;api.czrSekSettingsPanelState.set(!1),api.czrModulePanelState.set(!api.czrModulePanelState()),api.czrModulePanelState()?b.czr_Item.each(function(a){a.czr_ItemState.set("expanded"!=a.czr_ItemState()?"expanded_noscroll":"expanded")}):b.closeAllOtherSektions($(a.dom_event.currentTarget,a.dom_el))},renderModulePanel:function(){if(0===$("#tmpl-czr-available-modules").length)throw new Error("No template found to render the module panel list");$("#widgets-left").after($(wp.template("czr-available-modules")())),_.each(api.czrModuleMap,function(a,b){var c=$("<li/>",{"class":"czr-module-candidate","data-module-type":b,html:'<h3><span class="czr-mod-drag-handler fa fa-arrows-alt"></span>'+a.name+"</h3>"});$("#czr-available-modules-list").append(c)})}});var CZRColumnMths=CZRColumnMths||{};$.extend(CZRColumnMths,{initialize:function(a,b){var c=this;api.Value.prototype.initialize.call(c,null,b),$.extend(c,b||{}),c.isReady=$.Deferred(),c.embedded=$.Deferred(),c.czr_columnModuleCollection=new api.Value,c.czr_columnModuleCollection.set(c.modules),c.set(b),c.defautModuleModelInColumn={id:""},api.consoleLog("column.sektion.contentRendered.state()",c.sektion.contentRendered.state()),c.sektion.contentRendered.done(function(){c.container=c.render(),api.consoleLog("COLUMN CONTAINER?",c.container),c.embedded.resolve()}),c.embedded.done(function(){c.mayBeInstantiateColumnModules(),c.callbacks.add(function(){return c.columnReact.apply(c,arguments)}),c.czr_columnModuleCollection.callbacks.add(function(){return c.columnModuleCollectionReact.apply(c,arguments)}),api.CZR_Helpers.setupDOMListeners(c.column_event_map,{dom_el:c.container},c);var a=api.control(c.control_id).getSyncCollectionControl();api.consoleLog("////////////////////////////////////////////////////"),api.consoleLog("column.container?",c.container),api.consoleLog("syncCollectionControl.syncSektionModule()",a.syncSektionModule()()),api.consoleLog("////////////////////////////////////////////////////"),a.syncSektionModule().modsDragInstance.containers.push($(".czr-module-collection-wrapper",c.container)[0])})},ready:function(){var a=this;a.isReady.resolve(),a.sektion.module.updateColumnCollection({column:a()})},mayBeInstantiateColumnModules:function(){var a=this,b=a.sektion.control.getSyncCollectionControl();$.when(b.moduleCollectionReady.promise()).then(function(){_.each(a.czr_columnModuleCollection(),function(a){b.czr_Module.has(a.id)||$.when(_.findWhere(b.czr_moduleCollection(),{id:a.id})).done(function(c){if(_.isUndefined(c)||_.isEmpty(c))throw new Error("Module "+a.id+" was not found in the module collection.");b.instantiateModule(c,{}).ready()})})},function(){},function(){api.consoleLog("NOT SYNCHRONIZED YET")})},render:function(){var a=this;return $view=$(wp.template("czr-sektion-column")({id:a.id})),$view.appendTo($(".czr-column-wrapper",a.sektion.container)),$view},columnReact:function(a,b){this.sektion.module.updateColumnCollection({column:a})}});var CZRColumnMths=CZRColumnMths||{};
|
14 |
+
$.extend(CZRColumnMths,{updateColumnModuleCollection:function(a){var b=this,c=b.czr_columnModuleCollection();if(_new_collection=$.extend(!0,[],c),api.consoleLog("column.czr_columnModuleCollection()",b.czr_columnModuleCollection()),_.has(a,"collection"))return void b.czr_columnModuleCollection.set(a.collection);if(!_.has(a,"module"))throw new Error("updateColumnModuleCollection, no module provided in column "+b.id+". Aborting");var d=b.prepareModuleForColumnAPI(_.clone(a.module));_.findWhere(_new_collection,{id:d.id})?_.each(c,function(a,b){a.id==d.id&&(_new_collection[b]=d)}):_new_collection.push(d),b.czr_columnModuleCollection.set(_new_collection)},columnModuleCollectionReact:function(a,b){var c=this,d=c(),e=_.clone(d),f=[];_.each(a,function(a,b){f[b]={id:a.id}}),e.modules=f,c.set(e)},removeModuleFromColumnCollection:function(a){var b=this,c=b.czr_columnModuleCollection();_new_collection=$.extend(!0,[],c),_new_collection=_.filter(_new_collection,function(b){return b.id!=a.id}),b.czr_columnModuleCollection.set(_new_collection)},prepareModuleForColumnAPI:function(a){if(!_.isObject(a))throw new Error("prepareModuleForColumnAPI : a module must be an object.");var b=this,c={};return _.each(b.defautModuleModelInColumn,function(d,e){var f=a[e];switch(e){case"id":if(!_.isString(f)||_.isEmpty(f))throw new Error("prepareModuleForColumnAPI : a module id must a string not empty");if(!b.sektion.module.moduleExistsInOneColumnMax(a.id))throw new Error("A module can not be embedded in more than one column at a time. Module "+a.id+" exists in several columns : "+b.sektion.module.getModuleColumn(a.id).join(","));c[e]=f}}),c},getColumnModuleCollectionFromDom:function(a){var b=this,c=$(".czr-module-collection-wrapper",b.container),d=b.sektion.module.czr_Column(a).czr_columnModuleCollection(),e=[];if(api.consoleLog("in GET COLUMN MODULE COLLECTION FROM DOM",a,c,b.container),$(".czr-single-module",c).each(function(c){if(!_.isUndefined(_.findWhere(b.czr_columnModuleCollection(),{id:$(this).attr("data-module-id")})))return void(e[c]=_.findWhere(b.czr_columnModuleCollection(),{id:$(this).attr("data-module-id")}));var f=_.findWhere(d,{id:$(this).attr("data-module-id")});if(!f)throw new Error("The module : "+$(this).attr("data-module-id")+" was not found in the collection of its previous column "+a);e[c]=b.prepareModuleForColumnAPI(f)}),_.isEmpty(e))throw new Error("There was a problem when re-building the column module collection from the DOM in column : "+b.id);return e}});var CZRSektionMths=CZRSektionMths||{};$.extend(CZRSektionMths,{toggleSekSettingsPanel:function(a){var b=this;"pending"==api.czrSekSettingsPanelEmbedded.state()&&$.when(b.renderSekSettingsPanel()).done(function(){api.czrSekSettingsPanelEmbedded.resolve()}),api.czrModulePanelState.set(!1),api.czrSekSettingsPanelState.set(!api.czrSekSettingsPanelState()),b.closeAllOtherSektions($(a.dom_event.currentTarget,a.dom_el))},reactToSekSettingPanelState:function(a){$("body").toggleClass("czr-editing-sektion",a)},renderSekSettingsPanel:function(){var a="";if(0===$("#tmpl-czr-sektion-settings-panel").length)throw new Error("No template found to render the sektion setting panel");try{a=wp.template("czr-sektion-settings-panel")()}catch(b){throw new Error("Error when parsing the template of the sektion setting panel"+b)}$("#widgets-left").after($(a))}});var CZRSocialModuleMths=CZRSocialModuleMths||{};$.extend(CZRSocialModuleMths,{initialize:function(a,b){var c=this;api.CZRDynModule.prototype.initialize.call(c,a,b),$.extend(c,{itemPreAddEl:"czr-module-social-pre-add-view-content",itemInputList:"czr-module-social-item-content"}),this.social_icons=["500px","adn","amazon","android","angellist","apple","behance","behance-square","bitbucket","bitbucket-square","black-tie","btc","buysellads","chrome","codepen","codiepie","connectdevelop","contao","dashcube","delicious","delicious","deviantart","digg","dribbble","dropbox","drupal","edge","empire","expeditedssl","facebook","facebook","facebook-f (alias)","facebook-official","facebook-square","firefox","flickr","fonticons","fort-awesome","forumbee","foursquare","get-pocket","gg","gg-circle","git","github","github","github-alt","github-square","git-square","google","google","google-plus","google-plus-circle","google-plus-official","google-plus-square","google-wallet","gratipay","hacker-news","houzz","instagram","internet-explorer","ioxhost","joomla","jsfiddle","lastfm","lastfm-square","leanpub","linkedin","linkedin","linkedin-square","linux","maxcdn","meanpath","medium","mixcloud","modx","odnoklassniki","odnoklassniki-square","opencart","openid","opera","optin-monster","pagelines","paypal","pied-piper","pied-piper-alt","pinterest","pinterest-p","pinterest-square","product-hunt","qq","rebel","reddit","reddit-alien","reddit-square","renren","rss","rss-square","safari","scribd","sellsy","share-alt","share-alt-square","shirtsinbulk","simplybuilt","skyatlas","skype","slack","slideshare","snapchat","soundcloud","spotify","stack-exchange","stack-overflow","steam","steam-square","stumbleupon","stumbleupon","stumbleupon-circle","telegram","tencent-weibo","trello","tripadvisor","tumblr","tumblr-square","twitch","twitter","twitter","twitter-square","usb","viacoin","vimeo","vimeo-square","vine","vk","weibo","weixin","whatsapp","wikipedia-w","windows","wordpress","xing","xing-square","yahoo","yahoo","y-combinator","yelp","youtube","youtube-play","youtube-square"],c.inputConstructor=api.CZRInput.extend(c.CZRSocialsInputMths||{}),c.itemConstructor=api.CZRItem.extend(c.CZRSocialsItem||{}),this.defaultItemModel={id:"",title:"","social-icon":"","social-link":"","social-color":serverControlParams.social_el_params.defaultSocialColor,"social-target":1},this.itemAddedMessage=serverControlParams.translatedStrings.socialLinkAdded,_.has(api,"czr_activeSectionId")&&c.control.section()==api.czr_activeSectionId()&&"resolved"!=c.isReady.state()&&c.ready(),api.section(c.control.section()).expanded.bind(function(a){"resolved"!=c.isReady.state()&&c.ready()}),c.isReady.then(function(){c.preItem.bind(function(a,b){_.has(a,"social-icon")&&(_.isEqual(a["social-icon"],b["social-icon"])||c.updateItemModel(c.preItem,!0))})})},updateItemModel:function(a,b){var c=a;if(b=b||!1,_.has(c(),"social-icon")&&!_.isEmpty(c()["social-icon"])){var d=$.extend(!0,{},c()),e=api.CZR_Helpers.capitalize(d["social-icon"].replace("fa-","")),f=serverControlParams.social_el_params.defaultSocialColor;e=[serverControlParams.translatedStrings.followUs,e].join(" "),b?(d=$.extend(d,{title:e,"social-color":f}),c.set(d)):(c.czr_Input("title").set(e),c.czr_Input("social-link").set(""),c.czr_Input("social-color").set(f))}},CZRSocialsInputMths:{setupSelect:function(){function a(a){if(!a.id)return a.text;var b=$('<span class="fa '+a.element.value.toLowerCase()+'"> '+a.text+"</span>");return b}var b=this,c=b.item,d=b.module,e=d.social_icons,f=c();_.isEmpty(f.id)&&(e=_.union([serverControlParams.translatedStrings.selectSocialIcon],e)),_.each(e,function(a,c){var d=0===c?"":"fa-"+a.toLowerCase(),e={value:d,html:api.CZR_Helpers.capitalize(a)};d==f["social-icon"]&&$.extend(e,{selected:"selected"}),$('select[data-type="social-icon"]',b.container).append($("<option>",e))}),$('select[data-type="social-icon"]',b.container).select2({templateResult:a,templateSelection:a})},setupIcheck:function(a){var b=this;$("input[type=checkbox]",b.container).each(function(a){0===$(this).closest('div[class^="icheckbox"]').length&&$(this).iCheck({checkboxClass:"icheckbox_flat-grey",checkedClass:"checked",radioClass:"iradio_flat-grey"}).on("ifChanged",function(a){$(this).val(!1===$(this).is(":checked")?0:1),$(a.currentTarget).trigger("change")})})},setupColorPicker:function(a){var b=this,c=(b.item,b.module);$('input[data-type="social-color"]',b.container).wpColorPicker({defaultColor:"rgba(255,255,255,0.7)",change:function(a,b){_.has(b,"color")&&16777215==b.color._color?$(this).val("rgba(255,255,255,0.7)"):$(this).val(b.color.toString()),$(this).trigger("colorpickerchange").trigger("change")}}),$('input[data-type="social-color"]',b.container).closest("div").on("click keydown",function(){c._adjustScrollExpandedBlock(b.container)})}},CZRSocialsItem:{ready:function(){var a=this;api.CZRItem.prototype.ready.call(a),a.bind("social-icon:changed",function(){a.module.updateItemModel(a)})},_buildTitle:function(a,b,c){var d=this,e=d.module;return a=a||("string"==typeof b?api.CZR_Helpers.capitalize(b.replace("fa-","")):""),a=api.CZR_Helpers.truncate(a,20),b=b||"fa-"+e.social_icons[0],c=c||serverControlParams.social_el_params.defaultSocialColor,'<div><span class="fa '+b+'" style="color:'+c+'"></span> '+a+"</div>"},writeItemViewTitle:function(a){var b=this,c=b.module,d=a||b(),e=api.CZR_Helpers.capitalize(d["social-icon"].replace("fa-",""));$("."+c.control.css_attr.item_title,b.container).html(b._buildTitle(e,d["social-icon"],d["social-color"]))}}});var CZRWidgetAreaModuleMths=CZRWidgetAreaModuleMths||{};$.extend(CZRWidgetAreaModuleMths,{initialize:function(a,b){var c=this;api.CZRDynModule.prototype.initialize.call(this,a,b),$.extend(c,{itemPreAddEl:"czr-module-widgets-pre-add-view-content",itemInputList:"czr-module-widgets-item-input-list",itemInputListReduced:"czr-module-widgets-item-input-list-reduced",ruItemPart:"czr-module-widgets-ru-item-part"}),c.inputConstructor=api.CZRInput.extend(c.CZRWZonesInputMths||{}),c.itemConstructor=api.CZRItem.extend(c.CZRWZonesItem||{}),c.serverParams=serverControlParams.widget_area_el_params||{},c.contexts=_.has(c.serverParams,"sidebar_contexts")?c.serverParams.sidebar_contexts:{},c.context_match_map={is_404:"404",is_category:"archive-category",is_home:"home",is_page:"page",is_search:"search",is_single:"single"},c.locations=_.has(c.serverParams,"sidebar_locations")?c.serverParams.sidebar_locations:{},c.defaultItemModel={id:"",title:serverControlParams.translatedStrings.widgetZone,contexts:_.without(_.keys(c.contexts),"_all_"),locations:[c.serverParams.defaultWidgetLocation],description:""},this.itemAddedMessage=serverControlParams.translatedStrings.widgetZoneAdded,this.listenToSidebarInsights(),api.czr_widgetZoneSettings.bind(function(a,b){c.isReady.then(function(){_.each(a,function(a,b){api.sidebar_insights(b).set(a)})})}),c.preItem_location_alert_view_state=new api.Value("closed"),c.preItem_location_alert_view_state.callbacks.add(function(a,b){c._toggleLocationAlertExpansion(c.container,a)}),c.bind("item_added",function(a){c.addWidgetSidebar(a)}),c.bind("pre_item_api_remove",function(a){c.removeWidgetSidebar(a)});var d=new api.Values;d.create("fixed_for_current_session"),d.create("value"),api.section(c.serverParams.dynWidgetSection).fixTopMargin=d,api.section(c.serverParams.dynWidgetSection).fixTopMargin("fixed_for_current_session").set(!1),api.panel("widgets").expanded.callbacks.add(function(a,b){c.widgetPanelReact(),"resolved"!=c.isReady.state()&&c.ready()})},ready:function(){var a=this;api.CZRDynModule.prototype.ready.call(a),a.preItemExpanded.callbacks.add(function(b,c){b&&(a.preItem.czr_Input("locations")._setupLocationSelect(!0),a.preItem.czr_Input("locations").mayBeDisplayModelAlert())})},initializeModuleModel:function(a){var b=this;return a.items=_.union(_.has(b.serverParams,"default_zones")?b.serverParams.default_zones:[],a.items),a},CZRWZonesInputMths:{ready:function(){var a=this;a.bind("locations:changed",function(){a.mayBeDisplayModelAlert()}),api.CZRInput.prototype.ready.call(a)},setupSelect:function(){"locations"==this.id&&this._setupLocationSelect(),"contexts"==this.id&&this._setupContextSelect()},_setupContextSelect:function(){var a=this,b=a(),c=(a.item,a.module);_.each(c.contexts,function(c,d){var e={value:d,html:c};(d==b||_.contains(b,d))&&$.extend(e,{selected:"selected"}),$('select[data-type="contexts"]',a.container).append($("<option>",e))}),$('select[data-type="contexts"]',a.container).select2()},_setupLocationSelect:function(a){function b(a){if(!a.id)return a.text;if(_.contains(f,a.element.value))return a.text;var b=$('<span class="czr-unavailable-location fa fa-ban" title="'+serverControlParams.translatedStrings.unavailableLocation+'"> '+a.text+"</span>");return b}var c=this,d=c(),e=(c.item,c.module),f=api.sidebar_insights("available_locations")();$('select[data-type="locations"]',c.container).children().length||_.each(e.locations,function(a,b){var e={value:b,html:a};(b==d||_.contains(d,b))&&$.extend(e,{selected:"selected"}),$('select[data-type="locations"]',c.container).append($("<option>",e))}),a&&$('select[data-type="locations"]',c.container).select2("destroy"),$('select[data-type="locations"]',c.container).select2({templateResult:b,templateSelection:b})},mayBeDisplayModelAlert:function(){var a=this,b=a.item,c=a.module;if(_.has(b(),"locations")&&!_.isEmpty(b().locations)){var d=$('select[data-type="locations"]',a.container).val(),e=api.sidebar_insights("available_locations")(),f=_.filter(d,function(a){return!_.contains(e,a)});!_.has(b(),"id")||_.isEmpty(b().id)?c.preItem_location_alert_view_state.set(_.isEmpty(f)?"closed":"expanded"):b.czr_itemLocationAlert.set(_.isEmpty(f)?"closed":"expanded")}}},CZRWZonesItem:{initialize:function(a,b){var c=this;c.module;c.czr_itemLocationAlert=new api.Value,api.CZRItem.prototype.initialize.call(c,null,b)},itemWrapperViewSetup:function(){var a=this,b=a.module;api.CZRItem.prototype.itemWrapperViewSetup.call(a),a.czr_itemLocationAlert.set("closed"),a.czr_itemLocationAlert.callbacks.add(function(c,d){b._toggleLocationAlertExpansion(a.container,c)}),a.writeSubtitleInfos(a()),a.czr_ItemState.callbacks.add(function(b,c){-1!=b.indexOf("expanded")&&a.contentRendered.then(function(){a.czr_Input("locations")._setupLocationSelect(!0),a.czr_Input("locations").mayBeDisplayModelAlert()})})},itemReact:function(a,b){var c=this;api.CZRItem.prototype.itemReact.call(c,a,b),c.writeSubtitleInfos(a),c.updateSectionTitle(a).setModelUpdateTimer()},writeSubtitleInfos:function(a){var b=this,c=b.module,d=_.clone(a||b()),e=[],f=[],g="";if(!b.container.length)return this;d.locations=_.isString(d.locations)?[d.locations]:d.locations,_.each(d.locations,function(a){_.has(c.locations,a)?e.push(c.locations[a]):e.push(a)}),d.contexts=_.isString(d.contexts)?[d.contexts]:d.contexts,b._hasModelAllContexts(a)?f.push(c.contexts._all_):_.each(d.contexts,function(a){_.has(c.contexts,a)?f.push(c.contexts[a]):f.push(a)});var h=serverControlParams.translatedStrings.locations,i=serverControlParams.translatedStrings.contexts,j=serverControlParams.translatedStrings.notset;if(e=_.isEmpty(e)?'<span style="font-weight: bold;">'+j+"</span>":e.join(", "),f=_.isEmpty(f)?'<span style="font-weight: bold;">'+j+"</span>":f.join(", "),g="<u>"+h+"</u> : "+e+" <strong>|</strong> <u>"+i+"</u> : "+f,$(".czr-zone-infos",b.container).length)$(".czr-zone-infos",b.container).html(g);else{var k=$("<div/>",{"class":["czr-zone-infos",c.control.css_attr.item_sort_handle].join(" "),html:g});$("."+c.control.css_attr.item_btns,b.container).after(k)}return this},updateSectionTitle:function(a){var b="sidebar-widgets-"+a.id,c=a.title;return api.section.has(b)?($(".accordion-section-title",api.section(b).container).text(c),$(".customize-section-title h3",api.section(b).container).html('<span class="customize-action">'+api.section(b).params.customizeAction+"</span>"+c),this):this},setModelUpdateTimer:function(){var a=this,b=a.module;clearTimeout($.data(this,"modelUpdateTimer")),$.data(this,"modelUpdateTimer",setTimeout(function(){b.control.refreshPreview()},1e3))},_hasModelAllContexts:function(a){var b=this,c=b.module,d=_.keys(c.contexts);if(a=a||this(),_.has(a,"contexts"))return!!_.contains(a.contexts,"_all_")||_.isEmpty(_.difference(_.without(d,"_all_"),a.contexts))},_getMatchingContexts:function(a){var b=this,c=api.czr_wp_conditionals()||{},d=_.filter(b.context_match_map,function(a,b){return!0===c[b]});return _.isEmpty(d)?a:d}},addWidgetSidebar:function(a,b){if(!_.isObject(a)&&_.isEmpty(b))throw new Error("No valid input were provided to add a new Widget Zone.");var c=this,d=_.isEmpty(a)?b:_.clone(a),e=_.isEmpty(a)?b:$.extend(_.clone(_.findWhere(api.Widgets.data.registeredSidebars,{id:c.serverParams.defaultWidgetSidebar})),{name:d.title,id:d.id});api.Widgets.registeredSidebars.add(e);var f=$.extend(_.clone(api.section("sidebar-widgets-"+c.serverParams.defaultWidgetSidebar).params),{id:"sidebar-widgets-"+d.id,instanceNumber:_.max(api.settings.sections,function(a){return a.instanceNumber}).instanceNumber+1,sidebarId:e.id,title:e.name,description:"undefined"!=typeof b?b.description:api.section("sidebar-widgets-"+c.serverParams.defaultWidgetSidebar).params.description,priority:_.max(_.omit(api.settings.sections,c.serverParams.dynWidgetSection),function(a){return a.instanceNumber}).priority+1});api.section.add(f.id,new api.sectionConstructor[f.type](f.id,{params:f})),api.settings.sections[f.id]=f.id;var g="sidebars_widgets["+d.id+"]",h=$.extend(_.clone(api.settings.settings["sidebars_widgets["+c.serverParams.defaultWidgetSidebar+"]"]),{value:[]});api.settings.settings[g]=h,api.create(g,g,h.value,{transport:h.transport,previewer:api.previewer,dirty:!1});var i=$.extend(_.clone(api.settings.controls["sidebars_widgets["+c.serverParams.defaultWidgetSidebar+"]"]),{settings:{"default":g}}),j={};_.each(i,function(a,b){"string"==typeof a&&(a=a.replace(c.serverParams.defaultWidgetSidebar,d.id)),j[b]=a}),j.instanceNumber=_.max(api.settings.controls,function(a){return a.instanceNumber}).instanceNumber+1,api.settings.controls[g]=j,api.control.add(g,new api.controlConstructor[j.type](g,{params:j,previewer:api.previewer})),_.has(this,"container")&&this.container.trigger("widget_zone_created",{model:d,section_id:"sidebar-widgets-"+d.id,setting_id:g})},removeWidgetSidebar:function(a){var b=this;if(!_.isObject(a)||_.isEmpty(a))throw new Error("No valid data were provided to remove a Widget Zone.");api.Widgets.registeredSidebars.remove(a.id),api.section.has("sidebar-widgets-"+a.id)&&(api.section("sidebar-widgets-"+a.id).container.remove(),api.section.remove("sidebar-widgets-"+a.id),delete api.settings.sections["sidebar-widgets-"+a.id]),api.has("sidebars_widgets["+a.id+"]")&&(api.remove("sidebars_widgets["+a.id+"]"),delete api.settings.settings["sidebars_widgets["+a.id+"]"]),api.control.has("sidebars_widgets["+a.id+"]")&&(api.control("sidebars_widgets["+a.id+"]").container.remove(),api.control.remove("sidebars_widgets["+a.id+"]"),delete api.settings.controls["sidebars_widgets["+a.id+"]"]);var c=function(){api.previewer.refresh()};c=_.debounce(c,500),$.when(c()).done(function(){b.trigger("widget_zone_removed",{model:a,section_id:"sidebar-widgets-"+a.id,setting_id:"sidebars_widgets["+a.id+"]"})})},widgetPanelReact:function(){var a=this,b=api.panel("widgets").container.find(".control-panel-content").css("margin-top");api.section(a.serverParams.dynWidgetSection).fixTopMargin("value").set(b);var c=api.section(a.serverParams.dynWidgetSection).container.find(".accordion-section-content"),d=api.panel("widgets").container.find(".control-panel-content"),e=function(){c.css("margin-top",""),d.css("margin-top",api.section(a.serverParams.dynWidgetSection).fixTopMargin("value")())};api.bind("pane-contents-reflowed",_.debounce(function(){e()},150)),a.closeAllItems(),_.has(a,"preItemExpanded")&&a.preItemExpanded.set(!1)},widgetSectionReact:function(a,b){var c=this,d=api.section(c.serverParams.dynWidgetSection),e=d.container.closest(".wp-full-overlay-sidebar-content"),f=d.container.find(".accordion-section-content"),g=d.container.closest(".wp-full-overlay"),h=(d.container.find(".customize-section-back"),d.container.find(".accordion-section-title").first());$("#customize-header-actions").height();a&&(g.removeClass("section-open"),f.css("height","auto"),h.attr("tabindex","0"),f.css("margin-top",""),e.scrollTop(0)),c.closeAllItems(),f.slideToggle()},listenToSidebarInsights:function(){var a=this;api.sidebar_insights("registered").callbacks.add(function(b){var c=_.clone(a.itemCollection());_.map(c,function(c){a.getViewEl(c.id).length&&a.getViewEl(c.id).css("display",_.contains(b,c.id)?"block":"none")})}),api.sidebar_insights("inactives").callbacks.add(function(b){var c=_.clone(a.itemCollection());_.map(c,function(c){a.getViewEl(c.id).length&&(_.contains(b,c.id)?(a.getViewEl(c.id).addClass("inactive"),a.getViewEl(c.id).find(".czr-inactive-alert").length||a.getViewEl(c.id).find(".czr-item-title").append($("<span/>",{"class":"czr-inactive-alert",html:" [ "+serverControlParams.translatedStrings.inactiveWidgetZone+" ]"}))):(a.getViewEl(c.id).removeClass("inactive"),a.getViewEl(c.id).find(".czr-inactive-alert").length&&a.getViewEl(c.id).find(".czr-inactive-alert").remove()))})}),api.sidebar_insights("candidates").callbacks.add(function(b){_.isArray(b)&&_.map(b,function(b){_.isObject(b)&&(api.section.has("sidebar-widgets-"+b.id)||(a.addWidgetSidebar({},b),_.has(api.sidebar_insights("actives")(),b.id)&&api.section.has("sidebar-widgets-"+b.id)&&api.section("sidebar-widgets-"+b.id).activate()))})})},_adjustScrollExpandedBlock:function(a,b){if(a.length){var c,d=$(".wp-full-overlay-sidebar-content").scrollTop(),e=b||90;setTimeout(function(){a.offset().top+a.height()+e>$(window.top).height()&&(c=a.offset().top+a.height()+e-$(window.top).height(),$(".wp-full-overlay-sidebar-content").animate({scrollTop:d+c},600))},50)}},getDefaultModel:function(a){var b=this,c=b.itemCollection(),d=_.clone(b.defaultItemModel);d.contexts;return $.extend(d,{title:"Widget Zone "+(1*_.size(c)+1)})},getTemplateEl:function(a,b){var c,d=this;switch("rudItemPart"==a?a=_.has(b,"is_builtin")&&b.is_builtin?"ruItemPart":a:"itemInputList"==a&&(a=_.has(b,"is_builtin")&&b.is_builtin?"itemInputListReduced":a),a){case"rudItemPart":c=d.rudItemPart;break;case"ruItemPart":c=d.ruItemPart;break;case"itemInputList":c=d.itemInputList;break;case"itemInputListReduced":c=d.itemInputListReduced}if(_.isEmpty(c))throw new Error("No valid template has been found in getTemplateEl()");return c},_toggleLocationAlertExpansion:function(a,b){var c=a.find(".czr-location-alert");if(!c.length){var d=["<span>"+serverControlParams.translatedStrings.locationWarning+"</span>",api.CZR_Helpers.getDocSearchLink(serverControlParams.translatedStrings.locationWarning)].join("");c=$("<div/>",{"class":"czr-location-alert",html:d,style:"display:none"}),$('select[data-type="locations"]',a).closest("div").after(c)}c.toggle("expanded"==b)}});var CZRFeaturedPageModuleMths=CZRFeaturedPageModuleMths||{};$.extend(CZRFeaturedPageModuleMths,{initialize:function(a,b){var c=this;api.CZRDynModule.prototype.initialize.call(c,a,b),$.extend(c,{itemPreAddEl:"czr-module-fp-pre-add-view-content",itemInputList:"czr-module-fp-view-content"}),c.inputConstructor=api.CZRInput.extend(c.CZRFeaturedPagesInputMths||{}),c.itemConstructor=api.CZRItem.extend(c.CZRFeaturedPagesItem||{}),this.defaultItemModel={id:"",title:"","fp-post":"","fp-title":"","fp-text":"","fp-image":""},this.itemAddedMessage=serverControlParams.translatedStrings.featuredPageAdded,api.section(c.control.section()).expanded.bind(function(a){"resolved"!=c.isReady.state()&&c.ready()})},addItem:function(a){var b=this,c=b.preItem,d=c();if(_.isEmpty(d)||!_.isObject(d))throw new Error("addItem : an item should be an object and not empty. In : "+b.id+". Aborted.");var e=d["fp-post"];if("undefined"!=typeof e){e=e[0];var f=function(e){c.set($.extend(d,e)),api.CZRDynModule.prototype.addItem.call(b,a)};b.CZRFeaturedPagesItem.setContentAjaxInfo(e.id,{},f)}},CZRFeaturedPagesInputMths:{ready:function(){var a=this;a.bind("fp-post:changed",function(){a.updateItemModel()}),a.bind("fp-title:changed",function(){a.updateItemTitle()}),api.CZRInput.prototype.ready.call(a)},setupImageUploader:function(){var a=this;a.container.bind("fp-image:content_rendered",function(){a.addResetDefaultButton()}),a.container.on("click keydown",".default-fpimage-button",function(){a.setThumbnailAjax()}),api.CZRInput.prototype.setupImageUploader.call(a)},updateItemModel:function(a){var b=this,c=this.item,d=_.has(b,"is_preItemInput")&&b.is_preItemInput;if(_.has(c(),"fp-post")&&!_.isEmpty(c()["fp-post"])){var e=_.clone(c()),f=e["fp-post"][0],g=f.title;d?b.module.preItemInput:c.czr_Input;if(d)$.extend(e,{title:g,"fp-title":g}),c.set(e);else{var h=function(a){_.each(a,function(a,b){c.czr_Input(b).set(a)})};c.setContentAjaxInfo(f.id,{"fp-title":g},h)}}},updateItemTitle:function(a){var b=this,c=this.item,d=_.has(b,"is_preItemInput")&&b.is_preItemInput;if(!d){var e=_.clone(c()),f="undefined"!=typeof e["fp-title"]?e["fp-title"]:"";$.extend(e,{title:f}),c.set(e)}},setThumbnailAjax:function(){var a,b=this.item,c=b.czr_Input("fp-post")();"undefined"!=typeof c&&(c=c[0],a=c.id,$(".fpimage-reset-messages p").hide(),request=wp.ajax.post("get-fp-post-tb",{wp_customize:"on",id:a,CZRFPNonce:serverControlParams.CZRFPNonce}),request.done(function(a){var c=a,d=b.czr_Input("fp-image");0!==c.length?($(".fpimage-reset-messages .success",d.container).show("fast").fadeOut(),d.set(c)):$(".fpimage-reset-messages .warning",d.container).show("fast").delay(2e3).fadeOut()}),request.fail(function(a){"undefined"!=typeof console&&console.error&&console.error(a)}))},addResetDefaultButton:function(a){var b=this,c=(b.item,serverControlParams.translatedStrings.featuredPageImgReset),d=serverControlParams.translatedStrings.featuredPageResetSucc,e=serverControlParams.translatedStrings.featuredPageResetErr,f='<div class="fpimage-reset-messages" style="clear:both"><p class="success" style="display:none">'+d+'</p><p class="warning" style="display:none">'+e+"</p></div>";$(".actions",b.container).append('<button type="button" class="button default-fpimage-button">'+c+"</button>"),$(".fpimage-reset-messages",b.container).detach(),$(b.container).append(f)}},CZRFeaturedPagesItem:{setContentAjaxInfo:function(a,b,c){var d=b||{};return request=wp.ajax.post("get-fp-post",{wp_customize:"on",id:a,CZRFPNonce:serverControlParams.CZRFPNonce}),request.done(function(a){var b=a.post_info;0!==b.length&&($.extend(d,{"fp-image":b.thumbnail,"fp-text":b.excerpt}),"function"==typeof c&&c(d))}),request.fail(function(a){"undefined"!=typeof console&&console.error&&console.error(a)}),request},writeItemViewTitle:function(a){var b=this,c=b.module,d=a||b(),e=d.title?d.title:serverControlParams.translatedStrings.featuredPageTitle;e=api.CZR_Helpers.truncate(e,25),$("."+c.control.css_attr.item_title,b.container).html(e)}}});var CZRTextModuleMths=CZRTextModuleMths||{};$.extend(CZRTextModuleMths,{initialize:function(a,b){var c=this;api.CZRModule.prototype.initialize.call(c,a,b),$.extend(c,{itemInputList:"czr-module-text-view-content"}),c.defaultItemModel={id:"",text:""}}});var CZRSlideModuleMths=CZRSlideModuleMths||{};$.extend(CZRSlideModuleMths,{initialize:function(a,b){var c=this;api.CZRDynModule.prototype.initialize.call(c,a,b),$.extend(c,{itemPreAddEl:"czr-module-slide-pre-item-input-list",itemInputList:"czr-module-slide-item-input-list"}),c.inputConstructor=api.CZRInput.extend(c.CZRSliderInputMths||{}),c.itemConstructor=api.CZRItem.extend(c.CZRSliderItem||{}),this.defaultItemModel={id:"",title:"","slide-background":"","slide-title":"","slide-subtitle":""},this.itemAddedMessage=serverControlParams.translatedStrings.slideAdded},CZRSliderInputMths:{ready:function(){var a=this;a.bind("slide-title:changed",function(){a.updateItemTitle()}),api.CZRInput.prototype.ready.call(a)},updateItemTitle:function(a){var b=this,c=this.item,d=(_.has(b,"is_preItemInput")&&b.is_preItemInput,_.clone(c())),e=d["slide-title"];$.extend(d,{title:e}),c.set(d)}},CZRSliderItem:{writeItemViewTitle:function(a){var b=this,c=b.module,d=a||b(),e=d.title?d.title:serverControlParams.translatedStrings.slideTitle;e=api.CZR_Helpers.truncate(e,25),$("."+c.control.css_attr.item_title,b.container).html(e)}}});var CZRTextEditorModuleMths=CZRTextEditorModuleMths||{};$.extend(CZRTextEditorModuleMths,{initialize:function(a,b){var c=this;api.CZRModule.prototype.initialize.call(c,a,b),$.extend(c,{itemInputList:"czr-module-text_editor-item-content"}),c.inputConstructor=api.CZRInput.extend(c.CZRTextEditorInputMths||{}),c.itemConstructor=api.CZRItem.extend(c.CZRTextEditorItem||{}),this.defaultItemModel={id:"",text:""}},CZRTextEditorInputMths:{},CZRTextEditorItem:{}});var CZRBodyBgModuleMths=CZRBodyBgModuleMths||{};$.extend(CZRBodyBgModuleMths,{initialize:function(a,b){var c=this;api.CZRModule.prototype.initialize.call(c,a,b),$.extend(c,{itemInputList:"czr-module-bodybg-item-content"}),c.inputConstructor=api.CZRInput.extend(c.CZRBodyBgInputMths||{}),c.itemConstructor=api.CZRItem.extend(c.CZBodyBgItemMths||{}),c.defaultItemModel={"background-color":"#eaeaea","background-image":"","background-repeat":"no-repeat","background-attachment":"fixed","background-position":"center center","background-size":"cover"},api.consoleLog("module ID",c.id),_.has(api,"czr_activeSectionId")&&c.control.section()==api.czr_activeSectionId()&&"resolved"!=c.isReady.state()&&c.ready(),api.section(c.control.section()).expanded.bind(function(a){"resolved"!=c.isReady.state()&&c.ready()})},CZRBodyBgInputMths:{setupSelect:function(){var a=this,b={"background-repeat":"bg_repeat_options","background-attachment":"bg_attachment_options","background-position":"bg_position_options"},c=(a.item,serverControlParams.body_bg_module_params),d={};a.module;_.has(b,a.id)&&(_.isUndefined(c)||_.isUndefined(c[b[a.id]])||(d=c[b[a.id]],_.isEmpty(d)||(_.each(d,function(b,c){var d={value:c,html:b};(c==a()||_.contains(a(),c))&&$.extend(d,{selected:"selected"}),$("select[data-type]",a.container).append($("<option>",d))}),$("select[data-type]",a.container).select2())))}},CZBodyBgItemMths:{ready:function(){var a=this;api.CZRItem.prototype.ready.call(a),a.czr_Input("background-image").isReady.done(function(b){var c=function(b){var c=!_.isEmpty(b)||_.isNumber(b);_.each(["background-repeat","background-attachment","background-position","background-size"],function(b){a.czr_Input(b).container.toggle(c||!1)})};c(b()),a.bind("background-image:changed",function(){c(a.czr_Input("background-image")())})})}}});var CZRBaseControlMths=CZRBaseControlMths||{};$.extend(CZRBaseControlMths,{initialize:function(a,b){var c=this;c.css_attr=_.has(serverControlParams,"css_attr")?serverControlParams.css_attr:{},api.Control.prototype.initialize.call(c,a,b)},refreshPreview:function(a){this.previewer.refresh()}});var CZRBaseModuleControlMths=CZRBaseModuleControlMths||{};$.extend(CZRBaseModuleControlMths,{initialize:function(a,b){var c=this;c.czr_Module=new api.Values,c.czr_moduleCollection=new api.Value,c.czr_moduleCollection.set([]),c.moduleCollectionReady=$.Deferred(),c.moduleCollectionReady.done(function(a){!c.isMultiModuleControl(b.params),c.czr_moduleCollection.callbacks.add(function(){return c.moduleCollectionReact.apply(c,arguments)})}),c.isMultiModuleControl(b.params)&&(c.syncSektionModule=new api.Value),api.CZRBaseControl.prototype.initialize.call(c,a,b)},ready:function(){var a=this;if(a.isMultiModuleControl())a.syncSektionModule.bind(function(b,c){"resolved"!=a.moduleCollectionReady.state()&&(a.registerModulesOnInit(b),a.moduleCollectionReady.resolve())});else{var b={};_.each(a.getSavedModules(),function(c,d){b=c,a.instantiateModule(c,{}),a.container.attr("data-module",c.id)}),a.moduleCollectionReady.resolve(b)}a.bind("user-module-candidate",function(b){a.instantiateModule(b,{}).ready(b.is_added_by_user)})},getDefaultModuleApiModel:function(){var a={id:"",module_type:"",items:[],crud:!1,multi_item:!1,control:{}};return this.isMultiModuleControl()?$.extend(a,{column_id:"",sektion:{},sektion_id:"",is_added_by_user:!1,dirty:!1}):$.extend(a,{section:""})},getDefaultModuleDBModel:function(){var a={items:[]};return this.isMultiModuleControl()?$.extend(a,{id:"",module_type:"",column_id:"",sektion_id:"",dirty:!1}):a},isMultiModuleControl:function(a){return"czr_multi_module"==(a||this.params).type},getSyncCollectionControl:function(){var a=this;if(_.isUndefined(a.params.syncCollection))throw new Error("Control "+a.id+" has no synchronized sektion control defined.");return api.control(api.CZR_Helpers.build_setId(a.params.syncCollection));
|
15 |
+
},getSavedModules:function(){var a=this,b=[],c=a.params.module_type;if(a.isMultiModuleControl())b=$.extend(!0,[],api(a.id)());else{!api.CZR_Helpers.isMultiItemModule(c)||_.isEmpty(api(a.id)())||_.isObject(api(a.id)())||api.consoleLog("Module Control Init for "+a.id+" : a mono item module control value should be an object if not empty.");var d=_.isArray(api(a.id)())?api(a.id)():[api(a.id)()];b.push({id:api.CZR_Helpers.getOptionName(a.id)+"_"+a.params.type,module_type:a.params.module_type,section:a.section(),items:$.extend(!0,[],d)})}return b},isModuleRegistered:function(a){var b=this;return!_.isUndefined(_.findWhere(b.czr_moduleCollection(),{id:a}))}});var CZRBaseModuleControlMths=CZRBaseModuleControlMths||{};$.extend(CZRBaseModuleControlMths,{instantiateModule:function(a,b){if(!_.has(a,"id"))throw new Error("CZRModule::instantiateModule() : a module has no id and could not be added in the collection of : "+this.id+". Aborted.");var c=this;if((_.isUndefined(b)||_.isEmpty(b))&&(b=c.getModuleConstructor(a)),!_.isEmpty(a.id)&&c.czr_Module.has(a.id))throw new Error("The module id already exists in the collection in control : "+c.id);var d=c.prepareModuleForAPI(a);if(c.czr_Module.add(d.id,new b(d.id,d)),!c.czr_Module.has(d.id))throw new Error("instantiateModule() : instantiation failed for module id "+d.id+" in control "+c.id);return c.czr_Module(d.id)},getModuleConstructor:function(a){var b=this,c={},d={};if(!_.has(a,"module_type"))throw new Error("CZRModule::getModuleConstructor : no module type found for module "+a.id);if(!_.has(api.czrModuleMap,a.module_type))throw new Error("Module type "+a.module_type+" is not listed in the module map api.czrModuleMap.");var e=api.czrModuleMap[a.module_type].mthds,f=api.czrModuleMap[a.module_type].crud,g=f?api.CZRDynModule:api.CZRModule;if(_.isEmpty(a.sektion_id)?d=g.extend(e):(c=g.extend(e),d=c.extend(b.getMultiModuleExtender(c))),_.isUndefined(d)||_.isEmpty(d)||!d)throw new Error("CZRModule::getModuleConstructor : no constructor found for module type : "+a.module_type+".");return d},prepareModuleForAPI:function(a){if(!_.isObject(a))throw new Error("prepareModuleForAPI : a module must be an object to be instantiated.");var b=this,c={};return _.each(b.getDefaultModuleApiModel(),function(d,e){var f=a[e];switch(e){case"id":_.isEmpty(f)?c[e]=b.generateModuleId(a.module_type):c[e]=f;break;case"module_type":if(!_.isString(f)||_.isEmpty(f))throw new Error("prepareModuleForAPI : a module type must a string not empty");c[e]=f;break;case"items":if(!_.isArray(f))throw new Error("prepareModuleForAPI : a module item list must be an array");c[e]=f;break;case"crud":if(_.has(api.czrModuleMap,a.module_type))f=api.czrModuleMap[a.module_type].crud;else if(!_.isUndefined(f)&&!_.isBoolean(f))throw new Error('prepareModuleForAPI : the module param "crud" must be a boolean');c[e]=f||!1;break;case"multi_item":if(_.has(api.czrModuleMap,a.module_type))f=api.czrModuleMap[a.module_type].crud||api.czrModuleMap[a.module_type].multi_item;else if(!_.isUndefined(f)&&!_.isBoolean(f))throw new Error('prepareModuleForAPI : the module param "multi_item" must be a boolean');c[e]=f||!1;break;case"control":c[e]=b;break;case"section":if(!_.isString(f)||_.isEmpty(f))throw new Error("prepareModuleForAPI : a module section must be a string not empty");c[e]=f;break;case"column_id":if(!_.isString(f)||_.isEmpty(f))throw new Error("prepareModuleForAPI : a module column id must a string not empty");c[e]=f;break;case"sektion":if(!_.isObject(f)||_.isEmpty(f))throw new Error("prepareModuleForAPI : a module sektion must be an object not empty");c[e]=f;break;case"sektion_id":if(!_.isString(f)||_.isEmpty(f))throw new Error("prepareModuleForAPI : a module sektion id must be a string not empty");c[e]=f;break;case"is_added_by_user":if(!_.isUndefined(f)&&!_.isBoolean(f))throw new Error('prepareModuleForAPI : the module param "is_added_by_user" must be a boolean');c[e]=f||!1;break;case"dirty":c[e]=f||!1}}),c},generateModuleId:function(a,b,c){if(c=c||1,c>100)throw new Error("Infinite loop when generating of a module id.");var d=this;b=b||d._getNextModuleKeyInCollection();var e=a+"_"+b;if(!_.has(d,"czr_moduleCollection")||!_.isArray(d.czr_moduleCollection()))throw new Error("The module collection does not exist or is not properly set in control : "+d.id);return d.isModuleRegistered(e)?(b++,c++,d.generateModuleId(a,b,c)):e},_getNextModuleKeyInCollection:function(){var a=this,b={},c=0;return _.isEmpty(a.czr_moduleCollection())||(b=_.max(a.czr_moduleCollection(),function(a){return parseInt(a.id.replace(/[^\/\d]/g,""),10)}),c=parseInt(b.id.replace(/[^\/\d]/g,""),10)+1),c}});var CZRBaseModuleControlMths=CZRBaseModuleControlMths||{};$.extend(CZRBaseModuleControlMths,{registerModulesOnInit:function(a){var b=this,c=[];_.each(b.getSavedModules(),function(d,e){if(!a.czr_Item.has(d.sektion_id))return api.consoleLog("Warning Module "+d.id+" is orphan : it has no sektion to be embedded to. It Must be removed."),void c.push(d);var f=a.czr_Item(d.sektion_id);if(_.isUndefined(f))throw new Error("sektion instance missing. Impossible to instantiate module : "+d.id);$.extend(d,{sektion:f}),b.updateModulesCollection({module:d})}),b.moduleCollectionReady.then(function(){_.isEmpty(c)||b.moduleCollectionReact(b.czr_moduleCollection(),[],{orphans_module_removal:c})})},updateModulesCollection:function(a){var b=this,c=b.czr_moduleCollection(),d=$.extend(!0,[],c);if(_.has(a,"collection"))return void b.czr_moduleCollection.set(a.collection,a.data||{});if(!_.has(a,"module"))throw new Error("updateModulesCollection, no module provided "+b.id+". Aborting");var e=b.prepareModuleForAPI(_.clone(a.module));_.findWhere(d,{id:e.id})?_.each(c,function(a,b){a.id==e.id&&(d[b]=e)}):d.push(e);var f={};_.has(a,"data")&&(f=$.extend(!0,{},a.data),$.extend(f,{module:e})),b.czr_moduleCollection.set(d,f)},moduleCollectionReact:function(a,b,c){var d=this,e=_.size(a)>_.size(b),f=_.size(b)>_.size(a);_.size(b)==_.size(a);if(is_collection_sorted=!1,f){var g=_.filter(b,function(b){return _.isUndefined(_.findWhere(a,{id:b.id}))});g=g[0],d.czr_Module.remove(g.id)}_.isObject(c)&&_.has(c,"module")&&(c.module=d.prepareModuleForDB($.extend(!0,{},c.module))),!d.isMultiModuleControl()&&e||api(this.id).set(d.filterModuleCollectionBeforeAjax(a),c)},filterModuleCollectionBeforeAjax:function(a){var b=this,c=$.extend(!0,[],a);if(_.each(a,function(a,d){var e=$.extend(!0,{},a);c[d]=b.prepareModuleForDB(e)}),b.isMultiModuleControl())return c;if(_.size(a)>1)throw new Error("There should not be several modules in the collection of control : "+b.id);if(!_.isArray(a)||_.isEmpty(a)||!_.has(a[0],"items"))throw new Error("The setting value could not be populated in control : "+b.id);var d=a[0].id;if(!b.czr_Module.has(d))throw new Error("The single module control ("+b.id+") has no module registered with the id "+d);var e=b.czr_Module(d);if(!_.isArray(e().items))throw new Error("The module "+d+" should be an array in control : "+b.id);return e.isMultiItem()?e().items:e().items[0]||[]},prepareModuleForDB:function(a){if(!_.isObject(a))throw new Error("MultiModule Control::prepareModuleForDB : a module must be an object. Aborting.");var b=this,c={};return _.each(b.getDefaultModuleDBModel(),function(d,e){if(!_.has(a,e))throw new Error("MultiModule Control::prepareModuleForDB : a module is missing the property : "+e+" . Aborting.");var f=a[e];switch(e){case"items":if(!_.isArray(f))throw new Error("prepareModuleForDB : a module item list must be an array");c[e]=f;break;case"id":if(!_.isString(f)||_.isEmpty(f))throw new Error("prepareModuleForDB : a module id must a string not empty");c[e]=f;break;case"module_type":if(!_.isString(f)||_.isEmpty(f))throw new Error("prepareModuleForDB : a module type must a string not empty");c[e]=f;break;case"column_id":if(!_.isString(f)||_.isEmpty(f))throw new Error("prepareModuleForDB : a module column id must a string not empty");c[e]=f;break;case"sektion_id":if(!_.isObject(a.sektion)||!_.has(a.sektion,"id"))throw new Error("prepareModuleForDB : a module sektion must be an object with an id.");c[e]=a.sektion.id;break;case"dirty":if(b.czr_Module.has(a.id)?c[e]=b.czr_Module(a.id).isDirty():c[e]=f,!_.isBoolean(c[e]))throw new Error("prepareModuleForDB : a module dirty state must be a boolean.")}}),c}});var CZRMultiModuleControlMths=CZRMultiModuleControlMths||{};$.extend(CZRMultiModuleControlMths,{initialize:function(a,b){var c=this;api.consoleLog("IN MULTI MODULE INITIALIZE ? ",b),api(a).callbacks.add(function(){return c.syncColumn.apply(c,arguments)}),api.CZRBaseModuleControl.prototype.initialize.call(c,a,b)},ready:function(){var a=this;api.consoleLog("MODULE-COLLECTION CONTROL READY",this.id),api.CZRBaseModuleControl.prototype.ready.apply(a,arguments)},syncColumn:function(a,b,c){if(api.consoleLog("IN SYNC COLUMN",a,b,c),(_.isUndefined(c)||!c.silent)&&(api.consoleLog("IN SYNXXX",api.control("hu_theme_options[module-collection]").syncSektionModule()(),this.syncSektionModule()(),this.id),!_.has(c,"orphans_module_removal"))){var d=api.control(this.id),e=_.filter(a,function(a,c){return!_.findWhere(b,{id:a.id})});_.isEmpty(e)||(api.consoleLog("ADDED MODULE?",e),_.each(e,function(a){d.syncSektionModule().czr_Column(a.column_id).updateColumnModuleCollection({module:a})}));var f=_.filter(b,function(b,c){return!_.findWhere(a,{id:b.id})});_.isEmpty(f)||_.each(f,function(a){d.syncSektionModule().czr_Column(a.column_id).removeModuleFromColumnCollection(a)}),_.size(b)==_.size(a)&&_.has(c,"module")&&_.has(c,"source_column")&&_.has(c,"target_column")&&$.when(d.syncSektionModule().moveModuleFromTo(c.module,c.source_column,c.target_column)).done(function(){d.syncSektionModule().control.trigger("module-moved",{module:c.module,source_column:c.source_column,target_column:c.target_column})}),d.trigger("columns-synchronized",a)}},removeModule:function(a){var b=this;b.czr_Module.has(a.id)&&"resolved"==b.czr_Module(a.id).embedded.state()&&b.czr_Module(a.id).container.remove(),b.removeModuleFromCollection(a)},removeModuleFromCollection:function(a){var b=this,c=b.czr_moduleCollection(),d=$.extend(!0,[],c);d=_.filter(d,function(b){return b.id!=a.id}),b.czr_moduleCollection.set(d)}});var CZRMultiModuleControlMths=CZRMultiModuleControlMths||{};$.extend(CZRMultiModuleControlMths,{getMultiModuleExtender:function(a){var b=this;return $.extend(b.CZRModuleExtended,{initialize:function(b,c){var d=this;a.prototype.initialize.call(d,b,c),api.consoleLog("MODULE INSTANTIATED : ",d.id),$.extend(d,{singleModuleWrapper:"czr-single-module-wrapper",sektionModuleTitle:"czr-module-sektion-title-part",ruModuleEl:"czr-ru-module-sektion-content"}),d.czr_ModuleState=new api.Value((!1)),d.isReady.done(function(){d.setupModuleView()}),d.moduleTitleEmbedded=$.Deferred(),d.modColumn=new api.Value,d.modColumn.set(c.column_id),d.modColumn.bind(function(a,b){api.consoleLog("MODULE "+d.id+" HAS BEEN MOVED TO COLUMN",a,d());var c=d(),e=$.extend(!0,{},c);e.column_id=a,d.set(e,{target_column:a,source_column:b})})},ready:function(b){var c=this;api.consoleLog("MODULE READY IN EXTENDED MODULE CLASS : ",c.id),$.when(c.renderModuleWrapper(b)).done(function(a){if(_.isUndefined(a)||!1===a.length)throw new Error("Module container has not been embedded for module :"+c.id);c.container=a,c.embedded.resolve()}),a.prototype.ready.call(c)}}),b.CZRModuleExtended},CZRModuleExtended:{renderModuleWrapper:function(a){var b=this;if("resolved"==b.embedded.state())return b.container;if(0===$("#tmpl-"+b.singleModuleWrapper).length)throw new Error("No template for module "+b.id+". The template script id should be : #tmpl-"+b.singleModuleWrapper);var c=wp.template(b.singleModuleWrapper),d={id:b.id,type:b.module_type},e=$(c(d));return a?$.when($(".czr-module-collection-wrapper",b._getColumn().container).find(".czr-module-candidate").after(e)).done(function(){$(".czr-module-collection-wrapper",b._getColumn().container).find(".czr-module-candidate").remove()}):$(".czr-module-collection-wrapper",b._getColumn().container).append(e),e},setupModuleView:function(){var a=this;a.view_event_map=[{trigger:"click keydown",selector:[".czr-remove-mod","."+a.control.css_attr.cancel_alert_btn].join(","),name:"toggle_remove_alert",actions:["toggleModuleRemoveAlert"]},{trigger:"click keydown",selector:"."+a.control.css_attr.remove_view_btn,name:"remove_module",actions:["removeModule"]},{trigger:"click keydown",selector:".czr-edit-mod",name:"edit_module",actions:["setModuleViewVisibility","sendEditModule"]},{trigger:"click keydown",selector:".czr-module-back",name:"back_to_column",actions:["setModuleViewVisibility"]},{trigger:"mouseenter",selector:".czr-mod-header",name:"hovering_module",actions:function(b){a.control.previewer.send("start_hovering_module",{id:a.id})}},{trigger:"mouseleave",selector:".czr-mod-header",name:"hovering_module",actions:function(b){a.control.previewer.send("stop_hovering_module",{id:a.id})}}],a.embedded.done(function(){a.czr_ModuleState.callbacks.add(function(){return a.setupModuleViewStateListeners.apply(a,arguments)}),api.CZR_Helpers.setupDOMListeners(a.view_event_map,{module:{id:a.id},dom_el:a.container},a)})},setModuleViewVisibility:function(a,b){var c=this;c.czr_ModuleState(!c.czr_ModuleState()),api.czrModulePanelState.set(!1),api.czrSekSettingsPanelState.set(!1),c.control.syncSektionModule().closeAllOtherSektions($(a.dom_event.currentTarget,a.dom_el))},sendEditModule:function(a){var b=this;b.control.previewer.send("edit_module",{id:b.id})},setupModuleViewStateListeners:function(a){var b=this;api.czr_isModuleExpanded=api.czr_isModuleExpanded||new api.Value,a?api.czr_isModuleExpanded(b):api.czr_isModuleExpanded(!1),$.when(b.toggleModuleViewExpansion(a)).done(function(){a?(b.renderModuleTitle(),b.populateSavedItemCollection()):b.czr_Item.each(function(a){a.czr_ItemState.set("closed"),a._destroyView(0),b.czr_Item.remove(a.id)})})},renderModuleTitle:function(){var a=this;if("resolved"!=a.moduleTitleEmbedded.state()){if(0===$("#tmpl-"+a.sektionModuleTitle).length)throw new Error("No sektion title Module Part template for module "+a.id+". The template script id should be : #tmpl-"+a.sektionModuleTitle);$.when($(a.container).find(".czr-mod-content").prepend($(wp.template(a.sektionModuleTitle)({id:a.id})))).done(function(){a.moduleTitleEmbedded.resolve()})}},toggleModuleViewExpansion:function(a,b){var c=this;$(".czr-mod-content",c.container).slideToggle({duration:b||200,done:function(){var b=c.container.closest(".wp-full-overlay"),d=c.container.find(".czr-module-back"),e=c.container.find(".czr-module-title");c.container.toggleClass("open",a),b.toggleClass("czr-module-open",a),e.attr("tabindex",a?"-1":"0"),d.attr("tabindex",a?"0":"-1"),a?d.focus():e.focus(),a&&c._adjustScrollExpandedBlock(c.container)}})},toggleModuleRemoveAlert:function(a){var b=this,c=this.control,d=$("."+b.control.css_attr.remove_alert_wrapper,b.container).first(),e=(a.dom_event,c.syncSektionModule().czr_Column(b.column_id).container);if(_.has(b,"preItem")&&c.syncSektionModule().preItemExpanded.set(!1),$("."+b.control.css_attr.remove_alert_wrapper,e).not(d).each(function(){$(this).hasClass("open")&&$(this).slideToggle({duration:200,done:function(){$(this).toggleClass("open",!1),$(this).siblings().find("."+b.control.css_attr.display_alert_btn).toggleClass("active",!1)}})}),!wp.template(b.AlertPart)||!b.container)throw new Error("No removal alert template available for module :"+b.id);d.html(wp.template(b.AlertPart)({title:b().title||b.id})),d.slideToggle({duration:200,done:function(){var c=!$(this).hasClass("open")&&$(this).is(":visible");$(this).toggleClass("open",c),$(a.dom_el).find("."+b.control.css_attr.display_alert_btn).toggleClass("active",c),c&&b._adjustScrollExpandedBlock(b.container)}})},removeModule:function(a){this.control.removeModule(a.module)},_getColumn:function(){var a=this;return a.control.syncSektionModule().czr_Column(a.modColumn())},_getSektion:function(){}}});var CZRMultiplePickerMths=CZRMultiplePickerMths||{};$.extend(CZRMultiplePickerMths,{ready:function(){var a=this,b=this.container.find("select");b.on("change",function(b){0===$(this).find("option:selected").length&&a.setting.set([])})}});var CZRCroppedImageMths=CZRCroppedImageMths||{};!function(a,b,c){"function"==typeof wp.media.controller.Cropper&&"function"==typeof a.CroppedImageControl&&(wp.media.controller.CZRCustomizeImageCropper=wp.media.controller.Cropper.extend({doCrop:function(a){var b=a.get("cropDetails"),c=this.get("control");return b.dst_width=c.params.dst_width,b.dst_height=c.params.dst_height,wp.ajax.post("crop-image",{wp_customize:"on",nonce:a.get("nonces").edit,id:a.get("id"),context:c.id,cropDetails:b})}}),b.extend(CZRCroppedImageMths,{initFrame:function(){var a=_wpMediaViewsL10n;this.frame=wp.media({button:{text:a.select,close:!1},states:[new wp.media.controller.Library({title:this.params.button_labels.frame_title,library:wp.media.query({type:"image"}),multiple:!1,date:!1,priority:20,suggestedWidth:this.params.width,suggestedHeight:this.params.height}),new wp.media.controller.CZRCustomizeImageCropper({imgSelectOptions:this.calculateImageSelectOptions,control:this})]}),this.frame.on("select",this.onSelect,this),this.frame.on("cropped",this.onCropped,this),this.frame.on("skippedcrop",this.onSkippedCrop,this)},onSelect:function(){var a=this.frame.state().get("selection").first().toJSON();return a.mime&&a.mime.indexOf("image")>-1?void(c.contains(["image/svg+xml","image/gif"],a.mime)||this.params.width===a.width&&this.params.height===a.height&&!this.params.flex_width&&!this.params.flex_height?(this.setImageFromAttachment(a),this.frame.close()):this.frame.setState("cropper")):void this.frame.trigger("content:error")}}))}(wp.customize,jQuery,_);var CZRUploadMths=CZRUploadMths||{};$.extend(CZRUploadMths,{ready:function(){var a=this;this.params.removed=this.params.removed||"",this.success=$.proxy(this.success,this),this.uploader=$.extend({container:this.container,browser:this.container.find(".czr-upload"),success:this.success,plupload:{},params:{}},this.uploader||{}),a.params.extensions&&(a.uploader.plupload.filters=[{title:api.l10n.allowedFiles,extensions:a.params.extensions}]),a.params.context&&(a.uploader.params["post_data[context]"]=this.params.context),api.settings.theme.stylesheet&&(a.uploader.params["post_data[theme]"]=api.settings.theme.stylesheet),this.uploader=new wp.Uploader(this.uploader),this.remover=this.container.find(".remove"),this.remover.on("click keydown",function(b){"keydown"===b.type&&13!==b.which||(a.setting.set(a.params.removed),b.preventDefault())}),this.removerVisibility=$.proxy(this.removerVisibility,this),this.setting.bind(this.removerVisibility),this.removerVisibility(this.setting())},success:function(a){this.setting.set(a.get("id"))},removerVisibility:function(a){this.remover.toggle(a!=this.params.removed)}});var CZRLayoutSelectMths=CZRLayoutSelectMths||{};$.extend(CZRLayoutSelectMths,{ready:function(){this.setupSelect()},setupSelect:function(a){function b(a){if(!a.id)return a.text;if(_.has(c.params.layouts,a.element.value)){var b=c.params.layouts[a.element.value],d=b.src,e=b.label,f=$('<img src="'+d+'" class="czr-layout-img" title="'+e+'" /><span class="czr-layout-title">'+e+"</span>");return f}}var c=this;$_select=this.container.find("select"),$_select.select2({templateResult:b,templateSelection:b,minimumResultsForSearch:1/0})}}),function(a,b,c){b.extend(CZRBaseControlMths,a.Events),b.extend(CZRModuleMths,a.Events),b.extend(CZRItemMths,a.Events),b.extend(CZRSkopeBaseMths,a.Events),b.extend(CZRSkopeMths,a.Events),b.extend(CZRBaseControlMths,a.CZR_Helpers),b.extend(CZRInputMths,a.CZR_Helpers),b.extend(CZRModuleMths,a.CZR_Helpers),b.extend(CZRSkopeMths,a.CZR_Helpers),a.CZR_skopeBase=a.Class.extend(CZRSkopeBaseMths),a.CZR_skopeSave=a.Class.extend(CZRSkopeSaveMths),a.CZR_skopeReset=a.Class.extend(CZRSkopeResetMths),a.CZR_skope=a.Value.extend(CZRSkopeMths),c.has(a,"HeaderTool")&&(a.czr_HeaderTool=b.extend(!0,{},a.HeaderTool)),a.CZRInput=a.Value.extend(CZRInputMths),a.CZRItem=a.Value.extend(CZRItemMths),a.CZRModule=a.Value.extend(CZRModuleMths),a.CZRDynModule=a.CZRModule.extend(CZRDynModuleMths),a.CZRColumn=a.Value.extend(CZRColumnMths),a.CZRBaseControl=a.Control.extend(CZRBaseControlMths),a.CZRBaseModuleControl=a.CZRBaseControl.extend(CZRBaseModuleControlMths),a.CZRMultiModuleControl=a.CZRBaseModuleControl.extend(CZRMultiModuleControlMths),a.CZRUploadControl=a.Control.extend(CZRUploadMths),a.CZRLayoutControl=a.Control.extend(CZRLayoutSelectMths),a.CZRMultiplePickerControl=a.Control.extend(CZRMultiplePickerMths),b.extend(a.controlConstructor,{czr_upload:a.CZRUploadControl,czr_module:a.CZRBaseModuleControl,czr_multi_module:a.CZRMultiModuleControl,czr_multiple_picker:a.CZRMultiplePickerControl,czr_layouts:a.CZRLayoutControl}),a.czrModuleMap=a.czrModuleMap||{},b.extend(a.czrModuleMap,{czr_widget_areas_module:{mthds:CZRWidgetAreaModuleMths,crud:!0,sektion_allowed:!1,name:"Widget Areas"},czr_social_module:{mthds:CZRSocialModuleMths,crud:!0,name:"Social Icons"},czr_sektion_module:{mthds:CZRSektionMths,crud:!0,name:"Sektions"},czr_fp_module:{mthds:CZRFeaturedPageModuleMths,crud:!0,name:"Featured Pages"},czr_slide_module:{mthds:CZRSlideModuleMths,crud:!0,name:"Slider"},czr_text_module:{mthds:CZRTextModuleMths,crud:!1,multi_item:!1,name:"Simple Text"},czr_text_editor_module:{mthds:CZRTextEditorModuleMths,crud:!1,multi_item:!1,name:"WP Text Editor"},czr_background:{mthds:CZRBodyBgModuleMths,crud:!1,multi_item:!1,name:"Slider"}}),"function"==typeof a.CroppedImageControl&&(a.CZRCroppedImageControl=a.CroppedImageControl.extend(CZRCroppedImageMths),b.extend(a.controlConstructor,{czr_cropped_image:a.CZRCroppedImageControl}))}(wp.customize,jQuery,_),function(a,b,c){var d=serverControlParams.translatedStrings||{};a.czr_CrtlDependenciesReady=b.Deferred(),a.bind("ready",function(){c.has(a,"czr_ctrlDependencies")||(serverControlParams.isSkopOn?a.czr_skopeReady.done(function(){a.czr_ctrlDependencies=new a.CZR_ctrlDependencies,a.czr_CrtlDependenciesReady.resolve()}):(a.czr_ctrlDependencies=new a.CZR_ctrlDependencies,a.czr_CrtlDependenciesReady.resolve()))}),a.CZR_ctrlDependencies=a.Class.extend({dominiDeps:[],initialize:function(){var b=this;if(this.defaultDominusParams={dominus:"",servi:[],visibility:null,actions:null,onSectionExpand:!0},this.dominiDeps=c.extend(this.dominiDeps,this._getControlDeps()),!c.isArray(b.dominiDeps))throw new Error("Visibilities : the dominos dependency array is not an array.");a.czr_activeSectionId.bind(function(d){!c.isEmpty(d)&&a.section.has(d)&&b.setServiDependencies(d)}),a.bind("awaken-section",function(d){serverControlParams.isSkopOn&&c.has(a,"czr_skopeBase")?a.czr_skopeBase.processSilentUpdates({candidates:{},section_id:d.target,refresh:!1}).then(function(){b.setServiDependencies(d.target,d.source)}):b.setServiDependencies(d.target,d.source)}),this._handleFaviconNote()},setServiDependencies:function(d,e,f){var g=this,h=b.Deferred();if(f=f||!1,c.isUndefined(d)||!a.section.has(d))throw new Error("Control Dependencies : the targetSectionId is missing or not registered : "+d);if(a.section(d).czr_ctrlDependenciesReady=a.section(d).czr_ctrlDependenciesReady||b.Deferred(),!f&&"resolved"==a.section(d).czr_ctrlDependenciesReady.state())return h.resolve().promise();c.each(g.dominiDeps,function(b){if(!c.has(b,"dominus")||!c.isString(b.dominus)||c.isEmpty(b.dominus))throw new Error("Control Dependencies : a dominus control id must be a not empty string.");var e=a.CZR_Helpers.build_setId(b.dominus);a.control(e).section()==d&&(b=g._prepareDominusParams(b),g._processDominusCallbacks(b.dominus,b,f).fail(function(){a.consoleLog("self._processDominusCallbacks fail for section "+d),h.reject()}).done(function(){h.resolve()}))});var i=a.CZR_Helpers.getSectionControlIds(d),j=function(a){var b=[];return c.each(g.dominiDeps,function(d){if(!c.has(d,"servi")||!c.isArray(d.servi)||!c.has(d,"dominus")||c.isEmpty(d.dominus))throw new Error("Control Dependencies : wrong params in _getServusDomini.");c.contains(d.servi,a)&&!c.contains(b,d.dominus)&&(d=g._prepareDominusParams(d),b.push(d.dominus))}),c.isArray(b)?b:[]},k=[];return c.each(i,function(a){c.isEmpty(j(a))||(k=c.union(k,j(a)))}),c.each(k,function(b){var c=a.CZR_Helpers.build_setId(b);a.control(c).section()!=d&&e!=a.control(c).section()&&a.trigger("awaken-section",{target:a.control(c).section(),source:d})}),h.always(function(){a.section(d).czr_ctrlDependenciesReady.resolve()}),h.promise()},_deferCallbackForControl:function(d,e,f){var g=b.Deferred();if(c.isEmpty(d)||!c.isString(d))throw new Error("_deferCallbackForControl : the control id is missing.");if(!c.isFunction(e))throw new Error("_deferCallbackForControl : callback must be a funtion.");return f=c.isUndefined(f)||!c.isArray(f)?[]:f,a.control.has(d)?"resolved"==a.control(d).deferred.embedded.state()?b.when(e.apply(null,f)).fail(function(){g.reject()}).done(function(){g.resolve()}):a.control(d).deferred.embedded.then(function(){b.when(e.apply(null,f)).fail(function(){g.reject()}).done(function(){g.resolve()})}):a.control.when(d,function(){a.control(d).deferred.embedded.then(function(){b.when(e.apply(null,f)).fail(function(){g.reject()}).done(function(){g.resolve()})})}),g.promise()},_processDominusCallbacks:function(d,e,f){var g=this,h=a.CZR_Helpers.build_setId(d),i=a(h),j=b.Deferred(),k=!1;return c.each(e.servi,function(b){if(a.control.has(a.CZR_Helpers.build_setId(b))){var d=function(a,b,d,e){var f=arguments;c.each(d,function(a,b){switch(b){case"visibility":g._setVisibility.apply(null,f);break;case"actions":c.isFunction(a)&&a.apply(null,f)}})},f=function(c){c=c||i();var f=a.CZR_Helpers.build_setId(b);g._deferCallbackForControl(f,d,[c,b,e]).always(function(){k=!0}).fail(function(){j.reject()}).done(function(){j.resolve()})};f(),c.has(i,"czr_visibilityServi")||(i.czr_visibilityServi=new a.Value([]));var h=i.czr_visibilityServi();c.contains(h,b)||(i.bind(function(a){f(a)}),i.czr_visibilityServi(c.union(h,[b])))}}),k?j.promise():j.resolve().promise()},_setVisibility:function(b,d,e,f){var g=a.CZR_Helpers.build_setId(d),h=e.visibility(b,d,e.dominus);if(f=f||!1,c.isBoolean(h)&&("unchanged"!=h||f)){var i=function(){a.state.has("silent-update-processing")&&!a.state("silent-update-processing")()&&(a.control(g,function(a){var b={duration:"fast",completeCallback:function(){},unchanged:!1};c.has(a,"active")&&(h=h&&a.active()),c.has(a,"defaultActiveArguments")&&(b=control.defaultActiveArguments),a.onChangeActive(h,a.defaultActiveArguments)}),a.state("silent-update-processing").unbind(i))};a.state.has("silent-update-processing")&&a.state("silent-update-processing")()?a.state("silent-update-processing").bind(i):i()}},_getControlDeps:function(){return{}},_prepareDominusParams:function(b){var d=this,e={};if(!c.isObject(b))throw new Error("Visibilities : a dominus param definition must be an object.");if(!c.has(b,"visibility")&&!c.has(b,"actions"))throw new Error("Visibilities : a dominus definition must include a visibility or an actions callback.");if(!c.has(b,"dominus")||!c.isString(b.dominus)||c.isEmpty(b.dominus))throw new Error("Visibilities : a dominus control id must be a not empty string.");var f=a.CZR_Helpers.build_setId(b.dominus);if(!a.control.has(f))throw new Error("Visibilities : a dominus control id is not registered : "+f);if(!c.has(b,"servi")||c.isUndefined(b.servi)||!c.isArray(b.servi)||c.isEmpty(b.servi))throw new Error("Visibilities : servi must be set as an array not empty.");return c.each(d.defaultDominusParams,function(a,d){var f=b[d];switch(d){case"visibility":if(!c.isUndefined(f)&&!c.isEmpty(f)&&!c.isFunction(f))throw new Error("Visibilities : a dominus visibility callback must be a function : "+b.dominus);break;case"actions":if(!c.isUndefined(f)&&!c.isEmpty(f)&&!c.isFunction(f))throw new Error("Visibilities : a dominus actions callback must be a function : "+b.dominus);break;case"onSectionExpand":if(!c.isUndefined(f)&&!c.isEmpty(f)&&!c.isBoolean(f))throw new Error("Visibilities : a dominus onSectionExpand param must be a boolean : "+b.dominus)}e[d]=f}),e},_handleFaviconNote:function(){var b=this,c=a.CZR_Helpers.build_setId(serverControlParams.faviconOptionName);if(!(!a.has("site_icon")||!a.control("site_icon")||a.has(c)&&0===+a(c)()||+a("site_icon")()>0)){var e=a.control("site_icon").params.description;_newDes=["<strong>",d.faviconNote||"","</strong><br/><br/>"].join("")+e,b._printFaviconNote(_newDes),a("site_icon").callbacks.add(function(d){+d>0?(a.control("site_icon").container.find(".description").text(e),a.has(c)&&a(c).set("")):b._printFaviconNote(_newDes)})}},_printFaviconNote:function(b){a.control("site_icon").container.find(".description").html(b)}})}(wp.customize,jQuery,_),function(a,b){b(function(b){function c(a){var c=a.siblings(".open");0!==c.length&&c.offset().top<0&&b(".wp-full-overlay-sidebar-content").animate({scrollTop:-b("#customize-theme-controls").offset().top-c.height()+a.offset().top+b(".wp-full-overlay-sidebar-content").offset().top},700)}var d=a.customize||d;b(".accordion-section").not(".control-panel").click(function(){c(b(this))}),d.czrSetupCheckbox=function(a,c){b("input[type=checkbox]",d.control(a).container).each(function(){0===b(this).val()||"0"==b(this).val()||"off"==b(this).val()||_.isEmpty(b(this).val())?b(this).prop("checked",!1):b(this).prop("checked",!0),0===b(this).closest('div[class^="icheckbox"]').length&&b(this).iCheck({checkboxClass:"icheckbox_flat-grey",radioClass:"iradio_flat-grey"}).on("ifChanged",function(a){b(this).val(!1===b(this).is(":checked")?0:1),b(a.currentTarget).trigger("change")})})},d.czrSetupSelect=function(a,c){b("select[data-customize-setting-link]",d.control(a).container).not(".no-selecter-js").each(function(){b(this).selecter({})})},d.czrSetupStepper=function(a,c){b('input[type="number"]',d.control(a).container).each(function(){b(this).stepper()})},d.control.each(function(a){_.has(a,"id")&&("widget_"!=a.id.substring(0,"widget_".length)&&"nav_menu"!=a.id.substring(0,"nav_menu".length)&&d.czrSetupCheckbox(a.id),"nav_menu_locations"!=a.id.substring(0,"nav_menu_locations".length)&&d.czrSetupSelect(a.id),d.czrSetupStepper(a.id))}),b(".control-panel-widgets").find(".accordion-section-title").first().length&&b(".control-panel-widgets").find(".accordion-section-title").first().prepend(b("<span/>",{"class":"fa fa-magic"}));var e=function(){var a=b("<span/>",{"class":"customize-controls-home fa fa-home",html:'<span class="screen-reader-text">Home</span>'});b.when(b("#customize-header-actions").append(a)).done(function(){a.keydown(function(a){9!==a.which&&(13===a.which&&this.click(),a.preventDefault())}).on("click.customize-controls-home",function(){d.section.has(d.czr_activeSectionId())?d.section(d.czr_activeSectionId()).expanded(!1):d.section.each(function(a){a.expanded(!1)}),d.panel.each(function(a){a.expanded(!1)})})})};e()})}(wp,jQuery);
|
ha-fire.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Hueman Addons
|
4 |
* Plugin URI: http://presscustomizr.com
|
5 |
* Description: Hueman Theme Addons
|
6 |
-
* Version: 2.0.
|
7 |
* Text Domain: hueman-addons
|
8 |
* Author: Press Customizr
|
9 |
* Author URI: http://presscustomizr.com
|
@@ -38,7 +38,7 @@ if ( ! class_exists( 'HU_AD' ) ) :
|
|
38 |
self::$instance =& $this;
|
39 |
|
40 |
//last version sync
|
41 |
-
$this -> last_theme_version_fmk_sync = '3.3.
|
42 |
$this -> minimal_authorized_theme_version = '3.3.0';
|
43 |
|
44 |
//checks if is customizing : two context, admin and front (preview frame)
|
3 |
* Plugin Name: Hueman Addons
|
4 |
* Plugin URI: http://presscustomizr.com
|
5 |
* Description: Hueman Theme Addons
|
6 |
+
* Version: 2.0.6
|
7 |
* Text Domain: hueman-addons
|
8 |
* Author: Press Customizr
|
9 |
* Author URI: http://presscustomizr.com
|
38 |
self::$instance =& $this;
|
39 |
|
40 |
//last version sync
|
41 |
+
$this -> last_theme_version_fmk_sync = '3.3.4';
|
42 |
$this -> minimal_authorized_theme_version = '3.3.0';
|
43 |
|
44 |
//checks if is customizing : two context, admin and front (preview frame)
|
lang/en_US.po
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
-
"Project-Id-Version: Hueman Addons v2.0.
|
4 |
"POT-Creation-Date: 2016-12-19 18:13+0100\n"
|
5 |
"PO-Revision-Date: 2016-12-19 18:14+0100\n"
|
6 |
"Last-Translator: \n"
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
+
"Project-Id-Version: Hueman Addons v2.0.6\n"
|
4 |
"POT-Creation-Date: 2016-12-19 18:13+0100\n"
|
5 |
"PO-Revision-Date: 2016-12-19 18:14+0100\n"
|
6 |
"Last-Translator: \n"
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: https://wordpress.org/plugins/hueman-addons/
|
|
5 |
Tags: hueman theme, hueman
|
6 |
Requires at least: 3.4
|
7 |
Tested up to: 4.7
|
8 |
-
Stable tag: 2.0.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -37,6 +37,9 @@ The plugin has been designed specifically for the Hueman WordPress theme. Lightw
|
|
37 |
|
38 |
|
39 |
== Changelog ==
|
|
|
|
|
|
|
40 |
= 2.0.5 : December 28th, 2016 =
|
41 |
* fixed : customizer panel doesn't scroll down fully
|
42 |
* fixed : customizer freezing on Safari 10.0.2
|
5 |
Tags: hueman theme, hueman
|
6 |
Requires at least: 3.4
|
7 |
Tested up to: 4.7
|
8 |
+
Stable tag: 2.0.6
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
37 |
|
38 |
|
39 |
== Changelog ==
|
40 |
+
= 2.0.6 January 4th 2017 =
|
41 |
+
* fixed : customizer not loading when deprecated link widget is enabled
|
42 |
+
|
43 |
= 2.0.5 : December 28th, 2016 =
|
44 |
* fixed : customizer panel doesn't scroll down fully
|
45 |
* fixed : customizer freezing on Safari 10.0.2
|