/*!*
 **                 _     _                         
 ** __      ___ __ | |   (_)_ __   __ _ _   _  __ _ 
 ** \ \ /\ / / '_ \| |   | | '_ \ / _` | | | |/ _` |
 **  \ V  V /| |_) | |___| | | | | (_| | |_| | (_| |
 **   \_/\_/ | .__/|_____|_|_| |_|\__, |\__,_|\__,_|
 **          |_|                  |___/             
 **
 **        -- wpLingua | WordPress plugin --
 **   Translate and make your website multilingual
 **
 **     https://github.com/julien-jacob/wplingua
 **      https://wordpress.org/plugins/wplingua/
 **              https://wplingua.com/
 **
 **/
jQuery(document).ready(function(i){let r=JSON.parse(i("#wplng_dictionary_entries").val());function n(e){e.each(function(){var e,t=this,n=(t.style.height="0px",window.getComputedStyle(t));"border-box"===n.boxSizing?(e=parseFloat(n.borderTopWidth)+parseFloat(n.borderBottomWidth),t.style.height=t.scrollHeight+e+"px"):(e=parseFloat(n.paddingTop)+parseFloat(n.paddingBottom),t.style.height=t.scrollHeight-e+"px")})}i("#wplng-new-rule-button").click(function(){i("#wplng-section-entries-all").hide(),i("#wplng-section-entry-new").show(),n(i("#wplng-dictionary-entry-new .wplng-adaptive-textarea")),window.scrollTo(0,0)}),i("#wplng-new-never-translate").change(function(){this.checked?i("#wplng-new-rules").slideUp("fast"):i("#wplng-new-rules").slideDown("fast")}),i("#wplng-new-add-button").click(function(){var e=i("#wplng-new-source").val();let n={};null!=e&&""!=e.trim()&&(i("#wplng-edit-never-translate").prop("checked")||i(".wplng-new-rule").each(function(){var e=i(this).attr("wplng-rule"),t=i("textarea",this).val();null!=t&&""!=t.trim()&&(n[e]=t.trim())}),0==Object.keys(n).length?r.push({source:e}):r.push({source:e,rules:n}),i("#wplng_dictionary_entries").val(JSON.stringify(r)),i("#submit").click())}),i("#wplng-new-cancel-button").click(function(){i("#wplng-section-entries-all").show(),i("#wplng-section-entry-new").hide(),window.scrollTo(0,0)}),i(".wplng-rule-link-remove").click(function(){let t=i(this).attr("wplng-rule"),n=[],l=0;r.forEach(e=>{l!=t&&n.push(e),l++}),i("#wplng_dictionary_entries").val(JSON.stringify(n)),i("#submit").click()}),i(".wplng-rule-link-edit").click(function(){var e=i(this).attr("wplng-rule"),t=r[e];i("#wplng-section-entries-all").hide(),i("#wplng-section-entry-edit").show(),n(i("#wplng-dictionary-entry-edit .wplng-adaptive-textarea")),i("#wplng-edit-source").val(t.source),i("#wplng-edit-save-button").prop("wplng-rule",e),null==t.rules?(i("#wplng-edit-never-translate").prop("checked",!0),i("#wplng-edit-rules").hide()):(i("#wplng-edit-never-translate").prop("checked",!1),i("#wplng-edit-rules").show(),i("#wplng-edit-rules textarea").val(""),i.each(t.rules,function(e,t){i("#wplng-edit-always-translate-"+e).val(t)})),window.scrollTo(0,0)}),i("#wplng-edit-never-translate").change(function(){this.checked?i("#wplng-edit-rules").slideUp("fast"):i("#wplng-edit-rules").slideDown("fast")}),i("#wplng-edit-save-button").click(function(){var e=i("#wplng-edit-source").val();let n={};var t=i(this).prop("wplng-rule");null!=e&&""!=e.trim()&&(i("#wplng-edit-never-translate").prop("checked")||i(".wplng-edit-rule").each(function(){var e=i(this).attr("wplng-rule"),t=i("textarea",this).val();null!=t&&""!=t.trim()&&(n[e]=t.trim())}),r.splice(t,1),0==Object.keys(n).length?r.push({source:e}):r.push({source:e,rules:n}),i("#wplng_dictionary_entries").val(JSON.stringify(r)),i("#submit").click())}),i("#wplng-edit-cancel-button").click(function(){i("#wplng-section-entries-all").show(),i("#wplng-section-entry-edit").hide(),window.scrollTo(0,0)});let e=i("textarea.wplng-adaptive-textarea");e.off("keyup.textarea").on("keyup.textarea",function(){n(i(this))}),i(window).resize(function(){e.each(function(){n(i(this))})}),e.each(function(){n(i(this))})});//# sourceMappingURL=option-page-dictionary.js.map
