Current Path : /home/theafprt/fnf.group/wp-content/plugins/wp-smush-pro/app/assets/js/ |
Current File : //home/theafprt/fnf.group/wp-content/plugins/wp-smush-pro/app/assets/js/smush-admin.min.js |
!function(e){var t={};function s(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,s),n.l=!0,n.exports}s.m=e,s.c=t,s.d=function(e,t,i){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(s.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)s.d(i,n,function(t){return e[t]}.bind(null,n));return i},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="",s(s.s=12)}([function(e,t,s){"use strict";function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var s=0;s<t.length;s++){var i=t[s];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var r=0,a=function(){function e(t,s){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"media";n(this,e),this.errors=[];var r=jQuery(".bulk-smush-wrapper .sui-progress-state-text");this.smushed=parseInt(r.find("span:first-child").html()),this.total=parseInt(r.find("span:last-child").html()),this.skip_resmush=!(void 0===t.data("smush")||!t.data("smush")),this.button=jQuery(t[0]),this.is_bulk=!!i(s)&&s,this.url=ajaxurl,this.log=jQuery(".smush-final-log"),this.deferred=jQuery.Deferred(),this.deferred.errors=[];var a=0<wp_smushit_data.resmush.length&&!this.skip_resmush?wp_smushit_data.unsmushed.length>0?wp_smushit_data.resmush.concat(wp_smushit_data.unsmushed):wp_smushit_data.resmush:wp_smushit_data.unsmushed;return"object"===i(a)?this.ids=a.filter((function(e,t,s){return t===s.indexOf(e)})):this.ids=a,this.is_bulk_resmush=0<wp_smushit_data.resmush.length&&!this.skip_resmush,this.status=this.button.parent().prev(".smush-status"),this.smush_type=o,this.single_ajax_suffix="nextgen"===this.smush_type?"smush_manual_nextgen":"wp_smushit_manual",this.bulk_ajax_suffix="nextgen"===this.smush_type?"wp_smushit_nextgen_bulk":"wp_smushit_bulk",this.url=this.is_bulk?e.smushAddParams(this.url,{action:this.bulk_ajax_suffix}):e.smushAddParams(this.url,{action:this.single_ajax_suffix}),this.start(),this.run(),this.bindDeferredEvents(),this.cancelAjax(),this.deferred}var t,s,a;return t=e,a=[{key:"smushAddParams",value:function(e,t){return jQuery.isEmptyObject(t)||(e+=(e.indexOf("?")>=0?"&":"?")+jQuery.param(t)),e}},{key:"membershipValidity",value:function(e){var t=jQuery("#wp-smush-invalid-member");void 0!==e&&void 0!==e.show_warning&&t.length>0&&(e.show_warning?t.show():t.hide())}},{key:"ajax",value:function(e,t,s,i){var n=jQuery.param({is_bulk_resmush:e,attachment_id:t,_nonce:i});return jQuery.ajax({type:"GET",data:n,url:s,timeout:wp_smushit_data.timeout,dataType:"json"})}},{key:"setProSavings",value:function(){var e=wp_smushit_data.savings_percent>0?wp_smushit_data.savings_percent:0,t=wp_smushit_data.savings_bytes>0?wp_smushit_data.savings_bytes:0,s=2.22058824;e>49&&(s=1.22054412),e>0&&(e*=s,t*=s),wp_smushit_data.pro_savings={percent:WP_Smush.helpers.precise_round(e,1),savings_bytes:WP_Smush.helpers.formatBytes(t,1)}}},{key:"updateStats",value:function(t){var s=void 0!==t&&"nextgen"===t,i=0;wp_smushit_data.savings_bytes=parseInt(wp_smushit_data.size_before)-parseInt(wp_smushit_data.size_after);var n=WP_Smush.helpers.formatBytes(wp_smushit_data.savings_bytes,1),o=jQuery(".wp-smush-savings .wp-smush-stats-human");s?o.html(n):(o.html(WP_Smush.helpers.getFormatFromString(n)),jQuery(".sui-summary-large.wp-smush-stats-human").html(WP_Smush.helpers.getSizeFromString(n))),wp_smushit_data.savings_percent=WP_Smush.helpers.precise_round(parseInt(wp_smushit_data.savings_bytes)/parseInt(wp_smushit_data.size_before)*100,1),isNaN(wp_smushit_data.savings_percent)||jQuery(".wp-smush-savings .wp-smush-stats-percent").html(wp_smushit_data.savings_percent),void 0!==wp_smushit_data.savings_bytes&&void 0!==wp_smushit_data.savings_resize&&(i=parseInt(wp_smushit_data.savings_bytes)-parseInt(wp_smushit_data.savings_resize))>0&&jQuery("li.super-smush-attachments span.smushed-savings").html(WP_Smush.helpers.formatBytes(i,1)),s?jQuery(".sui-summary-details span.wp-smush-total-optimised").html(wp_smushit_data.count_images):jQuery("span.smushed-items-count span.wp-smush-count-total span.wp-smush-total-optimised").html(wp_smushit_data.count_images),jQuery("span.smushed-items-count span.wp-smush-count-resize-total span.wp-smush-total-optimised").html(wp_smushit_data.count_resize);var r=jQuery("li.super-smush-attachments .smushed-count");r.length&&void 0!==wp_smushit_data.count_supersmushed&&r.html(wp_smushit_data.count_supersmushed);var a=jQuery(".smush-conversion-savings");if(a.length>0&&void 0!==wp_smushit_data.savings_conversion&&""!==wp_smushit_data.savings_conversion){var u=a.find(".wp-smush-stats");u.length>0&&u.html(WP_Smush.helpers.formatBytes(wp_smushit_data.savings_conversion,1))}var d=jQuery(".smush-resize-savings");if(d.length>0&&void 0!==wp_smushit_data.savings_resize&&""!==wp_smushit_data.savings_resize){var l=parseInt(wp_smushit_data.savings_resize),c=d.find(".wp-smush-stats"),h=d.find(".wp-smush-stats-label-message");l>0&&c.length>0&&(h.length>0&&h.hide(),c.html(WP_Smush.helpers.formatBytes(wp_smushit_data.savings_resize,1)))}if(e.setProSavings(),void 0!==wp_smushit_data.pro_savings){var p=jQuery(".smush-avg-pro-savings");if(p.length>0){var f=p.find(".wp-smush-stats-percent"),m=p.find(".wp-smush-stats-human");f.length>0&&void 0!==wp_smushit_data.pro_savings.percent&&""!==wp_smushit_data.pro_savings.percent&&f.html(wp_smushit_data.pro_savings.percent),m.length>0&&void 0!==wp_smushit_data.pro_savings.savings_bytes&&""!==wp_smushit_data.pro_savings.savings_bytes&&m.html(wp_smushit_data.pro_savings.savings_bytes)}}var g=jQuery(".smush-sidenav .wp-smush-remaining-count");if(g.length){var v=0;void 0!==wp_smushit_data.unsmushed&&wp_smushit_data.unsmushed.length>0&&(v+=wp_smushit_data.unsmushed.length),void 0!==wp_smushit_data.resmush&&wp_smushit_data.resmush.length>0&&(v+=wp_smushit_data.resmush.length),v>0?g.html(v):(jQuery(".sui-summary-smush .smush-stats-icon").addClass("sui-hidden"),g.removeClass("sui-tag sui-tag-warning").html(""))}}},{key:"updateImageStats",value:function(e){if(0!==e){var t=jQuery(".attachment-info .file-size");if(t.contents().filter((function(){return 3===this.nodeType})).text()!==" "+e){var s=t.contents().filter((function(){return 1===this.nodeType})).text();t.html("<strong>"+s+"</strong> "+e)}}}},{key:"updateLocalizedStats",value:function(e,t){void 0!==window.wp_smushit_data&&("media"===t?(wp_smushit_data.count_images=parseInt(wp_smushit_data.count_images)+parseInt(e.count),e.is_lossy&&(wp_smushit_data.count_supersmushed=parseInt(wp_smushit_data.count_supersmushed)+1),wp_smushit_data.savings_resize=void 0!==e.savings_resize.bytes?parseInt(wp_smushit_data.savings_resize)+parseInt(e.savings_resize.bytes):parseInt(wp_smushit_data.savings_resize),wp_smushit_data.count_resize=void 0!==e.savings_resize.bytes?parseInt(wp_smushit_data.count_resize)+1:wp_smushit_data.count_resize,wp_smushit_data.savings_conversion=void 0!==e.savings_conversion&&void 0!==e.savings_conversion.bytes?parseInt(wp_smushit_data.savings_conversion)+parseInt(e.savings_conversion.bytes):parseInt(wp_smushit_data.savings_conversion)):"directory_smush"===t?wp_smushit_data.count_images=parseInt(wp_smushit_data.count_images)+1:"nextgen"===t&&(wp_smushit_data.count_supersmushed=parseInt(wp_smushit_data.count_supersmushed)+1,wp_smushit_data.count_images=parseInt(wp_smushit_data.count_images)+parseInt(e.count)),e.size_before>e.size_after&&(wp_smushit_data.size_before=void 0!==e.size_before?parseInt(wp_smushit_data.size_before)+parseInt(e.size_before):parseInt(wp_smushit_data.size_before),wp_smushit_data.size_after=void 0!==e.size_after?parseInt(wp_smushit_data.size_after)+parseInt(e.size_after):parseInt(wp_smushit_data.size_after)),void 0!==e.savings_resize&&(wp_smushit_data.size_before=void 0!==e.savings_resize.size_before?parseInt(wp_smushit_data.size_before)+parseInt(e.savings_resize.size_before):parseInt(wp_smushit_data.size_before),wp_smushit_data.size_after=void 0!==e.savings_resize.size_after?parseInt(wp_smushit_data.size_after)+parseInt(e.savings_resize.size_after):parseInt(wp_smushit_data.size_after)),void 0!==e.savings_conversion&&(wp_smushit_data.size_before=void 0!==e.savings_conversion.size_before?parseInt(wp_smushit_data.size_before)+parseInt(e.savings_conversion.size_before):parseInt(wp_smushit_data.size_before),wp_smushit_data.size_after=void 0!==e.savings_conversion.size_after?parseInt(wp_smushit_data.size_after)+parseInt(e.savings_conversion.size_after):parseInt(wp_smushit_data.size_after)))}},{key:"prepareErrorRow",value:function(e,t,s,i,n){var o='<div class="smush-bulk-error-row"><div class="smush-bulk-image-data">'+(void 0===s?'<i class="sui-icon-photo-picture" aria-hidden="true"></i>':s)+'<span class="smush-image-name">'+("undefined"===t||void 0===t?"undefined":t)+'</span><span class="smush-image-error">'+e+"</span></div>";return"media"===n&&(o=o+'<div class="smush-bulk-image-actions"><button type="button" class="sui-button-icon sui-tooltip sui-tooltip-constrained sui-tooltip-top-right smush-ignore-image" data-tooltip="'+window.wp_smush_msgs.error_ignore+'" data-id="'+i+'"><i class="sui-icon-eye-hide" aria-hidden="true"></i></button></div>'),o+="</div>"}},{key:"updateSmushIds",value:function(e){if(void 0!==wp_smushit_data.unsmushed&&wp_smushit_data.unsmushed.length>0){var t=wp_smushit_data.unsmushed.indexOf(e);t>-1&&wp_smushit_data.unsmushed.splice(t,1)}if(void 0!==wp_smushit_data.resmush&&wp_smushit_data.resmush.length>0){var s=wp_smushit_data.resmush.indexOf(e);s>-1&&wp_smushit_data.resmush.splice(s,1)}}}],(s=[{key:"start",value:function(){this.button.attr("disabled","disabled"),this.button.addClass("wp-smush-started"),this.bulkStart(),this.singleStart()}},{key:"bulkStart",value:function(){this.is_bulk&&(jQuery(".wp-smush-bulk-wrapper").hide(),jQuery(".sui-notice-top").remove(),jQuery(".wp-smush-bulk-progress-bar-wrapper .sui-notice-warning:first-of-type").hide(),0>=jQuery("div.smush-final-log .smush-bulk-error-row").length&&jQuery("div.smush-final-log").hide(),jQuery(".bulk-smush-wrapper .wp-smush-bulk-progress-bar-wrapper").show())}},{key:"singleStart",value:function(){this.is_bulk||(this.button.html('<span class="spinner wp-smush-progress">'+window.wp_smush_msgs.smushing+"</span>"),this.status.removeClass("error"))}},{key:"enableButton",value:function(){this.button.removeAttr("disabled"),jQuery(".wp-smush-all").removeAttr("disabled"),jQuery("button.wp-smush-scan, a.wp-smush-lossy-enable, button.wp-smush-resize-enable, button#wp-smush-save-settings").removeAttr("disabled")}},{key:"singleDone",value:function(){if(!this.is_bulk){var t=this;this.button.html(window.wp_smush_msgs.all_done),this.request.done((function(s){if(void 0!==s.data){var i=t.status.parent();e.membershipValidity(s.data),s.success?i.html(s.data):(t.status.addClass("error"),t.status.html(s.data.error_msg),t.button.html(window.smush_vars.strings.stats_label)),e.updateImageStats(s.data.new_size)}t.enableButton()})).fail((function(e){t.status.html(e.data),t.status.addClass("error"),t.enableButton()}))}}},{key:"syncStats",value:function(){var t=jQuery("div.wp-smush-bulk-progress-bar-wrapper div.wp-smush-count.tc"),s=t.html();t.html(window.wp_smush_msgs.sync_stats),jQuery.ajax({type:"GET",url:this.url,data:{action:"get_stats"},success:function(t){t&&void 0!==t&&(t=t.data,jQuery.extend(wp_smushit_data,{count_images:t.count_images,count_smushed:t.count_smushed,count_total:t.count_total,count_resize:t.count_resize,count_supersmushed:t.count_supersmushed,savings_bytes:t.savings_bytes,savings_conversion:t.savings_conversion,savings_resize:t.savings_resize,size_before:t.size_before,size_after:t.size_after}),e.updateStats(this.smush_type))}}).always((function(){return t.html(s)}))}},{key:"bulkDone",value:function(){if(this.is_bulk){this.enableButton();var e=jQuery(".sui-summary-smush .smush-stats-icon");if(0===this.ids.length)e.addClass("sui-hidden"),jQuery(".bulk-smush-wrapper .wp-smush-all-done, .wp-smush-pagespeed-recommendation").show(),jQuery(".wp-smush-bulk-wrapper").hide(),jQuery(".wp-smush-bulk-progress-bar-wrapper").hide();else{e.removeClass("sui-icon-loader sui-loading sui-hidden").addClass("sui-icon-info sui-warning");var t=jQuery(".bulk-smush-wrapper .wp-smush-resmush-notice");t.length>0?t.show():jQuery(".bulk-smush-wrapper .wp-smush-remaining").show()}jQuery(".wp-resmush.wp-smush-action, .wp-smush-scan").removeAttr("disabled")}}},{key:"freeExceeded",value:function(){var e=jQuery(".wp-smush-bulk-progress-bar-wrapper");e.addClass("wp-smush-exceed-limit"),e.find(".sui-progress-block .wp-smush-cancel-bulk").addClass("sui-hidden"),e.find(".sui-progress-block .wp-smush-all").removeClass("sui-hidden"),e.find("i.sui-icon-loader").addClass("sui-icon-info").removeClass("sui-icon-loader").removeClass("sui-loading"),document.getElementById("bulk-smush-resume-button").classList.remove("sui-hidden")}},{key:"updateRemainingCount",value:function(){if(this.is_bulk_resmush){var e=jQuery(".wp-smush-resmush-notice .wp-smush-remaining-count");e.length&&void 0!==this.ids&&e.html(this.ids.length)}else{var t=jQuery(".bulk-smush-wrapper .wp-smush-remaining-count");t.length&&void 0!==this.ids&&t.html(this.ids.length)}var s=jQuery(".smush-sidenav .wp-smush-remaining-count");s.length&&void 0!==this.ids&&(this.ids.length>0?s.html(this.ids.length):(jQuery(".sui-summary-smush .smush-stats-icon").addClass("sui-hidden"),s.removeClass("sui-tag sui-tag-warning").html("")))}},{key:"updateProgress",value:function(t){if(this.is_bulk_resmush||this.is_bulk){var s=0;t&&void 0!==t.data&&void 0!==t.data.stats&&e.updateLocalizedStats(t.data.stats,this.smush_type),this.is_bulk_resmush?(t.success&&(wp_smushit_data.resmush.length>0?jQuery(".wp-smush-images-remaining").html(wp_smushit_data.resmush.length):0===wp_smushit_data.resmush.length&&0===this.ids.length&&(jQuery(".bulk-resmush-wrapper .wp-smush-all-done, .wp-smush-pagespeed-recommendation").removeClass("sui-hidden"),jQuery(".wp-smush-resmush-wrap, .wp-smush-bulk-progress-bar-wrapper").hide())),void 0!==this.ids&&void 0!==this.total&&this.total>0&&(s=(this.smushed+this.errors.length)/this.total*100)):s=(this.smushed+this.errors.length)/this.total*100,0===this.ids.length&&("nextgen"!==this.smush_type&&this.syncStats(),jQuery(".bulk-smush-wrapper .wp-smush-all-done, .wp-smush-pagespeed-recommendation").show(),jQuery(".wp-smush-bulk-wrapper").hide()),this.updateRemainingCount(),this._updateProgress(this.smushed+this.errors.length,WP_Smush.helpers.precise_round(s,1)),e.updateStats(this.smush_type)}}},{key:"_updateProgress",value:function(e,t){(this.is_bulk||this.is_bulk_resmush)&&(jQuery("span.wp-smush-images-percent").html(t+"%"),jQuery(".bulk-smush-wrapper .wp-smush-progress-inner").css("width",t+"%"),jQuery(".bulk-smush-wrapper .sui-progress-state-text").find("span:first-child").html(e).find("span:last-child").html(this.total))}},{key:"continue",value:function(){var e=this.button.attr("continue_smush");return void 0===e&&(e=!0),"false"!==e&&e||(e=!1),e&&this.ids.length>0&&this.is_bulk}},{key:"callAjax",value:function(){if(0!==r&&void 0!==r&&10>performance.now()-r)return this.freeExceeded(),this.deferred;var t="";this.current_id=this.is_bulk?this.ids.shift():this.button.data("id"),e.updateSmushIds(this.current_id);var s=this.button.parent().find("#_wp_smush_nonce");s&&(t=s.val());var i=this;return this.request=e.ajax(this.is_bulk_resmush,this.current_id,this.url,t).done((function(t){if(void 0===t.success||void 0!==t.success&&!1===t.success&&void 0!==t.data&&"limit_exceeded"!==t.data.error){i.errors.push(i.current_id);var s=e.prepareErrorRow(t.data.error_message,t.data.file_name,t.data.thumbnail,i.current_id,i.smush_type);i.log.show(),i.errors.length>5?jQuery(".smush-bulk-errors-actions").removeClass("sui-hidden"):i.log.find(".smush-bulk-errors").append(s)}else void 0!==t.success&&t.success&&i.smushed++;e.membershipValidity(t.data),void 0!==t.data&&"limit_exceeded"===t.data.error&&"resolved"!==i.deferred.state()?(document.getElementById("bulk_smush_warning").classList.remove("sui-hidden"),i.button.attr("continue_smush",!1),wp_smushit_data.unsmushed.unshift(i.current_id),i.ids.unshift(i.current_id),r=performance.now(),i.freeExceeded()):i.is_bulk?i.updateProgress(t):0===i.ids.length&&i.syncStats(),i.singleDone()})).always((function(){i.continue()&&i.is_bulk?i.callAjax():i.deferred.resolve()})),this.deferred.errors=this.errors,this.deferred}},{key:"run",value:function(){this.is_bulk&&this.ids.length>0&&this.callAjax(),this.is_bulk||this.callAjax()}},{key:"bindDeferredEvents",value:function(){var e=this;this.deferred.done((function(){if(e.button.removeAttr("continue_smush"),e.errors.length){var t=window.wp_smush_msgs.error_in_bulk.replace("{{errors}}",e.errors.length).replace("{{total}}",e.total).replace("{{smushed}}",e.smushed);jQuery(".wp-smush-all-done").addClass("sui-notice-warning").removeClass("sui-notice-success").find("p").html(t)}e.bulkDone(),jQuery(".wp-smush-all:not(.wp-smush-finished), .wp-smush-scan").removeAttr("disabled")}))}},{key:"cancelAjax",value:function(){var t=this;jQuery(".wp-smush-cancel-bulk").on("click",(function(){t.button.attr("continue_smush",!1),t.syncStats(),e.updateStats(this.smush_type),t.request.abort(),t.enableButton(),t.button.removeClass("wp-smush-started"),wp_smushit_data.unsmushed.unshift(t.current_id),jQuery(".wp-smush-bulk-wrapper").show(),jQuery(".wp-smush-bulk-progress-bar-wrapper").hide()}))}}])&&o(t.prototype,s),a&&o(t,a),e}();t.a=a},,function(e,t){e.exports=jQuery},function(e,t,s){var i,n,o; /*! * jquery.fancytree.js * Tree view control with support for lazy loading and much more. * https://github.com/mar10/fancytree/ * * Copyright (c) 2008-2019, Martin Wendt (https://wwWendt.de) * Released under the MIT license * https://github.com/mar10/fancytree/wiki/LicenseInfo * * @version 2.34.0 * @date 2019-12-26T14:16:19Z */n=[s(2),s(17)],void 0===(o="function"==typeof(i=function(e){"use strict";if(!e.ui||!e.ui.fancytree){var t,s,i=null,n=new RegExp(/\.|\//),o=/[&<>"'/]/g,r=/[<>"'/]/g,a={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},u={16:!0,17:!0,18:!0},d={8:"backspace",9:"tab",10:"return",13:"return",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",59:";",61:"=",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},l={16:"shift",17:"ctrl",18:"alt",91:"meta",93:"meta"},c={0:"",1:"left",2:"middle",3:"right"},h="active expanded focus folder lazy radiogroup selected unselectable unselectableIgnore".split(" "),p={},f="columns types".split(" "),m="checkbox expanded extraClasses folder icon iconTooltip key lazy partsel radiogroup refKey selected statusNodeType title tooltip type unselectable unselectableIgnore unselectableStatus".split(" "),g={},v={},_={active:!0,children:!0,data:!0,focus:!0};for(t=0;t<h.length;t++)p[h[t]]=!0;for(t=0;t<m.length;t++)s=m[t],g[s]=!0,s!==s.toLowerCase()&&(v[s.toLowerCase()]=s);return w(e.ui,"Fancytree requires jQuery UI (http://jqueryui.com)"),Date.now||(Date.now=function(){return(new Date).getTime()}),z.prototype={_findDirectChild:function(e){var t,s,i=this.children;if(i)if("string"==typeof e){for(t=0,s=i.length;t<s;t++)if(i[t].key===e)return i[t]}else{if("number"==typeof e)return this.children[e];if(e.parent===this)return e}return null},_setChildren:function(e){w(e&&(!this.children||0===this.children.length),"only init supported"),this.children=[];for(var t=0,s=e.length;t<s;t++)this.children.push(new z(this,e[t]));this.tree._callHook("treeStructureChanged",this.tree,"setChildren")},addChildren:function(t,s){var i,n,o,r,a=this.getFirstChild(),u=this.getLastChild(),d=[];for(e.isPlainObject(t)&&(t=[t]),this.children||(this.children=[]),i=0,n=t.length;i<n;i++)d.push(new z(this,t[i]));if(r=d[0],null==s?this.children=this.children.concat(d):(s=this._findDirectChild(s),w((o=e.inArray(s,this.children))>=0,"insertBefore must be an existing child"),this.children.splice.apply(this.children,[o,0].concat(d))),a&&!s){for(i=0,n=d.length;i<n;i++)d[i].render();a!==this.getFirstChild()&&a.renderStatus(),u!==this.getLastChild()&&u.renderStatus()}else(!this.parent||this.parent.ul||this.tr)&&this.render();return 3===this.tree.options.selectMode&&this.fixSelection3FromEndNodes(),this.triggerModifyChild("add",1===d.length?d[0]:null),r},addClass:function(e){return this.toggleClass(e,!0)},addNode:function(e,t){switch(void 0!==t&&"over"!==t||(t="child"),t){case"after":return this.getParent().addChildren(e,this.getNextSibling());case"before":return this.getParent().addChildren(e,this);case"firstChild":var s=this.children?this.children[0]:null;return this.addChildren(e,s);case"child":case"over":return this.addChildren(e)}w(!1,"Invalid mode: "+t)},addPagingNode:function(t,s){var i,n;if(s=s||"child",!1!==t)return t=e.extend({title:this.tree.options.strings.moreData,statusNodeType:"paging",icon:!1},t),this.partload=!0,this.addNode(t,s);for(i=this.children.length-1;i>=0;i--)"paging"===(n=this.children[i]).statusNodeType&&this.removeChild(n);this.partload=!1},appendSibling:function(e){return this.addNode(e,"after")},applyCommand:function(e,t){return this.tree.applyCommand(e,this,t)},applyPatch:function(t){if(null===t)return this.remove(),S(this);var s,i,n={children:!0,expanded:!0,parent:!0};for(s in t)t.hasOwnProperty(s)&&(i=t[s],n[s]||e.isFunction(i)||(g[s]?this[s]=i:this.data[s]=i));return t.hasOwnProperty("children")&&(this.removeChildren(),t.children&&this._setChildren(t.children)),this.isVisible()&&(this.renderTitle(),this.renderStatus()),t.hasOwnProperty("expanded")?this.setExpanded(t.expanded):S(this)},collapseSiblings:function(){return this.tree._callHook("nodeCollapseSiblings",this)},copyTo:function(e,t,s){return e.addNode(this.toDict(!0,s),t)},countChildren:function(e){var t,s,i,n=this.children;if(!n)return 0;if(i=n.length,!1!==e)for(t=0,s=i;t<s;t++)i+=n[t].countChildren();return i},debug:function(e){this.tree.options.debugLevel>=4&&(Array.prototype.unshift.call(arguments,this.toString()),y("log",arguments))},discard:function(){return this.warn("FancytreeNode.discard() is deprecated since 2014-02-16. Use .resetLazy() instead."),this.resetLazy()},discardMarkup:function(e){var t=e?"nodeRemoveMarkup":"nodeRemoveChildMarkup";this.tree._callHook(t,this)},error:function(e){this.tree.options.debugLevel>=1&&(Array.prototype.unshift.call(arguments,this.toString()),y("error",arguments))},findAll:function(t){t=e.isFunction(t)?t:T(t);var s=[];return this.visit((function(e){t(e)&&s.push(e)})),s},findFirst:function(t){t=e.isFunction(t)?t:T(t);var s=null;return this.visit((function(e){if(t(e))return s=e,!1})),s},findRelatedNode:function(e,t){return this.tree.findRelatedNode(this,e,t)},_changeSelectStatusAttrs:function(e){var t=!1,s=this.tree.options,n=i.evalOption("unselectable",this,this,s,!1),o=i.evalOption("unselectableStatus",this,this,s,void 0);switch(n&&null!=o&&(e=o),e){case!1:t=this.selected||this.partsel,this.selected=!1,this.partsel=!1;break;case!0:t=!this.selected||!this.partsel,this.selected=!0,this.partsel=!0;break;case void 0:t=this.selected||!this.partsel,this.selected=!1,this.partsel=!0;break;default:w(!1,"invalid state: "+e)}return t&&this.renderStatus(),t},fixSelection3AfterClick:function(e){var t=this.isSelected();this.visit((function(e){if(e._changeSelectStatusAttrs(t),e.radiogroup)return"skip"})),this.fixSelection3FromEndNodes(e)},fixSelection3FromEndNodes:function(e){var t=this.tree.options;w(3===t.selectMode,"expected selectMode 3"),function e(s){var n,o,r,a,u,d,l,c,h=s.children;if(h&&h.length){for(d=!0,l=!1,n=0,o=h.length;n<o;n++)a=e(r=h[n]),i.evalOption("unselectableIgnore",r,r,t,!1)||(!1!==a&&(l=!0),!0!==a&&(d=!1));u=!!d||!!l&&void 0}else u=null==(c=i.evalOption("unselectableStatus",s,s,t,void 0))?!!s.selected:!!c;return s.partsel&&!s.selected&&s.lazy&&null==s.children&&(u=void 0),s._changeSelectStatusAttrs(u),u}(this),this.visitParents((function(e){var s,n,o,r,a,u=e.children,d=!0,l=!1;for(s=0,n=u.length;s<n;s++)o=u[s],i.evalOption("unselectableIgnore",o,o,t,!1)||(((r=null==(a=i.evalOption("unselectableStatus",o,o,t,void 0))?!!o.selected:!!a)||o.partsel)&&(l=!0),r||(d=!1));r=!!d||!!l&&void 0,e._changeSelectStatusAttrs(r)}))},fromDict:function(t){for(var s in t)g[s]?this[s]=t[s]:"data"===s?e.extend(this.data,t.data):e.isFunction(t[s])||_[s]||(this.data[s]=t[s]);t.children&&(this.removeChildren(),this.addChildren(t.children)),this.renderTitle()},getChildren:function(){if(void 0!==this.hasChildren())return this.children},getFirstChild:function(){return this.children?this.children[0]:null},getIndex:function(){return e.inArray(this,this.parent.children)},getIndexHier:function(t,s){t=t||".";var i,n=[];return e.each(this.getParentList(!1,!0),(function(e,t){i=""+(t.getIndex()+1),s&&(i=("0000000"+i).substr(-s)),n.push(i)})),n.join(t)},getKeyPath:function(e){var t=this.tree.options.keyPathSeparator;return t+this.getPath(!e,"key",t)},getLastChild:function(){return this.children?this.children[this.children.length-1]:null},getLevel:function(){for(var e=0,t=this.parent;t;)e++,t=t.parent;return e},getNextSibling:function(){if(this.parent){var e,t,s=this.parent.children;for(e=0,t=s.length-1;e<t;e++)if(s[e]===this)return s[e+1]}return null},getParent:function(){return this.parent},getParentList:function(e,t){for(var s=[],i=t?this:this.parent;i;)(e||i.parent)&&s.unshift(i),i=i.parent;return s},getPath:function(t,s,i){t=!1!==t,s=s||"title",i=i||"/";var n,o=[],r=e.isFunction(s);return this.visitParents((function(e){e.parent&&(n=r?s(e):e[s],o.unshift(n))}),t),o.join(i)},getPrevSibling:function(){if(this.parent){var e,t,s=this.parent.children;for(e=1,t=s.length;e<t;e++)if(s[e]===this)return s[e-1]}return null},getSelectedNodes:function(e){var t=[];return this.visit((function(s){if(s.selected&&(t.push(s),!0===e))return"skip"})),t},hasChildren:function(){if(this.lazy){if(null==this.children)return;if(0===this.children.length)return!1;if(1===this.children.length&&this.children[0].isStatusNode())return;return!0}return!(!this.children||!this.children.length)},hasClass:function(e){return(" "+(this.extraClasses||"")+" ").indexOf(" "+e+" ")>=0},hasFocus:function(){return this.tree.hasFocus()&&this.tree.focusNode===this},info:function(e){this.tree.options.debugLevel>=3&&(Array.prototype.unshift.call(arguments,this.toString()),y("info",arguments))},isActive:function(){return this.tree.activeNode===this},isBelowOf:function(e){return this.getIndexHier(".",5)>e.getIndexHier(".",5)},isChildOf:function(e){return this.parent&&this.parent===e},isDescendantOf:function(t){if(!t||t.tree!==this.tree)return!1;for(var s=this.parent;s;){if(s===t)return!0;s===s.parent&&e.error("Recursive parent link: "+s),s=s.parent}return!1},isExpanded:function(){return!!this.expanded},isFirstSibling:function(){var e=this.parent;return!e||e.children[0]===this},isFolder:function(){return!!this.folder},isLastSibling:function(){var e=this.parent;return!e||e.children[e.children.length-1]===this},isLazy:function(){return!!this.lazy},isLoaded:function(){return!this.lazy||void 0!==this.hasChildren()},isLoading:function(){return!!this._isLoading},isRoot:function(){return this.isRootNode()},isPartsel:function(){return!this.selected&&!!this.partsel},isPartload:function(){return!!this.partload},isRootNode:function(){return this.tree.rootNode===this},isSelected:function(){return!!this.selected},isStatusNode:function(){return!!this.statusNodeType},isPagingNode:function(){return"paging"===this.statusNodeType},isTopLevel:function(){return this.tree.rootNode===this.parent},isUndefined:function(){return void 0===this.hasChildren()},isVisible:function(){var e,t,s=this.tree.enableFilter,i=this.getParentList(!1,!1);if(s&&!this.match&&!this.subMatchCount)return!1;for(e=0,t=i.length;e<t;e++)if(!i[e].expanded)return!1;return!0},lazyLoad:function(e){return this.warn("FancytreeNode.lazyLoad() is deprecated since 2014-02-16. Use .load() instead."),this.load(e)},load:function(e){var t,s,i=this,n=this.isExpanded();return w(this.isLazy(),"load() requires a lazy node"),e||this.isUndefined()?(this.isLoaded()&&this.resetLazy(),!1===(s=this.tree._triggerNodeEvent("lazyLoad",this))?S(this):(w("boolean"!=typeof s,"lazyLoad event must return source in data.result"),t=this.tree._callHook("nodeLoadChildren",this,s),n?(this.expanded=!0,t.always((function(){i.render()}))):t.always((function(){i.renderStatus()})),t)):S(this)},makeVisible:function(t){var s,i=this,n=[],o=new e.Deferred,r=this.getParentList(!1,!1),a=r.length,u=!(t&&!0===t.noAnimation),d=!(t&&!1===t.scrollIntoView);for(s=a-1;s>=0;s--)n.push(r[s].setExpanded(!0,t));return e.when.apply(e,n).done((function(){d?i.scrollIntoView(u).done((function(){o.resolve()})):o.resolve()})),o.promise()},moveTo:function(t,s,i){void 0===s||"over"===s?s="child":"firstChild"===s&&(t.children&&t.children.length?(s="before",t=t.children[0]):s="child");var n,o=this.tree,r=this.parent,a="child"===s?t:t.parent;if(this!==t){if(this.parent?a.isDescendantOf(this)&&e.error("Cannot move a node to its own descendant"):e.error("Cannot move system root"),a!==r&&r.triggerModifyChild("remove",this),1===this.parent.children.length){if(this.parent===a)return;this.parent.children=this.parent.lazy?[]:null,this.parent.expanded=!1}else w((n=e.inArray(this,this.parent.children))>=0,"invalid source parent"),this.parent.children.splice(n,1);if(this.parent=a,a.hasChildren())switch(s){case"child":a.children.push(this);break;case"before":w((n=e.inArray(t,a.children))>=0,"invalid target parent"),a.children.splice(n,0,this);break;case"after":w((n=e.inArray(t,a.children))>=0,"invalid target parent"),a.children.splice(n+1,0,this);break;default:e.error("Invalid mode "+s)}else a.children=[this];i&&t.visit(i,!0),a===r?a.triggerModifyChild("move",this):a.triggerModifyChild("add",this),o!==t.tree&&(this.warn("Cross-tree moveTo is experimental!"),this.visit((function(e){e.tree=t.tree}),!0)),o._callHook("treeStructureChanged",o,"moveTo"),r.isDescendantOf(a)||r.render(),a.isDescendantOf(r)||a===r||a.render()}},navigate:function(t,s){var i,n=e.ui.keyCode;switch(t){case"left":case n.LEFT:if(this.expanded)return this.setExpanded(!1);break;case"right":case n.RIGHT:if(!this.expanded&&(this.children||this.lazy))return this.setExpanded()}if(i=this.findRelatedNode(t)){try{i.makeVisible({scrollIntoView:!1})}catch(e){}return!1===s?(i.setFocus(),S()):i.setActive()}return this.warn("Could not find related node '"+t+"'."),S()},remove:function(){return this.parent.removeChild(this)},removeChild:function(e){return this.tree._callHook("nodeRemoveChild",this,e)},removeChildren:function(){return this.tree._callHook("nodeRemoveChildren",this)},removeClass:function(e){return this.toggleClass(e,!1)},render:function(e,t){return this.tree._callHook("nodeRender",this,e,t)},renderTitle:function(){return this.tree._callHook("nodeRenderTitle",this)},renderStatus:function(){return this.tree._callHook("nodeRenderStatus",this)},replaceWith:function(s){var i,n=this.parent,o=e.inArray(this,n.children),r=this;return w(this.isPagingNode(),"replaceWith() currently requires a paging status node"),(i=this.tree._callHook("nodeLoadChildren",this,s)).done((function(e){var s=r.children;for(t=0;t<s.length;t++)s[t].parent=n;n.children.splice.apply(n.children,[o+1,0].concat(s)),r.children=null,r.remove(),n.render()})).fail((function(){r.setExpanded()})),i},resetLazy:function(){this.removeChildren(),this.expanded=!1,this.lazy=!0,this.children=void 0,this.renderStatus()},scheduleAction:function(t,s){this.tree.timer&&(clearTimeout(this.tree.timer),this.tree.debug("clearTimeout(%o)",this.tree.timer)),this.tree.timer=null;var i=this;switch(t){case"cancel":break;case"expand":this.tree.timer=setTimeout((function(){i.tree.debug("setTimeout: trigger expand"),i.setExpanded(!0)}),s);break;case"activate":this.tree.timer=setTimeout((function(){i.tree.debug("setTimeout: trigger activate"),i.setActive(!0)}),s);break;default:e.error("Invalid mode "+t)}},scrollIntoView:function(t,s){if(void 0!==s&&(i=s).tree&&void 0!==i.statusNodeType)throw Error("scrollIntoView() with 'topNode' option is deprecated since 2014-05-08. Use 'options.topNode' instead.");var i,n=e.extend({effects:!0===t?{duration:200,queue:!1}:t,scrollOfs:this.tree.options.scrollOfs,scrollParent:this.tree.options.scrollParent,topNode:null},s),o=n.scrollParent,r=this.tree.$container,a=r.css("overflow-y");o?o.jquery||(o=e(o)):o=this.tree.tbody?r.scrollParent():"scroll"===a||"auto"===a?r:r.scrollParent(),o[0]!==document&&o[0]!==document.body||(this.debug("scrollIntoView(): normalizing scrollParent to 'window':",o[0]),o=e(window));var u,d,l,c=new e.Deferred,h=this,p=e(this.span).height(),f=n.scrollOfs.top||0,m=n.scrollOfs.bottom||0,g=o.height(),v=o.scrollTop(),_=o,y=o[0]===window,b=n.topNode||null,k=null;return this.isVisible()?(y?(d=e(this.span).offset().top,u=b&&b.span?e(b.span).offset().top:0,_=e("html,body")):(w(o[0]!==document&&o[0]!==document.body,"scrollParent should be a simple element or `window`, not document or body."),l=o.offset().top,d=e(this.span).offset().top-l+v,u=b?e(b.span).offset().top-l+v:0,g-=Math.max(0,o.innerHeight()-o[0].clientHeight)),d<v+f?k=d-f:d+p>v+g-m&&(k=d+p-g+m,b&&(w(b.isRootNode()||b.isVisible(),"topNode must be visible"),u<k&&(k=u-f))),null===k?c.resolveWith(this):n.effects?(n.effects.complete=function(){c.resolveWith(h)},_.stop(!0).animate({scrollTop:k},n.effects)):(_[0].scrollTop=k,c.resolveWith(this)),c.promise()):(this.warn("scrollIntoView(): node is invisible."),S())},setActive:function(e,t){return this.tree._callHook("nodeSetActive",this,e,t)},setExpanded:function(e,t){return this.tree._callHook("nodeSetExpanded",this,e,t)},setFocus:function(e){return this.tree._callHook("nodeSetFocus",this,e)},setSelected:function(e,t){return this.tree._callHook("nodeSetSelected",this,e,t)},setStatus:function(e,t,s){return this.tree._callHook("nodeSetStatus",this,e,t,s)},setTitle:function(e){this.title=e,this.renderTitle(),this.triggerModify("rename")},sortChildren:function(e,t){var s,i,n=this.children;if(n){if(e=e||function(e,t){var s=e.title.toLowerCase(),i=t.title.toLowerCase();return s===i?0:s>i?1:-1},n.sort(e),t)for(s=0,i=n.length;s<i;s++)n[s].children&&n[s].sortChildren(e,"$norender$");"$norender$"!==t&&this.render(),this.triggerModifyChild("sort")}},toDict:function(t,s){var i,n,o,r,a={},u=this;if(e.each(m,(function(e,t){(u[t]||!1===u[t])&&(a[t]=u[t])})),e.isEmptyObject(this.data)||(a.data=e.extend({},this.data),e.isEmptyObject(a.data)&&delete a.data),s){if(!1===(r=s(a,u)))return!1;"skip"===r&&(t=!1)}if(t&&this.hasChildren())for(a.children=[],i=0,n=this.children.length;i<n;i++)(o=this.children[i]).isStatusNode()||!1!==(r=o.toDict(!0,s))&&a.children.push(r);return a},toggleClass:function(t,s){var i,n,o=t.match(/\S+/g)||[],r=0,a=!1,u=this[this.tree.statusClassPropName],d=" "+(this.extraClasses||"")+" ";for(u&&e(u).toggleClass(t,s);i=o[r++];)if(n=d.indexOf(" "+i+" ")>=0,s=void 0===s?!n:!!s)n||(d+=i+" ",a=!0);else for(;d.indexOf(" "+i+" ")>-1;)d=d.replace(" "+i+" "," ");return this.extraClasses=e.trim(d),a},toggleExpanded:function(){return this.tree._callHook("nodeToggleExpanded",this)},toggleSelected:function(){return this.tree._callHook("nodeToggleSelected",this)},toString:function(){return"FancytreeNode@"+this.key+"[title='"+this.title+"']"},triggerModifyChild:function(t,s,i){var n,o=this.tree.options.modifyChild;o&&(s&&s.parent!==this&&e.error("childNode "+s+" is not a child of "+this),n={node:this,tree:this.tree,operation:t,childNode:s||null},i&&e.extend(n,i),o({type:"modifyChild"},n))},triggerModify:function(e,t){this.parent.triggerModifyChild(e,this,t)},visit:function(e,t){var s,i,n=!0,o=this.children;if(!0===t&&(!1===(n=e(this))||"skip"===n))return n;if(o)for(s=0,i=o.length;s<i&&!1!==(n=o[s].visit(e,!0));s++);return n},visitAndLoad:function(t,s,i){var n,o,r,a=this;return!t||!0!==s||!1!==(o=t(a))&&"skip"!==o?a.children||a.lazy?(n=new e.Deferred,r=[],a.load().done((function(){for(var s=0,i=a.children.length;s<i;s++){if(!1===(o=a.children[s].visitAndLoad(t,!0,!0))){n.reject();break}"skip"!==o&&r.push(o)}e.when.apply(this,r).then((function(){n.resolve()}))})),n.promise()):S():i?o:S()},visitParents:function(e,t){if(t&&!1===e(this))return!1;for(var s=this.parent;s;){if(!1===e(s))return!1;s=s.parent}return!0},visitSiblings:function(e,t){var s,i,n,o=this.parent.children;for(s=0,i=o.length;s<i;s++)if(n=o[s],(t||n!==this)&&!1===e(n))return!1;return!0},warn:function(e){this.tree.options.debugLevel>=2&&(Array.prototype.unshift.call(arguments,this.toString()),y("warn",arguments))}},I.prototype={_makeHookContext:function(t,s,i){var n,o;return void 0!==t.node?(s&&t.originalEvent!==s&&e.error("invalid args"),n=t):t.tree?n={node:t,tree:o=t.tree,widget:o.widget,options:o.widget.options,originalEvent:s,typeInfo:o.types[t.type]||{}}:t.widget?n={node:null,tree:t,widget:t.widget,options:t.widget.options,originalEvent:s}:e.error("invalid args"),i&&e.extend(n,i),n},_callHook:function(t,s,i){var n=this._makeHookContext(s),o=this[t],r=Array.prototype.slice.call(arguments,2);return e.isFunction(o)||e.error("_callHook('"+t+"') is not a function"),r.unshift(n),o.apply(this,r)},_setExpiringValue:function(e,t,s){this._tempCache[e]={value:t,expire:Date.now()+(+s||50)}},_getExpiringValue:function(e){var t=this._tempCache[e];return t&&t.expire>Date.now()?t.value:(delete this._tempCache[e],null)},_usesExtension:function(t){return e.inArray(t,this.options.extensions)>=0},_requireExtension:function(t,s,i,n){null!=i&&(i=!!i);var o=this._local.name,r=this.options.extensions,a=e.inArray(t,r)<e.inArray(o,r),u=s&&null==this.ext[t],d=!u&&null!=i&&i!==a;return w(o&&o!==t,"invalid or same name '"+o+"' (require yourself?)"),!u&&!d||(n||(u||s?(n="'"+o+"' extension requires '"+t+"'",d&&(n+=" to be registered "+(i?"before":"after")+" itself")):n="If used together, `"+t+"` must be registered "+(i?"before":"after")+" `"+o+"`"),e.error(n),!1)},activateKey:function(e,t){var s=this.getNodeByKey(e);return s?s.setActive(!0,t):this.activeNode&&this.activeNode.setActive(!1,t),s},addPagingNode:function(e,t){return this.rootNode.addPagingNode(e,t)},applyCommand:function(t,s,i){var n;switch(s=s||this.getActiveNode(),t){case"moveUp":(n=s.getPrevSibling())&&(s.moveTo(n,"before"),s.setActive());break;case"moveDown":(n=s.getNextSibling())&&(s.moveTo(n,"after"),s.setActive());break;case"indent":(n=s.getPrevSibling())&&(s.moveTo(n,"child"),n.setExpanded(),s.setActive());break;case"outdent":s.isTopLevel()||(s.moveTo(s.getParent(),"after"),s.setActive());break;case"remove":n=s.getPrevSibling()||s.getParent(),s.remove(),n&&n.setActive();break;case"addChild":s.editCreateNode("child","");break;case"addSibling":s.editCreateNode("after","");break;case"rename":s.editStart();break;case"down":case"first":case"last":case"left":case"parent":case"right":case"up":return s.navigate(t);default:e.error("Unhandled command: '"+t+"'")}},applyPatch:function(t){var s,i,n,o,r,a,u=t.length,d=[];for(i=0;i<u;i++)w(2===(n=t[i]).length,"patchList must be an array of length-2-arrays"),o=n[0],r=n[1],(a=null===o?this.rootNode:this.getNodeByKey(o))?(s=new e.Deferred,d.push(s),a.applyPatch(r).always(N(s,a))):this.warn("could not find node with key '"+o+"'");return e.when.apply(e,d).promise()},clear:function(e){this._callHook("treeClear",this)},count:function(){return this.rootNode.countChildren()},debug:function(e){this.options.debugLevel>=4&&(Array.prototype.unshift.call(arguments,this.toString()),y("log",arguments))},destroy:function(){this.widget.destroy()},enable:function(e){!1===e?this.widget.disable():this.widget.enable()},enableUpdate:function(e){return e=!1!==e,!!this._enableUpdate==!!e?e:(this._enableUpdate=e,e?(this.debug("enableUpdate(true): redraw "),this._callHook("treeStructureChanged",this,"enableUpdate"),this.render()):this.debug("enableUpdate(false)..."),!e)},error:function(e){this.options.debugLevel>=1&&(Array.prototype.unshift.call(arguments,this.toString()),y("error",arguments))},expandAll:function(e,t){var s=this.enableUpdate(!1);e=!1!==e,this.visit((function(s){!1!==s.hasChildren()&&s.isExpanded()!==e&&s.setExpanded(e,t)})),this.enableUpdate(s)},findAll:function(e){return this.rootNode.findAll(e)},findFirst:function(e){return this.rootNode.findFirst(e)},findNextNode:function(e,t){var s,i=null,n=this.getFirstChild();function o(s){if(e(s)&&(i=s),i||s===t)return!1}return e="string"==typeof e?(s=new RegExp("^"+e,"i"),function(e){return s.test(e.title)}):e,t=t||n,this.visitRows(o,{start:t,includeSelf:!1}),i||t===n||this.visitRows(o,{start:n,includeSelf:!0}),i},findRelatedNode:function(t,s,i){var n=null,o=e.ui.keyCode;switch(s){case"parent":case o.BACKSPACE:t.parent&&t.parent.parent&&(n=t.parent);break;case"first":case o.HOME:this.visit((function(e){if(e.isVisible())return n=e,!1}));break;case"last":case o.END:this.visit((function(e){e.isVisible()&&(n=e)}));break;case"left":case o.LEFT:t.expanded?t.setExpanded(!1):t.parent&&t.parent.parent&&(n=t.parent);break;case"right":case o.RIGHT:t.expanded||!t.children&&!t.lazy?t.children&&t.children.length&&(n=t.children[0]):(t.setExpanded(),n=t);break;case"up":case o.UP:this.visitRows((function(e){return n=e,!1}),{start:t,reverse:!0,includeSelf:!1});break;case"down":case o.DOWN:this.visitRows((function(e){return n=e,!1}),{start:t,includeSelf:!1});break;default:this.tree.warn("Unknown relation '"+s+"'.")}return n},generateFormElements:function(t,s,i){i=i||{};var n,o="string"==typeof t?t:"ft_"+this._id+"[]",r="string"==typeof s?s:"ft_"+this._id+"_active",a="fancytree_result_"+this._id,u=e("#"+a),d=3===this.options.selectMode&&!1!==i.stopOnParents;function l(t){u.append(e("<input>",{type:"checkbox",name:o,value:t.key,checked:!0}))}u.length?u.empty():u=e("<div>",{id:a}).hide().insertAfter(this.$container),!1!==s&&this.activeNode&&u.append(e("<input>",{type:"radio",name:r,value:this.activeNode.key,checked:!0})),i.filter?this.visit((function(e){var t=i.filter(e);if("skip"===t)return t;!1!==t&&l(e)})):!1!==t&&(n=this.getSelectedNodes(d),e.each(n,(function(e,t){l(t)})))},getActiveNode:function(){return this.activeNode},getFirstChild:function(){return this.rootNode.getFirstChild()},getFocusNode:function(){return this.focusNode},getOption:function(e){return this.widget.option(e)},getNodeByKey:function(e,t){var s,i;return!t&&(s=document.getElementById(this.options.idPrefix+e))?s.ftnode?s.ftnode:null:(t=t||this.rootNode,i=null,t.visit((function(t){if(t.key===e)return i=t,!1}),!0),i)},getRootNode:function(){return this.rootNode},getSelectedNodes:function(e){return this.rootNode.getSelectedNodes(e)},hasFocus:function(){return!!this._hasFocus},info:function(e){this.options.debugLevel>=3&&(Array.prototype.unshift.call(arguments,this.toString()),y("info",arguments))},isLoading:function(){var e=!1;return this.rootNode.visit((function(t){if(t._isLoading||t._requestId)return e=!0,!1}),!0),e},loadKeyPath:function(t,s){var i,n,o,r=this,a=new e.Deferred,u=this.getRootNode(),d=this.options.keyPathSeparator,l=[],c=e.extend({},s);for("function"==typeof s?i=s:s&&s.callback&&(i=s.callback),c.callback=function(e,t,s){i&&i.call(e,t,s),a.notifyWith(e,[{node:t,status:s}])},null==c.matchKey&&(c.matchKey=function(e,t){return e.key===t}),e.isArray(t)||(t=[t]),n=0;n<t.length;n++)(o=t[n]).charAt(0)===d&&(o=o.substr(1)),l.push(o.split(d));return setTimeout((function(){r._loadKeyPathImpl(a,c,u,l).done((function(){a.resolve()}))}),0),a.promise()},_loadKeyPathImpl:function(t,s,i,n){var o,r,a,u,d,l,c,h,p,f,m=this;function g(e,t){var i,n,o=e.children;if(o)for(i=0,n=o.length;i<n;i++)if(s.matchKey(o[i],t))return o[i];return null}for(c={},r=0;r<n.length;r++)for(p=n[r],h=i;p.length;){if(a=p.shift(),!(u=g(h,a))){this.warn("loadKeyPath: key not found: "+a+" (parent: "+h+")"),s.callback(this,a,"error");break}if(0===p.length){s.callback(this,u,"ok");break}if(u.lazy&&void 0===u.hasChildren()){s.callback(this,u,"loaded"),c[a=u.key]?c[a].pathSegList.push(p):c[a]={parent:u,pathSegList:[p]};break}s.callback(this,u,"loaded"),h=u}function v(e,t,i){s.callback(m,t,"loading"),t.load().done((function(){m._loadKeyPathImpl.call(m,e,s,t,i).always(N(e,m))})).fail((function(i){m.warn("loadKeyPath: error loading lazy "+t),s.callback(m,u,"error"),e.rejectWith(m)}))}for(d in o=[],c)c.hasOwnProperty(d)&&(l=c[d],f=new e.Deferred,o.push(f),v(f,l.parent,l.pathSegList));return e.when.apply(e,o).promise()},reactivate:function(e){var t,s=this.activeNode;return s?(this.activeNode=null,t=s.setActive(!0,{noFocus:!0}),e&&s.setFocus(),t):S()},reload:function(e){return this._callHook("treeClear",this),this._callHook("treeLoad",this,e)},render:function(e,t){return this.rootNode.render(e,t)},selectAll:function(e){this.visit((function(t){t.setSelected(e)}))},setFocus:function(e){return this._callHook("treeSetFocus",this,e)},setOption:function(e,t){return this.widget.option(e,t)},debugTime:function(e){this.options.debugLevel>=4&&window.console.time(this+" - "+e)},debugTimeEnd:function(e){this.options.debugLevel>=4&&window.console.timeEnd(this+" - "+e)},toDict:function(e,t){var s=this.rootNode.toDict(!0,t);return e?s:s.children},toString:function(){return"Fancytree@"+this._id},_triggerNodeEvent:function(e,t,s,i){var n=this._makeHookContext(t,s,i),o=this.widget._trigger(e,s,n);return!1!==o&&void 0!==n.result?n.result:o},_triggerTreeEvent:function(e,t,s){var i=this._makeHookContext(this,t,s),n=this.widget._trigger(e,t,i);return!1!==n&&void 0!==i.result?i.result:n},visit:function(e){return this.rootNode.visit(e,!1)},visitRows:function(e,t){if(!this.rootNode.hasChildren())return!1;if(t&&t.reverse)return delete t.reverse,this._visitRowsUp(e,t);var s,i,n,o=0,r=!1===(t=t||{}).includeSelf,a=!!t.includeHidden,u=!a&&this.enableFilter,d=t.start||this.rootNode.children[0];for(i=d.parent;i;){for(s=(n=i.children).indexOf(d)+o;s<n.length;s++)if(d=n[s],!u||d.match||d.subMatchCount){if(!r&&!1===e(d))return!1;if(r=!1,d.children&&d.children.length&&(a||d.expanded)&&!1===d.visit((function(t){return!u||t.match||t.subMatchCount?!1!==e(t)&&(a||!t.children||t.expanded?void 0:"skip"):"skip"}),!1))return!1}d=i,i=i.parent,o=1}return!0},_visitRowsUp:function(e,t){for(var s,i,n,o=!!t.includeHidden,r=t.start||this.rootNode.children[0];;){if((s=(n=r.parent).children)[0]===r){if(!(r=n).parent)break;s=n.children}else for(i=s.indexOf(r),r=s[i-1];(o||r.expanded)&&r.children&&r.children.length;)n=r,r=(s=r.children)[s.length-1];if((o||r.isVisible())&&!1===e(r))return!1}},warn:function(e){this.options.debugLevel>=2&&(Array.prototype.unshift.call(arguments,this.toString()),y("warn",arguments))}},e.extend(I.prototype,{nodeClick:function(e){var t,s,i=e.targetType,n=e.node;if("expander"===i){if(n.isLoading())return void n.debug("Got 2nd click while loading: ignored");this._callHook("nodeToggleExpanded",e)}else if("checkbox"===i)this._callHook("nodeToggleSelected",e),e.options.focusOnSelect&&this._callHook("nodeSetFocus",e,!0);else{if(s=!1,t=!0,n.folder)switch(e.options.clickFolderMode){case 2:s=!0,t=!1;break;case 3:t=!0,s=!0}t&&(this.nodeSetFocus(e),this._callHook("nodeSetActive",e,!0)),s&&this._callHook("nodeToggleExpanded",e)}},nodeCollapseSiblings:function(e,t){var s,i,n,o=e.node;if(o.parent)for(i=0,n=(s=o.parent.children).length;i<n;i++)s[i]!==o&&s[i].expanded&&this._callHook("nodeSetExpanded",s[i],!1,t)},nodeDblclick:function(e){"title"===e.targetType&&4===e.options.clickFolderMode&&this._callHook("nodeToggleExpanded",e),"title"===e.targetType&&e.originalEvent.preventDefault()},nodeKeydown:function(t){var s,n,o,r=t.originalEvent,a=t.node,u=t.tree,c=t.options,h=r.which,p=r.key||String.fromCharCode(h),f=!!(r.altKey||r.ctrlKey||r.metaKey),m=!l[h]&&!d[h]&&!f,g=e(r.target),v=!0,_=!(r.ctrlKey||!c.autoActivate);if(a||(o=this.getActiveNode()||this.getFirstChild())&&(o.setFocus(),(a=t.node=this.focusNode).debug("Keydown force focus on active node")),c.quicksearch&&m&&!g.is(":input:enabled"))return(n=Date.now())-u.lastQuicksearchTime>500&&(u.lastQuicksearchTerm=""),u.lastQuicksearchTime=n,u.lastQuicksearchTerm+=p,(s=u.findNextNode(u.lastQuicksearchTerm,u.getActiveNode()))&&s.setActive(),void r.preventDefault();switch(i.eventToString(r)){case"+":case"=":u.nodeSetExpanded(t,!0);break;case"-":u.nodeSetExpanded(t,!1);break;case"space":a.isPagingNode()?u._triggerNodeEvent("clickPaging",t,r):i.evalOption("checkbox",a,a,c,!1)?u.nodeToggleSelected(t):u.nodeSetActive(t,!0);break;case"return":u.nodeSetActive(t,!0);break;case"home":case"end":case"backspace":case"left":case"right":case"up":case"down":a.navigate(r.which,_);break;default:v=!1}v&&r.preventDefault()},nodeLoadChildren:function(t,s){var i,n,o,r,a=t.tree,u=t.node,d=Date.now();return e.isFunction(s)&&(s=s.call(a,{type:"source"},t),w(!e.isFunction(s),"source callback must not return another function")),s.url&&(u._requestId&&u.warn("Recursive load request #"+d+" while #"+u._requestId+" is pending."),i=e.extend({},t.options.ajax,s),u._requestId=d,i.debugDelay?(n=i.debugDelay,delete i.debugDelay,e.isArray(n)&&(n=n[0]+Math.random()*(n[1]-n[0])),u.warn("nodeLoadChildren waiting debugDelay "+Math.round(n)+" ms ..."),o=e.Deferred((function(t){setTimeout((function(){e.ajax(i).done((function(){t.resolveWith(this,arguments)})).fail((function(){t.rejectWith(this,arguments)}))}),n)}))):o=e.ajax(i),s=new e.Deferred,o.done((function(i,n,o){var r,l;if("json"!==this.dataType&&"jsonp"!==this.dataType||"string"!=typeof i||e.error("Ajax request returned a string (did you get the JSON dataType wrong?)."),u._requestId&&u._requestId>d)s.rejectWith(this,["$recursive_request"]);else{if(t.options.postProcess){try{l=a._triggerNodeEvent("postProcess",t,t.originalEvent,{response:i,error:null,dataType:this.dataType})}catch(e){l={error:e,message:""+e,details:"postProcess failed"}}if(l.error)return r=e.isPlainObject(l.error)?l.error:{message:l.error},r=a._makeHookContext(u,null,r),void s.rejectWith(this,[r]);(e.isArray(l)||e.isPlainObject(l)&&e.isArray(l.children))&&(i=l)}else i&&i.hasOwnProperty("d")&&t.options.enableAspx&&(i="string"==typeof i.d?e.parseJSON(i.d):i.d);s.resolveWith(this,[i])}})).fail((function(e,t,i){var n=a._makeHookContext(u,null,{error:e,args:Array.prototype.slice.call(arguments),message:i,details:e.status+": "+i});s.rejectWith(this,[n])}))),e.isFunction(s.then)&&e.isFunction(s.catch)&&(o=s,s=new e.Deferred,o.then((function(e){s.resolve(e)}),(function(e){s.reject(e)}))),e.isFunction(s.promise)?(a.nodeSetStatus(t,"loading"),s.done((function(e){a.nodeSetStatus(t,"ok"),u._requestId=null})).fail((function(e){var s;"$recursive_request"!==e?(e.node&&e.error&&e.message?s=e:"[object Object]"===(s=a._makeHookContext(u,null,{error:e,args:Array.prototype.slice.call(arguments),message:e?e.message||e.toString():""})).message&&(s.message=""),u.warn("Load children failed ("+s.message+")",s),!1!==a._triggerNodeEvent("loadError",s,null)&&a.nodeSetStatus(t,"error",s.message,s.details)):u.warn("Ignored response for obsolete load request #"+d+" (expected #"+u._requestId+")")}))):t.options.postProcess&&(r=a._triggerNodeEvent("postProcess",t,t.originalEvent,{response:s,error:null,dataType:typeof s}),(e.isArray(r)||e.isPlainObject(r)&&e.isArray(r.children))&&(s=r)),e.when(s).done((function(s){var i,n;e.isPlainObject(s)&&(w(u.isRootNode(),"source may only be an object for root nodes (expecting an array of child objects otherwise)"),w(e.isArray(s.children),"if an object is passed as source, it must contain a 'children' array (all other properties are added to 'tree.data')"),i=s,s=s.children,delete i.children,e.each(f,(function(e,t){void 0!==i[t]&&(a[t]=i[t],delete i[t])})),e.extend(a.data,i)),w(e.isArray(s),"expected array of children"),u._setChildren(s),a.options.nodata&&0===s.length&&(e.isFunction(a.options.nodata)?n=a.options.nodata.call(a,{type:"nodata"},t):!0===a.options.nodata&&u.isRootNode()?n=a.options.strings.nodata:"string"==typeof a.options.nodata&&u.isRootNode()&&(n=a.options.nodata),n&&u.setStatus("nodata",n)),a._triggerNodeEvent("loadChildren",u)}))},nodeLoadKeyPath:function(e,t){},nodeRemoveChild:function(t,s){var i,n=t.node,o=e.extend({},t,{node:s}),r=n.children;if(1===r.length)return w(s===r[0],"invalid single child"),this.nodeRemoveChildren(t);this.activeNode&&(s===this.activeNode||this.activeNode.isDescendantOf(s))&&this.activeNode.setActive(!1),this.focusNode&&(s===this.focusNode||this.focusNode.isDescendantOf(s))&&(this.focusNode=null),this.nodeRemoveMarkup(o),this.nodeRemoveChildren(o),w((i=e.inArray(s,r))>=0,"invalid child"),n.triggerModifyChild("remove",s),s.visit((function(e){e.parent=null}),!0),this._callHook("treeRegisterNode",this,!1,s),r.splice(i,1)},nodeRemoveChildMarkup:function(t){var s=t.node;s.ul&&(s.isRootNode()?e(s.ul).empty():(e(s.ul).remove(),s.ul=null),s.visit((function(e){e.li=e.ul=null})))},nodeRemoveChildren:function(e){var t=e.tree,s=e.node;s.children&&(this.activeNode&&this.activeNode.isDescendantOf(s)&&this.activeNode.setActive(!1),this.focusNode&&this.focusNode.isDescendantOf(s)&&(this.focusNode=null),this.nodeRemoveChildMarkup(e),s.triggerModifyChild("remove",null),s.visit((function(e){e.parent=null,t._callHook("treeRegisterNode",t,!1,e)})),s.lazy?s.children=[]:s.children=null,s.isRootNode()||(s.expanded=!1),this.nodeRenderStatus(e))},nodeRemoveMarkup:function(t){var s=t.node;s.li&&(e(s.li).remove(),s.li=null),this.nodeRemoveChildMarkup(t)},nodeRender:function(t,s,i,n,o){var r,a,u,d,l,c,h,p=t.node,f=t.tree,m=t.options,g=m.aria,v=!1,_=p.parent,y=!_,b=p.children,k=null;if(!1!==f._enableUpdate&&(y||_.ul)){if(w(y||_.ul,"parent UL must exist"),y||(p.li&&(s||p.li.parentNode!==p.parent.ul)&&(p.li.parentNode===p.parent.ul?k=p.li.nextSibling:this.debug("Unlinking "+p+" (must be child of "+p.parent+")"),this.nodeRemoveMarkup(t)),p.li?this.nodeRenderStatus(t):(v=!0,p.li=document.createElement("li"),p.li.ftnode=p,p.key&&m.generateIds&&(p.li.id=m.idPrefix+p.key),p.span=document.createElement("span"),p.span.className="fancytree-node",g&&!p.tr&&e(p.li).attr("role","treeitem"),p.li.appendChild(p.span),this.nodeRenderTitle(t),m.createNode&&m.createNode.call(f,{type:"createNode"},t)),m.renderNode&&m.renderNode.call(f,{type:"renderNode"},t)),b){if(y||p.expanded||!0===i){for(p.ul||(p.ul=document.createElement("ul"),(!0!==n||o)&&p.expanded||(p.ul.style.display="none"),g&&e(p.ul).attr("role","group"),p.li?p.li.appendChild(p.ul):p.tree.$div.append(p.ul)),d=0,l=b.length;d<l;d++)h=e.extend({},t,{node:b[d]}),this.nodeRender(h,s,i,!1,!0);for(r=p.ul.firstChild;r;)(u=r.ftnode)&&u.parent!==p?(p.debug("_fixParent: remove missing "+u,r),c=r.nextSibling,r.parentNode.removeChild(r),r=c):r=r.nextSibling;for(r=p.ul.firstChild,d=0,l=b.length-1;d<l;d++)(a=b[d])===(u=r.ftnode)?r=r.nextSibling:p.ul.insertBefore(a.li,u.li)}}else p.ul&&(this.warn("remove child markup for "+p),this.nodeRemoveChildMarkup(t));y||v&&_.ul.insertBefore(p.li,k)}},nodeRenderTitle:function(t,s){var o,r,a,u,d,l,c,h=t.node,p=t.tree,f=t.options,m=f.aria,g=h.getLevel(),v=[];void 0!==s&&(h.title=s),h.span&&!1!==p._enableUpdate&&(d=m&&!1!==h.hasChildren()?" role='button'":"",g<f.minExpandLevel?(h.lazy||(h.expanded=!0),g>1&&v.push("<span "+d+" class='fancytree-expander fancytree-expander-fixed'></span>")):v.push("<span "+d+" class='fancytree-expander'></span>"),(o=i.evalOption("checkbox",h,h,f,!1))&&!h.isStatusNode()&&(d=m?" role='checkbox'":"",r="fancytree-checkbox",("radio"===o||h.parent&&h.parent.radiogroup)&&(r+=" fancytree-radio"),v.push("<span "+d+" class='"+r+"'></span>")),void 0!==h.data.iconClass&&(h.icon?e.error("'iconClass' node option is deprecated since v2.14.0: use 'icon' only instead"):(h.warn("'iconClass' node option is deprecated since v2.14.0: use 'icon' instead"),h.icon=h.data.iconClass)),!1!==(a=i.evalOption("icon",h,h,f,!0))&&(d=m?" role='presentation'":"",c=(c=i.evalOption("iconTooltip",h,h,f,null))?" title='"+j(c)+"'":"","string"==typeof a?n.test(a)?(a="/"===a.charAt(0)?a:(f.imagePath||"")+a,v.push("<img src='"+a+"' class='fancytree-icon'"+c+" alt='' />")):v.push("<span "+d+" class='fancytree-custom-icon "+a+"'"+c+"></span>"):a.text?v.push("<span "+d+" class='fancytree-custom-icon "+(a.addClass||"")+"'"+c+">"+i.escapeHtml(a.text)+"</span>"):a.html?v.push("<span "+d+" class='fancytree-custom-icon "+(a.addClass||"")+"'"+c+">"+a.html+"</span>"):v.push("<span "+d+" class='fancytree-icon'"+c+"></span>")),u="",f.renderTitle&&(u=f.renderTitle.call(p,{type:"renderTitle"},t)||""),u||(!0===(l=i.evalOption("tooltip",h,h,f,null))&&(l=h.title),u="<span class='fancytree-title'"+(l=l?" title='"+j(l)+"'":"")+(f.titlesTabbable?" tabindex='0'":"")+">"+(f.escapeTitles?i.escapeHtml(h.title):h.title)+"</span>"),v.push(u),h.span.innerHTML=v.join(""),this.nodeRenderStatus(t),f.enhanceTitle&&(t.$title=e(">span.fancytree-title",h.span),u=f.enhanceTitle.call(p,{type:"enhanceTitle"},t)||""))},nodeRenderStatus:function(t){var s,n=t.node,o=t.tree,r=t.options,a=n.hasChildren(),u=n.isLastSibling(),d=r.aria,l=r._classNames,c=[],h=n[o.statusClassPropName];h&&!1!==o._enableUpdate&&(d&&(s=e(n.tr||n.li)),c.push(l.node),o.activeNode===n&&c.push(l.active),o.focusNode===n&&c.push(l.focused),n.expanded&&c.push(l.expanded),d&&(!1===a?s.removeAttr("aria-expanded"):s.attr("aria-expanded",Boolean(n.expanded))),n.folder&&c.push(l.folder),!1!==a&&c.push(l.hasChildren),u&&c.push(l.lastsib),n.lazy&&null==n.children&&c.push(l.lazy),n.partload&&c.push(l.partload),n.partsel&&c.push(l.partsel),i.evalOption("unselectable",n,n,r,!1)&&c.push(l.unselectable),n._isLoading&&c.push(l.loading),n._error&&c.push(l.error),n.statusNodeType&&c.push(l.statusNodePrefix+n.statusNodeType),n.selected?(c.push(l.selected),d&&s.attr("aria-selected",!0)):d&&s.attr("aria-selected",!1),n.extraClasses&&c.push(n.extraClasses),!1===a?c.push(l.combinedExpanderPrefix+"n"+(u?"l":"")):c.push(l.combinedExpanderPrefix+(n.expanded?"e":"c")+(n.lazy&&null==n.children?"d":"")+(u?"l":"")),c.push(l.combinedIconPrefix+(n.expanded?"e":"c")+(n.folder?"f":"")),h.className=c.join(" "),n.li&&e(n.li).toggleClass(l.lastsib,u))},nodeSetActive:function(t,s,i){i=i||{};var n,o=t.node,r=t.tree,a=t.options,u=!0===i.noEvents,d=!0===i.noFocus,l=!1!==i.scrollIntoView;return o===r.activeNode==(s=!1!==s)?S(o):s&&!u&&!1===this._triggerNodeEvent("beforeActivate",o,t.originalEvent)?C(o,["rejected"]):(s?(r.activeNode&&(w(r.activeNode!==o,"node was active (inconsistency)"),n=e.extend({},t,{node:r.activeNode}),r.nodeSetActive(n,!1),w(null===r.activeNode,"deactivate was out of sync?")),a.activeVisible&&o.makeVisible({scrollIntoView:l}),r.activeNode=o,r.nodeRenderStatus(t),d||r.nodeSetFocus(t),u||r._triggerNodeEvent("activate",o,t.originalEvent)):(w(r.activeNode===o,"node was not active (inconsistency)"),r.activeNode=null,this.nodeRenderStatus(t),u||t.tree._triggerNodeEvent("deactivate",o,t.originalEvent)),S(o))},nodeSetExpanded:function(t,s,i){i=i||{};var n,o,r,a,u,d,l=t.node,c=t.tree,h=t.options,p=!0===i.noAnimation,f=!0===i.noEvents;if(s=!1!==s,l.expanded&&s||!l.expanded&&!s)return S(l);if(s&&!l.lazy&&!l.hasChildren())return S(l);if(!s&&l.getLevel()<h.minExpandLevel)return C(l,["locked"]);if(!f&&!1===this._triggerNodeEvent("beforeExpand",l,t.originalEvent))return C(l,["rejected"]);if(p||l.isVisible()||(p=i.noAnimation=!0),o=new e.Deferred,s&&!l.expanded&&h.autoCollapse){u=l.getParentList(!1,!0),d=h.autoCollapse;try{for(h.autoCollapse=!1,r=0,a=u.length;r<a;r++)this._callHook("nodeCollapseSiblings",u[r],i)}finally{h.autoCollapse=d}}return o.done((function(){var e=l.getLastChild();s&&h.autoScroll&&!p&&e&&c._enableUpdate?e.scrollIntoView(!0,{topNode:l}).always((function(){f||t.tree._triggerNodeEvent(s?"expand":"collapse",t)})):f||t.tree._triggerNodeEvent(s?"expand":"collapse",t)})),n=function(i){var n=h._classNames,o=h.toggleEffect;if(l.expanded=s,c._callHook("treeStructureChanged",t,s?"expand":"collapse"),c._callHook("nodeRender",t,!1,!1,!0),l.ul)if("none"!==l.ul.style.display==!!l.expanded)l.warn("nodeSetExpanded: UL.style.display already set");else{if(o&&!p)return e(l.li).addClass(n.animating),void(e.isFunction(e(l.ul)[o.effect])?e(l.ul)[o.effect]({duration:o.duration,always:function(){e(this).removeClass(n.animating),e(l.li).removeClass(n.animating),i()}}):(e(l.ul).stop(!0,!0),e(l.ul).parent().find(".ui-effects-placeholder").remove(),e(l.ul).toggle(o.effect,o.options,o.duration,(function(){e(this).removeClass(n.animating),e(l.li).removeClass(n.animating),i()}))));l.ul.style.display=l.expanded||!parent?"":"none"}i()},s&&l.lazy&&void 0===l.hasChildren()?l.load().done((function(){o.notifyWith&&o.notifyWith(l,["loaded"]),n((function(){o.resolveWith(l)}))})).fail((function(e){n((function(){o.rejectWith(l,["load failed ("+e+")"])}))})):n((function(){o.resolveWith(l)})),o.promise()},nodeSetFocus:function(t,s){var i,n=t.tree,o=t.node,r=n.options,a=!!t.originalEvent&&e(t.originalEvent.target).is(":input");if(s=!1!==s,n.focusNode){if(n.focusNode===o&&s)return;i=e.extend({},t,{node:n.focusNode}),n.focusNode=null,this._triggerNodeEvent("blur",i),this._callHook("nodeRenderStatus",i)}s&&(this.hasFocus()||(o.debug("nodeSetFocus: forcing container focus"),this._callHook("treeSetFocus",t,!0,{calledByNode:!0})),o.makeVisible({scrollIntoView:!1}),n.focusNode=o,r.titlesTabbable&&(a||e(o.span).find(".fancytree-title").focus()),r.aria&&e(n.$container).attr("aria-activedescendant",e(o.tr||o.li).uniqueId().attr("id")),this._triggerNodeEvent("focus",t),document.activeElement===n.$container.get(0)||e(document.activeElement,n.$container).length>=1||e(n.$container).focus(),r.autoScroll&&o.scrollIntoView(),this._callHook("nodeRenderStatus",t))},nodeSetSelected:function(e,t,s){s=s||{};var n=e.node,o=e.tree,r=e.options,a=!0===s.noEvents,u=n.parent;if(t=!1!==t,!i.evalOption("unselectable",n,n,r,!1)){if(n._lastSelectIntent=t,!!n.selected===t&&(3!==r.selectMode||!n.partsel||t))return t;if(!a&&!1===this._triggerNodeEvent("beforeSelect",n,e.originalEvent))return!!n.selected;t&&1===r.selectMode?(o.lastSelectedNode&&o.lastSelectedNode.setSelected(!1),n.selected=t):3!==r.selectMode||!u||u.radiogroup||n.radiogroup?u&&u.radiogroup?n.visitSiblings((function(e){e._changeSelectStatusAttrs(t&&e===n)}),!0):n.selected=t:(n.selected=t,n.fixSelection3AfterClick(s)),this.nodeRenderStatus(e),o.lastSelectedNode=t?n:null,a||o._triggerNodeEvent("select",e)}},nodeSetStatus:function(t,s,i,n){var o=t.node,r=t.tree;function a(s,i){var n=o.children?o.children[0]:null;return n&&n.isStatusNode()?(e.extend(n,s),n.statusNodeType=i,r._callHook("nodeRenderTitle",n)):(o._setChildren([s]),r._callHook("treeStructureChanged",t,"setStatusNode"),o.children[0].statusNodeType=i,r.render()),o.children[0]}switch(s){case"ok":!function(){var e=o.children?o.children[0]:null;if(e&&e.isStatusNode()){try{o.ul&&(o.ul.removeChild(e.li),e.li=null)}catch(e){}1===o.children.length?o.children=[]:o.children.shift(),r._callHook("treeStructureChanged",t,"clearStatusNode")}}(),o._isLoading=!1,o._error=null,o.renderStatus();break;case"loading":o.parent||a({title:r.options.strings.loading+(i?" ("+i+")":""),checkbox:!1,tooltip:n},s),o._isLoading=!0,o._error=null,o.renderStatus();break;case"error":a({title:r.options.strings.loadError+(i?" ("+i+")":""),checkbox:!1,tooltip:n},s),o._isLoading=!1,o._error={message:i,details:n},o.renderStatus();break;case"nodata":a({title:i||r.options.strings.noData,checkbox:!1,tooltip:n},s),o._isLoading=!1,o._error=null,o.renderStatus();break;default:e.error("invalid node status "+s)}},nodeToggleExpanded:function(e){return this.nodeSetExpanded(e,!e.node.expanded)},nodeToggleSelected:function(e){var t=e.node,s=!t.selected;return t.partsel&&!t.selected&&!0===t._lastSelectIntent&&(s=!1,t.selected=!0),t._lastSelectIntent=s,this.nodeSetSelected(e,s)},treeClear:function(e){var t=e.tree;t.activeNode=null,t.focusNode=null,t.$div.find(">ul.fancytree-container").empty(),t.rootNode.children=null,t._callHook("treeStructureChanged",e,"clear")},treeCreate:function(e){},treeDestroy:function(e){this.$div.find(">ul.fancytree-container").remove(),this.$source&&this.$source.removeClass("fancytree-helper-hidden")},treeInit:function(t){var s=t.tree,i=s.options;s.$container.attr("tabindex",i.tabindex),e.each(f,(function(e,t){void 0!==i[t]&&(s.info("Move option "+t+" to tree"),s[t]=i[t],delete i[t])})),i.checkboxAutoHide&&s.$container.addClass("fancytree-checkbox-auto-hide"),i.rtl?s.$container.attr("DIR","RTL").addClass("fancytree-rtl"):s.$container.removeAttr("DIR").removeClass("fancytree-rtl"),i.aria&&(s.$container.attr("role","tree"),1!==i.selectMode&&s.$container.attr("aria-multiselectable",!0)),this.treeLoad(t)},treeLoad:function(t,s){var n,o,r,a=t.tree,u=t.widget.element,d=e.extend({},t,{node:this.rootNode});if(a.rootNode.children&&this.treeClear(t),s=s||this.options.source)"string"==typeof s&&e.error("Not implemented");else switch(o=u.data("type")||"html"){case"html":(r=u.find(">ul").not(".fancytree-container").first()).length?(r.addClass("ui-fancytree-source fancytree-helper-hidden"),s=e.ui.fancytree.parseHtml(r),this.data=e.extend(this.data,E(r))):(i.warn("No `source` option was passed and container does not contain `<ul>`: assuming `source: []`."),s=[]);break;case"json":s=e.parseJSON(u.text()),u.contents().filter((function(){return 3===this.nodeType})).remove(),e.isPlainObject(s)&&(w(e.isArray(s.children),"if an object is passed as source, it must contain a 'children' array (all other properties are added to 'tree.data')"),n=s,s=s.children,delete n.children,e.each(f,(function(e,t){void 0!==n[t]&&(a[t]=n[t],delete n[t])})),e.extend(a.data,n));break;default:e.error("Invalid data-type: "+o)}return a._triggerTreeEvent("preInit",null),this.nodeLoadChildren(d,s).done((function(){a._callHook("treeStructureChanged",t,"loadChildren"),a.render(),3===t.options.selectMode&&a.rootNode.fixSelection3FromEndNodes(),a.activeNode&&a.options.activeVisible&&a.activeNode.makeVisible(),a._triggerTreeEvent("init",null,{status:!0})})).fail((function(){a.render(),a._triggerTreeEvent("init",null,{status:!1})}))},treeRegisterNode:function(e,t,s){e.tree._callHook("treeStructureChanged",e,t?"addNode":"removeNode")},treeSetFocus:function(t,s,i){var n;(s=!1!==s)!==this.hasFocus()&&(this._hasFocus=s,!s&&this.focusNode?this.focusNode.setFocus(!1):!s||i&&i.calledByNode||e(this.$container).focus(),this.$container.toggleClass("fancytree-treefocus",s),this._triggerTreeEvent(s?"focusTree":"blurTree"),s&&!this.activeNode&&(n=this._lastMousedownNode||this.getFirstChild())&&n.setFocus())},treeSetOption:function(t,s,i){var n=t.tree,o=!0,r=!1,a=!1;switch(s){case"aria":case"checkbox":case"icon":case"minExpandLevel":case"tabindex":r=!0,a=!0;break;case"checkboxAutoHide":n.$container.toggleClass("fancytree-checkbox-auto-hide",!!i);break;case"escapeTitles":case"tooltip":a=!0;break;case"rtl":!1===i?n.$container.removeAttr("DIR").removeClass("fancytree-rtl"):n.$container.attr("DIR","RTL").addClass("fancytree-rtl"),a=!0;break;case"source":o=!1,n._callHook("treeLoad",n,i),a=!0}n.debug("set option "+s+"="+i+" <"+typeof i+">"),o&&(this.widget._super?this.widget._super.call(this.widget,s,i):e.Widget.prototype._setOption.call(this.widget,s,i)),r&&n._callHook("treeCreate",n),a&&n.render(!0,!1)},treeStructureChanged:function(e,t){}}),e.widget("ui.fancytree",{options:{activeVisible:!0,ajax:{type:"GET",cache:!1,dataType:"json"},aria:!0,autoActivate:!0,autoCollapse:!1,autoScroll:!1,checkbox:!1,clickFolderMode:4,debugLevel:null,disabled:!1,enableAspx:!0,escapeTitles:!1,extensions:[],toggleEffect:{effect:"slideToggle",duration:200},generateIds:!1,icon:!0,idPrefix:"ft_",focusOnSelect:!1,keyboard:!0,keyPathSeparator:"/",minExpandLevel:1,nodata:!0,quicksearch:!1,rtl:!1,scrollOfs:{top:0,bottom:0},scrollParent:null,selectMode:2,strings:{loading:"Loading...",loadError:"Load error!",moreData:"More...",noData:"No data."},tabindex:"0",titlesTabbable:!1,tooltip:!1,treeId:null,_classNames:{node:"fancytree-node",folder:"fancytree-folder",animating:"fancytree-animating",combinedExpanderPrefix:"fancytree-exp-",combinedIconPrefix:"fancytree-ico-",hasChildren:"fancytree-has-children",active:"fancytree-active",selected:"fancytree-selected",expanded:"fancytree-expanded",lazy:"fancytree-lazy",focused:"fancytree-focused",partload:"fancytree-partload",partsel:"fancytree-partsel",radio:"fancytree-radio",unselectable:"fancytree-unselectable",lastsib:"fancytree-lastsib",loading:"fancytree-loading",error:"fancytree-error",statusNodePrefix:"fancytree-statusnode-"},lazyLoad:null,postProcess:null},_deprecationWarning:function(e){var t=this.tree;t&&t.options.debugLevel>=3&&t.warn("$().fancytree('"+e+"') is deprecated (see https://wwwendt.de/tech/fancytree/doc/jsdoc/Fancytree_Widget.html")},_create:function(){this.tree=new I(this),this.$source=this.source||"json"===this.element.data("type")?this.element:this.element.find(">ul").first();var t,s,i,n=this.options,o=n.extensions;this.tree;for(i=0;i<o.length;i++)s=o[i],(t=e.ui.fancytree._extensions[s])||e.error("Could not apply extension '"+s+"' (it is not registered, did you forget to include it?)"),this.tree.options[s]=b({},t.options,this.tree.options[s]),w(void 0===this.tree.ext[s],"Extension name must not exist as Fancytree.ext attribute: '"+s+"'"),this.tree.ext[s]={},x(this.tree,0,t,s),t;void 0!==n.icons&&(!0===n.icon?(this.tree.warn("'icons' tree option is deprecated since v2.14.0: use 'icon' instead"),n.icon=n.icons):e.error("'icons' tree option is deprecated since v2.14.0: use 'icon' only instead")),void 0!==n.iconClass&&(n.icon?e.error("'iconClass' tree option is deprecated since v2.14.0: use 'icon' only instead"):(this.tree.warn("'iconClass' tree option is deprecated since v2.14.0: use 'icon' instead"),n.icon=n.iconClass)),void 0!==n.tabbable&&(n.tabindex=n.tabbable?"0":"-1",this.tree.warn("'tabbable' tree option is deprecated since v2.17.0: use 'tabindex='"+n.tabindex+"' instead")),this.tree._callHook("treeCreate",this.tree)},_init:function(){this.tree._callHook("treeInit",this.tree),this._bind()},_setOption:function(e,t){return this.tree._callHook("treeSetOption",this.tree,e,t)},_destroy:function(){this._unbind(),this.tree._callHook("treeDestroy",this.tree)},_unbind:function(){var t=this.tree._ns;this.element.off(t),this.tree.$container.off(t),e(document).off(t)},_bind:function(){var t=this,s=this.options,n=this.tree,o=n._ns;this._unbind(),n.$container.on("focusin"+o+" focusout"+o,(function(t){var s=i.getNode(t),o="focusin"===t.type;if(!o&&s&&e(t.target).is("a"))s.debug("Ignored focusout on embedded <a> element.");else{if(o){if(n._getExpiringValue("focusin"))return void n.debug("Ignored double focusin.");n._setExpiringValue("focusin",!0,50),s||(s=n._getExpiringValue("mouseDownNode"))&&n.debug("Reconstruct mouse target for focusin from recent event.")}s?n._callHook("nodeSetFocus",n._makeHookContext(s,t),o):n.tbody&&e(t.target).parents("table.fancytree-container > thead").length?n.debug("Ignore focus event outside table body.",t):n._callHook("treeSetFocus",n,o)}})).on("selectstart"+o,"span.fancytree-title",(function(e){e.preventDefault()})).on("keydown"+o,(function(e){if(s.disabled||!1===s.keyboard)return!0;var t,i=n.focusNode,o=n._makeHookContext(i||n,e),r=n.phase;try{return n.phase="userEvent","preventNav"===(t=i?n._triggerNodeEvent("keydown",i,e):n._triggerTreeEvent("keydown",e))?t=!0:!1!==t&&(t=n._callHook("nodeKeydown",o)),t}finally{n.phase=r}})).on("mousedown"+o,(function(e){var t=i.getEventTarget(e);n._lastMousedownNode=t?t.node:null,n._setExpiringValue("mouseDownNode",n._lastMousedownNode)})).on("click"+o+" dblclick"+o,(function(e){if(s.disabled)return!0;var n,o=i.getEventTarget(e),r=o.node,a=t.tree,u=a.phase;if(!r)return!0;n=a._makeHookContext(r,e);try{switch(a.phase="userEvent",e.type){case"click":return n.targetType=o.type,r.isPagingNode()?!0===a._triggerNodeEvent("clickPaging",n,e):!1!==a._triggerNodeEvent("click",n,e)&&a._callHook("nodeClick",n);case"dblclick":return n.targetType=o.type,!1!==a._triggerNodeEvent("dblclick",n,e)&&a._callHook("nodeDblclick",n)}}finally{a.phase=u}}))},getActiveNode:function(){return this._deprecationWarning("getActiveNode"),this.tree.activeNode},getNodeByKey:function(e){return this._deprecationWarning("getNodeByKey"),this.tree.getNodeByKey(e)},getRootNode:function(){return this._deprecationWarning("getRootNode"),this.tree.rootNode},getTree:function(){return this._deprecationWarning("getTree"),this.tree}}),i=e.ui.fancytree,e.extend(e.ui.fancytree,{version:"2.34.0",buildType:"production",debugLevel:3,_nextId:1,_nextNodeKey:1,_extensions:{},_FancytreeClass:I,_FancytreeNodeClass:z,jquerySupports:{positionMyOfs:function(t,s,i,n){var o,r,a,u=e.map(e.trim(t).split("."),(function(e){return parseInt(e,10)})),d=e.map(Array.prototype.slice.call(arguments,1),(function(e){return parseInt(e,10)}));for(o=0;o<d.length;o++)if(r=u[o]||0,a=d[o]||0,r!==a)return r>a;return!0}(e.ui.version,1,9)},assert:function(e,t){return w(e,t)},createTree:function(t,s){var n=e(t).fancytree(s);return i.getTree(n)},debounce:function(e,t,s,i){var n;return 3===arguments.length&&"boolean"!=typeof s&&(i=s,s=!1),function(){var o=arguments;i=i||this,s&&!n&&t.apply(i,o),clearTimeout(n),n=setTimeout((function(){s||t.apply(i,o),n=null}),e)}},debug:function(t){e.ui.fancytree.debugLevel>=4&&y("log",arguments)},error:function(t){e.ui.fancytree.debugLevel>=1&&y("error",arguments)},escapeHtml:function(e){return(""+e).replace(o,(function(e){return a[e]}))},fixPositionOptions:function(t){if((t.offset||(""+t.my+t.at).indexOf("%")>=0)&&e.error("expected new position syntax (but '%' is not supported)"),!e.ui.fancytree.jquerySupports.positionMyOfs){var s=/(\w+)([+-]?\d+)?\s+(\w+)([+-]?\d+)?/.exec(t.my),i=/(\w+)([+-]?\d+)?\s+(\w+)([+-]?\d+)?/.exec(t.at),n=(s[2]?+s[2]:0)+(i[2]?+i[2]:0),o=(s[4]?+s[4]:0)+(i[4]?+i[4]:0);t=e.extend({},t,{my:s[1]+" "+s[3],at:i[1]+" "+i[3]}),(n||o)&&(t.offset=n+" "+o)}return t},getEventTarget:function(t){var s,n=t&&t.target?t.target.className:"",o={node:this.getNode(t.target),type:void 0};return/\bfancytree-title\b/.test(n)?o.type="title":/\bfancytree-expander\b/.test(n)?o.type=!1===o.node.hasChildren()?"prefix":"expander":/\bfancytree-checkbox\b/.test(n)?o.type="checkbox":/\bfancytree(-custom)?-icon\b/.test(n)?o.type="icon":/\bfancytree-node\b/.test(n)?o.type="title":t&&t.target&&((s=e(t.target)).is("ul[role=group]")?((o.node&&o.node.tree||i).debug("Ignoring click on outer UL."),o.node=null):s.closest(".fancytree-title").length?o.type="title":s.closest(".fancytree-checkbox").length?o.type="checkbox":s.closest(".fancytree-expander").length&&(o.type="expander")),o},getEventTargetType:function(e){return this.getEventTarget(e).type},getNode:function(t){if(t instanceof z)return t;for(t instanceof e?t=t[0]:void 0!==t.originalEvent&&(t=t.target);t;){if(t.ftnode)return t.ftnode;t=t.parentNode}return null},getTree:function(t){var s,i=t;return t instanceof I?t:(void 0===t&&(t=0),"number"==typeof t?t=e(".fancytree-container").eq(t):"string"==typeof t?(t=e("#ft-id-"+i).eq(0)).length||(t=e(i).eq(0)):t instanceof Element||t instanceof HTMLDocument?t=e(t):t instanceof e?t=t.eq(0):void 0!==t.originalEvent&&(t=e(t.target)),(s=(t=t.closest(":ui-fancytree")).data("ui-fancytree")||t.data("fancytree"))?s.tree:null)},evalOption:function(t,s,i,n,o){var r,a,u=s.tree,d=n[t],l=i[t];return e.isFunction(d)?(r={node:s,tree:u,widget:u.widget,options:u.widget.options,typeInfo:u.types[s.type]||{}},null==(a=d.call(u,{type:t},r))&&(a=l)):a=null==l?d:l,null==a&&(a=o),a},setSpanIcon:function(t,s,i){var n=e(t);"string"==typeof i?n.attr("class",s+" "+i):(i.text?n.text(""+i.text):i.html&&(t.innerHTML=i.html),n.attr("class",s+" "+(i.addClass||"")))},eventToString:function(e){var t=e.which,s=e.type,i=[];return e.altKey&&i.push("alt"),e.ctrlKey&&i.push("ctrl"),e.metaKey&&i.push("meta"),e.shiftKey&&i.push("shift"),"click"===s||"dblclick"===s?i.push(c[e.button]+s):"wheel"===s?i.push(s):u[t]||i.push(d[t]||String.fromCharCode(t).toLowerCase()),i.join("+")},info:function(t){e.ui.fancytree.debugLevel>=3&&y("info",arguments)},keyEventToString:function(e){return this.warn("keyEventToString() is deprecated: use eventToString()"),this.eventToString(e)},overrideMethod:function(t,s,i,n){var o,r=t[s]||e.noop;t[s]=function(){var e=n||this;try{return o=e._super,e._super=r,i.apply(e,arguments)}finally{e._super=o}}},parseHtml:function(t){var s,i,n,o,r,a,u,d,l=t.find(">li"),c=[];return l.each((function(){var l,f,g=e(this),_=g.find(">span",this).first(),w=_.length?null:g.find(">a").first(),y={tooltip:null,data:{}};for(_.length?y.title=_.html():w&&w.length?(y.title=w.html(),y.data.href=w.attr("href"),y.data.target=w.attr("target"),y.tooltip=w.attr("title")):(y.title=g.html(),(r=y.title.search(/<ul/i))>=0&&(y.title=y.title.substring(0,r))),y.title=e.trim(y.title),o=0,a=h.length;o<a;o++)y[h[o]]=void 0;for(s=this.className.split(" "),n=[],o=0,a=s.length;o<a;o++)i=s[o],p[i]?y[i]=!0:n.push(i);if(y.extraClasses=n.join(" "),(u=g.attr("title"))&&(y.tooltip=u),(u=g.attr("id"))&&(y.key=u),g.attr("hideCheckbox")&&(y.checkbox=!1),(l=E(g))&&!e.isEmptyObject(l)){for(f in v)l.hasOwnProperty(f)&&(l[v[f]]=l[f],delete l[f]);for(o=0,a=m.length;o<a;o++)u=m[o],null!=(d=l[u])&&(delete l[u],y[u]=d);e.extend(y.data,l)}(t=g.find(">ul").first()).length?y.children=e.ui.fancytree.parseHtml(t):y.children=y.lazy?void 0:null,c.push(y)})),c},registerExtension:function(t){w(null!=t.name,"extensions must have a `name` property."),w(null!=t.version,"extensions must have a `version` property."),e.ui.fancytree._extensions[t.name]=t},unescapeHtml:function(e){var t=document.createElement("div");return t.innerHTML=e,0===t.childNodes.length?"":t.childNodes[0].nodeValue},warn:function(t){e.ui.fancytree.debugLevel>=2&&y("warn",arguments)}}),e.ui.fancytree}function w(t,s){t||(s=s?": "+s:"",e.error("Fancytree assertion failed"+s))}function y(e,t){var s,i,n=window.console?window.console[e]:null;if(n)try{n.apply(window.console,t)}catch(e){for(i="",s=0;s<t.length;s++)i+=t[s];n(i)}}function b(){var t,s,i,n,o,r=arguments[0]||{},a=1,u=arguments.length;if("object"==typeof r||e.isFunction(r)||(r={}),a===u)throw Error("need at least two args");for(;a<u;a++)if(null!=(t=arguments[a]))for(s in t)if(t.hasOwnProperty(s)){if(i=r[s],r===(n=t[s]))continue;n&&e.isPlainObject(n)?(o=i&&e.isPlainObject(i)?i:{},r[s]=b(o,n)):void 0!==n&&(r[s]=n)}return r}function k(e,t,s,i,n){var o,r,a,u,d;return o=t[e],r=i[e],a=t.ext[n],u=function(){return o.apply(t,arguments)},d=function(e){return o.apply(t,e)},function(){var e=t._local,s=t._super,i=t._superApply;try{return t._local=a,t._super=u,t._superApply=d,r.apply(t,arguments)}finally{t._local=e,t._super=s,t._superApply=i}}}function x(t,s,i,n){for(var o in i)"function"==typeof i[o]?"function"==typeof t[o]?t[o]=k(o,t,0,i,n):"_"===o.charAt(0)?t.ext[n][o]=k(o,t,0,i,n):e.error("Could not override tree."+o+". Use prefix '_' to create tree."+n+"._"+o):"options"!==o&&(t.ext[n][o]=i[o])}function S(t,s){return void 0===t?e.Deferred((function(){this.resolve()})).promise():e.Deferred((function(){this.resolveWith(t,s)})).promise()}function C(t,s){return void 0===t?e.Deferred((function(){this.reject()})).promise():e.Deferred((function(){this.rejectWith(t,s)})).promise()}function N(e,t){return function(){e.resolveWith(t)}}function E(t){var s=e.extend({},t.data()),i=s.json;return delete s.fancytree,delete s.uiFancytree,i&&(delete s.json,s=e.extend(s,i)),s}function j(e){return(""+e).replace(r,(function(e){return a[e]}))}function T(e){return e=e.toLowerCase(),function(t){return t.title.toLowerCase().indexOf(e)>=0}}function z(t,s){var n,o,r,a;for(this.parent=t,this.tree=t.tree,this.ul=null,this.li=null,this.statusNodeType=null,this._isLoading=!1,this._error=null,this.data={},n=0,o=m.length;n<o;n++)this[r=m[n]]=s[r];for(r in null==this.unselectableIgnore&&null==this.unselectableStatus||(this.unselectable=!0),s.hideCheckbox&&e.error("'hideCheckbox' node option was removed in v2.23.0: use 'checkbox: false'"),s.data&&e.extend(this.data,s.data),s)g[r]||e.isFunction(s[r])||_[r]||(this.data[r]=s[r]);null==this.key?this.tree.options.defaultKey?(this.key=this.tree.options.defaultKey(this),w(this.key,"defaultKey() must return a unique key")):this.key="_"+i._nextNodeKey++:this.key=""+this.key,s.active&&(w(null===this.tree.activeNode,"only one active node allowed"),this.tree.activeNode=this),s.selected&&(this.tree.lastSelectedNode=this),(a=s.children)?a.length?this._setChildren(a):this.children=this.lazy?[]:null:this.children=null,this.tree._callHook("treeRegisterNode",this.tree,!0,this)}function I(t){this.widget=t,this.$div=t.element,this.options=t.options,this.options&&(void 0!==this.options.lazyload&&e.error("The 'lazyload' event is deprecated since 2014-02-25. Use 'lazyLoad' (with uppercase L) instead."),void 0!==this.options.loaderror&&e.error("The 'loaderror' event was renamed since 2014-07-03. Use 'loadError' (with uppercase E) instead."),void 0!==this.options.fx&&e.error("The 'fx' option was replaced by 'toggleEffect' since 2014-11-30."),void 0!==this.options.removeNode&&e.error("The 'removeNode' event was replaced by 'modifyChild' since 2.20 (2016-09-10).")),this.ext={},this.types={},this.columns={},this.data=E(this.$div),this._id=""+(this.options.treeId||e.ui.fancytree._nextId++),this._ns=".fancytree-"+this._id,this.activeNode=null,this.focusNode=null,this._hasFocus=null,this._tempCache={},this._lastMousedownNode=null,this._enableUpdate=!0,this.lastSelectedNode=null,this.systemFocusElement=null,this.lastQuicksearchTerm="",this.lastQuicksearchTime=0,this.viewport=null,this.statusClassPropName="span",this.ariaPropName="li",this.nodeContainerAttrName="li",this.$div.find(">ul.fancytree-container").remove();var s,n={tree:this};this.rootNode=new z(n,{title:"root",key:"root_"+this._id,children:null,expanded:!0}),this.rootNode.parent=null,s=e("<ul>",{id:"ft-id-"+this._id,class:"ui-fancytree fancytree-container fancytree-plain"}).appendTo(this.$div),this.$container=s,this.rootNode.ul=s[0],null==this.options.debugLevel&&(this.options.debugLevel=i.debugLevel)}e.ui.fancytree.warn("Fancytree: ignored duplicate include")})?i.apply(t,n):i)||(e.exports=o)},,,,,,,,,function(e,t,s){var i=i||{};window.WP_Smush=i,String.prototype.includes||(String.prototype.includes=function(e,t){return"number"!=typeof t&&(t=0),!(t+e.length>this.length)&&-1!==this.indexOf(e,t)}),s(13),s(14),s(15),s(16),s(28),s(18),s(19),s(20),s(21)},function(e,t){!function(){"use strict";WP_Smush.helpers={init:function(){},formatBytes:function(e,t){var s=["KB","MB","GB","TB","PB"];if(Math.abs(e)<1024)return e+" B";var i=-1;do{e/=1024,++i}while(Math.abs(e)>=1024&&i<s.length-1);return e.toFixed(t)+" "+s[i]},getSizeFromString:function(e){return e.replace(/[a-zA-Z]/g,"").trim()},getFormatFromString:function(e){return e.replace(/[0-9.]/g,"").trim()},precise_round:function(e,t){var s=e>=0?1:-1;return e=e>100?100:e,Math.round(e*Math.pow(10,t)+.001*s)/Math.pow(10,t)},resetSettings:function(){var e=new XMLHttpRequest;e.open("POST",ajaxurl+"?action=reset_settings",!0),e.setRequestHeader("Content-type","application/x-www-form-urlencoded"),e.onload=function(){if(200===e.status){var t=JSON.parse(e.response);void 0!==t.success&&t.success&&(window.location.href=wp_smush_msgs.smush_url)}else window.console.log("Request failed. Returned status of "+e.status)},e.send("_ajax_nonce="+smush_vars.nonce.get_smush_status)}},WP_Smush.helpers.init()}()},function(e,t,s){"use strict";s.r(t);var i=s(0),n=function(e,t){void 0===t&&(t=100),e.fadeTo(t,0,(function(){e.slideUp(t,(function(){e.remove()}))}))};jQuery((function(e){var t=function(t,s,n,o){if("disabled"!==s.attr("disabled")){t.preventDefault(),e(".wp-smush-error").remove(),e(".smush-stats-wrapper").hide();var r="grid";"smush_restore_image"===n&&(r=e(document).find("div.media-modal.wp-core-ui").length>0?"grid":window.location.search.indexOf("item")>-1?"grid":"list");var a={action:n,attachment_id:s.data("id"),mode:r,_nonce:s.data("nonce")};!function(e){var t=e.parent();t.css({opacity:"0.5"}),t.find("a").attr("disabled","disabled")}(s),s.html('<span class="spinner wp-smush-progress">'+wp_smush_msgs[o]+"</span>"),e.post(ajaxurl,a,(function(e){!function(e){var t=e.parent();t.css({opacity:"1"}),t.find("a").removeAttr("disabled")}(s),e.success&&void 0!==e.data?(void 0!==this.data&&this.data.indexOf("nextgen")>-1?s.parents().eq(1).html(e.data.stats):"restore"===o?s.parents().eq(1).html(e.data.stats):s.parents().eq(1).html(e.data),void 0!==e.data&&"restore"===o&&i.a.updateImageStats(e.data.new_size)):e.data.error_msg&&s.parent().append(e.data.error_msg)}))}},s=function(t){var s=e(".wp-smush-scan");s.text("").addClass("sui-button-onload sui-icon-loader sui-loading").blur();var o=s.data("type");o=void 0===o?"media":o,e(".wp-smush-all").removeAttr("data-smush");var r=e(".sui-notice-top.sui-notice-success");r.slideUp(100,(function(){r.remove()})),e(".wp-smush-all").attr("disabled","disabled"),e(".wp-smush-settings-changed").hide();var a={action:"scan_for_resmush",type:o,get_ui:!0,process_settings:t,wp_smush_options_nonce:jQuery("#wp_smush_options_nonce").val()};e.get(ajaxurl,a,(function(t){if(void 0!==t.data){if(void 0!==t.data.resmush_ids){wp_smushit_data.resmush=t.data.resmush_ids,"undefinied"!=typeof wp_smushit_data&&(wp_smushit_data.count_smushed=void 0!==t.data.count_smushed?t.data.count_smushed:wp_smushit_data.count_smushed,wp_smushit_data.count_supersmushed=void 0!==t.data.count_supersmushed?t.data.count_supersmushed:wp_smushit_data.count_supersmushed,wp_smushit_data.count_images=void 0!==t.data.count_image?t.data.count_image:wp_smushit_data.count_images,wp_smushit_data.size_before=void 0!==t.data.size_before?t.data.size_before:wp_smushit_data.size_before,wp_smushit_data.size_after=void 0!==t.data.size_after?t.data.size_after:wp_smushit_data.size_after,wp_smushit_data.savings_resize=void 0!==t.data.savings_resize?t.data.savings_resize:wp_smushit_data.savings_resize,wp_smushit_data.savings_conversion=void 0!==t.data.savings_conversion?t.data.savings_conversion:wp_smushit_data.savings_conversion,wp_smushit_data.count_resize=void 0!==t.data.count_resize?t.data.count_resize:wp_smushit_data.count_resize),"nextgen"===o&&(wp_smushit_data.bytes=parseInt(wp_smushit_data.size_before)-parseInt(wp_smushit_data.size_after));var s=e(".bulk-smush-wrapper .sui-notice");s.length>0&&(s.hide(),e(".wp-smush-pagespeed-recommendation").hide()),e(".wp-smush-resmush-notice").remove(),e(".wp-smush-bulk-wrapper").show()}if(void 0!==t.data.content&&e(".bulk-smush-wrapper .sui-box-body > p:first-of-type").after(t.data.content),void 0!==t.data.notice){var n=e("#wp-smush-ajax-notice");n.addClass("sui-notice-success"),n.html("<p>"+t.data.notice+"</p>"),n.slideDown(),setTimeout((function(){n.slideUp()}),5e3)}if(e("div.smush-final-log").hide(),void 0!==t.data.super_smush&&t.data.super_smush){var r=jQuery(".wp-smush-enable-lossy");r.length>0&&r.remove(),"undefined"!==t.data.super_smush_stats&&e(".super-smush-attachments .wp-smush-stats").html(t.data.super_smush_stats)}i.a.updateStats(o)}})).always((function(){jQuery(".bulk-smush-wrapper .wp-smush-bulk-progress-bar-wrapper").hide(),s.text(wp_smush_msgs.resmush_complete).removeClass("sui-button-onload sui-icon-loader sui-loading").addClass("smush-button-check-success"),setTimeout((function(){s.removeClass("smush-button-check-success").html('<i class="sui-icon-update" aria-hidden="true"></i>'+wp_smush_msgs.resmush_check)}),2e3),e(".wp-smush-all").removeAttr("disabled");var t=e(".wp-smush-re-check-message");t.length&&n(t)}))},o=function(t){e(t).length>0&&e("html, body").animate({scrollTop:e(t).offset().top-100},"slow")};e("#all-image-sizes").on("change",(function(){e('input[name^="wp-smush-image_sizes"]').prop("checked",!0)})),e("#wp-smush-update-api-status").on("click",(function(t){t.preventDefault(),e(this).addClass("sui-button-onload"),e.post(ajaxurl,{action:"recheck_api_status"},(function(){location.reload()}))})),e("body").on("click","a.smush-stats-details",(function(t){if("disabled"==e(this).attr("disabled"))return!1;t.preventDefault();var s=e(this).find(".stats-toggle");e(this).parents().eq(1).find(".smush-stats-wrapper").slideToggle(),s.text("+"==s.text()?"-":"+")})),e("body").on("click",".wp-smush-send:not(.wp-smush-resmush)",(function(t){t.preventDefault(),new i.a(e(this),!1)})),e("body").on("click",".wp-smush-remove-skipped",(function(t){t.preventDefault();var s=e(this);e.post(ajaxurl,{action:"remove_from_skip_list",id:s.attr("data-id")}).done((function(e){e.success&&void 0!==e.data.links&&(s.parent().parent().find(".smush-status").text(wp_smush_msgs.not_processed),t.target.closest(".smush-status-links").innerHTML=e.data.links)}))})),e("body").on("click",".wp-smush-nextgen-send",(function(t){t.preventDefault(),new i.a(e(this),!1,"nextgen")})),e("body").on("click",".wp-smush-nextgen-bulk",(function(t){if(t.preventDefault(),e(".wp-smush-resmush-notice").remove(),"undefined"==typeof wp_smushit_data||0===wp_smushit_data.unsmushed.length&&0===wp_smushit_data.resmush.length)return!1;jQuery(".wp-smush-all, .wp-smush-scan").attr("disabled","disabled"),e(".wp-smush-notice.wp-smush-remaining").hide(),new i.a(e(this),!0,"nextgen")})),e("body").on("click",".wp-smush-action.wp-smush-restore",(function(s){var i=e(this);t(s,i,"smush_restore_image","restore")})),e("body").on("click",".wp-smush-action.wp-smush-resmush",(function(s){t(s,e(this),"smush_resmush_image","smushing")})),e("body").on("click",".wp-smush-action.wp-smush-nextgen-restore",(function(s){t(s,e(this),"smush_restore_nextgen_image","restore")})),e("body").on("click",".wp-smush-action.wp-smush-nextgen-resmush",(function(s){t(s,e(this),"smush_resmush_nextgen_image","smushing")})),e(".wp-smush-scan").on("click",(function(e){e.preventDefault(),s(!1)})),e("#wp-smush-welcome-box .smush-dismiss-welcome").on("click",(function(t){t.preventDefault();var s=e(this).parents().eq(1);n(s);e.post(ajaxurl,{action:"dismiss_welcome_notice"})})),e("body").on("click",".wp-smush-notice .icon-fi-close",(function(t){t.preventDefault();var s=e(this).parent();n(s)})),e("input[name=wp-smush-keep_data]").on("change",(function(e){var t="keep_data-true"===e.target.id?"keep_data-false":"keep_data-true";e.target.parentNode.classList.add("active"),document.getElementById(t).parentNode.classList.remove("active")})),e("button#wp-smush-save-settings").on("click",(function(t){t.preventDefault();var s="",i=e('input[name="setting-type"]');i.length>0&&(s=i.val());var n=e(this);if(n.parent().find("span.sui-icon-loader.sui-loading").removeClass("sui-hidden"),""!=s&&"network"==s){var o={action:"save_settings",wp_smush_options_nonce:e("#wp_smush_options_nonce").val()};o=jQuery.param(o)+"&"+jQuery("form#wp-smush-settings-form").serialize(),jQuery.post(ajaxurl,o).done((function(){return jQuery("form#wp-smush-settings-form").submit(),!0}))}else{e(".wp-smush-hex-notice").hide(),n.attr("disabled","disabled").addClass("button-grey"),void 0!==n.attr("data-msg")&&n.attr("data-msg").length>0?n.html(n.attr("data-msg")):n.html(wp_smush_msgs.checking);var r=n.data("type");r=void 0===r?"media":r;var a={action:"scan_for_resmush",wp_smush_options_nonce:jQuery("#wp_smush_options_nonce").val(),type:r};a=jQuery.param(a)+"&"+jQuery("form#wp-smush-settings-form").serialize(),jQuery.post(ajaxurl,a).done((function(){return jQuery("form#wp-smush-settings-form").submit(),!0}))}})),e("body").on("click",".wp-smush-skip-resmush",(function(t){t.preventDefault();var s=jQuery(this),o=s.parents().eq(1),r=s.parent();n(r),e(".sui-notice-top.sui-notice-success").remove(),o.find(".wp-smush-all").attr("data-smush","skip_resmush"),wp_smushit_data.count_smushed=parseInt(wp_smushit_data.count_smushed)+wp_smushit_data.resmush.length,wp_smushit_data.count_supersmushed=parseInt(wp_smushit_data.count_supersmushed)+wp_smushit_data.resmush.length,wp_smushit_data.count_smushed===wp_smushit_data.count_total&&(e(".wp-smush-notice.wp-smush-all-done, .wp-smush-pagespeed-recommendation").show(),e(".wp-smush-bulk-wrapper ").hide()),e(".wp-smush-resmush-notice").remove();var a=e(".wp-smush-scan").data("type");a=void 0===a?"media":a;var u=(void 0!==wp_smushit_data.count_smushed?wp_smushit_data.count_smushed:0)/wp_smushit_data.count_total*100;u=WP_Smush.helpers.precise_round(u,1),e(".wp-smush-images-percent").html(u);var d=jQuery(".bulk-smush-wrapper .wp-smush-progress-inner");if(!(d.length<1)){d.css("width",u+"%"),e(".wp-smush-bulk-wrapper").show(),e(".wp-smush-bulk-wrapper .sui-notice").show();var l={action:"delete_resmush_list",type:a};e.post(ajaxurl,l,(function(t){if(t.success&&void 0!==t.data.stats){var s=t.data.stats;"undefinied"!=typeof wp_smushit_data&&(wp_smushit_data.count_images=void 0!==s.count_images?parseInt(wp_smushit_data.count_images)+s.count_images:wp_smushit_data.count_images,wp_smushit_data.size_before=void 0!==s.size_before?parseInt(wp_smushit_data.size_before)+s.size_before:wp_smushit_data.size_before,wp_smushit_data.size_after=void 0!==s.size_after?parseInt(wp_smushit_data.size_after)+s.size_after:wp_smushit_data.size_after,wp_smushit_data.savings_resize=void 0!==s.savings_resize?parseInt(wp_smushit_data.savings_resize)+s.savings_resize:wp_smushit_data.savings_resize,wp_smushit_data.savings_conversion=void 0!==s.savings_conversion?parseInt(wp_smushit_data.savings_conversion)+s.savings_conversion:wp_smushit_data.savings_conversion,void 0!==wp_smushit_data.savings_dir_smush&&void 0!==wp_smushit_data.savings_dir_smush.orig_size&&(wp_smushit_data.size_before=void 0!==wp_smushit_data.savings_dir_smush?parseInt(wp_smushit_data.size_before)+parseInt(wp_smushit_data.savings_dir_smush.orig_size):wp_smushit_data.size_before,wp_smushit_data.size_after=void 0!==wp_smushit_data.savings_dir_smush?parseInt(wp_smushit_data.size_after)+parseInt(wp_smushit_data.savings_dir_smush.image_size):wp_smushit_data.size_after),wp_smushit_data.count_resize=void 0!==s.count_resize?parseInt(wp_smushit_data.count_resize)+s.count_resize:wp_smushit_data.count_resize);var n=e(".bulk-smush-wrapper .wp-smush-remaining-count");n.length&&void 0!==wp_smushit_data.unsmushed&&n.html(wp_smushit_data.unsmushed.length),void 0===wp_smushit_data.unsmushed&&0!==wp_smushit_data.unsmushed.length||(e(".wp-smush-bulk-wrapper .sui-notice").hide(),e(".sui-notice-success.wp-smush-all-done").show()),i.a.updateStats()}}))}}));var r=function(){e("#wp-smush-resize").prop("checked",!0).focus(),e("div.wp-smush-resize-settings-wrap").show(),o("#column-wp-smush-resize")},a=function(){e("#wp-smush-lossy").prop("checked",!0).focus(),o("#column-wp-smush-lossy")};if(e("a.wp-smush-lossy-enable").on("click",(function(e){e.preventDefault(),a()})),e(".wp-smush-resize-enable").on("click",(function(e){e.preventDefault(),r()})),window.location.hash){var u=window.location.hash.substring(1);"enable-resize"===u?r():"enable-lossy"===u&&a()}if(e("body").on("click",".wp-smush-trigger-bulk",(function(t){t.preventDefault(),void 0!==t.target.dataset.type&&"nextgen"===t.target.dataset.type?e(".wp-smush-nextgen-bulk").click():e(".wp-smush-all").click(),e("span.sui-notice-dismiss").click()})),e("body").on("click","#bulk-smush-top-notice-close",(function(t){t.preventDefault(),e(this).parent().parent().slideUp("slow")})),e(".wp-smush-setting-row .toggle-checkbox").focus((function(){e(this).keypress((function(t){32==t.keyCode&&(t.preventDefault(),e(this).find(".toggle-checkbox").click())}))})),e("body").on("blur",".wp-smush-resize-input",(function(){!function(e,t,s){var i=e.find("#wp-smush-resize, #wp-smush-resize-quick-setup");if(!s)var n=e.find("#wp-smush-resize_width, #quick-setup-resize_width"),o=e.find(".sui-notice-info.wp-smush-update-width");if(!t)var r=e.find("#wp-smush-resize_height, #quick-setup-resize_height"),a=e.find(".sui-notice-info.wp-smush-update-height");var u=!1,d=!1;!i.is(":checked")||(void 0===wp_smushit_data.resize_sizes||void 0===wp_smushit_data.resize_sizes.width||(!s&&void 0!==n&&parseInt(wp_smushit_data.resize_sizes.width)>parseInt(n.val())?(n.parent().addClass("sui-form-field-error"),o.show("slow"),u=!0):(n.parent().removeClass("sui-form-field-error"),o.hide(),r.hasClass("error")&&a.show("slow")),!t&&void 0!==r&&parseInt(wp_smushit_data.resize_sizes.height)>parseInt(r.val())?(r.parent().addClass("sui-form-field-error"),u||a.show("slow"),d=!0):(r.parent().removeClass("sui-form-field-error"),a.hide(),n.hasClass("error")&&o.show("slow"))))}(e(this).parents().eq(4),!1,!1)})),e("body").on("click","#wp-smush-resize, #wp-smush-resize-quick-setup",(function(){var t=e(this),s=e(".wp-smush-resize-settings-wrap");t.is(":checked")?s.show():s.hide()})),e("#column-wp-smush-auto").on("click","#wp-smush-auto",(function(){var t=e("#column-wp-smush-auto .auto-smush-notice");e(this).is(":checked")?t.show():t.hide()})),e("body").on("click","#wp-smush-detection",(function(){var t=e(this),s=e(".smush-highlighting-notice"),i=e(".smush-highlighting-warning");t.is(":checked")?s.length>0?s.show():i.show():(s.hide(),i.hide())})),e("#wp-smush-png_to_jpg").click((function(){var t=e(this),s=e(".wp-smush-png_to_jpg-wrap");t.is(":checked")?s.show():s.hide()})),e("#wp-smush-revalidate-member").on("click",(function(t){t.preventDefault();var s=e(this).parents().eq(1);s.addClass("loading-notice"),e.get(ajaxurl,{action:"smush_show_warning"},(function(e){s.removeClass("loading-notice").addClass("loaded-notice"),0==e?(s.attr("data-message",wp_smush_msgs.membership_valid),n(s,1e3)):(s.attr("data-message",wp_smush_msgs.membership_invalid),setTimeout((function(){s.removeClass("loaded-notice")}),1e3))}))})),"undefined"!=typeof wp_smush_run_re_check&&1==wp_smush_run_re_check&&e(".wp-smush-scan").length>0&&s(!1),e("li.smush-dir-savings").length>0){e.get(ajaxurl,{action:"get_dir_smush_stats"},(function(t){e("li.smush-dir-savings .sui-icon-loader").hide(),t.success||void 0===t.data.message?void 0===t.data||void 0===t.data.dir_smush?(e("li.smush-dir-savings span.wp-smush-stats").append(wp_smush_msgs.ajax_error),e("li.smush-dir-savings span.wp-smush-stats span").hide()):function(t){if(void 0!==t.dir_smush){var s=e("li.smush-dir-savings span.wp-smush-stats span.wp-smush-stats-human"),i=e("li.smush-dir-savings span.wp-smush-stats span.wp-smush-stats-percent");if(t.dir_smush.bytes>0){if(e("li.smush-dir-savings .wp-smush-stats-label-message").hide(),s.length>0)s.html(t.dir_smush.human);else t.dir_smush.bytes;if(t.dir_smush.percent>0)if(e("li.smush-dir-savings span.wp-smush-stats span.wp-smush-stats-sep").removeClass("sui-hidden"),i.length>0)i.html(t.dir_smush.percent+"%");else t.dir_smush.percent}}if(void 0!==t.combined_stats&&t.combined_stats.length>0){var n=t.combined_stats,o=n.smushed/n.total_count*100;(o=WP_Smush.helpers.precise_round(o,1))&&e("div.wp-smush-count-total span.wp-smush-images-percent").html(o),n.total_count&&e("span.wp-smush-count-total span.wp-smush-total-optimised").html(n.total_count),n.savings&&e("span.wp-smush-savings span.wp-smush-stats-human").html(n.savings),n.percent&&e("span.wp-smush-savings span.wp-smush-stats-percent").html(n.percent)}}(t.data):e("div.wp-smush-scan-result div.content").prepend(t.data.message)}))}e(document).keyup((function(t){if(27===t.keyCode){var s=e("div.dev-overlay.wp-smush-list-dialog, div.dev-overlay.wp-smush-get-pro");if(!s.is(":visible"))return;s.find("div.close").click()}})),e("span.dismiss-recommendation").on("click",(function(t){t.preventDefault();var s=e(this).parent();s.hide("slow",(function(){s.remove()})),e.ajax({type:"POST",url:ajaxurl,data:{action:"hide_pagespeed_suggestion"}})})),e("div.wp-smush-api-message i.icon-fi-close").on("click",(function(t){t.preventDefault();var s=e(this).parent();s.hide("slow",(function(){s.remove()})),e.ajax({type:"POST",url:ajaxurl,data:{action:"hide_api_message"}})})),e("#close-resize-update-dialog").on("click",(function(e){e.preventDefault(),window.SUI.dialogs["resizing-update"].hide(),o("#column-wp-smush-resize")}))}))},function(e,t,s){"use strict";s.r(t);var i,n=s(0);i=jQuery,WP_Smush.bulk={init:function(){i(".wp-smush-all").on("click",(function(e){e.preventDefault(),i(".sui-notice-top.sui-notice-success").remove();var t=document.getElementById("bulk_smush_warning");t.classList.add("sui-hidden");var s=i(".wp-smush-bulk-progress-bar-wrapper");if(s.removeClass("wp-smush-exceed-limit"),s.find(".sui-progress-block .wp-smush-all").addClass("sui-hidden"),s.find(".sui-progress-block .wp-smush-cancel-bulk").removeClass("sui-hidden"),t&&document.getElementById("bulk-smush-resume-button").classList.add("sui-hidden"),i(".wp-resmush.wp-smush-action, .wp-smush-scan, .wp-smush-all:not(.sui-progress-close), a.wp-smush-lossy-enable, button.wp-smush-resize-enable, button#wp-smush-save-settings").attr("disabled","disabled"),void 0===window.wp_smushit_data||0===window.wp_smushit_data.unsmushed.length&&0===window.wp_smushit_data.resmush.length)return!1;i(".wp-smush-remaining").hide(),s.find("i.sui-icon-info").removeClass("sui-icon-info").addClass("sui-loading").addClass("sui-icon-loader"),new n.a(i(this),!0)})),i("body").on("click",".smush-ignore-image",(function(e){e.preventDefault();var t=i(this);t.attr("disabled",!0),t.attr("data-tooltip"),t.removeClass("sui-tooltip"),i.post(ajaxurl,{action:"ignore_bulk_image",id:t.attr("data-id")}).done((function(s){t.is("a")&&s.success&&void 0!==s.data.links&&(t.parent().parent().find(".smush-status").text(wp_smush_msgs.ignored),e.target.closest(".smush-status-links").innerHTML=s.data.links)}))}))}},WP_Smush.bulk.init()},function(e,t){!function(){"use strict";WP_Smush.onboarding={membership:"free",onboardingModal:document.getElementById("smush-onboarding-dialog"),scanFilesModal:document.getElementById("checking-files-dialog"),settings:{first:!0,last:!1,slide:"start",value:!1},selection:{auto:!0,lossy:!0,strip_exif:!0,original:!1,lazy_load:!0,usage:!1},contentContainer:document.getElementById("smush-onboarding-content"),onboardingSlides:["start","auto","lossy","strip_exif","original","lazy_load","usage"],touchX:null,touchY:null,init:function(){if(this.onboardingModal){this.membership=document.getElementById("smush-onboarding").dataset.type,"pro"!==this.membership&&(this.onboardingSlides=["start","auto","strip_exif","lazy_load","usage"],this.selection.lossy=!1),this.renderTemplate();var e=this.onboardingModal.querySelector(".smush-onboarding-skip-link");e&&e.addEventListener("click",this.skipSetup),window.SUI.openModal("smush-onboarding-dialog","checking-files-dialog",void 0,!1)}},handleTouchStart:function(e){var t=e.touches[0];this.touchX=t.clientX,this.touchY=t.clientY},handleTouchMove:function(e){if(this.touchX&&this.touchY){var t=e.touches[0].clientX,s=e.touches[0].clientY,i=this.touchX-t,n=this.touchY-s;Math.abs(i)>Math.abs(n)&&(i>0?!1===WP_Smush.onboarding.settings.last&&WP_Smush.onboarding.next(null,"next"):!1===WP_Smush.onboarding.settings.first&&WP_Smush.onboarding.next(null,"prev")),this.touchX=null,this.touchY=null}},renderTemplate:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"none",s=this.onboardingModal.querySelector('input[type="checkbox"]');s&&(this.selection[s.id]=s.checked);var i=WP_Smush.onboarding.template("smush-onboarding"),n=i(this.settings);n&&(this.contentContainer.innerHTML=n,"none"===t?this.contentContainer.classList.add("loaded"):(this.contentContainer.classList.remove("loaded"),this.contentContainer.classList.add(t),setTimeout((function(){e.contentContainer.classList.add("loaded"),e.contentContainer.classList.remove(t)}),600))),this.onboardingModal.addEventListener("touchstart",this.handleTouchStart,!1),this.onboardingModal.addEventListener("touchmove",this.handleTouchMove,!1),this.bindSubmit()},bindSubmit:function(){var e=this.onboardingModal.querySelector('button[type="submit"]'),t=this;e&&e.addEventListener("click",(function(e){e.preventDefault();var s=t.onboardingModal.querySelector('input[type="checkbox"]');s&&(t.selection[s.id]=s.checked);var i=document.getElementById("_wpnonce"),n=new XMLHttpRequest;n.open("POST",ajaxurl+"?action=smush_setup",!0),n.setRequestHeader("Content-type","application/x-www-form-urlencoded"),n.onload=function(){200===n.status?WP_Smush.onboarding.showScanDialog():window.console.log("Request failed. Returned status of "+n.status)},n.send("smush_settings="+JSON.stringify(t.selection)+"&_ajax_nonce="+i.value)}))},next:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=this.onboardingSlides.indexOf(this.settings.slide),i=0;i=t?"next"===t?s+1:s-1:null!==e&&e.classList.contains("next")?s+1:s-1;var n=null!==e&&e.classList.contains("next")?"fadeInRight":"fadeInLeft";this.settings={first:0===i,last:i+1===this.onboardingSlides.length,slide:this.onboardingSlides[i],value:this.selection[this.onboardingSlides[i]]},this.renderTemplate(n)},goTo:function(e){var t=this.onboardingSlides.indexOf(e);this.settings={first:0===t,last:t+1===this.onboardingSlides.length,slide:e,value:this.selection[e]},this.renderTemplate()},skipSetup:function(){var e=document.getElementById("_wpnonce"),t=new XMLHttpRequest;t.open("POST",ajaxurl+"?action=skip_smush_setup&_ajax_nonce="+e.value),t.onload=function(){200===t.status?WP_Smush.onboarding.showScanDialog():window.console.log("Request failed. Returned status of "+t.status)},t.send()},showScanDialog:function(){window.SUI.closeModal(),window.SUI.openModal("checking-files-dialog","wpbody-content",void 0,!1);var e=document.getElementById("wp_smush_options_nonce");setTimeout((function(){var t=new XMLHttpRequest;t.open("POST",ajaxurl+"?action=scan_for_resmush",!0),t.setRequestHeader("Content-type","application/x-www-form-urlencoded"),t.onload=function(){var e=document.querySelector("#smush-onboarding-dialog");e.parentNode.removeChild(e),window.SUI.closeModal(),200===t.status?setTimeout((function(){location.reload()}),1e3):window.console.log("Request failed. Returned status of "+t.status)},t.send("type=media&get_ui=false&process_settings=false&wp_smush_options_nonce="+e.value)}),3e3)}},WP_Smush.onboarding.template=_.memoize((function(e){var t,s={evaluate:/<#([\s\S]+?)#>/g,interpolate:/{{{([\s\S]+?)}}}/g,escape:/{{([^}]+?)}}(?!})/g,variable:"data"};return function(i){return _.templateSettings=s,(t=t||_.template(document.getElementById(e).innerHTML))(i)}})),window.addEventListener("load",(function(){return WP_Smush.onboarding.init()}))}()},function(e,t,s){var i,n,o; /*! jQuery UI - v1.12.1 - 2018-05-20 * http://jqueryui.com * Includes: widget.js, position.js, keycode.js, scroll-parent.js, unique-id.js * Copyright jQuery Foundation and other contributors; Licensed MIT */n=[s(2)],void 0===(o="function"==typeof(i=function(e){e.ui=e.ui||{},e.ui.version="1.12.1";var t,s,i=0,n=Array.prototype.slice; /*! * jQuery UI Widget 1.12.1 * http://jqueryui.com * * Copyright jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license */e.cleanData=e.cleanData||(t=e.cleanData,function(s){var i,n,o;for(o=0;null!=(n=s[o]);o++)try{(i=e._data(n,"events"))&&i.remove&&e(n).triggerHandler("remove")}catch(e){}t(s)}),e.widget=e.widget||function(t,s,i){var n,o,r,a={},u=t.split(".")[0],d=u+"-"+(t=t.split(".")[1]);return i||(i=s,s=e.Widget),e.isArray(i)&&(i=e.extend.apply(null,[{}].concat(i))),e.expr[":"][d.toLowerCase()]=function(t){return!!e.data(t,d)},e[u]=e[u]||{},n=e[u][t],o=e[u][t]=function(e,t){if(!this._createWidget)return new o(e,t);arguments.length&&this._createWidget(e,t)},e.extend(o,n,{version:i.version,_proto:e.extend({},i),_childConstructors:[]}),(r=new s).options=e.widget.extend({},r.options),e.each(i,(function(t,i){e.isFunction(i)?a[t]=function(){function e(){return s.prototype[t].apply(this,arguments)}function n(e){return s.prototype[t].apply(this,e)}return function(){var t,s=this._super,o=this._superApply;return this._super=e,this._superApply=n,t=i.apply(this,arguments),this._super=s,this._superApply=o,t}}():a[t]=i})),o.prototype=e.widget.extend(r,{widgetEventPrefix:n&&r.widgetEventPrefix||t},a,{constructor:o,namespace:u,widgetName:t,widgetFullName:d}),n?(e.each(n._childConstructors,(function(t,s){var i=s.prototype;e.widget(i.namespace+"."+i.widgetName,o,s._proto)})),delete n._childConstructors):s._childConstructors.push(o),e.widget.bridge(t,o),o},e.widget.extend=function(t){for(var s,i,o=n.call(arguments,1),r=0,a=o.length;r<a;r++)for(s in o[r])i=o[r][s],o[r].hasOwnProperty(s)&&void 0!==i&&(e.isPlainObject(i)?t[s]=e.isPlainObject(t[s])?e.widget.extend({},t[s],i):e.widget.extend({},i):t[s]=i);return t},e.widget.bridge=function(t,s){var i=s.prototype.widgetFullName||t;e.fn[t]=function(o){var r="string"==typeof o,a=n.call(arguments,1),u=this;return r?this.length||"instance"!==o?this.each((function(){var s,n=e.data(this,i);return"instance"===o?(u=n,!1):n?e.isFunction(n[o])&&"_"!==o.charAt(0)?(s=n[o].apply(n,a))!==n&&void 0!==s?(u=s&&s.jquery?u.pushStack(s.get()):s,!1):void 0:e.error("no such method '"+o+"' for "+t+" widget instance"):e.error("cannot call methods on "+t+" prior to initialization; attempted to call method '"+o+"'")})):u=void 0:(a.length&&(o=e.widget.extend.apply(null,[o].concat(a))),this.each((function(){var t=e.data(this,i);t?(t.option(o||{}),t._init&&t._init()):e.data(this,i,new s(o,this))}))),u}},e.Widget=e.Widget||function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:!1,create:null},_createWidget:function(t,s){s=e(s||this.defaultElement||this)[0],this.element=e(s),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=e(),this.hoverable=e(),this.focusable=e(),this.classesElementLookup={},s!==this&&(e.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===s&&this.destroy()}}),this.document=e(s.style?s.ownerDocument:s.document||s),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){var t=this;this._destroy(),e.each(this.classesElementLookup,(function(e,s){t._removeClass(s,e)})),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:e.noop,widget:function(){return this.element},option:function(t,s){var i,n,o,r=t;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof t)if(r={},i=t.split("."),t=i.shift(),i.length){for(n=r[t]=e.widget.extend({},this.options[t]),o=0;o<i.length-1;o++)n[i[o]]=n[i[o]]||{},n=n[i[o]];if(t=i.pop(),1===arguments.length)return void 0===n[t]?null:n[t];n[t]=s}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];r[t]=s}return this._setOptions(r),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return"classes"===e&&this._setOptionClasses(t),this.options[e]=t,"disabled"===e&&this._setOptionDisabled(t),this},_setOptionClasses:function(t){var s,i,n;for(s in t)n=this.classesElementLookup[s],t[s]!==this.options.classes[s]&&n&&n.length&&(i=e(n.get()),this._removeClass(n,s),i.addClass(this._classes({element:i,keys:s,classes:t,add:!0})))},_setOptionDisabled:function(e){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!e),e&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(t){var s=[],i=this;function n(n,o){var r,a;for(a=0;a<n.length;a++)r=i.classesElementLookup[n[a]]||e(),r=t.add?e(e.unique(r.get().concat(t.element.get()))):e(r.not(t.element).get()),i.classesElementLookup[n[a]]=r,s.push(n[a]),o&&t.classes[n[a]]&&s.push(t.classes[n[a]])}return t=e.extend({element:this.element,classes:this.options.classes||{}},t),this._on(t.element,{remove:"_untrackClassesElement"}),t.keys&&n(t.keys.match(/\S+/g)||[],!0),t.extra&&n(t.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(t){var s=this;e.each(s.classesElementLookup,(function(i,n){-1!==e.inArray(t.target,n)&&(s.classesElementLookup[i]=e(n.not(t.target).get()))}))},_removeClass:function(e,t,s){return this._toggleClass(e,t,s,!1)},_addClass:function(e,t,s){return this._toggleClass(e,t,s,!0)},_toggleClass:function(e,t,s,i){i="boolean"==typeof i?i:s;var n="string"==typeof e||null===e,o={extra:n?t:s,keys:n?e:t,element:n?this.element:e,add:i};return o.element.toggleClass(this._classes(o),i),this},_on:function(t,s,i){var n,o=this;"boolean"!=typeof t&&(i=s,s=t,t=!1),i?(s=n=e(s),this.bindings=this.bindings.add(s)):(i=s,s=this.element,n=this.widget()),e.each(i,(function(i,r){function a(){if(t||!0!==o.options.disabled&&!e(this).hasClass("ui-state-disabled"))return("string"==typeof r?o[r]:r).apply(o,arguments)}"string"!=typeof r&&(a.guid=r.guid=r.guid||a.guid||e.guid++);var u=i.match(/^([\w:-]*)\s*(.*)$/),d=u[1]+o.eventNamespace,l=u[2];l?n.on(d,l,a):s.on(d,a)}))},_off:function(t,s){s=(s||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.off(s).off(s),this.bindings=e(this.bindings.not(t).get()),this.focusable=e(this.focusable.not(t).get()),this.hoverable=e(this.hoverable.not(t).get())},_delay:function(e,t){var s=this;return setTimeout((function(){return("string"==typeof e?s[e]:e).apply(s,arguments)}),t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){this._addClass(e(t.currentTarget),null,"ui-state-hover")},mouseleave:function(t){this._removeClass(e(t.currentTarget),null,"ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){this._addClass(e(t.currentTarget),null,"ui-state-focus")},focusout:function(t){this._removeClass(e(t.currentTarget),null,"ui-state-focus")}})},_trigger:function(t,s,i){var n,o,r=this.options[t];if(i=i||{},(s=e.Event(s)).type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),s.target=this.element[0],o=s.originalEvent)for(n in o)n in s||(s[n]=o[n]);return this.element.trigger(s,i),!(e.isFunction(r)&&!1===r.apply(this.element[0],[s].concat(i))||s.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},(function(t,s){e.Widget.prototype["_"+t]=function(i,n,o){var r;"string"==typeof n&&(n={effect:n});var a=n?!0===n||"number"==typeof n?s:n.effect||s:t;"number"==typeof(n=n||{})&&(n={duration:n}),r=!e.isEmptyObject(n),n.complete=o,n.delay&&i.delay(n.delay),r&&e.effects&&e.effects.effect[a]?i[t](n):a!==t&&i[a]?i[a](n.duration,n.easing,o):i.queue((function(s){e(this)[t](),o&&o.call(i[0]),s()}))}})),e.widget, /*! * jQuery UI Position 1.12.1 * http://jqueryui.com * * Copyright jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/position/ */ function(){var t,s=Math.max,i=Math.abs,n=/left|center|right/,o=/top|center|bottom/,r=/[\+\-]\d+(\.[\d]+)?%?/,a=/^\w+/,u=/%$/,d=e.fn.position;function l(e,t,s){return[parseFloat(e[0])*(u.test(e[0])?t/100:1),parseFloat(e[1])*(u.test(e[1])?s/100:1)]}function c(t,s){return parseInt(e.css(t,s),10)||0}function h(t){var s=t[0];return 9===s.nodeType?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:e.isWindow(s)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:s.preventDefault?{width:0,height:0,offset:{top:s.pageY,left:s.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()}}e.position=e.position||{scrollbarWidth:function(){if(void 0!==t)return t;var s,i,n=e("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),o=n.children()[0];return e("body").append(n),s=o.offsetWidth,n.css("overflow","scroll"),s===(i=o.offsetWidth)&&(i=n[0].clientWidth),n.remove(),t=s-i},getScrollInfo:function(t){var s=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),i=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),n="scroll"===s||"auto"===s&&t.width<t.element[0].scrollWidth;return{width:"scroll"===i||"auto"===i&&t.height<t.element[0].scrollHeight?e.position.scrollbarWidth():0,height:n?e.position.scrollbarWidth():0}},getWithinInfo:function(t){var s=e(t||window),i=e.isWindow(s[0]),n=!!s[0]&&9===s[0].nodeType;return{element:s,isWindow:i,isDocument:n,offset:i||n?{left:0,top:0}:e(t).offset(),scrollLeft:s.scrollLeft(),scrollTop:s.scrollTop(),width:s.outerWidth(),height:s.outerHeight()}}},e.fn.position=function(t){if(!t||!t.of)return d.apply(this,arguments);t=e.extend({},t);var u,p,f,m,g,v,_=e(t.of),w=e.position.getWithinInfo(t.within),y=e.position.getScrollInfo(w),b=(t.collision||"flip").split(" "),k={};return v=h(_),_[0].preventDefault&&(t.at="left top"),p=v.width,f=v.height,m=v.offset,g=e.extend({},m),e.each(["my","at"],(function(){var e,s,i=(t[this]||"").split(" ");1===i.length&&(i=n.test(i[0])?i.concat(["center"]):o.test(i[0])?["center"].concat(i):["center","center"]),i[0]=n.test(i[0])?i[0]:"center",i[1]=o.test(i[1])?i[1]:"center",e=r.exec(i[0]),s=r.exec(i[1]),k[this]=[e?e[0]:0,s?s[0]:0],t[this]=[a.exec(i[0])[0],a.exec(i[1])[0]]})),1===b.length&&(b[1]=b[0]),"right"===t.at[0]?g.left+=p:"center"===t.at[0]&&(g.left+=p/2),"bottom"===t.at[1]?g.top+=f:"center"===t.at[1]&&(g.top+=f/2),u=l(k.at,p,f),g.left+=u[0],g.top+=u[1],this.each((function(){var n,o,r=e(this),a=r.outerWidth(),d=r.outerHeight(),h=c(this,"marginLeft"),v=c(this,"marginTop"),x=a+h+c(this,"marginRight")+y.width,S=d+v+c(this,"marginBottom")+y.height,C=e.extend({},g),N=l(k.my,r.outerWidth(),r.outerHeight());"right"===t.my[0]?C.left-=a:"center"===t.my[0]&&(C.left-=a/2),"bottom"===t.my[1]?C.top-=d:"center"===t.my[1]&&(C.top-=d/2),C.left+=N[0],C.top+=N[1],n={marginLeft:h,marginTop:v},e.each(["left","top"],(function(s,i){e.ui.position[b[s]]&&e.ui.position[b[s]][i](C,{targetWidth:p,targetHeight:f,elemWidth:a,elemHeight:d,collisionPosition:n,collisionWidth:x,collisionHeight:S,offset:[u[0]+N[0],u[1]+N[1]],my:t.my,at:t.at,within:w,elem:r})})),t.using&&(o=function(e){var n=m.left-C.left,o=n+p-a,u=m.top-C.top,l=u+f-d,c={target:{element:_,left:m.left,top:m.top,width:p,height:f},element:{element:r,left:C.left,top:C.top,width:a,height:d},horizontal:o<0?"left":n>0?"right":"center",vertical:l<0?"top":u>0?"bottom":"middle"};p<a&&i(n+o)<p&&(c.horizontal="center"),f<d&&i(u+l)<f&&(c.vertical="middle"),s(i(n),i(o))>s(i(u),i(l))?c.important="horizontal":c.important="vertical",t.using.call(this,e,c)}),r.offset(e.extend(C,{using:o}))}))},e.ui.position={fit:{left:function(e,t){var i,n=t.within,o=n.isWindow?n.scrollLeft:n.offset.left,r=n.width,a=e.left-t.collisionPosition.marginLeft,u=o-a,d=a+t.collisionWidth-r-o;t.collisionWidth>r?u>0&&d<=0?(i=e.left+u+t.collisionWidth-r-o,e.left+=u-i):e.left=d>0&&u<=0?o:u>d?o+r-t.collisionWidth:o:u>0?e.left+=u:d>0?e.left-=d:e.left=s(e.left-a,e.left)},top:function(e,t){var i,n=t.within,o=n.isWindow?n.scrollTop:n.offset.top,r=t.within.height,a=e.top-t.collisionPosition.marginTop,u=o-a,d=a+t.collisionHeight-r-o;t.collisionHeight>r?u>0&&d<=0?(i=e.top+u+t.collisionHeight-r-o,e.top+=u-i):e.top=d>0&&u<=0?o:u>d?o+r-t.collisionHeight:o:u>0?e.top+=u:d>0?e.top-=d:e.top=s(e.top-a,e.top)}},flip:{left:function(e,t){var s,n,o=t.within,r=o.offset.left+o.scrollLeft,a=o.width,u=o.isWindow?o.scrollLeft:o.offset.left,d=e.left-t.collisionPosition.marginLeft,l=d-u,c=d+t.collisionWidth-a-u,h="left"===t.my[0]?-t.elemWidth:"right"===t.my[0]?t.elemWidth:0,p="left"===t.at[0]?t.targetWidth:"right"===t.at[0]?-t.targetWidth:0,f=-2*t.offset[0];l<0?((s=e.left+h+p+f+t.collisionWidth-a-r)<0||s<i(l))&&(e.left+=h+p+f):c>0&&((n=e.left-t.collisionPosition.marginLeft+h+p+f-u)>0||i(n)<c)&&(e.left+=h+p+f)},top:function(e,t){var s,n,o=t.within,r=o.offset.top+o.scrollTop,a=o.height,u=o.isWindow?o.scrollTop:o.offset.top,d=e.top-t.collisionPosition.marginTop,l=d-u,c=d+t.collisionHeight-a-u,h="top"===t.my[1]?-t.elemHeight:"bottom"===t.my[1]?t.elemHeight:0,p="top"===t.at[1]?t.targetHeight:"bottom"===t.at[1]?-t.targetHeight:0,f=-2*t.offset[1];l<0?((n=e.top+h+p+f+t.collisionHeight-a-r)<0||n<i(l))&&(e.top+=h+p+f):c>0&&((s=e.top-t.collisionPosition.marginTop+h+p+f-u)>0||i(s)<c)&&(e.top+=h+p+f)}},flipfit:{left:function(){e.ui.position.flip.left.apply(this,arguments),e.ui.position.fit.left.apply(this,arguments)},top:function(){e.ui.position.flip.top.apply(this,arguments),e.ui.position.fit.top.apply(this,arguments)}}}}(),e.ui.position,e.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},e.fn.scrollParent=function(t){var s=this.css("position"),i="absolute"===s,n=t?/(auto|scroll|hidden)/:/(auto|scroll)/,o=this.parents().filter((function(){var t=e(this);return(!i||"static"!==t.css("position"))&&n.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))})).eq(0);return"fixed"!==s&&o.length?o:e(this[0].ownerDocument||document)},e.fn.extend({uniqueId:(s=0,function(){return this.each((function(){this.id||(this.id="ui-id-"+ ++s)}))}),removeUniqueId:function(){return this.each((function(){/^ui-id-\d+$/.test(this.id)&&e(this).removeAttr("id")}))}})})?i.apply(t,n):i)||(e.exports=o)},function(e,t){!function(){"use strict";WP_Smush.CDN={cdnEnableButton:document.getElementById("smush-enable-cdn"),cdnDisableButton:document.getElementById("smush-cancel-cdn"),cdnStatsBox:document.querySelector(".smush-cdn-stats"),init:function(){var e=this;this.cdnEnableButton&&this.cdnEnableButton.addEventListener("click",(function(t){t.currentTarget.classList.add("sui-button-onload");var s=t.currentTarget.querySelector(".sui-icon-loader");s.style.display="none",s.style.display="flex",e.toggle_cdn(!0)})),this.cdnDisableButton&&this.cdnDisableButton.addEventListener("click",(function(t){t.preventDefault(),e.toggle_cdn(!1)})),this.updateStatsBox()},toggle_cdn:function(e){var t=this,s=document.getElementsByName("wp_smush_options_nonce"),i=new XMLHttpRequest;i.open("POST",ajaxurl+"?action=smush_toggle_cdn",!0),i.setRequestHeader("Content-type","application/x-www-form-urlencoded"),i.onload=function(){if(200===i.status){var e=JSON.parse(i.response);void 0!==e.success&&e.success?location.reload():void 0!==e.data.message&&t.showNotice(e.data.message)}else t.showNotice("Request failed. Returned status of "+i.status)},i.send("param="+e+"&_ajax_nonce="+s[0].value)},showNotice:function(e){if(void 0!==e){var t=document.getElementById("wp-smush-ajax-notice");t.classList.add("sui-notice-error"),t.innerHTML="<p>".concat(e,"</p>"),this.cdnEnableButton&&this.cdnEnableButton.classList.remove("sui-button-onload"),t.style.display="block",setTimeout((function(){t.style.display="none"}),5e3)}},updateStatsBox:function(){var e=this;if(void 0!==this.cdnStatsBox&&this.cdnStatsBox&&window.location.search.includes("view=cdn")){this.toggleElements();var t=new XMLHttpRequest;t.open("POST",ajaxurl+"?action=get_cdn_stats",!0),t.onload=function(){if(200===t.status){var s=JSON.parse(t.response);void 0!==s.success&&s.success?e.toggleElements():void 0!==s.data.message&&e.showNotice(s.data.message)}else e.showNotice("Request failed. Returned status of "+t.status)},t.send()}},toggleElements:function(){for(var e=this.cdnStatsBox.querySelector(".sui-icon-loader"),t=this.cdnStatsBox.querySelectorAll(".wp-smush-stats > :not(.sui-icon-loader)"),s=0;s<t.length;s++)t[s].classList.toggle("sui-hidden");e.classList.toggle("sui-hidden")}},WP_Smush.CDN.init()}()},function(e,t){!function(){"use strict";WP_Smush.Lazyload={lazyloadEnableButton:document.getElementById("smush-enable-lazyload"),lazyloadDisableButton:document.getElementById("smush-cancel-lazyload"),init:function(){var e=this,t=this;this.lazyloadEnableButton&&this.lazyloadEnableButton.addEventListener("click",(function(t){t.currentTarget.classList.add("sui-button-onload");var s=t.currentTarget.querySelector(".sui-icon-loader");s.style.display="none",s.offsetHeight,s.style.display="flex",e.toggle_lazy_load(!0)})),this.lazyloadDisableButton&&this.lazyloadDisableButton.addEventListener("click",(function(t){t.preventDefault(),e.toggle_lazy_load(!1)}));var s=document.getElementById("smush-remove-spinner");s&&s.addEventListener("click",(function(t){t.preventDefault(),e.removeLoaderIcon()}));var i=document.getElementById("smush-remove-placeholder");i&&i.addEventListener("click",(function(t){t.preventDefault(),e.removeLoaderIcon("placeholder")}));var n=document.querySelectorAll(".smush-ll-remove");n&&0<n.length&&n.forEach((function(e){e.addEventListener("click",(function(e){e.preventDefault(),e.target.closest("li").style.display="none",t.remove(e.target.dataset.id,e.target.dataset.type)}))}))},toggle_lazy_load:function(e){var t=this,s=document.getElementsByName("wp_smush_options_nonce"),i=new XMLHttpRequest;i.open("POST",ajaxurl+"?action=smush_toggle_lazy_load",!0),i.setRequestHeader("Content-type","application/x-www-form-urlencoded"),i.onload=function(){if(200===i.status){var e=JSON.parse(i.response);void 0!==e.success&&e.success?location.reload():void 0!==e.data.message&&t.showNotice(e.data.message)}else window.console.log("Request failed. Returned status of "+i.status)},i.send("param="+e+"&_ajax_nonce="+s[0].value)},showNotice:function(e){if(void 0!==e){var t=document.getElementById("wp-smush-ajax-notice");t.classList.add("sui-notice-error"),t.innerHTML="<p>".concat(e,"</p>"),this.cdnEnableButton&&this.cdnEnableButton.classList.remove("sui-button-onload"),t.style.display="block",setTimeout((function(){t.style.display="none"}),5e3)}},addLoaderIcon:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"spinner";e?e.open():((e=wp.media({title:"Select or upload an icon",button:{text:"Select icon"},multiple:!1})).on("select",(function(){var s=e.state().get("selection").first().toJSON(),i=document.getElementById("smush-"+t+"-icon-preview");i.style.backgroundImage='url("'+s.url+'")',i.style.display="block",document.getElementById("smush-"+t+"-icon-file").setAttribute("value",s.id),document.getElementById("smush-upload-"+t).style.display="none";var n=document.getElementById("smush-remove-"+t);n.querySelector("span").innerHTML=s.filename,n.style.display="block"})),e.open())},removeLoaderIcon:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"spinner",t=document.getElementById("smush-"+e+"-icon-preview");t.style.backgroundImage="",t.style.display="none",document.getElementById("smush-upload-"+e).style.display="block",document.getElementById("smush-remove-"+e).style.display="none",document.getElementById("smush-"+e+"-icon-file").setAttribute("value","")},remove:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"spinner",s=document.getElementsByName("wp_smush_options_nonce"),i=new XMLHttpRequest;i.open("POST",ajaxurl+"?action=smush_remove_icon",!0),i.setRequestHeader("Content-type","application/x-www-form-urlencoded"),i.send("id="+e+"&type="+t+"&_ajax_nonce="+s[0].value)}},WP_Smush.Lazyload.init()}()},function(e,t){!function(){"use strict";WP_Smush.restore={modal:document.getElementById("smush-restore-images-dialog"),contentContainer:document.getElementById("smush-bulk-restore-content"),settings:{slide:"start",success:0,errors:[]},items:[],success:[],errors:[],currentStep:0,totalSteps:0,init:function(){this.modal&&(this.settings={slide:"start",success:0,errors:[]},this.resetModalWidth(),this.renderTemplate(),window.SUI.openModal("smush-restore-images-dialog","wpbody-content",void 0,!1))},renderTemplate:function(){var e=WP_Smush.onboarding.template("smush-bulk-restore")(this.settings);e&&(this.contentContainer.innerHTML=e),this.bindSubmit()},resetModalWidth:function(){this.modal.style.maxWidth="460px",this.modal.querySelector(".sui-box").style.maxWidth="460px"},bindSubmit:function(){var e=this.modal.querySelector('button[id="smush-bulk-restore-button"]'),t=this;e&&e.addEventListener("click",(function(e){e.preventDefault(),t.resetModalWidth(),t.settings={slide:"progress"},t.errors=[],t.renderTemplate(),t.initScan()}))},cancel:function(){"start"===this.settings.slide||"finish"===this.settings.slide?window.SUI.closeModal():(this.updateProgressBar(!0),window.location.reload())},updateProgressBar:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=0;0<this.currentStep&&(t=Math.min(Math.round(100*this.currentStep/this.totalSteps),99)),t>100&&(t=100),this.modal.querySelector(".sui-progress-text span").innerHTML=t+"%",this.modal.querySelector(".sui-progress-bar span").style.width=t+"%";var s=this.modal.querySelector(".sui-progress-state-text");s.innerHTML=t>=90?"Finalizing...":e?"Cancelling...":this.currentStep+"/"+this.totalSteps+" images restored"},initScan:function(){var e=this,t=document.getElementById("_wpnonce"),s=new XMLHttpRequest;s.open("POST",ajaxurl+"?action=get_image_count",!0),s.setRequestHeader("Content-type","application/x-www-form-urlencoded"),s.onload=function(){if(200===s.status){var t=JSON.parse(s.response);void 0!==t.data.items&&(e.items=t.data.items,e.totalSteps=t.data.items.length,e.step())}else window.console.log("Request failed. Returned status of "+s.status)},s.send("_ajax_nonce="+t.value)},step:function(){var e=this,t=this,s=document.getElementById("_wpnonce");if(0<this.items.length){var i=this.items.pop(),n=new XMLHttpRequest;n.open("POST",ajaxurl+"?action=restore_step",!0),n.setRequestHeader("Content-type","application/x-www-form-urlencoded"),n.onload=function(){if(e.currentStep++,200===n.status){var s=JSON.parse(n.response);void 0!==s.data.success&&s.data.success?t.success.push(i):t.errors.push({id:i,src:s.data.src,thumb:s.data.thumb,link:s.data.link})}t.updateProgressBar(),t.step()},n.send("item="+i+"&_ajax_nonce="+s.value)}else this.settings={slide:"finish",success:this.success.length,errors:this.errors,total:this.totalSteps},t.renderTemplate(),0<this.errors.length&&(this.modal.style.maxWidth="660px",this.modal.querySelector(".sui-box").style.maxWidth="660px")}},WP_Smush.restore.template=_.memoize((function(e){var t,s={evaluate:/<#([\s\S]+?)#>/g,interpolate:/{{{([\s\S]+?)}}}/g,escape:/{{([^}]+?)}}(?!})/g,variable:"data"};return function(i){return _.templateSettings=s,(t=t||_.template(document.getElementById(e).innerHTML))(i)}}))}()},function(e,t){!function(e){var t=this,s=e(".smush-notice"),i=s.find(".smush-notice-act");function n(){s.fadeTo(100,0,(function(){return s.slideUp(100,(function(){return s.remove()}))}))}function o(t){s.attr("data-message",t),s.addClass("loading"),e.post(ajaxurl,{action:"dismiss_upgrade_notice"})}s.fadeIn(500),i.on("click",(function(){n(),o(i.data("msg"))})),s.find(".smush-notice-dismiss").on("click",(function(){n(),o(i.data("msg"))})),e(".wp-smush-update-info").on("click",".notice-dismiss",(function(i){i.preventDefault(),s=e(t),n(),e.post(ajaxurl,{action:"dismiss_update_info"})})),e("div.wp-smush-s3support-alert").on("click",".sui-notice-dismiss > a",(function(){s=e(t),n(),e.post(ajaxurl,{action:"dismiss_s3support_alert"})}))}(jQuery)},,,,,,,function(e,t,s){"use strict";s.r(t);var i,n=s(3),o=function(e,t){e=parseInt(e),t=parseInt(t);var s=!1,i=0,n={scan:function(){var s=e-t;0!==t?o(s):jQuery.post(ajaxurl,{action:"directory_smush_start"},(function(){return o(s)}))},cancel:function(){return s=!0,jQuery.post(ajaxurl,{action:"directory_smush_cancel"})},getProgress:function(){if(s)return 0;var i=e-t;return Math.min(Math.round(100*parseInt(e-i)/e),99)},onFinishStep:function(s){jQuery(".wp-smush-progress-dialog .sui-progress-state-text").html(t-i+"/"+e+" "+window.wp_smush_msgs.progress_smushed),WP_Smush.directory.updateProgressBar(s)},onFinish:function(){WP_Smush.directory.updateProgressBar(100),window.location.href=window.wp_smush_msgs.directory_url+"&scan=done"},limitReached:function(){var e=jQuery("#wp-smush-progress-dialog");e.addClass("wp-smush-exceed-limit"),e.find("#cancel-directory-smush").attr("data-tooltip",window.wp_smush_msgs.bulk_resume),e.find(".sui-icon-close").removeClass("sui-icon-close").addClass("sui-icon-play"),e.find("#cancel-directory-smush").attr("id","cancel-directory-smush-disabled")},resume:function(){var e=jQuery("#wp-smush-progress-dialog"),t=e.find("#cancel-directory-smush-disabled");e.removeClass("wp-smush-exceed-limit"),e.find(".sui-icon-play").removeClass("sui-icon-play").addClass("sui-icon-close"),t.attr("data-tooltip","Cancel"),t.attr("id","cancel-directory-smush"),n.scan()}},o=function s(o){o>=0?(t=e-o,jQuery.post(ajaxurl,{action:"directory_smush_check_step",step:t},(function(e){void 0!==e.success&&e.success?(t++,o-=1,n.onFinishStep(n.getProgress()),s(o)):void 0!==e.data.error&&"dir_smush_limit_exceeded"===e.data.error?n.limitReached():(i++,t++,o-=1,n.onFinishStep(n.getProgress()),s(o))}))):jQuery.post(ajaxurl,{action:"directory_smush_finish",items:e-i,failed:i},(function(e){return n.onFinish(e)}))};return n};i=jQuery,WP_Smush.directory={selected:[],tree:[],wp_smush_msgs:[],init:function(){var e=this,t=i("#wp-smush-progress-dialog"),s=0,n=0;void 0!==window.wp_smushit_data.dir_smush&&(s=window.wp_smushit_data.dir_smush.totalSteps,n=window.wp_smushit_data.dir_smush.currentScanStep),this.scanner=new o(s,n),this.wp_smush_msgs=window.wp_smush_msgs||{},i("div.sui-wrap").on("click","button.wp-smush-browse",(function(t){t.preventDefault(),i("div.wp-smush-scan-result div.wp-smush-notice").hide(),i("div.wp-smush-info").remove(),e.initFileTree()})),i("body").on("click","a.wp-smush-dir-link",(function(t){i("div.sui-wrap button.wp-smush-browse").length>0&&(t.preventDefault(),window.SUI.openModal("wp-smush-list-dialog","dialog-close-div",void 0,!1),e.initFileTree())})),i(".wp-smush-select-dir").on("click",(function(t){if(t.preventDefault(),!i(this).attr("disabled")){var s=i(this);i("div.wp-smush-list-dialog div.sui-box-body").css({opacity:"0.8"}),i("div.wp-smush-list-dialog div.sui-box-body a").unbind("click"),s.attr("disabled","disabled"),s.parent().find(".add-dir-loader").addClass("sui-icon-loader sui-loading");var n=e.tree.getSelectedNodes(),r=i('input[name="wp-smush-base-path"]').val(),a=[];n.forEach((function(e){a.push(r+"/"+e.key)}));var u={action:"image_list",smush_path:a,image_list_nonce:i('input[name="image_list_nonce"]').val()};i.get(ajaxurl,u,(function(t){window.SUI.closeModal(),e.scanner=new o(t.data,0),e.showProgressDialog(t.data),e.scanner.scan()}))}})),i("#wp-smush-list-dialog").on("click",".sui-dialog-close",(function(){i(".wp-smush-browse").removeAttr("disabled"),window.SUI.closeModal(),i(".wp-smush-select-dir, button.wp-smush-browse, a.wp-smush-dir-link").removeAttr("disabled"),i(".wp-smush-select-dir, .wp-smush-list-dialog .sui-box-body").css({opacity:"1"})})),t.on("click","#cancel-directory-smush, .sui-dialog-close, .wp-smush-cancel-dir",(function(t){t.preventDefault(),i(this).parent().find(".add-dir-loader").addClass("sui-icon-loader sui-loading"),e.scanner.cancel().done((function(){return window.location.href=e.wp_smush_msgs.directory_url}))})),t.on("click",".sui-icon-play, .wp-smush-resume-scan",(function(t){t.preventDefault(),e.scanner.resume()}))},initFileTree:function(){var e=this,t=i("button.wp-smush-select-dir"),s={type:"GET",url:ajaxurl,data:{action:"smush_get_directory_list",list_nonce:i('input[name="list_nonce"]').val()},cache:!1};Object.entries(e.tree).length>0||(e.tree=Object(n.createTree)(".wp-smush-list-dialog .content",{autoCollapse:!0,clickFolderMode:3,checkbox:!0,debugLevel:0,selectMode:3,tabindex:"0",keyboard:!0,quicksearch:!0,source:s,lazyLoad:function(n,o){o.result=new Promise((function(e,t){s.data.dir=o.node.key,i.ajax(s).done((function(t){return e(t)})).fail(t)})),o.result.then(t.html(e.wp_smush_msgs.add_dir))},loadChildren:function(e,t){return t.node.fixSelection3AfterClick()},select:function(){return t.attr("disabled",!+e.tree.getSelectedNodes().length)},init:function(){return t.attr("disabled",!0)}}))},showProgressDialog:function(e){i(".wp-smush-progress-dialog .sui-progress-state-text").html("0/"+e+" "+self.wp_smush_msgs.progress_smushed),window.SUI.openModal("wp-smush-progress-dialog","dialog-close-div",void 0,!1)},updateProgressBar:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e>100&&(e=100),i(".sui-progress-block .sui-progress-text span").text(e+"%"),i(".sui-progress-block .sui-progress-bar span").width(e+"%"),e>=90&&i(".sui-progress-state .sui-progress-state-text").text("Finalizing..."),t&&i(".sui-progress-state .sui-progress-state-text").text("Cancelling...")}},WP_Smush.directory.init()}]); //# sourceMappingURL=smush-admin.min.js.map