UNPKG

froala-editor

Version:

The next generation Javascript WYSIWYG HTML rich text editor made by devs for devs. High performance and modern design make it easy to use for developers and loved by users.

7 lines (6 loc) 394 kB
/*! * froala_editor v3.1.0 (https://www.froala.com/wysiwyg-editor) * License https://froala.com/wysiwyg-editor/terms/ * Copyright 2014-2020 Froala Labs */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("froala-editor")):"function"==typeof define&&define.amd?define(["froala-editor"],t):t(e.FroalaEditor)}(this,function(Be){"use strict";function Pe(e){return(Pe="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)}if((Be=Be&&Be.hasOwnProperty("default")?Be["default"]:Be).PLUGINS.align=function(r){var i=r.$;return{apply:function o(e){var t=r.selection.element();if(i(t).parents(".fr-img-caption").length)i(t).css("text-align",e);else{r.selection.save(),r.html.wrap(!0,!0,!0,!0),r.selection.restore();for(var a=r.selection.blocks(),n=0;n<a.length;n++)i(a[n]).css("text-align",e).removeClass("fr-temp-div"),""===i(a[n]).attr("class")&&i(a[n]).removeAttr("class"),""===i(a[n]).attr("style")&&i(a[n]).removeAttr("style");r.selection.save(),r.html.unwrap(),r.selection.restore()}},refresh:function n(e){var t=r.selection.blocks();if(t.length){var a=r.helpers.getAlignment(i(t[0]));e.find("> *").first().replaceWith(r.icon.create("align-".concat(a)))}},refreshOnShow:function s(e,t){var a=r.selection.blocks();if(a.length){var n=r.helpers.getAlignment(i(a[0]));t.find('a.fr-command[data-param1="'.concat(n,'"]')).addClass("fr-active").attr("aria-selected",!0)}},refreshForToolbar:function l(e){var t=r.selection.blocks();if(t.length){var a=r.helpers.getAlignment(i(t[0]));a=a.charAt(0).toUpperCase()+a.slice(1),"align".concat(a)===e.attr("data-cmd")&&e.addClass("fr-active")}}}},Be.DefineIcon("align",{NAME:"align-left",SVG_KEY:"alignLeft"}),Be.DefineIcon("align-left",{NAME:"align-left",SVG_KEY:"alignLeft"}),Be.DefineIcon("align-right",{NAME:"align-right",SVG_KEY:"alignRight"}),Be.DefineIcon("align-center",{NAME:"align-center",SVG_KEY:"alignCenter"}),Be.DefineIcon("align-justify",{NAME:"align-justify",SVG_KEY:"alignJustify"}),Be.RegisterCommand("align",{type:"dropdown",title:"Align",options:{left:"Align Left",center:"Align Center",right:"Align Right",justify:"Align Justify"},html:function(){var e='<ul class="fr-dropdown-list" role="presentation">',t=Be.COMMANDS.align.options;for(var a in t)t.hasOwnProperty(a)&&(e+='<li role="presentation"><a class="fr-command fr-title" tabIndex="-1" role="option" data-cmd="align"data-param1="\n '.concat(a,'" title="').concat(this.language.translate(t[a]),'">').concat(this.icon.create("align-".concat(a)),'<span class="fr-sr-only">\n ').concat(this.language.translate(t[a]),"</span></a></li>"));return e+="</ul>"},callback:function(e,t){this.align.apply(t)},refresh:function(e){this.align.refresh(e)},refreshOnShow:function(e,t){this.align.refreshOnShow(e,t)},plugin:"align"}),Be.RegisterCommand("alignLeft",{type:"button",icon:"align-left",title:"Align Left",callback:function(){this.align.apply("left")},refresh:function(e){this.align.refreshForToolbar(e)},plugin:"align"}),Be.RegisterCommand("alignRight",{type:"button",icon:"align-right",title:"Align Right",callback:function(){this.align.apply("right")},refresh:function(e){this.align.refreshForToolbar(e)},plugin:"align"}),Be.RegisterCommand("alignCenter",{type:"button",icon:"align-center",title:"Align Center",callback:function(){this.align.apply("center")},refresh:function(e){this.align.refreshForToolbar(e)},plugin:"align"}),Be.RegisterCommand("alignJustify",{type:"button",icon:"align-justify",title:"Align Justify",callback:function(){this.align.apply("justify")},refresh:function(e){this.align.refreshForToolbar(e)},plugin:"align"}),Object.assign(Be.DEFAULTS,{charCounterMax:-1,charCounterCount:!0}),Be.PLUGINS.charCounter=function(a){var n,t=a.$,r=function r(){return(a.el.textContent||"").replace(/\u200B/g,"").length};function e(e){if(a.opts.charCounterMax<0)return!0;if(r()<a.opts.charCounterMax)return!0;var t=e.which;return!(!a.keys.ctrlKey(e)&&a.keys.isCharacter(t)||t===Be.KEYCODE.IME)||(e.preventDefault(),e.stopPropagation(),a.events.trigger("charCounter.exceeded"),!1)}function i(e){return a.opts.charCounterMax<0?e:t("<div>").html(e).text().length+r()<=a.opts.charCounterMax?e:(a.events.trigger("charCounter.exceeded"),"")}function o(){if(a.opts.charCounterCount){var e=r()+(0<a.opts.charCounterMax?"/"+a.opts.charCounterMax:"");n.text("".concat(a.language.translate("Characters")," : ").concat(e)),a.opts.toolbarBottom&&n.css("margin-bottom",a.$tb.outerHeight(!0));var t=a.$wp.get(0).offsetWidth-a.$wp.get(0).clientWidth;0<=t&&("rtl"==a.opts.direction?n.css("margin-left",t):n.css("margin-right",t))}}return{_init:function s(){return!!a.$wp&&!!a.opts.charCounterCount&&((n=t(document.createElement("span")).attr("class","fr-counter")).css("bottom",a.$wp.css("border-bottom-width")),a.$second_tb&&a.$second_tb.append(n),a.events.on("keydown",e,!0),a.events.on("paste.afterCleanup",i),a.events.on("keyup contentChanged input",function(){a.events.trigger("charCounter.update")}),a.events.on("charCounter.update",o),a.events.trigger("charCounter.update"),void a.events.on("destroy",function(){t(a.o_win).off("resize.char".concat(a.id)),n.removeData().remove(),n=null}))},count:r}},Be.PLUGINS.codeBeautifier=function(){var e,t,a,n,j={};function I(n,e){var t={"@page":!0,"@font-face":!0,"@keyframes":!0,"@media":!0,"@supports":!0,"@document":!0},a={"@media":!0,"@supports":!0,"@document":!0};e=e||{},n=(n=n||"").replace(/\r\n|[\r\u2028\u2029]/g,"\n");var r=e.indent_size||4,i=e.indent_char||" ",o=e.selector_separator_newline===undefined||e.selector_separator_newline,s=e.end_with_newline!==undefined&&e.end_with_newline,l=e.newline_between_rules===undefined||e.newline_between_rules,c=e.eol?e.eol:"\n";"string"==typeof r&&(r=parseInt(r,10)),e.indent_with_tabs&&(i="\t",r=1),c=c.replace(/\\r/,"\r").replace(/\\n/,"\n");var d,f=/^\s+$/,p=-1,u=0;function h(){return(d=n.charAt(++p))||""}function g(e){var t,a=p;return e&&v(),t=n.charAt(p+1)||"",p=a-1,h(),t}function m(e){for(var t=p;h();)if("\\"===d)h();else{if(-1!==e.indexOf(d))break;if("\n"===d)break}return n.substring(t,p+1)}function v(){for(var e="";f.test(g());)h(),e+=d;return e}function b(){var e="";for(d&&f.test(d)&&(e=d);f.test(h());)e+=d;return e}function E(e){var t=p;for(e="/"===g(),h();h();){if(!e&&"*"===d&&"/"===g()){h();break}if(e&&"\n"===d)return n.substring(t,p)}return n.substring(t,p)+d}function A(e){return n.substring(p-e.length,p).toLowerCase()===e}function T(){for(var e=0,t=p+1;t<n.length;t++){var a=n.charAt(t);if("{"===a)return!0;if("("===a)e+=1;else if(")"===a){if(0===e)return!1;e-=1}else if(" "===a||"}"===a)return!1}return!1}var C=n.match(/^[\t ]*/)[0],R=new Array(r+1).join(i),S=0,L=0;for(var _,y,w,I={"{":function(e){I.singleSpace(),O.push(e),I.newLine()},"}":function(e){I.newLine(),O.push(e),I.newLine()},_lastCharWhitespace:function(){return f.test(O[O.length-1])},newLine:function(e){O.length&&(e||"\n"===O[O.length-1]||I.trim(),O.push("\n"),C&&O.push(C))},singleSpace:function(){O.length&&!I._lastCharWhitespace()&&O.push(" ")},preserveSingleSpace:function(){_&&I.singleSpace()},trim:function(){for(;I._lastCharWhitespace();)O.pop()}},O=[],x=!1,F=!1,k=!1,N="",D="";;){var M=b();_=""!==M;var B=-1!==M.indexOf("\n");if(D=N,!(N=d))break;if("/"===d&&"*"===g()){var P=0===S;(B||P)&&I.newLine(),O.push(E()),I.newLine(),P&&I.newLine(!0)}else if("/"===d&&"/"===g())B||"{"===D||I.trim(),I.singleSpace(),O.push(E()),I.newLine();else if("@"===d){I.preserveSingleSpace(),O.push(d);var U=(void 0,y=p,w=m(": , {}()[]/='\""),p=y-1,h(),w);U.match(/[ :]$/)&&(h(),U=m(": ").replace(/\s$/,""),O.push(U),I.singleSpace()),(U=U.replace(/\s$/,""))in t&&(L+=1,U in a&&(k=!0))}else"#"===d&&"{"===g()?(I.preserveSingleSpace(),O.push(m("}"))):"{"===d?"}"===g(!0)?(v(),h(),I.singleSpace(),O.push("{}"),I.newLine(),l&&0===S&&I.newLine(!0)):(S++,C+=R,I["{"](d),x=k?(k=!1,L<S):L<=S):"}"===d?(S--,C=C.slice(0,-r),I["}"](d),F=x=!1,L&&L--,l&&0===S&&I.newLine(!0)):":"===d?(v(),!x&&!k||A("&")||T()?":"===g()?(h(),O.push("::")):O.push(":"):(F=!0,O.push(":"),I.singleSpace())):'"'===d||"'"===d?(I.preserveSingleSpace(),O.push(m(d))):" "===d?(F=!1,O.push(d),I.newLine()):"("===d?A("url")?(O.push(d),v(),h()&&(")"!==d&&'"'!==d&&"'"!==d?O.push(m(")")):p--)):(u++,I.preserveSingleSpace(),O.push(d),v()):")"===d?(O.push(d),u--):","===d?(O.push(d),v(),o&&!F&&u<1?I.newLine():I.singleSpace()):("]"===d||("["===d?I.preserveSingleSpace():"="===d?(v(),d="="):I.preserveSingleSpace()),O.push(d))}var W="";return C&&(W+=C),W+=O.join("").replace(/[\r\n\t ]+$/,""),s&&(W+="\n"),"\n"!=c&&(W=W.replace(/[\n]/g,c)),W}function q(e,t){for(var a=0;a<t.length;a+=1)if(t[a]===e)return!0;return!1}function X(e){return e.replace(/^\s+|\s+$/g,"")}function O(e,t){return new r(e,t).beautify()}e=j,t="\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0\u08a2-\u08ac\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097f\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d\u0c58\u0c59\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d60\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191c\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19c1-\u19c7\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua697\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa80-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc",a=new RegExp("[".concat(t,"]")),n=new RegExp("[".concat(t," ").concat("\u0300-\u036f\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u0620-\u0649\u0672-\u06d3\u06e7-\u06e8\u06fb-\u06fc\u0730-\u074a\u0800-\u0814\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0840-\u0857\u08e4-\u08fe\u0900-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962-\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09d7\u09df-\u09e0\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2-\u0ae3\u0ae6-\u0aef\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b5f-\u0b60\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c01-\u0c03\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62-\u0c63\u0c66-\u0c6f\u0c82\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2-\u0ce3\u0ce6-\u0cef\u0d02\u0d03\u0d46-\u0d48\u0d57\u0d62-\u0d63\u0d66-\u0d6f\u0d82\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0df2\u0df3\u0e34-\u0e3a\u0e40-\u0e45\u0e50-\u0e59\u0eb4-\u0eb9\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f41-\u0f47\u0f71-\u0f84\u0f86-\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u1000-\u1029\u1040-\u1049\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u170e-\u1710\u1720-\u1730\u1740-\u1750\u1772\u1773\u1780-\u17b2\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u1920-\u192b\u1930-\u193b\u1951-\u196d\u19b0-\u19c0\u19c8-\u19c9\u19d0-\u19d9\u1a00-\u1a15\u1a20-\u1a53\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1b46-\u1b4b\u1b50-\u1b59\u1b6b-\u1b73\u1bb0-\u1bb9\u1be6-\u1bf3\u1c00-\u1c22\u1c40-\u1c49\u1c5b-\u1c7d\u1cd0-\u1cd2\u1d00-\u1dbe\u1e01-\u1f15\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2d81-\u2d96\u2de0-\u2dff\u3021-\u3028\u3099\u309a\ua640-\ua66d\ua674-\ua67d\ua69f\ua6f0-\ua6f1\ua7f8-\ua800\ua806\ua80b\ua823-\ua827\ua880-\ua881\ua8b4-\ua8c4\ua8d0-\ua8d9\ua8f3-\ua8f7\ua900-\ua909\ua926-\ua92d\ua930-\ua945\ua980-\ua983\ua9b3-\ua9c0\uaa00-\uaa27\uaa40-\uaa41\uaa4c-\uaa4d\uaa50-\uaa59\uaa7b\uaae0-\uaae9\uaaf2-\uaaf3\uabc0-\uabe1\uabec\uabed\uabf0-\uabf9\ufb20-\ufb28\ufe00-\ufe0f\ufe20-\ufe26\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f","]")),e.newline=/[\n\r\u2028\u2029]/,e.lineBreak=new RegExp("\r\n|".concat(e.newline.source)),e.allLineBreaks=new RegExp(e.lineBreak.source,"g"),e.isIdentifierStart=function(e){return e<65?36===e||64===e:e<91||(e<97?95===e:e<123||170<=e&&a.test(String.fromCharCode(e)))},e.isIdentifierChar=function(e){return e<48?36===e:e<58||!(e<65)&&(e<91||(e<97?95===e:e<123||170<=e&&n.test(String.fromCharCode(e))))};var Q={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function r(n,e){var c,r,i,d,o,s,l,f,p,t,a,u,h,g=[],m="";function v(e,t){var a=0;return e&&(a=e.indentation_level,!c.just_added_newline()&&e.line_indent_level>a&&(a=e.line_indent_level)),{mode:t,parent:e,last_text:e?e.last_text:"",last_word:e?e.last_word:"",declaration_statement:!1,declaration_assignment:!1,multiline_frame:!1,if_block:!1,else_block:!1,do_block:!1,do_while:!1,in_case_statement:!1,in_case:!1,case_body:!1,indentation_level:a,line_indent_level:e?e.line_indent_level:a,start_line_index:c.get_line_number(),ternary_depth:0}}for(u={TK_START_EXPR:function N(){O();var e=Q.Expression;if("["===d.text){if("TK_WORD"===o||")"===f.last_text)return"TK_RESERVED"===o&&q(f.last_text,i.line_starters)&&(c.space_before_token=!0),L(e),R(),S(),void(h.space_in_paren&&(c.space_before_token=!0));e=Q.ArrayLiteral,_(f.mode)&&("["!==f.last_text&&(","!==f.last_text||"]"!==s&&"}"!==s)||h.keep_array_indentation||T())}else"TK_RESERVED"===o&&"for"===f.last_text?e=Q.ForInitializer:"TK_RESERVED"===o&&q(f.last_text,["if","while"])&&(e=Q.Conditional);" "===f.last_text||"TK_START_BLOCK"===o?T():"TK_END_EXPR"===o||"TK_START_EXPR"===o||"TK_END_BLOCK"===o||"."===f.last_text?A(d.wanted_newline):"TK_RESERVED"===o&&"("===d.text||"TK_WORD"===o||"TK_OPERATOR"===o?"TK_RESERVED"===o&&("function"===f.last_word||"typeof"===f.last_word)||"*"===f.last_text&&"function"===s?h.space_after_anon_function&&(c.space_before_token=!0):"TK_RESERVED"!==o||!q(f.last_text,i.line_starters)&&"catch"!==f.last_text||h.space_before_conditional&&(c.space_before_token=!0):c.space_before_token=!0;"("===d.text&&"TK_RESERVED"===o&&"await"===f.last_word&&(c.space_before_token=!0);"("===d.text&&("TK_EQUALS"!==o&&"TK_OPERATOR"!==o||I()||A());L(e),R(),h.space_in_paren&&(c.space_before_token=!0);S()},TK_END_EXPR:function D(){for(;f.mode===Q.Statement;)w();f.multiline_frame&&A("]"===d.text&&_(f.mode)&&!h.keep_array_indentation);h.space_in_paren&&("TK_START_EXPR"!==o||h.space_in_empty_paren?c.space_before_token=!0:(c.trim(),c.space_before_token=!1));"]"===d.text&&h.keep_array_indentation?(R(),w()):(w(),R());c.remove_redundant_indentation(p),f.do_while&&p.mode===Q.Conditional&&(p.mode=Q.Expression,f.do_block=!1,f.do_while=!1)},TK_START_BLOCK:function M(){var e=F(1),t=F(2);t&&(":"===t.text&&q(e.type,["TK_STRING","TK_WORD","TK_RESERVED"])||q(e.text,["get","set"])&&q(t.type,["TK_WORD","TK_RESERVED"]))?q(s,["class","interface"])?L(Q.BlockStatement):L(Q.ObjectLiteral):L(Q.BlockStatement);var a=!e.comments_before.length&&"}"===e.text&&"function"===f.last_word&&"TK_END_EXPR"===o;"expand"===h.brace_style||"none"===h.brace_style&&d.wanted_newline?"TK_OPERATOR"!==o&&(a||"TK_EQUALS"===o||"TK_RESERVED"===o&&x(f.last_text)&&"else"!==f.last_text)?c.space_before_token=!0:T(!1,!0):"TK_OPERATOR"!==o&&"TK_START_EXPR"!==o?"TK_START_BLOCK"===o?T():c.space_before_token=!0:_(p.mode)&&","===f.last_text&&("}"===s?c.space_before_token=!0:T());R(),S()},TK_END_BLOCK:function B(){for(;f.mode===Q.Statement;)w();var e="TK_START_BLOCK"===o;"expand"===h.brace_style?e||T():e||(_(f.mode)&&h.keep_array_indentation?(h.keep_array_indentation=!1,T(),h.keep_array_indentation=!0):T());w(),R()},TK_WORD:k,TK_RESERVED:k,TK_SEMICOLON:function P(){O()&&(c.space_before_token=!1);for(;f.mode===Q.Statement&&!f.if_block&&!f.do_block;)w();R()},TK_STRING:function U(){O()?c.space_before_token=!0:"TK_RESERVED"===o||"TK_WORD"===o?c.space_before_token=!0:"TK_COMMA"===o||"TK_START_EXPR"===o||"TK_EQUALS"===o||"TK_OPERATOR"===o?I()||A():T();R()},TK_EQUALS:function W(){O();f.declaration_statement&&(f.declaration_assignment=!0);c.space_before_token=!0,R(),c.space_before_token=!0},TK_OPERATOR:function K(){O();if("TK_RESERVED"===o&&x(f.last_text))return c.space_before_token=!0,void R();if("*"===d.text&&"TK_DOT"===o)return void R();if(":"===d.text&&f.in_case)return f.case_body=!0,S(),R(),T(),void(f.in_case=!1);if("::"===d.text)return void R();"TK_OPERATOR"===o&&A();var e=!0,t=!0;q(d.text,["--","++","!","~"])||q(d.text,["-","+"])&&(q(o,["TK_START_BLOCK","TK_START_EXPR","TK_EQUALS","TK_OPERATOR"])||q(f.last_text,i.line_starters)||","===f.last_text)?(t=e=!1,!d.wanted_newline||"--"!==d.text&&"++"!==d.text||T(!1,!0)," "===f.last_text&&y(f.mode)&&(e=!0),"TK_RESERVED"===o?e=!0:"TK_END_EXPR"===o?e=!("]"===f.last_text&&("--"===d.text||"++"===d.text)):"TK_OPERATOR"===o&&(e=q(d.text,["--","-","++","+"])&&q(f.last_text,["--","-","++","+"]),q(d.text,["+","-"])&&q(f.last_text,["--","++"])&&(t=!0)),f.mode!==Q.BlockStatement&&f.mode!==Q.Statement||"{"!==f.last_text&&" "!==f.last_text||T()):":"===d.text?0===f.ternary_depth?e=!1:f.ternary_depth-=1:"?"===d.text?f.ternary_depth+=1:"*"===d.text&&"TK_RESERVED"===o&&"function"===f.last_text&&(t=e=!1);c.space_before_token=c.space_before_token||e,R(),c.space_before_token=t},TK_COMMA:function H(){if(f.declaration_statement)return y(f.parent.mode)&&(f.declaration_assignment=!1),R(),void(f.declaration_assignment?T(f.declaration_assignment=!1,!0):(c.space_before_token=!0,h.comma_first&&A()));R(),f.mode===Q.ObjectLiteral||f.mode===Q.Statement&&f.parent.mode===Q.ObjectLiteral?(f.mode===Q.Statement&&w(),T()):(c.space_before_token=!0,h.comma_first&&A())},TK_BLOCK_COMMENT:function $(){if(c.raw)return c.add_raw_token(d),void(d.directives&&"end"===d.directives.preserve&&(h.test_output_raw||(c.raw=!1)));if(d.directives)return T(!1,!0),R(),"start"===d.directives.preserve&&(c.raw=!0),void T(!1,!0);if(!j.newline.test(d.text)&&!d.wanted_newline)return c.space_before_token=!0,R(),void(c.space_before_token=!0);var e,t=function o(e){var t;e=e.replace(/\x0d/g,"");var a=[];t=e.indexOf("\n");for(;-1!==t;)a.push(e.substring(0,t)),e=e.substring(t+1),t=e.indexOf("\n");e.length&&a.push(e);return a}(d.text),a=!1,n=!1,r=d.whitespace_before,i=r.length;T(!1,!0),1<t.length&&(!function s(e,t){for(var a=0;a<e.length;a++){var n=X(e[a]);if(n.charAt(0)!==t)return!1}return!0}(t.slice(1),"*")?function l(e,t){for(var a,n=0,r=e.length;n<r;n++)if((a=e[n])&&0!==a.indexOf(t))return!1;return!0}(t.slice(1),r)&&(n=!0):a=!0);for(R(t[0]),e=1;e<t.length;e++)T(!1,!0),a?R(" ".concat(t[e].replace(/^\s+/g,""))):n&&t[e].length>i?R(t[e].substring(i)):c.add_token(t[e]);T(!1,!0)},TK_COMMENT:function G(){d.wanted_newline?T(!1,!0):c.trim(!0);c.space_before_token=!0,R(),T(!1,!0)},TK_DOT:function Y(){O();"TK_RESERVED"===o&&x(f.last_text)?c.space_before_token=!0:A(")"===f.last_text&&h.break_chained_methods);R()},TK_UNKNOWN:function V(){R(),"\n"===d.text[d.text.length-1]&&T()},TK_EOF:function z(){for(;f.mode===Q.Statement;)w()}},h={},(e=e||{}).braces_on_own_line!==undefined&&(h.brace_style=e.braces_on_own_line?"expand":"collapse"),h.brace_style=e.brace_style?e.brace_style:h.brace_style?h.brace_style:"collapse","expand-strict"===h.brace_style&&(h.brace_style="expand"),h.indent_size=e.indent_size?parseInt(e.indent_size,10):4,h.indent_char=e.indent_char?e.indent_char:" ",h.eol=e.eol?e.eol:"\n",h.preserve_newlines=e.preserve_newlines===undefined||e.preserve_newlines,h.break_chained_methods=e.break_chained_methods!==undefined&&e.break_chained_methods,h.max_preserve_newlines=e.max_preserve_newlines===undefined?0:parseInt(e.max_preserve_newlines,10),h.space_in_paren=e.space_in_paren!==undefined&&e.space_in_paren,h.space_in_empty_paren=e.space_in_empty_paren!==undefined&&e.space_in_empty_paren,h.jslint_happy=e.jslint_happy!==undefined&&e.jslint_happy,h.space_after_anon_function=e.space_after_anon_function!==undefined&&e.space_after_anon_function,h.keep_array_indentation=e.keep_array_indentation!==undefined&&e.keep_array_indentation,h.space_before_conditional=e.space_before_conditional===undefined||e.space_before_conditional,h.unescape_strings=e.unescape_strings!==undefined&&e.unescape_strings,h.wrap_line_length=e.wrap_line_length===undefined?0:parseInt(e.wrap_line_length,10),h.e4x=e.e4x!==undefined&&e.e4x,h.end_with_newline=e.end_with_newline!==undefined&&e.end_with_newline,h.comma_first=e.comma_first!==undefined&&e.comma_first,h.test_output_raw=e.test_output_raw!==undefined&&e.test_output_raw,h.jslint_happy&&(h.space_after_anon_function=!0),e.indent_with_tabs&&(h.indent_char="\t",h.indent_size=1),h.eol=h.eol.replace(/\\r/,"\r").replace(/\\n/,"\n"),l="";0<h.indent_size;)l+=h.indent_char,h.indent_size-=1;var b=0;if(n&&n.length){for(;" "===n.charAt(b)||"\t"===n.charAt(b);)m+=n.charAt(b),b+=1;n=n.substring(b)}function E(e){var t=e.newlines;if(h.keep_array_indentation&&_(f.mode))for(var a=0;a<t;a+=1)T(0<a);else if(h.max_preserve_newlines&&t>h.max_preserve_newlines&&(t=h.max_preserve_newlines),h.preserve_newlines&&1<e.newlines){T();for(var n=1;n<t;n+=1)T(!0)}u[(d=e).type]()}function A(e){if(e=e!==undefined&&e,!c.just_added_newline())if(h.preserve_newlines&&d.wanted_newline||e)T(!1,!0);else if(h.wrap_line_length){c.current_line.get_character_count()+d.text.length+(c.space_before_token?1:0)>=h.wrap_line_length&&T(!1,!0)}}function T(e,t){if(!t&&" "!==f.last_text&&","!==f.last_text&&"="!==f.last_text&&"TK_OPERATOR"!==o)for(;f.mode===Q.Statement&&!f.if_block&&!f.do_block;)w();c.add_new_line(e)&&(f.multiline_frame=!0)}function C(){c.just_added_newline()&&(h.keep_array_indentation&&_(f.mode)&&d.wanted_newline?(c.current_line.push(d.whitespace_before),c.space_before_token=!1):c.set_indent(f.indentation_level)&&(f.line_indent_level=f.indentation_level))}function R(e){c.raw?c.add_raw_token(d):(h.comma_first&&"TK_COMMA"===o&&c.just_added_newline()&&","===c.previous_line.last()&&(c.previous_line.pop(),C(),c.add_token(","),c.space_before_token=!0),e=e||d.text,C(),c.add_token(e))}function S(){f.indentation_level+=1}function L(e){p=f?(t.push(f),f):v(null,e),f=v(p,e)}function _(e){return e===Q.ArrayLiteral}function y(e){return q(e,[Q.Expression,Q.ForInitializer,Q.Conditional])}function w(){0<t.length&&(p=f,f=t.pop(),p.mode===Q.Statement&&c.remove_redundant_indentation(p))}function I(){return f.parent.mode===Q.ObjectLiteral&&f.mode===Q.Statement&&(":"===f.last_text&&0===f.ternary_depth||"TK_RESERVED"===o&&q(f.last_text,["get","set"]))}function O(){return!!("TK_RESERVED"===o&&q(f.last_text,["const","let","const"])&&"TK_WORD"===d.type||"TK_RESERVED"===o&&"do"===f.last_text||"TK_RESERVED"===o&&"return"===f.last_text&&!d.wanted_newline||"TK_RESERVED"===o&&"else"===f.last_text&&("TK_RESERVED"!==d.type||"if"!==d.text)||"TK_END_EXPR"===o&&(p.mode===Q.ForInitializer||p.mode===Q.Conditional)||"TK_WORD"===o&&f.mode===Q.BlockStatement&&!f.in_case&&"--"!==d.text&&"++"!==d.text&&"function"!==s&&"TK_WORD"!==d.type&&"TK_RESERVED"!==d.type||f.mode===Q.ObjectLiteral&&(":"===f.last_text&&0===f.ternary_depth||"TK_RESERVED"===o&&q(f.last_text,["get","set"])))&&(L(Q.Statement),S(),"TK_RESERVED"===o&&q(f.last_text,["const","let","const"])&&"TK_WORD"===d.type&&(f.declaration_statement=!0),I()||A("TK_RESERVED"===d.type&&q(d.text,["do","for","if","while"])),!0)}function x(e){return q(e,["case","return","do","if","throw","else"])}function F(e){var t=r+(e||0);return t<0||t>=g.length?null:g[t]}function k(){("TK_RESERVED"===d.type&&f.mode!==Q.ObjectLiteral&&q(d.text,["set","get"])&&(d.type="TK_WORD"),"TK_RESERVED"===d.type&&f.mode===Q.ObjectLiteral)&&(":"===F(1).text&&(d.type="TK_WORD"));if(O()||!d.wanted_newline||y(f.mode)||"TK_OPERATOR"===o&&"--"!==f.last_text&&"++"!==f.last_text||"TK_EQUALS"===o||!h.preserve_newlines&&"TK_RESERVED"===o&&q(f.last_text,["const","let","const","set","get"])||T(),f.do_block&&!f.do_while){if("TK_RESERVED"===d.type&&"while"===d.text)return c.space_before_token=!0,R(),c.space_before_token=!0,void(f.do_while=!0);T(),f.do_block=!1}if(f.if_block)if(f.else_block||"TK_RESERVED"!==d.type||"else"!==d.text){for(;f.mode===Q.Statement;)w();f.if_block=!1,f.else_block=!1}else f.else_block=!0;if("TK_RESERVED"===d.type&&("case"===d.text||"default"===d.text&&f.in_case_statement))return T(),(f.case_body||h.jslint_happy)&&(!function e(){0<f.indentation_level&&(!f.parent||f.indentation_level>f.parent.indentation_level)&&(f.indentation_level-=1)}(),f.case_body=!1),R(),f.in_case=!0,void(f.in_case_statement=!0);if("TK_RESERVED"===d.type&&"function"===d.text&&((q(f.last_text,["}"," "])||c.just_added_newline()&&!q(f.last_text,["[","{",":","=",","]))&&(c.just_added_blankline()||d.comments_before.length||(T(),T(!0))),"TK_RESERVED"===o||"TK_WORD"===o?"TK_RESERVED"===o&&q(f.last_text,["get","set","new","return","export","async"])?c.space_before_token=!0:"TK_RESERVED"===o&&"default"===f.last_text&&"export"===s?c.space_before_token=!0:T():"TK_OPERATOR"===o||"="===f.last_text?c.space_before_token=!0:(f.multiline_frame||!y(f.mode)&&!_(f.mode))&&T()),"TK_COMMA"!==o&&"TK_START_EXPR"!==o&&"TK_EQUALS"!==o&&"TK_OPERATOR"!==o||I()||A(),"TK_RESERVED"===d.type&&q(d.text,["function","get","set"]))return R(),void(f.last_word=d.text);(a="NONE","TK_END_BLOCK"===o?"TK_RESERVED"===d.type&&q(d.text,["else","catch","finally"])?"expand"===h.brace_style||"end-expand"===h.brace_style||"none"===h.brace_style&&d.wanted_newline?a="NEWLINE":(a="SPACE",c.space_before_token=!0):a="NEWLINE":"TK_SEMICOLON"===o&&f.mode===Q.BlockStatement?a="NEWLINE":"TK_SEMICOLON"===o&&y(f.mode)?a="SPACE":"TK_STRING"===o?a="NEWLINE":"TK_RESERVED"===o||"TK_WORD"===o||"*"===f.last_text&&"function"===s?a="SPACE":"TK_START_BLOCK"===o?a="NEWLINE":"TK_END_EXPR"===o&&(c.space_before_token=!0,a="NEWLINE"),"TK_RESERVED"===d.type&&q(d.text,i.line_starters)&&")"!==f.last_text&&(a="else"===f.last_text||"export"===f.last_text?"SPACE":"NEWLINE"),"TK_RESERVED"===d.type&&q(d.text,["else","catch","finally"]))?"TK_END_BLOCK"!==o||"expand"===h.brace_style||"end-expand"===h.brace_style||"none"===h.brace_style&&d.wanted_newline?T():(c.trim(!0),"}"!==c.current_line.last()&&T(),c.space_before_token=!0):"NEWLINE"===a?"TK_RESERVED"===o&&x(f.last_text)?c.space_before_token=!0:"TK_END_EXPR"!==o?"TK_START_EXPR"===o&&"TK_RESERVED"===d.type&&q(d.text,["const","let","const"])||":"===f.last_text||("TK_RESERVED"===d.type&&"if"===d.text&&"else"===f.last_text?c.space_before_token=!0:T()):"TK_RESERVED"===d.type&&q(d.text,i.line_starters)&&")"!==f.last_text&&T():f.multiline_frame&&_(f.mode)&&","===f.last_text&&"}"===s?T():"SPACE"===a&&(c.space_before_token=!0);R(),f.last_word=d.text,"TK_RESERVED"===d.type&&"do"===d.text&&(f.do_block=!0),"TK_RESERVED"===d.type&&"if"===d.text&&(f.if_block=!0)}o="TK_START_BLOCK",s="",(c=new J(l,m)).raw=h.test_output_raw,t=[],L(Q.BlockStatement),this.beautify=function(){var e,t;for(i=new ee(n,h,l),g=i.tokenize(),r=0;e=F();){for(var a=0;a<e.comments_before.length;a++)E(e.comments_before[a]);E(e),s=f.last_text,o=e.type,f.last_text=e.text,r+=1}return t=c.get_code(),h.end_with_newline&&(t+="\n"),"\n"!=h.eol&&(t=t.replace(/[\n]/g,h.eol)),t}}function i(t){var a=0,n=-1,r=[],i=!0;this.set_indent=function(e){a=t.baseIndentLength+e*t.indent_length,n=e},this.get_character_count=function(){return a},this.is_empty=function(){return i},this.last=function(){return this._empty?null:r[r.length-1]},this.push=function(e){r.push(e),a+=e.length,i=!1},this.pop=function(){var e=null;return i||(e=r.pop(),a-=e.length,i=0===r.length),e},this.remove_indent=function(){0<n&&(n-=1,a-=t.indent_length)},this.trim=function(){for(;" "===this.last();)r.pop(),a-=1;i=0===r.length},this.toString=function(){var e="";return this._empty||(0<=n&&(e=t.indent_cache[n]),e+=r.join("")),e}}function J(t,a){a=a||"",this.indent_cache=[a],this.baseIndentLength=a.length,this.indent_length=t.length,this.raw=!1;var n=[];this.baseIndentString=a,this.indent_string=t,this.previous_line=null,this.current_line=null,this.space_before_token=!1,this.add_outputline=function(){this.previous_line=this.current_line,this.current_line=new i(this),n.push(this.current_line)},this.add_outputline(),this.get_line_number=function(){return n.length},this.add_new_line=function(e){return(1!==this.get_line_number()||!this.just_added_newline())&&(!(!e&&this.just_added_newline())&&(this.raw||this.add_outputline(),!0))},this.get_code=function(){return n.join("\n").replace(/[\r\n\t ]+$/,"")},this.set_indent=function(e){if(1<n.length){for(;e>=this.indent_cache.length;)this.indent_cache.push(this.indent_cache[this.indent_cache.length-1]+this.indent_string);return this.current_line.set_indent(e),!0}return this.current_line.set_indent(0),!1},this.add_raw_token=function(e){for(var t=0;t<e.newlines;t++)this.add_outputline();this.current_line.push(e.whitespace_before),this.current_line.push(e.text),this.space_before_token=!1},this.add_token=function(e){this.add_space_before_token(),this.current_line.push(e)},this.add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&this.current_line.push(" "),this.space_before_token=!1},this.remove_redundant_indentation=function(e){if(!e.multiline_frame&&e.mode!==Q.ForInitializer&&e.mode!==Q.Conditional)for(var t=e.start_line_index,a=n.length;t<a;)n[t].remove_indent(),t++},this.trim=function(e){for(e=e!==undefined&&e,this.current_line.trim(t,a);e&&1<n.length&&this.current_line.is_empty();)n.pop(),this.current_line=n[n.length-1],this.current_line.trim();this.previous_line=1<n.length?n[n.length-2]:null},this.just_added_newline=function(){return this.current_line.is_empty()},this.just_added_blankline=function(){return!!this.just_added_newline()&&(1===n.length||n[n.length-2].is_empty())}}var Z=function Z(e,t,a,n,r,i){this.type=e,this.text=t,this.comments_before=[],this.newlines=a||0,this.wanted_newline=0<a,this.whitespace_before=n||"",this.parent=null,this.directives=null};function ee(w,I,e){var O="\n\r\t ".split(""),x=/[0-9]/,F=/[01234567]/,k=/[0123456789abcdefABCDEF]/,N="+ - * / % & ++ -- = += -= *= /= %= == === != !== > < >= <= >> << >>> >>>= >>= <<= && &= | || ! ~ , : ? ^ ^= |= :: =>".split(" ");this.line_starters="continue,try,throw,return,const,let,const,if,switch,case,default,for,while,break,function,import,export".split(",");var D,M,B,P,U,W,K=this.line_starters.concat(["do","in","else","get","set","new","catch","finally","typeof","yield","async","await"]),H=/([\s\S]*?)((?:\*\/)|$)/g,$=/([^\n\r\u2028\u2029]*)/g,G=/\/\* beautify( \w+[:]\w+)+ \*\//g,Y=/ (\w+)[:](\w+)/g,V=/([\s\S]*?)((?:\/\*\sbeautify\signore:end\s\*\/)|$)/g,z=/((<\?php|<\?=)[\s\S]*?\?>)|(<%[\s\S]*?%>)/g;function o(){var e,t,a=[];if(D=0,M="",W<=U)return["","TK_EOF"];t=P.length?P[P.length-1]:new Z("TK_START_BLOCK","{");var n=w.charAt(U);for(U+=1;q(n,O);){if(j.newline.test(n)?"\n"===n&&"\r"===w.charAt(U-2)||(D+=1,a=[]):a.push(n),W<=U)return["","TK_EOF"];n=w.charAt(U),U+=1}if(a.length&&(M=a.join("")),x.test(n)){var r=!0,i=!0,o=x;for("0"===n&&U<W&&/[Xxo]/.test(w.charAt(U))?(i=r=!1,n+=w.charAt(U),U+=1,o=/[o]/.test(w.charAt(U))?F:k):(n="",U-=1);U<W&&o.test(w.charAt(U));)n+=w.charAt(U),U+=1,r&&U<W&&"."===w.charAt(U)&&(n+=w.charAt(U),U+=1,r=!1),i&&U<W&&/[Ee]/.test(w.charAt(U))&&(n+=w.charAt(U),(U+=1)<W&&/[+-]/.test(w.charAt(U))&&(n+=w.charAt(U),U+=1),r=i=!1);return[n,"TK_WORD"]}if(j.isIdentifierStart(w.charCodeAt(U-1))){if(U<W)for(;j.isIdentifierChar(w.charCodeAt(U))&&(n+=w.charAt(U),(U+=1)!==W););return"TK_DOT"===t.type||"TK_RESERVED"===t.type&&q(t.text,["set","get"])||!q(n,K)?[n,"TK_WORD"]:"in"===n?[n,"TK_OPERATOR"]:[n,"TK_RESERVED"]}if("("===n||"["===n)return[n,"TK_START_EXPR"];if(")"===n||"]"===n)return[n,"TK_END_EXPR"];if("{"===n)return[n,"TK_START_BLOCK"];if("}"===n)return[n,"TK_END_BLOCK"];if(" "===n)return[n,"TK_SEMICOLON"];if("/"===n){var s="";if("*"===w.charAt(U)){U+=1,H.lastIndex=U;var l=H.exec(w);s="/*".concat(l[0]),U+=l[0].length;var c=function _(e){if(!e.match(G))return null;var t={};Y.lastIndex=0;for(var a=Y.exec(e);a;)t[a[1]]=a[2],a=Y.exec(e);return t}(s);return c&&"start"===c.ignore&&(V.lastIndex=U,s+=(l=V.exec(w))[0],U+=l[0].length),[s=s.replace(j.lineBreak,"\n"),"TK_BLOCK_COMMENT",c]}if("/"===w.charAt(U)){U+=1,$.lastIndex=U;var d=$.exec(w);return s="//".concat(d[0]),U+=d[0].length,[s,"TK_COMMENT"]}}if("`"===n||"'"===n||'"'===n||("/"===n||I.e4x&&"<"===n&&w.slice(U-1).match(/^<([-a-zA-Z:0-9_.]+|{[^{}]*}|!\[CDATA\[[\s\S]*?\]\])(\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{.*?}))*\s*(\/?)\s*>/))&&("TK_RESERVED"===t.type&&q(t.text,["return","case","throw","else","do","typeof","yield"])||"TK_END_EXPR"===t.type&&")"===t.text&&t.parent&&"TK_RESERVED"===t.parent.type&&q(t.parent.text,["if","while","for"])||q(t.type,["TK_COMMENT","TK_START_EXPR","TK_START_BLOCK","TK_END_BLOCK","TK_OPERATOR","TK_EQUALS","TK_EOF","TK_SEMICOLON","TK_COMMA"]))){var f=n,p=!1,u=!1;if(e=n,"/"===f)for(var h=!1;U<W&&(p||h||w.charAt(U)!==f)&&!j.newline.test(w.charAt(U));)e+=w.charAt(U),p?p=!1:(p="\\"===w.charAt(U),"["===w.charAt(U)?h=!0:"]"===w.charAt(U)&&(h=!1)),U+=1;else if(I.e4x&&"<"===f){var g=/<(\/?)([-a-zA-Z:0-9_.]+|{[^{}]*}|!\[CDATA\[[\s\S]*?\]\])(\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{.*?}))*\s*(\/?)\s*>/g,m=w.slice(U-1),v=g.exec(m);if(v&&0===v.index){for(var b=v[2],E=0;v;){var A=!!v[1],T=v[2],C=!!v[v.length-1]||"![CDATA["===T.slice(0,8);if(T!==b||C||(A?--E:++E),E<=0)break;v=g.exec(m)}var R=v?v.index+v[0].length:m.length;return m=m.slice(0,R),U+=R-1,[m=m.replace(j.lineBreak,"\n"),"TK_STRING"]}}else for(;U<W&&(p||w.charAt(U)!==f&&("`"===f||!j.newline.test(w.charAt(U))));)(p||"`"===f)&&j.newline.test(w.charAt(U))?("\r"===w.charAt(U)&&"\n"===w.charAt(U+1)&&(U+=1),e+="\n"):e+=w.charAt(U),p=p?("x"!==w.charAt(U)&&"u"!==w.charAt(U)||(u=!0),!1):"\\"===w.charAt(U),U+=1;if(u&&I.unescape_strings&&(e=function y(e){var t,a=!1,n="",r=0,i="",o=0;for(;a||r<e.length;)if(t=e.charAt(r),r++,a){if(a=!1,"x"===t)i=e.substr(r,2),r+=2;else{if("u"!==t){n+="\\".concat(t);continue}i=e.substr(r,4),r+=4}if(!i.match(/^[0123456789abcdefABCDEF]+$/))return e;if(0<=(o=parseInt(i,16))&&o<32){n+="x"===t?"\\x".concat(i):"\\u".concat(i);continue}if(34===o||39===o||92===o)n+="\\".concat(String.fromCharCode(o));else{if("x"===t&&126<o&&o<=255)return e;n+=String.fromCharCode(o)}}else"\\"===t?a=!0:n+=t;return n}(e)),U<W&&w.charAt(U)===f&&(e+=f,U+=1,"/"===f))for(;U<W&&j.isIdentifierStart(w.charCodeAt(U));)e+=w.charAt(U),U+=1;return[e,"TK_STRING"]}if("#"===n){if(0===P.length&&"!"===w.charAt(U)){for(e=n;U<W&&"\n"!==n;)e+=n=w.charAt(U),U+=1;return["".concat(X(e),"\n"),"TK_UNKNOWN"]}var S="#";if(U<W&&x.test(w.charAt(U))){for(;S+=n=w.charAt(U),(U+=1)<W&&"#"!==n&&"="!==n;);return"#"===n||("["===w.charAt(U)&&"]"===w.charAt(U+1)?(S+="[]",U+=2):"{"===w.charAt(U)&&"}"===w.charAt(U+1)&&(S+="{}",U+=2)),[S,"TK_WORD"]}}if("<"===n&&("?"===w.charAt(U)||"%"===w.charAt(U))){z.lastIndex=U-1;var L=z.exec(w);if(L)return n=L[0],U+=n.length-1,[n=n.replace(j.lineBreak,"\n"),"TK_STRING"]}if("<"===n&&"\x3c!--"===w.substring(U-1,U+3)){for(U+=3,n="\x3c!--";!j.newline.test(w.charAt(U))&&U<W;)n+=w.charAt(U),U++;return B=!0,[n,"TK_COMMENT"]}if("-"===n&&B&&"--\x3e"===w.substring(U-1,U+2))return B=!1,U+=2,["--\x3e","TK_COMMENT"];if("."===n)return[n,"TK_DOT"];if(q(n,N)){for(;U<W&&q(n+w.charAt(U),N)&&(n+=w.charAt(U),!(W<=(U+=1))););return","===n?[n,"TK_COMMA"]:"="===n?[n,"TK_EQUALS"]:[n,"TK_OPERATOR"]}return[n,"TK_UNKNOWN"]}this.tokenize=function(){var e,t,a;W=w.length,U=0,B=!1,P=[];for(var n=null,r=[],i=[];!t||"TK_EOF"!==t.type;){for(a=o(),e=new Z(a[1],a[0],D,M);"TK_COMMENT"===e.type||"TK_BLOCK_COMMENT"===e.type||"TK_UNKNOWN"===e.type;)"TK_BLOCK_COMMENT"===e.type&&(e.directives=a[2]),i.push(e),a=o(),e=new Z(a[1],a[0],D,M);i.length&&(e.comments_before=i,i=[]),"TK_START_BLOCK"===e.type||"TK_START_EXPR"===e.type?(e.parent=t,r.push(n),n=e):("TK_END_BLOCK"===e.type||"TK_END_EXPR"===e.type)&&n&&("]"===e.text&&"["===n.text||")"===e.text&&"("===n.text||"}"===e.text&&"{"===n.text)&&(e.parent=n.parent,n=r.pop()),P.push(e),t=e}return P}}return{run:function x(e,t){function o(e){return e.replace(/\s+$/g,"")}var a,n,r,m,i,s,v,l,c,b,E,A,d,f;for((t=t||{}).wrap_line_length!==undefined&&0!==parseInt(t.wrap_line_length,10)||t.max_char===undefined||0===parseInt(t.max_char,10)||(t.wrap_line_length=t.max_char),n=t.indent_inner_html!==undefined&&t.indent_inner_html,r=t.indent_size===undefined?4:parseInt(t.indent_size,10),m=t.indent_char===undefined?" ":t.indent_char,s=t.brace_style===undefined?"collapse":t.brace_style,i=0===parseInt(t.wrap_line_length,10)?32786:parseInt(t.wrap_line_length||250,10),v=t.unformatted||["a","span","img","bdo","em","strong","dfn","code","samp","kbd","const","cite","abbr","acronym","q","sub","sup","tt","i","b","big","small","u","s","strike","font","ins","del","address","pre"],l=t.preserve_newlines===undefined||t.preserve_newlines,c=l?isNaN(parseInt(t.max_preserve_newlines,10))?32786:parseInt(t.max_preserve_newlines,10):0,b=t.indent_handlebars!==undefined&&t.indent_handlebars,E=t.wrap_attributes===undefined?"auto":t.wrap_attributes,A=t.wrap_attributes_indent_size===undefined?r:parseInt(t.wrap_attributes_indent_size,10)||r,d=t.end_with_newline!==undefined&&t.end_with_newline,f=Array.isArray(t.extra_liners)?t.extra_liners.concat():"string"==typeof t.extra_liners?t.extra_liners.split(","):"head,body,/html".split(","),t.indent_with_tabs&&(m="\t",r=1),(a=new function w(){return this.pos=0,this.token="",this.current_mode="CONTENT",this.tags={parent:"parent1",parentcount:1,parent1:""},this.tag_type="",this.token_text=this.last_token=this.last_text=this.token_type="",this.newlines=0,this.indent_content=n,this.Utils={whitespace:"\n\r\t ".split(""),single_token:"br,input,link,meta,source,!doctype,basefont,base,area,hr,wbr,param,img,isindex,embed".split(","),extra_liners:f,in_array:function(e,t){for(var a=0;a<t.length;a++)if(e===t[a])return!0;return!1}},this.is_whitespace=function(e){for(;0<e.length;e++)if(!this.Utils.in_array(e.charAt(0),this.Utils.whitespace))return!1;return!0},this.traverse_whitespace=function(){var e="";if(e=this.input.charAt(this.pos),this.Utils.in_array(e,this.Utils.whitespace)){for(this.newlines=0;this.Utils.in_array(e,this.Utils.whitespace);)l&&"\n"===e&&this.newlines<=c&&(this.newlines+=1),this.pos++,e=this.input.charAt(this.pos);return!0}return!1},this.space_or_wrap=function(e){this.line_char_count>=this.wrap_line_length?(this.print_newline(!1,e),this.print_indentation(e)):(this.line_char_count++,e.push(" "))},this.get_content=function(){for(var e="",t=[];"<"!=this.input.charAt(this.pos);){if(this.pos>=this.input.length)return t.length?t.join(""):["","TK_EOF"];if(this.traverse_whitespace())this.space_or_wrap(t);else{if(b){var a=this.input.substr(this.pos,3);if("{{#"===a||"{{/"===a)break;if("{{!"===a)return[this.get_tag(),"TK_TAG_HANDLEBARS_COMMENT"];if("{{"===this.input.substr(this.pos,2)&&"{{else}}"===this.get_tag(!0))break}e=this.input.charAt(this.pos),this.pos++,this.line_char_count++,t.push(e)}}return t.length?t.join(""):""},this.get_contents_to=function(e){if(this.pos===this.input.length)return["","TK_EOF"];var t="",a=new RegExp("</".concat(e,"\\s*>"),"igm");a.lastIndex=this.pos;var n=a.exec(this.input),r=n?n.index:this.input.length;return this.pos<r&&(t=this.input.substring(this.pos,r),this.pos=r),t},this.record_tag=function(e){this.tags["".concat(e,"count")]?this.tags["".concat(e,"count")]++:this.tags["".concat(e,"count")]=1,this.tags[e+this.tags["".concat(e,"count")]]=this.indent_level,this.tags[e+this.tags["".concat(e,"count")]+"parent"]=this.tags.parent,this.tags.parent=e+this.tags["".concat(e,"count")]},this.retrieve_tag=function(e){if(this.tags["".concat(e,"count")]){for(var t=this.tags.parent;t&&e+this.tags["".concat(e,"count")]!==t;)t=this.tags["".concat(t,"parent")];t&&(this.indent_level=this.tags[e+this.tags["".concat(e,"count")]],this.tags.parent=this.tags[t+"parent"]),delete this.tags[e+this.tags["".concat(e,"count")]+"parent"],delete this.tags[e+this.tags["".concat(e,"count")]],1===this.tags["".concat(e,"count")]?delete this.tags["".concat(e,"count")]:this.tags["".concat(e,"count")]--}},this.indent_to_tag=function(e){if(this.tags["".concat(e,"count")]){for(var t=this.tags.parent;t&&e+this.tags["".concat(e,"count")]!==t;)t=this.tags["".concat(t,"parent")];t&&(this.indent_level=this.tags[e+this.tags["".concat(e,"count")]])}},this.get_tag=function(e){var t,a,n="",r=[],i="",o=!1,s=!0,l=this.pos,c=this.line_char_count;e=e!==undefined&&e;do{if(this.pos>=this.input.length)return e&&(this.pos=l,this.line_char_count=c),r.length?r.join(""):["","TK_EOF"];if(n=this.input.charAt(this.pos),this.pos++,this.Utils.in_array(n,this.Utils.whitespace))o=!0;else{if("'"!==n&&'"'!==n||(n+=this.get_unformatted(n),o=!0),"="===n&&(o=!1),r.length&&"="!=r[r.length-1]&&">"!=n&&o){if(this.space_or_wrap(r),o=!1,!s&&"force"===E&&"/"!=n){this.print_newline(!0,r),this.print_indentation(r);for(var d=0;d<A;d++)r.push(m)}for(var f=0;f<r.length;f++)if(" "===r[f]){s=!1;break}}if(b&&"<"===a&&n+this.input.charAt(this.pos)==="{{"&&(n+=this.get_unformatted("}}"),r.length&&" "!=r[r.length-1]&&"<"!=r[r.length-1]&&(n=" ".concat(n)),o=!0),"<"!==n||a||(t=this.pos-1,a="<"),b&&!a&&2<=r.length&&"{"===r[r.length-1]&&"{"===r[r.length-2]&&(t="#"===n||"/"===n||"!"===n?this.pos-3:this.pos-2,a="{"),this.line_char_count++,r.push(n),r[1]&&("!"===r[1]||"?"===r[1]||"%"===r[1])){r=[this.get_comment(t)];break}if(b&&r[1]&&"{"===r[1]&&r[2]&&"!"===r[2]){r=[this.get_comment(t)];break}if(b&&"{"===a&&2<r.length&&"}"===r[r.length-2]&&"}"===r[r.length-1])break}}while(">"!=n);var p,u,h=r.join("");p=-1!=h.indexOf(" ")?h.indexOf(" "):"{"===h[0]?h.indexOf("}"):h.indexOf(">"),u="<"!==h[0]&&b?"#"===h[2]?3:2:1;var g=h.substring(u,p).toLowerCase();return"/"===h.charAt(h.length-2)||this.Utils.in_array(g,this.Utils.single_token)?e||(this.tag_type="SINGLE"):b&&"{"===h[0]&&"else"===g?e||(this.indent_to_tag("if"),this.tag_type="HANDLEBARS_ELSE",this.indent_content=!0,this.traverse_whitespace()):this.is_unformatted(g,v)?(i=this.get_unformatted("</".concat(g,">"),h),r.push(i),this.pos,this.tag_type="SINGLE"):"script"===g&&(-1===h.search("type")||-1<h.search("type")&&-1<h.search(/\b(text|application)\/(x-)?(javascript|ecmascript|jscript|livescript)/))?e||(this.record_tag(g),this.tag_type="SCRIPT"):"style"===g&&(-1===h.search("type")||-1<h.search("type")&&-1<h.search("text/css"))?e||(this.record_tag(g),this.tag_type="STYLE"):"!"===g.charAt(0)?e||(this.tag_type="SINGLE",this.traverse_whitespace()):e||("/"===g.charAt(0)?(this.retrieve_tag(g.substring(1)),this.tag_type="END"):(this.record_tag(g),"html"!=g.toLowerCase()&&(this.indent_content=!0),this.tag_type="START"),this.traverse_whitespace()&&this.space_or_wrap(r),this.Utils.in_array(g,this.Utils.extra_liners)&&(this.print_newline(!1,this.output),this.output.length&&"\n"!=this.output[this.output.length-2]&&this.print_newline(!0,this.output))),e&&(this.pos=l,this.line_char_count=c),r.join("")},this.get_comment=function(e){var t="",a=">",n=!1;this.pos=e;var r=this.input.charAt(this.pos);for(this.pos++;this.pos<=this.input.length&&((t+=r)[t.length-1]!==a[a.length-1]||-1==t.indexOf(a));)!n&&t.length<10&&(0===t.indexOf("<![if")?(a="<![endif]>",n=!0):0===t.indexOf("<![cdata[")?(a="]]>",n=!0):0===t.indexOf("<![")?(a="]>",n=!0):0===t.indexOf("\x3c!--")?(a="--\x3e",n=!0):0===t.indexOf("{{!")?(a="}}",n=!0):0===t.indexOf("<?")?(a="?>",n=!0):0===t.indexOf("<%")&&(a="%>",n=!0)),r=this.input.charAt(this.pos),this.pos++;return t},this.get_unformatted=function(e,t){if(t&&-1!=t.toLowerCase().indexOf(e))return"";var a="",n="",r=0,i=!0;do{if(this.pos>=this.input.length)return n;if(a=this.input.charAt(this.pos),this.pos++,this.Utils.in_array(a,this.Utils.whitespace)){if(!i){this.line_char_count--;continue}if("\n"===a||"\r"===a){n+="\n",this.line_char_count=0;continue}}n+=a,this.line_char_count++,i=!0,b&&"{"===a&&n.length&&"{"===n[n.length-2]&&(r=(n+=this.get_unformatted("}}")).length)}while(-1===n.toLowerCase().indexOf(e,r));return n},this.get_token=function(){var e;if("TK_TAG_SCRIPT"!==this.last_token&&"TK_TAG_STYLE"!==this.last_token)return"CONTENT"===this.current_mode?"string"!=typeof(e=this.get_content())?e:[e,"TK_CONTENT"]:"TAG"===this.current_mode?"string"!=typeof(e=this.get_tag())?e:[e,"TK_TAG_".concat(this.tag_type)]:void 0;var t=this.last_token.substr(7);return"string"!=typeof(e=this.get_contents_to(t))?e:[e,"TK_".concat(t)]},this.get_full_indent=function(e){return(e=this.indent_level+e||0)<1?"":new Array(e+1).join(this.indent_string)},this.is_unformatted=function(e,t){if(!this.Utils.in_array(e,t))return!1;if("a"!=e.toLowerCase()||!this.Utils.in_array("a",t))return!0;var a=(this.get_tag(!0)||"").match(/^\s*<\s*\/?([a-z]*)\s*[^>]*>\s*$/);return!(a&&!this.Utils.in_array(a,t))},this.printer=function(e,t,a,n,r){this.input=e||"",this.output=[],this.indent_character=t,this.indent_string="",this.indent_size=a,this.brace_style=r,this.indent_level=0,this.wrap_line_length=n;for(var i=this.line_char_count=0;i<this.indent_size;i++)this.indent_string+=this.indent_character;this.print_newline=function(e,t){this.line_char_count=0,t&&t.length&&(e||"\n"!=t[t.length-1])&&("\n"!=t[t.length-1]&&(t[t.length-1]=o(t[t.length-1])),t.push("\n"))},this.print_indentation=function(e){for(var t=0;t<this.indent_level;t++)e.push(this.indent_string),this.line_char_count+=this.indent_string.length},this.print_token=function(e){this.is_whitespace(e)&&!this.output.length||((e||""!==e)&&this.output.length&&"\n"===this.output[this.output.length-1]&&(this.print_indentation(this.output),e=function t(e){return e.replace(/^\s+/g,"")}(e)),this.print_token_raw(e))},this.print_token_raw=function(e){0<this.newlines&&(e=o(e)),e&&""!==e&&(1<e.length&&"\n"===e[e.length-1]?(this.output.push(e.slice(0,-1)),this.print_newline(!1,this.output)):this.output.push(e));for(var t=0;t<this.newlines;t++)this.print_newline(0<t,this.output);this.newlines=0},this.indent=function(){this.indent_level++},this.unindent=function(){0<this.indent_level&&this.indent_level--}},this}).printer(e,m,r,i,s);;){var p=a.get_token();if(a.token_text=p[0],a.token_type=p[1],"TK_EOF"===a.token_type)break;switch(a.token_type){case"TK_TAG_START":a.print_newline(!1,a.output),a.print_token(a.token_text),a.indent_content&&(a.indent(),a.indent_content=!1),a.current_mode="CONTENT";break;case"TK_TAG_STYLE":case"TK_TAG_SCRIPT":a.print_newline(!1,a.output),a.print_token(a.token_text),a.current_mode="CONTENT";break;case"TK_TAG_END":if("TK_CONTENT"===a.last_token&&""===a.last_text){var u=a.token_text.match(/\w+/)[0],h=null;a.output.length&&(h=a.output[a.output.length-1].match(/(?:<|{{#)\/?\s*(\w+)/)),(null===h||h[1]!=u&&!a.Utils.in_array(h[1],v))&&a.print_newline(!1,a.output)}a.print_token(a.token_text),a.current_mode="CONTENT";break;case"TK_TAG_SINGLE":v