ros.grant.common 2.0.1395 → 2.0.1397

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6422,12 +6422,12 @@ var LinkDialog = /** @class */ (function () {
6422
6422
  var $container = this.options.dialogsInBody ? this.$body : this.$editor;
6423
6423
  var body = [
6424
6424
  '<div class="inputbox">',
6425
- "<label>" + this.lang.link.textToDisplay + "</label>",
6426
- '<input type="text" />',
6425
+ "<label class=\"note-form-label\">" + this.lang.link.textToDisplay + "</label>",
6426
+ '<input class="note-link-text form-control note-form-control note-input" type="text" />',
6427
6427
  '</div>',
6428
6428
  '<div class="inputbox">',
6429
- "<label>" + this.lang.link.url + "</label>",
6430
- '<input type="text" value="http://" />',
6429
+ "<label class=\"note-form-label\">" + this.lang.link.url + "</label>",
6430
+ '<input class="note-link-url form-control note-form-control note-input" type="text" value="http://" />',
6431
6431
  '</div>',
6432
6432
  !this.options.disableLinkTarget
6433
6433
  ? $$1('<div/>').append(this.ui.checkbox({
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],e):e(t.jQuery)}(this,(function(t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var e=function(){function e(t,e,o,n){this.markup=t,this.children=e,this.options=o,this.callback=n}return e.prototype.render=function(e){var o=t(this.markup);if(this.options&&this.options.contents&&o.html(this.options.contents),this.options&&this.options.className&&o.addClass(this.options.className),this.options&&this.options.data&&t.each(this.options.data,(function(t,e){o.attr("data-"+t,e)})),this.options&&this.options.click&&o.on("click",this.options.click),this.children){var n=o.find(".note-children-container");this.children.forEach((function(t){t.render(n.length?n:o)}))}return this.callback&&this.callback(o,this.options),this.options&&this.options.callback&&this.options.callback(o),e&&e.append(o),o},e}(),o=function(o,n){return function(){var i="object"==typeof arguments[1]?arguments[1]:arguments[0],r=t.isArray(arguments[0])?arguments[0]:[];return i&&i.children&&(r=i.children),new e(o,r,i,n)}},n=function(){function t(t,e){if(this.$node=t,this.options=$.extend({},{title:"",target:e.container,trigger:"hover focus",placement:"bottom"},e),this.$tooltip=$(['<div class="note-tooltip in">',' <div class="note-tooltip-arrow"/>',' <div class="note-tooltip-content"/>',"</div>"].join("")),"manual"!==this.options.trigger){var o=this.show.bind(this),n=this.hide.bind(this),i=this.toggle.bind(this);this.options.trigger.split(" ").forEach((function(e){"hover"===e?(t.off("mouseenter mouseleave"),t.on("mouseenter",o).on("mouseleave",n)):"click"===e?t.on("click",i):"focus"===e&&t.on("focus",o).on("blur",n)}))}}return t.prototype.show=function(){var t=this.$node,e=t.offset(),o=this.$tooltip,n=this.options.title||t.attr("title")||t.data("title"),i=this.options.placement||t.data("placement");o.addClass(i),o.addClass("in"),o.find(".note-tooltip-content").text(n),o.appendTo(this.options.target);var r=t.outerWidth(),s=t.outerHeight(),a=o.outerWidth(),l=o.outerHeight();"bottom"===i?o.css({top:e.top+s,left:e.left+(r/2-a/2)}):"top"===i?o.css({top:e.top-l,left:e.left+(r/2-a/2)}):"left"===i?o.css({top:e.top+(s/2-l/2),left:e.left-a}):"right"===i&&o.css({top:e.top+(s/2-l/2),left:e.left+r})},t.prototype.hide=function(){this.$tooltip.removeClass("in"),this.$tooltip.remove()},t.prototype.toggle=function(){this.$tooltip.hasClass("in")?this.hide():this.show()},t}(),i=function(){function t(t,e){this.$button=t,this.options=$.extend({},{target:e.container},e),this.setEvent()}return t.prototype.setEvent=function(){this.$button.on("click",this.toggle.bind(this))},t.prototype.clear=function(){var t=$(".note-btn-group.open");t.find(".note-btn.active").removeClass("active"),t.removeClass("open")},t.prototype.show=function(){this.$button.addClass("active"),this.$button.parent().addClass("open");var t=this.$button.next(),e=t.offset(),o=t.outerWidth(),n=$(window).width(),i=parseFloat($(this.options.target).css("margin-right"));e.left+o>n-i?t.css("margin-left",n-i-(e.left+o)):t.css("margin-left","")},t.prototype.hide=function(){this.$button.removeClass("active"),this.$button.parent().removeClass("open")},t.prototype.toggle=function(){var t=this.$button.parent().hasClass("open");this.clear(),t?this.hide():this.show()},t}();$(document).on("click",(function(t){$(t.target).closest(".note-btn-group").length||$(".note-btn-group.open").removeClass("open")})),$(document).on("click.note-dropdown-menu",(function(t){$(t.target).closest(".note-dropdown-menu").parent().removeClass("open")}));var r=function(){function t(t,e){this.options=$.extend({},{target:e.container||"body"},e),this.$modal=t,this.$backdrop=$('<div class="note-modal-backdrop" />')}return t.prototype.show=function(){"body"===this.options.target?(this.$backdrop.css("position","fixed"),this.$modal.css("position","fixed")):(this.$backdrop.css("position","absolute"),this.$modal.css("position","absolute")),this.$backdrop.appendTo(this.options.target).show(),this.$modal.appendTo(this.options.target).addClass("open").show(),this.$modal.trigger("note.modal.show"),this.$modal.off("click",".close").on("click",".close",this.hide.bind(this))},t.prototype.hide=function(){this.$modal.removeClass("open").hide(),this.$backdrop.hide(),this.$modal.trigger("note.modal.hide")},t}(),s=o('<div class="note-editor note-frame"/>'),a=o('<div class="note-toolbar" role="toolbar"/>'),l=o('<div class="note-editing-area"/>'),c=o('<textarea class="note-codable" role="textbox" aria-multiline="true"/>'),d=o('<div class="note-editable" contentEditable="true" role="textbox" aria-multiline="true"/>'),u=o(['<output class="note-status-output" role="status" aria-live="polite"/>','<div class="note-statusbar" role="resize">',' <div class="note-resizebar" role="seperator" aria-orientation="horizontal" aria-label="resize">',' <div class="note-icon-bar"/>',' <div class="note-icon-bar"/>',' <div class="note-icon-bar"/>'," </div>","</div>"].join("")),h=o('<div class="note-editor"/>'),p=o(['<output class="note-status-output" role="status" aria-live="polite"/>','<div class="note-editable" contentEditable="true" role="textbox" aria-multiline="true"/>'].join("")),f=o('<div class="note-btn-group">'),m=o('<button type="button" class="note-btn" role="button" tabindex="-1">',(function(t,e){e&&e.tooltip&&(t.attr({"aria-label":e.tooltip}),t.data("_lite_tooltip",new n(t,{title:e.tooltip,container:e.container}))),e.contents&&t.html(e.contents),e&&e.data&&"dropdown"===e.data.toggle&&t.data("_lite_dropdown",new i(t,{container:e.container}))})),g=o('<div class="note-dropdown-menu" role="list">',(function(t,e){var o=$.isArray(e.items)?e.items.map((function(t){var o="string"==typeof t?t:t.value||"",n=e.template?e.template(t):t,i=$('<a class="note-dropdown-item" href="#" data-value="'+o+'" role="listitem" aria-label="'+t+'"></a>');return i.html(n).data("item",t),i})):e.items;t.html(o).attr({"aria-label":e.title}),t.on("click","> .note-dropdown-item",(function(t){var o=$(this),n=o.data("item"),i=o.data("value");n.click?n.click(o):e.itemClick&&e.itemClick(t,n,i)}))})),v=o('<div class="note-dropdown-menu note-check" role="list">',(function(t,e){var o=$.isArray(e.items)?e.items.map((function(t){var o="string"==typeof t?t:t.value||"",n=e.template?e.template(t):t,i=$('<a class="note-dropdown-item" href="#" data-value="'+o+'" role="listitem" aria-label="'+t+'"></a>');return i.html([w(e.checkClassName)," ",n]).data("item",t),i})):e.items;t.html(o).attr({"aria-label":e.title}),t.on("click","> .note-dropdown-item",(function(t){var o=$(this),n=o.data("item"),i=o.data("value");n.click?n.click(o):e.itemClick&&e.itemClick(t,n,i)}))})),b=o('<div class="note-color-palette"/>',(function(t,e){for(var o=[],i=0,r=e.colors.length;i<r;i++){for(var s=e.eventName,a=e.colors[i],l=e.colorsName[i],c=[],d=0,u=a.length;d<u;d++){var h=a[d],p=l[d];c.push(['<button type="button" class="note-btn note-color-btn"','style="background-color:',h,'" ','data-event="',s,'" ','data-value="',h,'" ','title="',p,'" ','aria-label="',p,'" ','data-toggle="button" tabindex="-1"></button>'].join(""))}o.push('<div class="note-color-row">'+c.join("")+"</div>")}t.html(o.join("")),t.find(".note-color-btn").each((function(){$(this).data("_lite_tooltip",new n($(this),{container:e.container}))}))})),y=o('<div class="note-modal" aria-hidden="false" tabindex="-1" role="dialog"/>',(function(t,e){e.fade&&t.addClass("fade"),t.attr({"aria-label":e.title}),t.html([' <div class="note-modal-content">',e.title?' <div class="note-modal-header"> <button type="button" class="close" aria-label="Close" aria-hidden="true"><i class="note-icon-close"></i></button> <h4 class="note-modal-title">'+e.title+"</h4> </div>":"",' <div class="note-modal-body">'+e.body+"</div>",e.footer?' <div class="note-modal-footer">'+e.footer+"</div>":""," </div>"].join("")),t.data("modal",new r(t,e))})),k=o(['<div class="note-popover bottom">',' <div class="note-popover-arrow"/>',' <div class="note-popover-content note-children-container"/>',"</div>"].join(""),(function(t,e){var o=void 0!==e.direction?e.direction:"bottom";t.addClass(o).hide(),e.hideArrow&&t.find(".note-popover-arrow").hide()})),C=o('<div class="checkbox"></div>',(function(t,e){t.html([" <label"+(e.id?' for="'+e.id+'"':"")+">",' <input role="checkbox" type="checkbox"'+(e.id?' id="'+e.id+'"':""),e.checked?" checked":"",' aria-checked="'+(e.checked?"true":"false")+'"/>',e.text?e.text:"","</label>"].join(""))})),w=function(t,e){return"<"+(e=e||"i")+' class="'+t+'"/>'},x={editor:s,toolbar:a,editingArea:l,codable:c,editable:d,statusbar:u,airEditor:h,airEditable:p,buttonGroup:f,button:m,dropdown:g,dropdownCheck:v,dropdownButton:function(t,e){return f([m({className:"dropdown-toggle",contents:t.title+" "+w("note-icon-caret"),tooltip:t.tooltip,data:{toggle:"dropdown"}}),g({className:t.className,items:t.items,template:t.template,itemClick:t.itemClick})],{callback:e}).render()},dropdownButtonContents:function(t,e){return t+" "+w(e.icons.caret,"span")},dropdownCheckButton:function(t,e){return f([m({className:"dropdown-toggle",contents:t.title+" "+w("note-icon-caret"),tooltip:t.tooltip,data:{toggle:"dropdown"}}),v({className:t.className,checkClassName:t.checkClassName,items:t.items,template:t.template,itemClick:t.itemClick})],{callback:e}).render()},paragraphDropdownButton:function(t){return f([m({className:"dropdown-toggle",contents:t.title+" "+w("note-icon-caret"),tooltip:t.tooltip,data:{toggle:"dropdown"}}),g([f({className:"note-align",children:t.items[0]}),f({className:"note-list",children:t.items[1]})])]).render()},tableDropdownButton:function(t){return f([m({className:"dropdown-toggle",contents:t.title+" "+w("note-icon-caret"),tooltip:t.tooltip,data:{toggle:"dropdown"}}),g({className:"note-table",items:['<div class="note-dimension-picker">',' <div class="note-dimension-picker-mousecatcher" data-event="insertTable" data-value="1x1"/>',' <div class="note-dimension-picker-highlighted"/>',' <div class="note-dimension-picker-unhighlighted"/>',"</div>",'<div class="note-dimension-display">1 x 1</div>'].join("")})],{callback:function(e){e.find(".note-dimension-picker-mousecatcher").css({width:t.col+"em",height:t.row+"em"}).mousedown(t.itemClick).mousemove((function(e){!function(t,e,o){var n,i=$(t.target.parentNode),r=i.next(),s=i.find(".note-dimension-picker-mousecatcher"),a=i.find(".note-dimension-picker-highlighted"),l=i.find(".note-dimension-picker-unhighlighted");if(void 0===t.offsetX){var c=$(t.target).offset();n={x:t.pageX-c.left,y:t.pageY-c.top}}else n={x:t.offsetX,y:t.offsetY};var d=Math.ceil(n.x/18)||1,u=Math.ceil(n.y/18)||1;a.css({width:d+"em",height:u+"em"}),s.data("value",d+"x"+u),d>3&&d<e&&l.css({width:d+1+"em"}),u>3&&u<o&&l.css({height:u+1+"em"}),r.html(d+" x "+u)}(e,t.col,t.row)}))}}).render()},colorDropdownButton:function(t,e){return f({className:"note-color",children:[m({className:"note-current-color-button",contents:t.title,tooltip:t.lang.color.recent,click:t.currentClick,callback:function(t){var o=t.find(".note-recent-color");"foreColor"!==e&&(o.css("background-color","#FFFF00"),t.attr("data-backColor","#FFFF00"))}}),m({className:"dropdown-toggle",contents:w("note-icon-caret"),tooltip:t.lang.color.more,data:{toggle:"dropdown"}}),g({items:["<div>",'<div class="note-btn-group btn-background-color">',' <div class="note-palette-title">'+t.lang.color.background+"</div>"," <div>",'<button type="button" class="note-color-reset note-btn note-btn-block" data-event="backColor" data-value="inherit">',t.lang.color.transparent," </button>"," </div>",' <div class="note-holder" data-event="backColor"/>',"</div>",'<div class="note-btn-group btn-foreground-color">',' <div class="note-palette-title">'+t.lang.color.foreground+"</div>"," <div>",'<button type="button" class="note-color-reset note-btn note-btn-block" data-event="removeFormat" data-value="foreColor">',t.lang.color.resetToDefault," </button>"," </div>",' <div class="note-holder" data-event="foreColor"/>',"</div>","</div>"].join(""),callback:function(o){o.find(".note-holder").each((function(){var e=$(this);e.append(b({colors:t.colors,eventName:e.data("event")}).render())})),"fore"===e?(o.find(".btn-background-color").hide(),o.css({"min-width":"210px"})):"back"===e&&(o.find(".btn-foreground-color").hide(),o.css({"min-width":"210px"}))},click:function(o){var n=$(o.target),i=n.data("event"),r=n.data("value");if(i&&r){var s="backColor"===i?"background-color":"color",a=n.closest(".note-color").find(".note-recent-color"),l=n.closest(".note-color").find(".note-current-color-button");a.css(s,r),l.attr("data-"+i,r),"fore"===e?t.itemClick("foreColor",r):"back"===e?t.itemClick("backColor",r):t.itemClick(i,r)}}})]}).render()},palette:b,dialog:y,videoDialog:function(t){var e='<div class="note-form-group"><label class="note-form-label">'+t.lang.video.url+' <small class="text-muted">'+t.lang.video.providers+'</small></label><input class="note-video-url note-input" type="text" /></div>',o=['<button type="button" href="#" class="note-btn note-btn-primary note-video-btn disabled" disabled>',t.lang.video.insert,"</button>"].join("");return y({title:t.lang.video.insert,fade:t.fade,body:e,footer:o}).render()},imageDialog:function(t){var e='<div class="note-form-group note-group-select-from-files"><label class="note-form-label">'+t.lang.image.selectFromFiles+'</label><input class="note-note-image-input note-input" type="file" name="files" accept="image/*" multiple="multiple" />'+t.imageLimitation+'</div><div class="note-form-group" style="overflow:auto;"><label class="note-form-label">'+t.lang.image.url+'</label><input class="note-image-url note-input" type="text" /></div>',o=['<button href="#" type="button" class="note-btn note-btn-primary note-btn-large note-image-btn disabled" disabled>',t.lang.image.insert,"</button>"].join("");return y({title:t.lang.image.insert,fade:t.fade,body:e,footer:o}).render()},linkDialog:function(t){var e='<div class="note-form-group"><label class="note-form-label">'+t.lang.link.textToDisplay+'</label><input class="note-link-text note-input" type="text" /></div><div class="note-form-group"><label class="note-form-label">'+t.lang.link.url+'</label><input class="note-link-url note-input" type="text" value="http://" /></div>'+(t.disableLinkTarget?"":'<div class="checkbox"><label><input type="checkbox" checked> '+t.lang.link.openInNewWindow+"</label></div>"),o=['<button href="#" type="button" class="note-btn note-btn-primary note-link-btn disabled" disabled>',t.lang.link.insert,"</button>"].join("");return y({className:"link-dialog",title:t.lang.link.insert,fade:t.fade,body:e,footer:o}).render()},popover:k,checkbox:C,icon:w,toggleBtn:function(t,e){t.toggleClass("disabled",!e),t.attr("disabled",!e)},toggleBtnActive:function(t,e){t.toggleClass("active",e)},check:function(t,e){t.find(".checked").removeClass("checked"),t.find('[data-value="'+e+'"]').addClass("checked")},onDialogShown:function(t,e){t.one("note.modal.show",e)},onDialogHidden:function(t,e){t.one("note.modal.hide",e)},showDialog:function(t){t.data("modal").show()},hideDialog:function(t){t.data("modal").hide()},getPopoverContent:function(t){return t.find(".note-popover-content")},getDialogBody:function(t){return t.find(".note-modal-body")},createLayout:function(t,e){var o=(e.airMode?x.airEditor([x.editingArea([x.airEditable()])]):x.editor([x.toolbar(),x.editingArea([x.codable(),x.editable()]),x.statusbar()])).render();return o.insertAfter(t),{note:t,editor:o,toolbar:o.find(".note-toolbar"),editingArea:o.find(".note-editing-area"),editable:o.find(".note-editable"),codable:o.find(".note-codable"),statusbar:o.find(".note-statusbar")}},removeLayout:function(t,e){t.html(e.editable.html()),e.editor.remove(),t.off("summernote"),t.show()}};t.summernote=t.summernote||{lang:{}},t.extend(t.summernote.lang,{"en-US":{font:{bold:"Bold",italic:"Italic",underline:"Underline",clear:"Remove Font Style",height:"Line Height",name:"Font Family",strikethrough:"Strikethrough",subscript:"Subscript",superscript:"Superscript",size:"Font Size"},image:{image:"Picture",insert:"Добавление изображения",resizeFull:"Resize Full",resizeHalf:"Resize Half",resizeQuarter:"Resize Quarter",floatLeft:"Float Left",floatRight:"Float Right",floatNone:"Float None",shapeRounded:"Shape: Rounded",shapeCircle:"Shape: Circle",shapeThumbnail:"Shape: Thumbnail",shapeNone:"Shape: None",dragImageHere:"Перетащите изображение или текст сюда",dropImage:"Перетащите изображение или текст",selectFromFiles:"Выберите файл",maximumFileSize:"Максимальный размер",maximumFileSizeError:"аксимальный размер файла превышен.",url:"Путь к изображению",remove:"Удалить изображение",original:"Оригинал"},video:{video:"Video",videoLink:"Добавление видео",insert:"Добавление видео",url:"Путь к видео",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion, Youku)"},link:{link:"Link",insert:"Добавление ссылки",unlink:"Unlink",edit:"Edit",textToDisplay:"Выводимый текст",url:"To what URL should this link go?",openInNewWindow:"Open in new window"},table:{table:"Table",addRowAbove:"Add row above",addRowBelow:"Add row below",addColLeft:"Add column left",addColRight:"Add column right",delRow:"Delete row",delCol:"Delete column",delTable:"Delete table"},hr:{insert:"Insert Horizontal Rule"},style:{style:"Style",p:"Normal",blockquote:"Quote",pre:"Code",h1:"Header 1",h2:"Header 2",h3:"Header 3",h4:"Header 4",h5:"Header 5",h6:"Header 6"},lists:{unordered:"Unordered list",ordered:"Ordered list"},options:{help:"Help",fullscreen:"Full Screen",codeview:"Code View"},paragraph:{paragraph:"Paragraph",outdent:"Outdent",indent:"Indent",left:"Align left",center:"Align center",right:"Align right",justify:"Justify full"},color:{recent:"Recent Color",more:"More Color",background:"Background Color",foreground:"Foreground Color",transparent:"Transparent",setTransparent:"Set transparent",reset:"Reset",resetToDefault:"Reset to default"},shortcut:{shortcuts:"Keyboard shortcuts",close:"Close",textFormatting:"Text formatting",action:"Action",paragraphFormatting:"Paragraph formatting",documentStyle:"Document Style",extraKeys:"Extra keys"},help:{insertParagraph:"Insert Paragraph",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDialog.show":"Show Link Dialog"},history:{undo:"Undo",redo:"Redo"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}});var S="function"==typeof define&&define.amd;var T,I=navigator.userAgent,N=/MSIE|Trident/i.test(I);if(N){var E=/MSIE (\d+[.]\d+)/.exec(I);E&&(T=parseFloat(E[1])),(E=/Trident\/.*rv:([0-9]{1,}[.0-9]{0,})/.exec(I))&&(T=parseFloat(E[1]))}var A=/Edge\/\d+/.test(I),R=!!window.CodeMirror;if(!R&&S)if("function"==typeof __webpack_require__)try{require.resolve("codemirror"),R=!0}catch(t){}else if("undefined"!=typeof require)if(void 0!==require.resolve)try{require.resolve("codemirror"),R=!0}catch(t){}else void 0!==require.specified&&(R=require.specified("codemirror"));var P="ontouchstart"in window||navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0,L=N||A?"DOMCharacterDataModified DOMSubtreeModified DOMNodeInserted":"input",H={isMac:navigator.appVersion.indexOf("Mac")>-1,isMSIE:N,isEdge:A,isFF:!A&&/firefox/i.test(I),isPhantom:/PhantomJS/i.test(I),isWebkit:!A&&/webkit/i.test(I),isChrome:!A&&/chrome/i.test(I),isSafari:!A&&/safari/i.test(I),browserVersion:T,jqueryVersion:parseFloat(t.fn.jquery),isSupportAmd:S,isSupportTouch:P,hasCodeMirror:R,isFontInstalled:function(e){var o="Comic Sans MS"===e?"Courier New":"Comic Sans MS",n=t("<div>").css({position:"absolute",left:"-9999px",top:"-9999px",fontSize:"200px"}).text("mmmmmmmmmwwwwwww").appendTo(document.body),i=n.css("fontFamily",o).width(),r=n.css("fontFamily",e+","+o).width();return n.remove(),i!==r},isW3CRangeSupport:!!document.createRange,inputEventName:L};var F=0;var D={eq:function(t){return function(e){return t===e}},eq2:function(t,e){return t===e},peq2:function(t){return function(e,o){return e[t]===o[t]}},ok:function(){return!0},fail:function(){return!1},self:function(t){return t},not:function(t){return function(){return!t.apply(t,arguments)}},and:function(t,e){return function(o){return t(o)&&e(o)}},invoke:function(t,e){return function(){return t[e].apply(t,arguments)}},uniqueId:function(t){var e=++F+"";return t?t+e:e},rect2bnd:function(t){var e=$(document);return{top:t.top+e.scrollTop(),left:t.left+e.scrollLeft(),width:t.right-t.left,height:t.bottom-t.top}},invertObject:function(t){var e={};for(var o in t)t.hasOwnProperty(o)&&(e[t[o]]=o);return e},namespaceToCamel:function(t,e){return(e=e||"")+t.split(".").map((function(t){return t.substring(0,1).toUpperCase()+t.substring(1)})).join("")},debounce:function(t,e,o){var n,i=this;return function(){var r=i,s=arguments,a=function(){n=null,o||t.apply(r,s)},l=o&&!n;clearTimeout(n),n=setTimeout(a,e),l&&t.apply(r,s)}}};function B(t){return t[0]}function z(t){return t[t.length-1]}function M(t){return t.slice(1)}function O(e,o){return t.inArray(o,e)}function U(t,e){return-1!==O(t,e)}var j={head:B,last:z,initial:function(t){return t.slice(0,t.length-1)},tail:M,prev:function(t,e){var o=O(t,e);return-1===o?null:t[o-1]},next:function(t,e){var o=O(t,e);return-1===o?null:t[o+1]},find:function(t,e){for(var o=0,n=t.length;o<n;o++){var i=t[o];if(e(i))return i}},contains:U,all:function(t,e){for(var o=0,n=t.length;o<n;o++)if(!e(t[o]))return!1;return!0},sum:function(t,e){return e=e||D.self,t.reduce((function(t,o){return t+e(o)}),0)},from:function(t){for(var e=[],o=t.length,n=-1;++n<o;)e[n]=t[n];return e},isEmpty:function(t){return!t||!t.length},clusterBy:function(t,e){return t.length?M(t).reduce((function(t,o){var n=z(t);return e(z(n),o)?n[n.length]=o:t[t.length]=[o],t}),[[B(t)]]):[]},compact:function(t){for(var e=[],o=0,n=t.length;o<n;o++)t[o]&&e.push(t[o]);return e},unique:function(t){for(var e=[],o=0,n=t.length;o<n;o++)U(e,t[o])||e.push(t[o]);return e}},K={BACKSPACE:8,TAB:9,ENTER:13,SPACE:32,DELETE:46,LEFT:37,UP:38,RIGHT:39,DOWN:40,NUM0:48,NUM1:49,NUM2:50,NUM3:51,NUM4:52,NUM5:53,NUM6:54,NUM7:55,NUM8:56,B:66,E:69,I:73,J:74,K:75,L:76,R:82,S:83,U:85,V:86,Y:89,Z:90,SLASH:191,LEFTBRACKET:219,BACKSLASH:220,RIGHTBRACKET:221},q={isEdit:function(t){return j.contains([K.BACKSPACE,K.TAB,K.ENTER,K.SPACE,K.DELETE],t)},isMove:function(t){return j.contains([K.LEFT,K.UP,K.RIGHT,K.DOWN],t)},nameFromCode:D.invertObject(K),code:K},W=String.fromCharCode(160);function V(e){return e&&t(e).hasClass("note-editable")}function _(t){return t=t.toUpperCase(),function(e){return e&&e.nodeName.toUpperCase()===t}}function G(t){return t&&3===t.nodeType}function Y(t){return t&&/^BR|^IMG|^HR|^IFRAME|^BUTTON|^INPUT/.test(t.nodeName.toUpperCase())}function Z(t){return!V(t)&&(t&&/^DIV|^P|^LI|^H[1-7]/.test(t.nodeName.toUpperCase()))}var Q=_("PRE"),X=_("LI");var J=_("TABLE"),tt=_("DATA");function et(t){return!(st(t)||ot(t)||nt(t)||Z(t)||J(t)||rt(t)||tt(t))}function ot(t){return t&&/^UL|^OL/.test(t.nodeName.toUpperCase())}var nt=_("HR");function it(t){return t&&/^TD|^TH/.test(t.nodeName.toUpperCase())}var rt=_("BLOCKQUOTE");function st(t){return it(t)||rt(t)||V(t)}var at=_("A");var lt=_("BODY");var ct=H.isMSIE&&H.browserVersion<11?"&nbsp;":"<br>";function dt(t){return G(t)?t.nodeValue.length:t?t.childNodes.length:0}function ut(t){var e=dt(t);return 0===e||(!G(t)&&1===e&&t.innerHTML===ct||!(!j.all(t.childNodes,G)||""!==t.innerHTML))}function ht(t){Y(t)||dt(t)||(t.innerHTML=ct)}function pt(t,e){for(;t;){if(e(t))return t;if(V(t))break;t=t.parentNode}return null}function ft(t,e){e=e||D.fail;var o=[];return pt(t,(function(t){return V(t)||o.push(t),e(t)})),o}function mt(t,e){e=e||D.fail;for(var o=[];t&&!e(t);)o.push(t),t=t.nextSibling;return o}function gt(t,e){var o=e.nextSibling,n=e.parentNode;return o?n.insertBefore(t,o):n.appendChild(t),t}function vt(e,o){return t.each(o,(function(t,o){e.appendChild(o)})),e}function bt(t){return 0===t.offset}function yt(t){return t.offset===dt(t.node)}function kt(t){return bt(t)||yt(t)}function Ct(t,e){for(;t&&t!==e;){if(0!==xt(t))return!1;t=t.parentNode}return!0}function wt(t,e){if(!e)return!1;for(;t&&t!==e;){if(xt(t)!==dt(t.parentNode)-1)return!1;t=t.parentNode}return!0}function xt(t){for(var e=0;t=t.previousSibling;)e+=1;return e}function St(t){return!!(t&&t.childNodes&&t.childNodes.length)}function $t(t,e){var o,n;if(0===t.offset){if(V(t.node))return null;o=t.node.parentNode,n=xt(t.node)}else St(t.node)?n=dt(o=t.node.childNodes[t.offset-1]):(o=t.node,n=e?0:t.offset-1);return{node:o,offset:n}}function Tt(t,e){var o,n;if(dt(t.node)===t.offset){if(V(t.node))return null;o=t.node.parentNode,n=xt(t.node)+1}else St(t.node)?(o=t.node.childNodes[t.offset],n=0):(o=t.node,n=e?dt(t.node):t.offset+1);return{node:o,offset:n}}function It(t,e){return t.node===e.node&&t.offset===e.offset}function Nt(t,e){var o=e&&e.isSkipPaddingBlankHTML,n=e&&e.isNotSplitEdgePoint;if(kt(t)&&(G(t.node)||n)){if(bt(t))return t.node;if(yt(t))return t.node.nextSibling}if(G(t.node))return t.node.splitText(t.offset);var i=t.node.childNodes[t.offset],r=gt(t.node.cloneNode(!1),t.node);return vt(r,mt(i)),o||(ht(t.node),ht(r)),r}function Et(t,e,o){var n=ft(e.node,D.eq(t));return n.length?1===n.length?Nt(e,o):n.reduce((function(t,n){return t===e.node&&(t=Nt(e,o)),Nt({node:n,offset:t?xt(t):dt(n)},o)})):null}function At(t){return document.createElement(t)}function Rt(t,e){if(t&&t.parentNode){if(t.removeNode)return t.removeNode(e);var o=t.parentNode;if(!e){for(var n=[],i=0,r=t.childNodes.length;i<r;i++)n.push(t.childNodes[i]);for(i=0,r=n.length;i<r;i++)o.insertBefore(n[i],t)}o.removeChild(t)}}var Pt=_("TEXTAREA");function Lt(t,e){var o=Pt(t[0])?t.val():t.html();return e?o.replace(/[\n\r]/g,""):o}var Ht={NBSP_CHAR:W,ZERO_WIDTH_NBSP_CHAR:"\ufeff",blank:ct,emptyPara:"<p>"+ct+"</p>",makePredByNodeName:_,isEditable:V,isControlSizing:function(e){return e&&t(e).hasClass("note-control-sizing")},isText:G,isElement:function(t){return t&&1===t.nodeType},isVoid:Y,isPara:Z,isPurePara:function(t){return Z(t)&&!X(t)},isHeading:function(t){return t&&/^H[1-7]/.test(t.nodeName.toUpperCase())},isInline:et,isBlock:D.not(et),isBodyInline:function(t){return et(t)&&!pt(t,Z)},isBody:lt,isParaInline:function(t){return et(t)&&!!pt(t,Z)},isPre:Q,isList:ot,isTable:J,isData:tt,isCell:it,isBlockquote:rt,isBodyContainer:st,isAnchor:at,isDiv:_("DIV"),isLi:X,isBR:_("BR"),isSpan:_("SPAN"),isB:_("B"),isU:_("U"),isS:_("S"),isI:_("I"),isImg:_("IMG"),isTextarea:Pt,isEmpty:ut,isEmptyAnchor:D.and(at,ut),isClosestSibling:function(t,e){return t.nextSibling===e||t.previousSibling===e},withClosestSiblings:function(t,e){e=e||D.ok;var o=[];return t.previousSibling&&e(t.previousSibling)&&o.push(t.previousSibling),o.push(t),t.nextSibling&&e(t.nextSibling)&&o.push(t.nextSibling),o},nodeLength:dt,isLeftEdgePoint:bt,isRightEdgePoint:yt,isEdgePoint:kt,isLeftEdgeOf:Ct,isRightEdgeOf:wt,isLeftEdgePointOf:function(t,e){return bt(t)&&Ct(t.node,e)},isRightEdgePointOf:function(t,e){return yt(t)&&wt(t.node,e)},prevPoint:$t,nextPoint:Tt,isSamePoint:It,isVisiblePoint:function(t){if(G(t.node)||!St(t.node)||ut(t.node))return!0;var e=t.node.childNodes[t.offset-1],o=t.node.childNodes[t.offset];return!(e&&!Y(e)||o&&!Y(o))},prevPointUntil:function(t,e){for(;t;){if(e(t))return t;t=$t(t)}return null},nextPointUntil:function(t,e){for(;t;){if(e(t))return t;t=Tt(t)}return null},isCharPoint:function(t){if(!G(t.node))return!1;var e=t.node.nodeValue.charAt(t.offset-1);return e&&" "!==e&&e!==W},walkPoint:function(t,e,o,n){for(var i=t;i&&(o(i),!It(i,e));){i=Tt(i,n&&t.node!==i.node&&e.node!==i.node)}},ancestor:pt,singleChildAncestor:function(t,e){for(t=t.parentNode;t&&1===dt(t);){if(e(t))return t;if(V(t))break;t=t.parentNode}return null},listAncestor:ft,lastAncestor:function(t,e){var o=ft(t);return j.last(o.filter(e))},listNext:mt,listPrev:function(t,e){e=e||D.fail;for(var o=[];t&&!e(t);)o.push(t),t=t.previousSibling;return o},listDescendant:function(t,e){var o=[];return e=e||D.ok,function n(i){t!==i&&e(i)&&o.push(i);for(var r=0,s=i.childNodes.length;r<s;r++)n(i.childNodes[r])}(t),o},commonAncestor:function(e,o){for(var n=ft(e),i=o;i;i=i.parentNode)if(t.inArray(i,n)>-1)return i;return null},wrap:function(e,o){var n=e.parentNode,i=t("<"+o+">")[0];return n.insertBefore(i,e),i.appendChild(e),i},insertAfter:gt,appendChildNodes:vt,position:xt,hasChildren:St,makeOffsetPath:function(t,e){return ft(e,D.eq(t)).map(xt).reverse()},fromOffsetPath:function(t,e){for(var o=t,n=0,i=e.length;n<i;n++)o=o.childNodes.length<=e[n]?o.childNodes[o.childNodes.length-1]:o.childNodes[e[n]];return o},splitTree:Et,splitPoint:function(t,e){var o,n,i=e?Z:st,r=ft(t.node,i),s=j.last(r)||t.node;i(s)?(o=r[r.length-2],n=s):n=(o=s).parentNode;var a=o&&Et(o,t,{isSkipPaddingBlankHTML:e,isNotSplitEdgePoint:e});return a||n!==t.node||(a=t.node.childNodes[t.offset]),{rightNode:a,container:n}},create:At,createText:function(t){return document.createTextNode(t)},remove:Rt,removeWhile:function(t,e){for(;t&&!V(t)&&e(t);){var o=t.parentNode;Rt(t),t=o}},replace:function(t,e){if(t.nodeName.toUpperCase()===e.toUpperCase())return t;var o=At(e);return t.style.cssText&&(o.style.cssText=t.style.cssText),vt(o,j.from(t.childNodes)),gt(o,t),Rt(t),o},html:function(e,o){var n=Lt(e);if(o){n=n.replace(/<(\/?)(\b(?!!)[^>\s]*)(.*?)(\s*\/?>)/g,(function(t,e,o){o=o.toUpperCase();var n=/^DIV|^TD|^TH|^P|^LI|^H[1-7]/.test(o)&&!!e,i=/^BLOCKQUOTE|^TABLE|^TBODY|^TR|^HR|^UL|^OL/.test(o);return t+(n||i?"\n":"")})),n=t.trim(n)}return n},value:Lt,posFromPlaceholder:function(e){var o=t(e),n=o.offset(),i=o.outerHeight(!0);return{left:n.left,top:n.top+i}},attachEvents:function(t,e){Object.keys(e).forEach((function(o){t.on(o,e[o])}))},detachEvents:function(t,e){Object.keys(e).forEach((function(o){t.off(o,e[o])}))},isCustomStyleTag:function(t){return t&&!G(t)&&j.contains(t.classList,"note-styletag")}};function Ft(t,e){var o,n,i=t.parentElement(),r=document.body.createTextRange(),s=j.from(i.childNodes);for(o=0;o<s.length;o++)if(!Ht.isText(s[o])){if(r.moveToElementText(s[o]),r.compareEndPoints("StartToStart",t)>=0)break;n=s[o]}if(0!==o&&Ht.isText(s[o-1])){var a=document.body.createTextRange(),l=null;a.moveToElementText(n||i),a.collapse(!n),l=n?n.nextSibling:i.firstChild;var c=t.duplicate();c.setEndPoint("StartToStart",a);for(var d=c.text.replace(/[\r\n]/g,"").length;d>l.nodeValue.length&&l.nextSibling;)d-=l.nodeValue.length,l=l.nextSibling;l.nodeValue;e&&l.nextSibling&&Ht.isText(l.nextSibling)&&d===l.nodeValue.length&&(d-=l.nodeValue.length,l=l.nextSibling),i=l,o=d}return{cont:i,offset:o}}function Dt(t){var e=function(t,o){var n,i;if(Ht.isText(t)){var r=Ht.listPrev(t,D.not(Ht.isText)),s=j.last(r).previousSibling;n=s||t.parentNode,o+=j.sum(j.tail(r),Ht.nodeLength),i=!s}else{if(n=t.childNodes[o]||t,Ht.isText(n))return e(n,0);o=0,i=!1}return{node:n,collapseToStart:i,offset:o}},o=document.body.createTextRange(),n=e(t.node,t.offset);return o.moveToElementText(n.node),o.collapse(n.collapseToStart),o.moveStart("character",n.offset),o}var Bt=function(){function e(t,e,o,n){this.sc=t,this.so=e,this.ec=o,this.eo=n,this.isOnEditable=this.makeIsOn(Ht.isEditable),this.isOnList=this.makeIsOn(Ht.isList),this.isOnAnchor=this.makeIsOn(Ht.isAnchor),this.isOnCell=this.makeIsOn(Ht.isCell),this.isOnData=this.makeIsOn(Ht.isData)}return e.prototype.nativeRange=function(){if(H.isW3CRangeSupport){var t=document.createRange();return t.setStart(this.sc,this.so),t.setEnd(this.ec,this.eo),t}var e=Dt({node:this.sc,offset:this.so});return e.setEndPoint("EndToEnd",Dt({node:this.ec,offset:this.eo})),e},e.prototype.getPoints=function(){return{sc:this.sc,so:this.so,ec:this.ec,eo:this.eo}},e.prototype.getStartPoint=function(){return{node:this.sc,offset:this.so}},e.prototype.getEndPoint=function(){return{node:this.ec,offset:this.eo}},e.prototype.select=function(){var t=this.nativeRange();if(H.isW3CRangeSupport){var e=document.getSelection();e.rangeCount>0&&e.removeAllRanges(),e.addRange(t)}else t.select();return this},e.prototype.scrollIntoView=function(e){var o=t(e).height();return e.scrollTop+o<this.sc.offsetTop&&(e.scrollTop+=Math.abs(e.scrollTop+o-this.sc.offsetTop)),this},e.prototype.normalize=function(){var t=function(t,e){if(Ht.isVisiblePoint(t)&&!Ht.isEdgePoint(t)||Ht.isVisiblePoint(t)&&Ht.isRightEdgePoint(t)&&!e||Ht.isVisiblePoint(t)&&Ht.isLeftEdgePoint(t)&&e||Ht.isVisiblePoint(t)&&Ht.isBlock(t.node)&&Ht.isEmpty(t.node))return t;var o=Ht.ancestor(t.node,Ht.isBlock);if((Ht.isLeftEdgePointOf(t,o)||Ht.isVoid(Ht.prevPoint(t).node))&&!e||(Ht.isRightEdgePointOf(t,o)||Ht.isVoid(Ht.nextPoint(t).node))&&e){if(Ht.isVisiblePoint(t))return t;e=!e}return(e?Ht.nextPointUntil(Ht.nextPoint(t),Ht.isVisiblePoint):Ht.prevPointUntil(Ht.prevPoint(t),Ht.isVisiblePoint))||t},o=t(this.getEndPoint(),!1),n=this.isCollapsed()?o:t(this.getStartPoint(),!0);return new e(n.node,n.offset,o.node,o.offset)},e.prototype.nodes=function(t,e){t=t||D.ok;var o=e&&e.includeAncestor,n=e&&e.fullyContains,i=this.getStartPoint(),r=this.getEndPoint(),s=[],a=[];return Ht.walkPoint(i,r,(function(e){var i;Ht.isEditable(e.node)||(n?(Ht.isLeftEdgePoint(e)&&a.push(e.node),Ht.isRightEdgePoint(e)&&j.contains(a,e.node)&&(i=e.node)):i=o?Ht.ancestor(e.node,t):e.node,i&&t(i)&&s.push(i))}),!0),j.unique(s)},e.prototype.commonAncestor=function(){return Ht.commonAncestor(this.sc,this.ec)},e.prototype.expand=function(t){var o=Ht.ancestor(this.sc,t),n=Ht.ancestor(this.ec,t);if(!o&&!n)return new e(this.sc,this.so,this.ec,this.eo);var i=this.getPoints();return o&&(i.sc=o,i.so=0),n&&(i.ec=n,i.eo=Ht.nodeLength(n)),new e(i.sc,i.so,i.ec,i.eo)},e.prototype.collapse=function(t){return t?new e(this.sc,this.so,this.sc,this.so):new e(this.ec,this.eo,this.ec,this.eo)},e.prototype.splitText=function(){var t=this.sc===this.ec,o=this.getPoints();return Ht.isText(this.ec)&&!Ht.isEdgePoint(this.getEndPoint())&&this.ec.splitText(this.eo),Ht.isText(this.sc)&&!Ht.isEdgePoint(this.getStartPoint())&&(o.sc=this.sc.splitText(this.so),o.so=0,t&&(o.ec=o.sc,o.eo=this.eo-this.so)),new e(o.sc,o.so,o.ec,o.eo)},e.prototype.deleteContents=function(){if(this.isCollapsed())return this;var o=this.splitText(),n=o.nodes(null,{fullyContains:!0}),i=Ht.prevPointUntil(o.getStartPoint(),(function(t){return!j.contains(n,t.node)})),r=[];return t.each(n,(function(t,e){var o=e.parentNode;i.node!==o&&1===Ht.nodeLength(o)&&r.push(o),Ht.remove(e,!1)})),t.each(r,(function(t,e){Ht.remove(e,!1)})),new e(i.node,i.offset,i.node,i.offset).normalize()},e.prototype.makeIsOn=function(t){return function(){var e=Ht.ancestor(this.sc,t);return!!e&&e===Ht.ancestor(this.ec,t)}},e.prototype.isLeftEdgeOf=function(t){if(!Ht.isLeftEdgePoint(this.getStartPoint()))return!1;var e=Ht.ancestor(this.sc,t);return e&&Ht.isLeftEdgeOf(this.sc,e)},e.prototype.isCollapsed=function(){return this.sc===this.ec&&this.so===this.eo},e.prototype.wrapBodyInlineWithPara=function(){if(Ht.isBodyContainer(this.sc)&&Ht.isEmpty(this.sc))return this.sc.innerHTML=Ht.emptyPara,new e(this.sc.firstChild,0,this.sc.firstChild,0);var t,o=this.normalize();if(Ht.isParaInline(this.sc)||Ht.isPara(this.sc))return o;if(Ht.isInline(o.sc)){var n=Ht.listAncestor(o.sc,D.not(Ht.isInline));t=j.last(n),Ht.isInline(t)||(t=n[n.length-2]||o.sc.childNodes[o.so])}else t=o.sc.childNodes[o.so>0?o.so-1:0];var i=Ht.listPrev(t,Ht.isParaInline).reverse();if((i=i.concat(Ht.listNext(t.nextSibling,Ht.isParaInline))).length){var r=Ht.wrap(j.head(i),"p");Ht.appendChildNodes(r,j.tail(i))}return this.normalize()},e.prototype.insertNode=function(t){var e=this.wrapBodyInlineWithPara().deleteContents(),o=Ht.splitPoint(e.getStartPoint(),Ht.isInline(t));return o.rightNode?o.rightNode.parentNode.insertBefore(t,o.rightNode):o.container.appendChild(t),t},e.prototype.pasteHTML=function(e){var o=t("<div></div>").html(e)[0],n=j.from(o.childNodes),i=this.wrapBodyInlineWithPara().deleteContents();return n.reverse().map((function(t){return i.insertNode(t)})).reverse()},e.prototype.toString=function(){var t=this.nativeRange();return H.isW3CRangeSupport?t.toString():t.text},e.prototype.getWordRange=function(t){var o=this.getEndPoint();if(!Ht.isCharPoint(o))return this;var n=Ht.prevPointUntil(o,(function(t){return!Ht.isCharPoint(t)}));return t&&(o=Ht.nextPointUntil(o,(function(t){return!Ht.isCharPoint(t)}))),new e(n.node,n.offset,o.node,o.offset)},e.prototype.bookmark=function(t){return{s:{path:Ht.makeOffsetPath(t,this.sc),offset:this.so},e:{path:Ht.makeOffsetPath(t,this.ec),offset:this.eo}}},e.prototype.paraBookmark=function(t){return{s:{path:j.tail(Ht.makeOffsetPath(j.head(t),this.sc)),offset:this.so},e:{path:j.tail(Ht.makeOffsetPath(j.last(t),this.ec)),offset:this.eo}}},e.prototype.getClientRects=function(){return this.nativeRange().getClientRects()},e}(),zt={create:function(t,e,o,n){if(4===arguments.length)return new Bt(t,e,o,n);if(2===arguments.length)return new Bt(t,e,o=t,n=e);var i=this.createFromSelection();return i||1!==arguments.length?i:(i=this.createFromNode(arguments[0])).collapse(Ht.emptyPara===arguments[0].innerHTML)},createFromSelection:function(){var t,e,o,n;if(H.isW3CRangeSupport){var i=document.getSelection();if(!i||0===i.rangeCount)return null;if(Ht.isBody(i.anchorNode))return null;var r=i.getRangeAt(0);t=r.startContainer,e=r.startOffset,o=r.endContainer,n=r.endOffset}else{var s=document.selection.createRange(),a=s.duplicate();a.collapse(!1);var l=s;l.collapse(!0);var c=Ft(l,!0),d=Ft(a,!1);Ht.isText(c.node)&&Ht.isLeftEdgePoint(c)&&Ht.isTextNode(d.node)&&Ht.isRightEdgePoint(d)&&d.node.nextSibling===c.node&&(c=d),t=c.cont,e=c.offset,o=d.cont,n=d.offset}return new Bt(t,e,o,n)},createFromNode:function(t){var e=t,o=0,n=t,i=Ht.nodeLength(n);return Ht.isVoid(e)&&(o=Ht.listPrev(e).length-1,e=e.parentNode),Ht.isBR(n)?(i=Ht.listPrev(n).length-1,n=n.parentNode):Ht.isVoid(n)&&(i=Ht.listPrev(n).length,n=n.parentNode),this.create(e,o,n,i)},createFromNodeBefore:function(t){return this.createFromNode(t).collapse(!0)},createFromNodeAfter:function(t){return this.createFromNode(t).collapse()},createFromBookmark:function(t,e){var o=Ht.fromOffsetPath(t,e.s.path),n=e.s.offset,i=Ht.fromOffsetPath(t,e.e.path),r=e.e.offset;return new Bt(o,n,i,r)},createFromParaBookmark:function(t,e){var o=t.s.offset,n=t.e.offset,i=Ht.fromOffsetPath(j.head(e),t.s.path),r=Ht.fromOffsetPath(j.last(e),t.e.path);return new Bt(i,o,r,n)}};var Mt=function(){function t(t){this.stack=[],this.stackOffset=-1,this.$editable=t,this.editable=t[0]}return t.prototype.makeSnapshot=function(){var t=zt.create(this.editable);return{contents:this.$editable.html(),bookmark:t?t.bookmark(this.editable):{s:{path:[],offset:0},e:{path:[],offset:0}}}},t.prototype.applySnapshot=function(t){null!==t.contents&&this.$editable.html(t.contents),null!==t.bookmark&&zt.createFromBookmark(this.editable,t.bookmark).select()},t.prototype.rewind=function(){this.$editable.html()!==this.stack[this.stackOffset].contents&&this.recordUndo(),this.stackOffset=0,this.applySnapshot(this.stack[this.stackOffset])},t.prototype.reset=function(){this.stack=[],this.stackOffset=-1,this.$editable.html(""),this.recordUndo()},t.prototype.undo=function(){this.$editable.html()!==this.stack[this.stackOffset].contents&&this.recordUndo(),this.stackOffset>0&&(this.stackOffset--,this.applySnapshot(this.stack[this.stackOffset]))},t.prototype.redo=function(){this.stack.length-1>this.stackOffset&&(this.stackOffset++,this.applySnapshot(this.stack[this.stackOffset]))},t.prototype.recordUndo=function(){this.stackOffset++,this.stack.length>this.stackOffset&&(this.stack=this.stack.slice(0,this.stackOffset)),this.stack.push(this.makeSnapshot())},t}(),Ot=function(){function e(){}return e.prototype.jQueryCSS=function(e,o){if(H.jqueryVersion<1.9){var n={};return t.each(o,(function(t,o){n[o]=e.css(o)})),n}return e.css(o)},e.prototype.fromNode=function(t){var e=this.jQueryCSS(t,["font-family","font-size","text-align","list-style-type","line-height"])||{};return e["font-size"]=parseInt(e["font-size"],10),e},e.prototype.stylePara=function(e,o){t.each(e.nodes(Ht.isPara,{includeAncestor:!0}),(function(e,n){t(n).css(o)}))},e.prototype.styleNodes=function(e,o){e=e.splitText();var n=o&&o.nodeName||"SPAN",i=!(!o||!o.expandClosestSibling),r=!(!o||!o.onlyPartialContains);if(e.isCollapsed())return[e.insertNode(Ht.create(n))];var s=Ht.makePredByNodeName(n),a=e.nodes(Ht.isText,{fullyContains:!0}).map((function(t){return Ht.singleChildAncestor(t,s)||Ht.wrap(t,n)}));if(i){if(r){var l=e.nodes();s=D.and(s,(function(t){return j.contains(l,t)}))}return a.map((function(e){var o=Ht.withClosestSiblings(e,s),n=j.head(o),i=j.tail(o);return t.each(i,(function(t,e){Ht.appendChildNodes(n,e.childNodes),Ht.remove(e)})),j.head(o)}))}return a},e.prototype.current=function(e){var o=t(Ht.isElement(e.sc)?e.sc:e.sc.parentNode),n=this.fromNode(o);try{n=t.extend(n,{"font-bold":document.queryCommandState("bold")?"bold":"normal","font-italic":document.queryCommandState("italic")?"italic":"normal","font-underline":document.queryCommandState("underline")?"underline":"normal","font-subscript":document.queryCommandState("subscript")?"subscript":"normal","font-superscript":document.queryCommandState("superscript")?"superscript":"normal","font-strikethrough":document.queryCommandState("strikethrough")?"strikethrough":"normal","font-family":document.queryCommandValue("fontname")||n["font-family"]})}catch(t){}if(e.isOnList()){var i=t.inArray(n["list-style-type"],["circle","disc","disc-leading-zero","square"])>-1;n["list-style"]=i?"unordered":"ordered"}else n["list-style"]="none";var r=Ht.ancestor(e.sc,Ht.isPara);if(r&&r.style["line-height"])n["line-height"]=r.style.lineHeight;else{var s=parseInt(n["line-height"],10)/parseInt(n["font-size"],10);n["line-height"]=s.toFixed(1)}return n.anchor=e.isOnAnchor()&&Ht.ancestor(e.sc,Ht.isAnchor),n.ancestors=Ht.listAncestor(e.sc,Ht.isEditable),n.range=e,n},e}(),Ut=function(){function e(){}return e.prototype.insertOrderedList=function(t){this.toggleList("OL",t)},e.prototype.insertUnorderedList=function(t){this.toggleList("UL",t)},e.prototype.indent=function(e){var o=this,n=zt.create(e).wrapBodyInlineWithPara(),i=n.nodes(Ht.isPara,{includeAncestor:!0}),r=j.clusterBy(i,D.peq2("parentNode"));t.each(r,(function(e,n){var i=j.head(n);Ht.isLi(i)?o.wrapList(n,i.parentNode.nodeName):t.each(n,(function(e,o){t(o).css("marginLeft",(function(t,e){return(parseInt(e,10)||0)+25}))}))})),n.select()},e.prototype.outdent=function(e){var o=this,n=zt.create(e).wrapBodyInlineWithPara(),i=n.nodes(Ht.isPara,{includeAncestor:!0}),r=j.clusterBy(i,D.peq2("parentNode"));t.each(r,(function(e,n){var i=j.head(n);Ht.isLi(i)?o.releaseList([n]):t.each(n,(function(e,o){t(o).css("marginLeft",(function(t,e){return(e=parseInt(e,10)||0)>25?e-25:""}))}))})),n.select()},e.prototype.toggleList=function(e,o){var n=this,i=zt.create(o).wrapBodyInlineWithPara(),r=i.nodes(Ht.isPara,{includeAncestor:!0}),s=i.paraBookmark(r),a=j.clusterBy(r,D.peq2("parentNode"));if(j.find(r,Ht.isPurePara)){var l=[];t.each(a,(function(t,o){l=l.concat(n.wrapList(o,e))})),r=l}else{var c=i.nodes(Ht.isList,{includeAncestor:!0}).filter((function(o){return!t.nodeName(o,e)}));c.length?t.each(c,(function(t,o){Ht.replace(o,e)})):r=this.releaseList(a,!0)}zt.createFromParaBookmark(s,r).select()},e.prototype.wrapList=function(t,e){var o=j.head(t),n=j.last(t),i=Ht.isList(o.previousSibling)&&o.previousSibling,r=Ht.isList(n.nextSibling)&&n.nextSibling,s=i||Ht.insertAfter(Ht.create(e||"UL"),n);return t=t.map((function(t){return Ht.isPurePara(t)?Ht.replace(t,"LI"):t})),Ht.appendChildNodes(s,t),r&&(Ht.appendChildNodes(s,j.from(r.childNodes)),Ht.remove(r)),t},e.prototype.releaseList=function(e,o){var n=[];return t.each(e,(function(e,i){var r=j.head(i),s=j.last(i),a=o?Ht.lastAncestor(r,Ht.isList):r.parentNode,l=a.childNodes.length>1?Ht.splitTree(a,{node:s.parentNode,offset:Ht.position(s)+1},{isSkipPaddingBlankHTML:!0}):null,c=Ht.splitTree(a,{node:r.parentNode,offset:Ht.position(r)},{isSkipPaddingBlankHTML:!0});i=o?Ht.listDescendant(c,Ht.isLi):j.from(c.childNodes).filter(Ht.isLi),!o&&Ht.isList(a.parentNode)||(i=i.map((function(t){return Ht.replace(t,"P")}))),t.each(j.from(i).reverse(),(function(t,e){Ht.insertAfter(e,a)}));var d=j.compact([a,c,l]);t.each(d,(function(e,o){var n=[o].concat(Ht.listDescendant(o,Ht.isList));t.each(n.reverse(),(function(t,e){Ht.nodeLength(e)||Ht.remove(e,!0)}))})),n=n.concat(i)})),n},e}(),jt=function(){function e(){this.bullet=new Ut}return e.prototype.insertTab=function(t,e){var o=Ht.createText(new Array(e+1).join(Ht.NBSP_CHAR));(t=t.deleteContents()).insertNode(o,!0),(t=zt.create(o,e)).select()},e.prototype.insertParagraph=function(e){var o=zt.create(e);o=(o=o.deleteContents()).wrapBodyInlineWithPara();var n,i=Ht.ancestor(o.sc,Ht.isPara);if(i){if(Ht.isEmpty(i)&&Ht.isLi(i))return void this.bullet.toggleList(i.parentNode.nodeName);if(Ht.isEmpty(i)&&Ht.isPara(i)&&Ht.isBlockquote(i.parentNode))Ht.insertAfter(i,i.parentNode),n=i;else{n=Ht.splitTree(i,o.getStartPoint());var r=Ht.listDescendant(i,Ht.isEmptyAnchor);r=r.concat(Ht.listDescendant(n,Ht.isEmptyAnchor)),t.each(r,(function(t,e){Ht.remove(e)})),(Ht.isHeading(n)||Ht.isPre(n)||Ht.isCustomStyleTag(n))&&Ht.isEmpty(n)&&(n=Ht.replace(n,"p"))}}else{var s=o.sc.childNodes[o.so];n=t(Ht.emptyPara)[0],s?o.sc.insertBefore(n,s):o.sc.appendChild(n)}zt.create(n,0).normalize().select().scrollIntoView(e)},e}(),Kt=function(t,e,o,n){var i={colPos:0,rowPos:0},r=[],s=[];function a(t,e,o,n,i,s,a){var l={baseRow:o,baseCell:n,isRowSpan:i,isColSpan:s,isVirtual:a};r[t]||(r[t]=[]),r[t][e]=l}function l(t,e,o,n){return{baseCell:t.baseCell,action:e,virtualTable:{rowIndex:o,cellIndex:n}}}function c(t,e){if(!r[t])return e;if(!r[t][e])return e;for(var o=e;r[t][o];)if(o++,!r[t][o])return o}function d(t,e){var o=c(t.rowIndex,e.cellIndex),n=e.colSpan>1,r=e.rowSpan>1,s=t.rowIndex===i.rowPos&&e.cellIndex===i.colPos;a(t.rowIndex,o,t,e,r,n,!1);var l=e.attributes.rowSpan?parseInt(e.attributes.rowSpan.value,10):0;if(l>1)for(var d=1;d<l;d++){var h=t.rowIndex+d;u(h,o,e,s),a(h,o,t,e,!0,n,!0)}var p=e.attributes.colSpan?parseInt(e.attributes.colSpan.value,10):0;if(p>1)for(var f=1;f<p;f++){var m=c(t.rowIndex,o+f);u(t.rowIndex,m,e,s),a(t.rowIndex,m,t,e,r,!0,!0)}}function u(t,e,o,n){t===i.rowPos&&i.colPos>=o.cellIndex&&o.cellIndex<=e&&!n&&i.colPos++}function h(t){switch(e){case Kt.where.Column:if(t.isColSpan)return Kt.resultAction.SubtractSpanCount;break;case Kt.where.Row:if(!t.isVirtual&&t.isRowSpan)return Kt.resultAction.AddCell;if(t.isRowSpan)return Kt.resultAction.SubtractSpanCount}return Kt.resultAction.RemoveCell}function p(t){switch(e){case Kt.where.Column:if(t.isColSpan)return Kt.resultAction.SumSpanCount;if(t.isRowSpan&&t.isVirtual)return Kt.resultAction.Ignore;break;case Kt.where.Row:if(t.isRowSpan)return Kt.resultAction.SumSpanCount;if(t.isColSpan&&t.isVirtual)return Kt.resultAction.Ignore}return Kt.resultAction.AddCell}this.getActionList=function(){for(var t=e===Kt.where.Row?i.rowPos:-1,n=e===Kt.where.Column?i.colPos:-1,a=0,c=!0;c;){var d=t>=0?t:a,u=n>=0?n:a,f=r[d];if(!f)return c=!1,s;var m=f[u];if(!m)return c=!1,s;var g=Kt.resultAction.Ignore;switch(o){case Kt.requestAction.Add:g=p(m);break;case Kt.requestAction.Delete:g=h(m)}s.push(l(m,g,d,u)),a++}return s},t&&t.tagName&&("td"===t.tagName.toLowerCase()||"th"===t.tagName.toLowerCase())?(i.colPos=t.cellIndex,t.parentElement&&t.parentElement.tagName&&"tr"===t.parentElement.tagName.toLowerCase()?i.rowPos=t.parentElement.rowIndex:console.error("Impossible to identify start Row point.",t)):console.error("Impossible to identify start Cell point.",t),function(){for(var t=n.rows,e=0;e<t.length;e++)for(var o=t[e].cells,i=0;i<o.length;i++)d(t[e],o[i])}()};Kt.where={Row:0,Column:1},Kt.requestAction={Add:0,Delete:1},Kt.resultAction={Ignore:0,SubtractSpanCount:1,RemoveCell:2,AddCell:3,SumSpanCount:4};var qt,Wt=function(){function e(){}return e.prototype.tab=function(t,e){var o=Ht.ancestor(t.commonAncestor(),Ht.isCell),n=Ht.ancestor(o,Ht.isTable),i=Ht.listDescendant(n,Ht.isCell),r=j[e?"prev":"next"](i,o);r&&zt.create(r,0).select()},e.prototype.addRow=function(e,o){for(var n=Ht.ancestor(e.commonAncestor(),Ht.isCell),i=t(n).closest("tr"),r=this.recoverAttributes(i),s=t("<tr"+r+"></tr>"),a=new Kt(n,Kt.where.Row,Kt.requestAction.Add,t(i).closest("table")[0]).getActionList(),l=0;l<a.length;l++){var c=a[l],d=this.recoverAttributes(c.baseCell);switch(c.action){case Kt.resultAction.AddCell:s.append("<td"+d+">"+Ht.blank+"</td>");break;case Kt.resultAction.SumSpanCount:if("top"===o)if((c.baseCell.parent?c.baseCell.closest("tr").rowIndex:0)<=i[0].rowIndex){var u=t("<div></div>").append(t("<td"+d+">"+Ht.blank+"</td>").removeAttr("rowspan")).html();s.append(u);break}var h=parseInt(c.baseCell.rowSpan,10);h++,c.baseCell.setAttribute("rowSpan",h)}}if("top"===o)i.before(s);else{if(n.rowSpan>1){var p=i[0].rowIndex+(n.rowSpan-2);return void t(t(i).parent().find("tr")[p]).after(t(s))}i.after(s)}},e.prototype.addCol=function(e,o){var n=Ht.ancestor(e.commonAncestor(),Ht.isCell),i=t(n).closest("tr");t(i).siblings().push(i);for(var r=new Kt(n,Kt.where.Column,Kt.requestAction.Add,t(i).closest("table")[0]).getActionList(),s=0;s<r.length;s++){var a=r[s],l=this.recoverAttributes(a.baseCell);switch(a.action){case Kt.resultAction.AddCell:"right"===o?t(a.baseCell).after("<td"+l+">"+Ht.blank+"</td>"):t(a.baseCell).before("<td"+l+">"+Ht.blank+"</td>");break;case Kt.resultAction.SumSpanCount:if("right"===o){var c=parseInt(a.baseCell.colSpan,10);c++,a.baseCell.setAttribute("colSpan",c)}else t(a.baseCell).before("<td"+l+">"+Ht.blank+"</td>")}}},e.prototype.recoverAttributes=function(t){var e="";if(!t)return e;for(var o=t.attributes||[],n=0;n<o.length;n++)"id"!==o[n].name.toLowerCase()&&o[n].specified&&(e+=" "+o[n].name+"='"+o[n].value+"'");return e},e.prototype.deleteRow=function(e){for(var o=Ht.ancestor(e.commonAncestor(),Ht.isCell),n=t(o).closest("tr"),i=n.children("td, th").index(t(o)),r=n[0].rowIndex,s=new Kt(o,Kt.where.Row,Kt.requestAction.Delete,t(n).closest("table")[0]).getActionList(),a=0;a<s.length;a++)if(s[a]){var l=s[a].baseCell,c=s[a].virtualTable,d=l.rowSpan&&l.rowSpan>1,u=d?parseInt(l.rowSpan,10):0;switch(s[a].action){case Kt.resultAction.Ignore:continue;case Kt.resultAction.AddCell:var h=n.next("tr")[0];if(!h)continue;var p=n[0].cells[i];d&&(u>2?(u--,h.insertBefore(p,h.cells[i]),h.cells[i].setAttribute("rowSpan",u),h.cells[i].innerHTML=""):2===u&&(h.insertBefore(p,h.cells[i]),h.cells[i].removeAttribute("rowSpan"),h.cells[i].innerHTML=""));continue;case Kt.resultAction.SubtractSpanCount:d&&(u>2?(u--,l.setAttribute("rowSpan",u),c.rowIndex!==r&&l.cellIndex===i&&(l.innerHTML="")):2===u&&(l.removeAttribute("rowSpan"),c.rowIndex!==r&&l.cellIndex===i&&(l.innerHTML="")));continue;case Kt.resultAction.RemoveCell:continue}}n.remove()},e.prototype.deleteCol=function(e){for(var o=Ht.ancestor(e.commonAncestor(),Ht.isCell),n=t(o).closest("tr"),i=n.children("td, th").index(t(o)),r=new Kt(o,Kt.where.Column,Kt.requestAction.Delete,t(n).closest("table")[0]).getActionList(),s=0;s<r.length;s++)if(r[s])switch(r[s].action){case Kt.resultAction.Ignore:continue;case Kt.resultAction.SubtractSpanCount:var a=r[s].baseCell;if(a.colSpan&&a.colSpan>1){var l=a.colSpan?parseInt(a.colSpan,10):0;l>2?(l--,a.setAttribute("colSpan",l),a.cellIndex===i&&(a.innerHTML="")):2===l&&(a.removeAttribute("colSpan"),a.cellIndex===i&&(a.innerHTML=""))}continue;case Kt.resultAction.RemoveCell:Ht.remove(r[s].baseCell,!0);continue}},e.prototype.createTable=function(e,o,n){for(var i,r=[],s=0;s<e;s++)r.push("<td>"+Ht.blank+"</td>");i=r.join("");for(var a,l=[],c=0;c<o;c++)l.push("<tr>"+i+"</tr>");a=l.join("");var d=t("<table>"+a+"</table>");return n&&n.tableClassName&&d.addClass(n.tableClassName),d[0]},e.prototype.deleteTable=function(e){var o=Ht.ancestor(e.commonAncestor(),Ht.isCell);t(o).closest("table").remove()},e}(),Vt=function(){function e(e){var o=this;this.context=e,this.$note=e.layoutInfo.note,this.$editor=e.layoutInfo.editor,this.$editable=e.layoutInfo.editable,this.options=e.options,this.lang=this.options.langInfo,this.editable=this.$editable[0],this.lastRange=null,this.style=new Ot,this.table=new Wt,this.typing=new jt,this.bullet=new Ut,this.history=new Mt(this.$editable),this.context.memo("help.undo",this.lang.help.undo),this.context.memo("help.redo",this.lang.help.redo),this.context.memo("help.tab",this.lang.help.tab),this.context.memo("help.untab",this.lang.help.untab),this.context.memo("help.insertParagraph",this.lang.help.insertParagraph),this.context.memo("help.insertOrderedList",this.lang.help.insertOrderedList),this.context.memo("help.insertUnorderedList",this.lang.help.insertUnorderedList),this.context.memo("help.indent",this.lang.help.indent),this.context.memo("help.outdent",this.lang.help.outdent),this.context.memo("help.formatPara",this.lang.help.formatPara),this.context.memo("help.insertHorizontalRule",this.lang.help.insertHorizontalRule),this.context.memo("help.fontName",this.lang.help.fontName);for(var n=["bold","italic","underline","strikethrough","superscript","subscript","justifyLeft","justifyCenter","justifyRight","justifyFull","formatBlock","removeFormat","backColor"],i=0,r=n.length;i<r;i++)this[n[i]]=function(t){return function(e){o.beforeCommand(),document.execCommand(t,!1,e),o.afterCommand(!0)}}(n[i]),this.context.memo("help."+n[i],this.lang.help[n[i]]);this.fontName=this.wrapCommand((function(t){return o.fontStyling("font-family","'"+t+"'")})),this.fontSize=this.wrapCommand((function(t){return o.fontStyling("font-size",t+"px")}));for(i=1;i<=6;i++)this["formatH"+i]=function(t){return function(){o.formatBlock("H"+t)}}(i),this.context.memo("help.formatH"+i,this.lang.help["formatH"+i]);this.insertParagraph=this.wrapCommand((function(){o.typing.insertParagraph(o.editable)})),this.insertOrderedList=this.wrapCommand((function(){o.bullet.insertOrderedList(o.editable)})),this.insertUnorderedList=this.wrapCommand((function(){o.bullet.insertUnorderedList(o.editable)})),this.indent=this.wrapCommand((function(){o.bullet.indent(o.editable)})),this.outdent=this.wrapCommand((function(){o.bullet.outdent(o.editable)})),this.insertNode=this.wrapCommand((function(e){o.isLimited(t(e).text().length)||(o.createRange().insertNode(e),zt.createFromNodeAfter(e).select())})),this.insertText=this.wrapCommand((function(t){if(!o.isLimited(t.length)){var e=o.createRange().insertNode(Ht.createText(t));zt.create(e,Ht.nodeLength(e)).select()}})),this.pasteHTML=this.wrapCommand((function(t){if(!o.isLimited(t.length)){var e=o.createRange().pasteHTML(t);zt.createFromNodeAfter(j.last(e)).select()}})),this.formatBlock=this.wrapCommand((function(t,e){var n=o.options.callbacks.onApplyCustomStyle;n?n.call(o,e,o.context,o.onFormatBlock):o.onFormatBlock(t,e)})),this.insertHorizontalRule=this.wrapCommand((function(){var t=o.createRange().insertNode(Ht.create("HR"));t.nextSibling&&zt.create(t.nextSibling,0).normalize().select()})),this.lineHeight=this.wrapCommand((function(t){o.style.stylePara(o.createRange(),{lineHeight:t})})),this.createLink=this.wrapCommand((function(e){var n=e.url,i=e.text,r=e.isNewWindow,s=e.range||o.createRange(),a=s.toString()!==i;"string"==typeof n&&(n=n.trim()),n=o.options.onCreateLink?o.options.onCreateLink(n):/^[A-Za-z][A-Za-z0-9+-.]*\:[\/\/]?/.test(n)?n:"http://"+n;var l=[];if(a){var c=(s=s.deleteContents()).insertNode(t("<A>"+i+"</A>")[0]);l.push(c)}else l=o.style.styleNodes(s,{nodeName:"A",expandClosestSibling:!0,onlyPartialContains:!0});t.each(l,(function(e,o){t(o).attr("href",n),r?t(o).attr("target","_blank"):t(o).removeAttr("target")}));var d=zt.createFromNodeBefore(j.head(l)).getStartPoint(),u=zt.createFromNodeAfter(j.last(l)).getEndPoint();zt.create(d.node,d.offset,u.node,u.offset).select()})),this.color=this.wrapCommand((function(t){var e=t.foreColor,o=t.backColor;e&&document.execCommand("foreColor",!1,e),o&&document.execCommand("backColor",!1,o)})),this.foreColor=this.wrapCommand((function(t){document.execCommand("styleWithCSS",!1,!0),document.execCommand("foreColor",!1,t)})),this.insertTable=this.wrapCommand((function(t){var e=t.split("x");o.createRange().deleteContents().insertNode(o.table.createTable(e[0],e[1],o.options))})),this.removeMedia=this.wrapCommand((function(){var e=t(o.restoreTarget()).parent();e.parent("figure").length?e.parent("figure").remove():e=t(o.restoreTarget()).detach(),o.context.triggerEvent("media.delete",e,o.$editable)})),this.floatMe=this.wrapCommand((function(e){var n=t(o.restoreTarget());n.toggleClass("note-float-left","left"===e),n.toggleClass("note-float-right","right"===e),n.css("float",e)})),this.resize=this.wrapCommand((function(e){t(o.restoreTarget()).css({width:100*e+"%",height:""})}))}return e.prototype.initialize=function(){var t=this;this.$editable.on("keydown",(function(e){if(e.keyCode===q.code.ENTER&&t.context.triggerEvent("enter",e),t.context.triggerEvent("keydown",e),e.isDefaultPrevented()||(t.options.shortcuts?t.handleKeyMap(e):t.preventDefaultEditableShortCuts(e)),t.isLimited(1,e))return!1})).on("keyup",(function(e){t.context.triggerEvent("keyup",e)})).on("focus",(function(e){t.context.triggerEvent("focus",e)})).on("blur",(function(e){t.context.triggerEvent("blur",e)})).on("mousedown",(function(e){t.context.triggerEvent("mousedown",e)})).on("mouseup",(function(e){t.context.triggerEvent("mouseup",e)})).on("scroll",(function(e){t.context.triggerEvent("scroll",e)})).on("paste",(function(e){t.context.triggerEvent("paste",e)})),this.$editable.html(Ht.html(this.$note)||Ht.emptyPara),this.$editable.on(H.inputEventName,D.debounce((function(){t.context.triggerEvent("change",t.$editable.html())}),100)),this.$editor.on("focusin",(function(e){t.context.triggerEvent("focusin",e)})).on("focusout",(function(e){t.context.triggerEvent("focusout",e)})),this.options.airMode||(this.options.width&&this.$editor.outerWidth(this.options.width),this.options.height&&this.$editable.outerHeight(this.options.height),this.options.maxHeight&&this.$editable.css("max-height",this.options.maxHeight),this.options.minHeight&&this.$editable.css("min-height",this.options.minHeight)),this.history.recordUndo()},e.prototype.destroy=function(){this.$editable.off()},e.prototype.handleKeyMap=function(t){var e=this.options.keyMap[H.isMac?"mac":"pc"],o=[];t.metaKey&&o.push("CMD"),t.ctrlKey&&!t.altKey&&o.push("CTRL"),t.shiftKey&&o.push("SHIFT");var n=q.nameFromCode[t.keyCode];n&&o.push(n);var i=e[o.join("+")];i?!1!==this.context.invoke(i)&&t.preventDefault():q.isEdit(t.keyCode)&&this.afterCommand()},e.prototype.preventDefaultEditableShortCuts=function(t){(t.ctrlKey||t.metaKey)&&j.contains([66,73,85],t.keyCode)&&t.preventDefault()},e.prototype.isLimited=function(t,e){return t=t||0,(void 0===e||!(q.isMove(e.keyCode)||e.ctrlKey||e.metaKey||j.contains([q.code.BACKSPACE,q.code.DELETE],e.keyCode)))&&(this.options.maxTextLength>0&&this.$editable.text().length+t>=this.options.maxTextLength)},e.prototype.createRange=function(){return this.focus(),zt.create(this.editable)},e.prototype.saveRange=function(t){this.lastRange=this.createRange(),t&&this.lastRange.collapse().select()},e.prototype.restoreRange=function(){this.lastRange&&(this.lastRange.select(),this.focus())},e.prototype.saveTarget=function(t){this.$editable.data("target",t)},e.prototype.clearTarget=function(){this.$editable.removeData("target")},e.prototype.restoreTarget=function(){return this.$editable.data("target")},e.prototype.currentStyle=function(){var t=zt.create();return t&&(t=t.normalize()),t?this.style.current(t):this.style.fromNode(this.$editable)},e.prototype.styleFromNode=function(t){return this.style.fromNode(t)},e.prototype.undo=function(){this.context.triggerEvent("before.command",this.$editable.html()),this.history.undo(),this.context.triggerEvent("change",this.$editable.html())},e.prototype.redo=function(){this.context.triggerEvent("before.command",this.$editable.html()),this.history.redo(),this.context.triggerEvent("change",this.$editable.html())},e.prototype.beforeCommand=function(){this.context.triggerEvent("before.command",this.$editable.html()),this.focus()},e.prototype.afterCommand=function(t){this.normalizeContent(),this.history.recordUndo(),t||this.context.triggerEvent("change",this.$editable.html())},e.prototype.tab=function(){var t=this.createRange();if(t.isCollapsed()&&t.isOnCell())this.table.tab(t);else{if(0===this.options.tabSize)return!1;this.isLimited(this.options.tabSize)||(this.beforeCommand(),this.typing.insertTab(t,this.options.tabSize),this.afterCommand())}},e.prototype.untab=function(){var t=this.createRange();if(t.isCollapsed()&&t.isOnCell())this.table.tab(t,!0);else if(0===this.options.tabSize)return!1},e.prototype.wrapCommand=function(t){var e=this;return function(){e.beforeCommand(),t.apply(e,arguments),e.afterCommand()}},e.prototype.insertImage=function(e,o){var n,i=this;return(n=e,t.Deferred((function(e){var o=t("<img>");o.one("load",(function(){o.off("error abort"),e.resolve(o)})).one("error abort",(function(){o.off("load").detach(),e.reject(o)})).css({display:"none"}).appendTo(document.body).attr("src",n)})).promise()).then((function(t){i.beforeCommand(),"function"==typeof o?o(t):("string"==typeof o&&t.attr("data-filename",o),t.css("width",Math.min(i.$editable.width(),t.width()))),t.show(),zt.create(i.editable).insertNode(t[0]),zt.createFromNodeAfter(t[0]).select(),i.afterCommand()})).fail((function(t){i.context.triggerEvent("image.upload.error",t)}))},e.prototype.insertImages=function(e){var o=this;t.each(e,(function(e,n){var i=n.name;o.options.maximumImageFileSize&&o.options.maximumImageFileSize<n.size?o.context.triggerEvent("image.upload.error",o.lang.image.maximumFileSizeError):function(e){return t.Deferred((function(o){t.extend(new FileReader,{onload:function(t){var e=t.target.result;o.resolve(e)},onerror:function(t){o.reject(t)}}).readAsDataURL(e)})).promise()}(n).then((function(t){return o.insertImage(t,i)})).fail((function(){o.context.triggerEvent("image.upload.error")}))}))},e.prototype.insertImagesOrCallback=function(t){this.options.callbacks.onImageUpload?this.context.triggerEvent("image.upload",t):this.insertImages(t)},e.prototype.getSelectedText=function(){var t=this.createRange();return t.isOnAnchor()&&(t=zt.createFromNode(Ht.ancestor(t.sc,Ht.isAnchor))),t.toString()},e.prototype.onFormatBlock=function(e,o){if(e=H.isMSIE?"<"+e+">":e,document.execCommand("FormatBlock",!1,e),o&&o.length){var n=o[0].className||"";if(n){var i=this.createRange();t([i.sc,i.ec]).closest(e).addClass(n)}}},e.prototype.formatPara=function(){this.formatBlock("P")},e.prototype.fontStyling=function(e,o){var n=this.createRange();if(n){var i=this.style.styleNodes(n);if(t(i).css(e,o),n.isCollapsed()){var r=j.head(i);r&&!Ht.nodeLength(r)&&(r.innerHTML=Ht.ZERO_WIDTH_NBSP_CHAR,zt.createFromNodeAfter(r.firstChild).select(),this.$editable.data("bogus",r))}}},e.prototype.unlink=function(){var t=this.createRange();if(t.isOnAnchor()){var e=Ht.ancestor(t.sc,Ht.isAnchor);(t=zt.createFromNode(e)).select(),this.beforeCommand(),document.execCommand("unlink"),this.afterCommand()}},e.prototype.getLinkInfo=function(){var e=this.createRange().expand(Ht.isAnchor),o=t(j.head(e.nodes(Ht.isAnchor))),n={range:e,text:e.toString(),url:o.length?o.attr("href"):""};return o.length&&(n.isNewWindow="_blank"===o.attr("target")),n},e.prototype.addRow=function(t){var e=this.createRange(this.$editable);e.isCollapsed()&&e.isOnCell()&&(this.beforeCommand(),this.table.addRow(e,t),this.afterCommand())},e.prototype.addCol=function(t){var e=this.createRange(this.$editable);e.isCollapsed()&&e.isOnCell()&&(this.beforeCommand(),this.table.addCol(e,t),this.afterCommand())},e.prototype.deleteRow=function(){var t=this.createRange(this.$editable);t.isCollapsed()&&t.isOnCell()&&(this.beforeCommand(),this.table.deleteRow(t),this.afterCommand())},e.prototype.deleteCol=function(){var t=this.createRange(this.$editable);t.isCollapsed()&&t.isOnCell()&&(this.beforeCommand(),this.table.deleteCol(t),this.afterCommand())},e.prototype.deleteTable=function(){var t=this.createRange(this.$editable);t.isCollapsed()&&t.isOnCell()&&(this.beforeCommand(),this.table.deleteTable(t),this.afterCommand())},e.prototype.resizeTo=function(t,e,o){var n;if(o){var i=t.y/t.x,r=e.data("ratio");n={width:r>i?t.x:t.y/r,height:r>i?t.x*r:t.y}}else n={width:t.x,height:t.y};e.css(n)},e.prototype.hasFocus=function(){return this.$editable.is(":focus")},e.prototype.focus=function(){this.hasFocus()||this.$editable.focus()},e.prototype.isEmpty=function(){return Ht.isEmpty(this.$editable[0])||Ht.emptyPara===this.$editable.html()},e.prototype.empty=function(){this.context.invoke("code",Ht.emptyPara)},e.prototype.normalizeContent=function(){this.$editable[0].normalize()},e}(),_t=function(){function t(t){this.context=t,this.$editable=t.layoutInfo.editable}return t.prototype.initialize=function(){this.$editable.on("paste",this.pasteByEvent.bind(this))},t.prototype.pasteByEvent=function(t){var e=t.originalEvent.clipboardData;if(e&&e.items&&e.items.length){var o=j.head(e.items);"file"===o.kind&&-1!==o.type.indexOf("image/")&&this.context.invoke("editor.insertImagesOrCallback",[o.getAsFile()]),this.context.invoke("editor.afterCommand")}},t}(),Gt=function(){function e(e){this.context=e,this.$eventListener=t(document),this.$editor=e.layoutInfo.editor,this.$editable=e.layoutInfo.editable,this.options=e.options,this.lang=this.options.langInfo,this.documentEventHandlers={},this.$dropzone=t(['<div class="note-dropzone">',' <div class="note-dropzone-message"/>',"</div>"].join("")).prependTo(this.$editor)}return e.prototype.initialize=function(){this.options.disableDragAndDrop?(this.documentEventHandlers.onDrop=function(t){t.preventDefault()},this.$eventListener=this.$dropzone,this.$eventListener.on("drop",this.documentEventHandlers.onDrop)):this.attachDragAndDropEvent()},e.prototype.attachDragAndDropEvent=function(){var e=this,o=t(),n=this.$dropzone.find(".note-dropzone-message");this.documentEventHandlers.onDragenter=function(t){var i=e.context.invoke("codeview.isActivated"),r=e.$editor.width()>0&&e.$editor.height()>0;i||o.length||!r||(e.$editor.addClass("dragover"),e.$dropzone.width(e.$editor.width()),e.$dropzone.height(e.$editor.height()),n.text(e.lang.image.dragImageHere)),o=o.add(t.target)},this.documentEventHandlers.onDragleave=function(t){(o=o.not(t.target)).length||e.$editor.removeClass("dragover")},this.documentEventHandlers.onDrop=function(){o=t(),e.$editor.removeClass("dragover")},this.$eventListener.on("dragenter",this.documentEventHandlers.onDragenter).on("dragleave",this.documentEventHandlers.onDragleave).on("drop",this.documentEventHandlers.onDrop),this.$dropzone.on("dragenter",(function(){e.$dropzone.addClass("hover"),n.text(e.lang.image.dropImage)})).on("dragleave",(function(){e.$dropzone.removeClass("hover"),n.text(e.lang.image.dragImageHere)})),this.$dropzone.on("drop",(function(o){var n=o.originalEvent.dataTransfer;o.preventDefault(),n&&n.files&&n.files.length?(e.$editable.focus(),e.context.invoke("editor.insertImagesOrCallback",n.files)):t.each(n.types,(function(o,i){var r=n.getData(i);i.toLowerCase().indexOf("text")>-1?e.context.invoke("editor.pasteHTML",r):t(r).each((function(t,o){e.context.invoke("editor.insertNode",o)}))}))})).on("dragover",!1)},e.prototype.destroy=function(){var t=this;Object.keys(this.documentEventHandlers).forEach((function(e){t.$eventListener.off(e.substr(2).toLowerCase(),t.documentEventHandlers[e])})),this.documentEventHandlers={}},e}();H.hasCodeMirror&&(H.isSupportAmd?require(["codemirror"],(function(t){qt=t})):qt=window.CodeMirror);var Yt=function(){function t(t){this.context=t,this.$editor=t.layoutInfo.editor,this.$editable=t.layoutInfo.editable,this.$codable=t.layoutInfo.codable,this.options=t.options}return t.prototype.sync=function(){this.isActivated()&&H.hasCodeMirror&&this.$codable.data("cmEditor").save()},t.prototype.isActivated=function(){return this.$editor.hasClass("codeview")},t.prototype.toggle=function(){this.isActivated()?this.deactivate():this.activate(),this.context.triggerEvent("codeview.toggled")},t.prototype.activate=function(){var t=this;if(this.$codable.val(Ht.html(this.$editable,this.options.prettifyHtml)),this.$codable.height(this.$editable.height()),this.context.invoke("toolbar.updateCodeview",!0),this.$editor.addClass("codeview"),this.$codable.focus(),H.hasCodeMirror){var e=qt.fromTextArea(this.$codable[0],this.options.codemirror);if(this.options.codemirror.tern){var o=new qt.TernServer(this.options.codemirror.tern);e.ternServer=o,e.on("cursorActivity",(function(t){o.updateArgHints(t)}))}e.on("blur",(function(o){t.context.triggerEvent("blur.codeview",e.getValue(),o)})),e.setSize(null,this.$editable.outerHeight()),this.$codable.data("cmEditor",e)}else this.$codable.on("blur",(function(e){t.context.triggerEvent("blur.codeview",t.$codable.val(),e)}))},t.prototype.deactivate=function(){if(H.hasCodeMirror){var t=this.$codable.data("cmEditor");this.$codable.val(t.getValue()),t.toTextArea()}var e=Ht.value(this.$codable,this.options.prettifyHtml)||Ht.emptyPara,o=this.$editable.html()!==e;this.$editable.html(e),this.$editable.height(this.options.height?this.$codable.height():"auto"),this.$editor.removeClass("codeview"),o&&this.context.triggerEvent("change",this.$editable.html(),this.$editable),this.$editable.focus(),this.context.invoke("toolbar.updateCodeview",!1)},t.prototype.destroy=function(){this.isActivated()&&this.deactivate()},t}(),Zt=function(){function e(e){this.$document=t(document),this.$statusbar=e.layoutInfo.statusbar,this.$editable=e.layoutInfo.editable,this.options=e.options}return e.prototype.initialize=function(){var t=this;this.options.airMode||this.options.disableResizeEditor?this.destroy():this.$statusbar.on("mousedown",(function(e){e.preventDefault(),e.stopPropagation();var o=t.$editable.offset().top-t.$document.scrollTop(),n=function(e){var n=e.clientY-(o+24);n=t.options.minheight>0?Math.max(n,t.options.minheight):n,n=t.options.maxHeight>0?Math.min(n,t.options.maxHeight):n,t.$editable.height(n)};t.$document.on("mousemove",n).one("mouseup",(function(){t.$document.off("mousemove",n)}))}))},e.prototype.destroy=function(){this.$statusbar.off(),this.$statusbar.addClass("locked")},e}(),Qt=function(){function e(e){var o=this;this.context=e,this.$editor=e.layoutInfo.editor,this.$toolbar=e.layoutInfo.toolbar,this.$editable=e.layoutInfo.editable,this.$codable=e.layoutInfo.codable,this.$window=t(window),this.$scrollbar=t("html, body"),this.onResize=function(){o.resizeTo({h:o.$window.height()-o.$toolbar.outerHeight()})}}return e.prototype.resizeTo=function(t){this.$editable.css("height",t.h),this.$codable.css("height",t.h),this.$codable.data("cmeditor")&&this.$codable.data("cmeditor").setsize(null,t.h)},e.prototype.toggle=function(){this.$editor.toggleClass("fullscreen"),this.isFullscreen()?(this.$editable.data("orgHeight",this.$editable.css("height")),this.$window.on("resize",this.onResize).trigger("resize"),this.$scrollbar.css("overflow","hidden")):(this.$window.off("resize",this.onResize),this.resizeTo({h:this.$editable.data("orgHeight")}),this.$scrollbar.css("overflow","visible")),this.context.invoke("toolbar.updateFullscreen",this.isFullscreen())},e.prototype.isFullscreen=function(){return this.$editor.hasClass("fullscreen")},e}(),Xt=function(){function e(e){var o=this;this.context=e,this.$document=t(document),this.$editingArea=e.layoutInfo.editingArea,this.options=e.options,this.lang=this.options.langInfo,this.events={"summernote.mousedown":function(t,e){o.update(e.target)&&e.preventDefault()},"summernote.keyup summernote.scroll summernote.change summernote.dialog.shown":function(){o.update()},"summernote.disable":function(){o.hide()},"summernote.codeview.toggled":function(){o.update()}}}return e.prototype.initialize=function(){var e=this;this.$handle=t(['<div class="note-handle">','<div class="note-control-selection">','<div class="note-control-selection-bg"></div>','<div class="note-control-holder note-control-nw"></div>','<div class="note-control-holder note-control-ne"></div>','<div class="note-control-holder note-control-sw"></div>','<div class="',this.options.disableResizeImage?"note-control-holder":"note-control-sizing",' note-control-se"></div>',this.options.disableResizeImage?"":'<div class="note-control-selection-info"></div>',"</div>","</div>"].join("")).prependTo(this.$editingArea),this.$handle.on("mousedown",(function(t){if(Ht.isControlSizing(t.target)){t.preventDefault(),t.stopPropagation();var o=e.$handle.find(".note-control-selection").data("target"),n=o.offset(),i=e.$document.scrollTop(),r=function(t){e.context.invoke("editor.resizeTo",{x:t.clientX-n.left,y:t.clientY-(n.top-i)},o,!t.shiftKey),e.update(o[0])};e.$document.on("mousemove",r).one("mouseup",(function(t){t.preventDefault(),e.$document.off("mousemove",r),e.context.invoke("editor.afterCommand")})),o.data("ratio")||o.data("ratio",o.height()/o.width())}})),this.$handle.on("wheel",(function(t){t.preventDefault(),e.update()}))},e.prototype.destroy=function(){this.$handle.remove()},e.prototype.update=function(e){if(this.context.isDisabled())return!1;var o=Ht.isImg(e),n=this.$handle.find(".note-control-selection");if(this.context.invoke("imagePopover.update",e),o){var i=t(e),r=i.position(),s={left:r.left+parseInt(i.css("marginLeft"),10),top:r.top+parseInt(i.css("marginTop"),10)},a={w:i.outerWidth(!1),h:i.outerHeight(!1)};n.css({display:"block",left:s.left,top:s.top,width:a.w,height:a.h}).data("target",i);var l=new Image;l.src=i.attr("src");var c=a.w+"x"+a.h+" ("+this.lang.image.original+": "+l.width+"x"+l.height+")";n.find(".note-control-selection-info").text(c),this.context.invoke("editor.saveTarget",e)}else this.hide();return o},e.prototype.hide=function(){this.context.invoke("editor.clearTarget"),this.$handle.children().hide()},e}(),Jt=/^([A-Za-z][A-Za-z0-9+-.]*\:[\/\/]?|mailto:[A-Z0-9._%+-]+@)?(www\.)?(.+)$/i,te=function(){function e(t){var e=this;this.context=t,this.events={"summernote.keyup":function(t,o){o.isDefaultPrevented()||e.handleKeyup(o)},"summernote.keydown":function(t,o){e.handleKeydown(o)}}}return e.prototype.initialize=function(){this.lastWordRange=null},e.prototype.destroy=function(){this.lastWordRange=null},e.prototype.replace=function(){if(this.lastWordRange){var e=this.lastWordRange.toString(),o=e.match(Jt);if(o&&(o[1]||o[2])){var n=o[1]?e:"http://"+e,i=t("<a />").html(e).attr("href",n)[0];this.lastWordRange.insertNode(i),this.lastWordRange=null,this.context.invoke("editor.focus")}}},e.prototype.handleKeydown=function(t){if(j.contains([q.code.ENTER,q.code.SPACE],t.keyCode)){var e=this.context.invoke("editor.createRange").getWordRange();this.lastWordRange=e}},e.prototype.handleKeyup=function(t){j.contains([q.code.ENTER,q.code.SPACE],t.keyCode)&&this.replace()},e}(),ee=function(){function t(t){var e=this;this.$note=t.layoutInfo.note,this.events={"summernote.change":function(){e.$note.val(t.invoke("code"))}}}return t.prototype.shouldInitialize=function(){return Ht.isTextarea(this.$note[0])},t}(),oe=function(){function e(t){var e=this;this.context=t,this.$editingArea=t.layoutInfo.editingArea,this.options=t.options,this.events={"summernote.init summernote.change":function(){e.update()},"summernote.codeview.toggled":function(){e.update()}}}return e.prototype.shouldInitialize=function(){return!!this.options.placeholder},e.prototype.initialize=function(){var e=this;this.$placeholder=t('<div class="note-placeholder">'),this.$placeholder.on("click",(function(){e.context.invoke("focus")})).text(this.options.placeholder).prependTo(this.$editingArea),this.update()},e.prototype.destroy=function(){this.$placeholder.remove()},e.prototype.update=function(){var t=!this.context.invoke("codeview.isActivated")&&this.context.invoke("editor.isEmpty");this.$placeholder.toggle(t)},e}(),ne=function(){function e(e){this.ui=t.summernote.ui,this.context=e,this.$toolbar=e.layoutInfo.toolbar,this.options=e.options,this.lang=this.options.langInfo,this.invertedKeyMap=D.invertObject(this.options.keyMap[H.isMac?"mac":"pc"])}return e.prototype.representShortcut=function(t){var e=this.invertedKeyMap[t];return this.options.shortcuts&&e?(H.isMac&&(e=e.replace("CMD","⌘").replace("SHIFT","⇧"))," ("+(e=e.replace("BACKSLASH","\\").replace("SLASH","/").replace("LEFTBRACKET","[").replace("RIGHTBRACKET","]"))+")"):""},e.prototype.button=function(t){return!this.options.tooltip&&t.tooltip&&delete t.tooltip,t.container=this.options.container,this.ui.button(t)},e.prototype.initialize=function(){this.addToolbarButtons(),this.addImagePopoverButtons(),this.addLinkPopoverButtons(),this.addTablePopoverButtons(),this.fontInstalledMap={}},e.prototype.destroy=function(){delete this.fontInstalledMap},e.prototype.isFontInstalled=function(t){return this.fontInstalledMap.hasOwnProperty(t)||(this.fontInstalledMap[t]=H.isFontInstalled(t)||j.contains(this.options.fontNamesIgnoreCheck,t)),this.fontInstalledMap[t]},e.prototype.isFontDeservedToAdd=function(e){return""!==(e=e.toLowerCase())&&this.isFontInstalled(e)&&-1===t.inArray(e,["sans-serif","serif","monospace","cursive","fantasy"])},e.prototype.addToolbarButtons=function(){var e=this;this.context.memo("button.style",(function(){return e.ui.buttonGroup([e.button({className:"dropdown-toggle",contents:e.ui.dropdownButtonContents(e.ui.icon(e.options.icons.magic),e.options),tooltip:e.lang.style.style,data:{toggle:"dropdown"}}),e.ui.dropdown({className:"dropdown-style",items:e.options.styleTags,title:e.lang.style.style,template:function(t){"string"==typeof t&&(t={tag:t,title:e.lang.style.hasOwnProperty(t)?e.lang.style[t]:t});var o=t.tag,n=t.title;return"<"+o+(t.style?' style="'+t.style+'" ':"")+(t.className?' class="'+t.className+'"':"")+">"+n+"</"+o+">"},click:e.context.createInvokeHandler("editor.formatBlock")})]).render()}));for(var o=function(t,o){var i=n.options.styleTags[t];n.context.memo("button.style."+i,(function(){return e.button({className:"note-btn-style-"+i,contents:'<div data-value="'+i+'">'+i.toUpperCase()+"</div>",tooltip:e.lang.style[i],click:e.context.createInvokeHandler("editor.formatBlock")}).render()}))},n=this,i=0,r=this.options.styleTags.length;i<r;i++)o(i);this.context.memo("button.bold",(function(){return e.button({className:"note-btn-bold",contents:e.ui.icon(e.options.icons.bold),tooltip:e.lang.font.bold+e.representShortcut("bold"),click:e.context.createInvokeHandlerAndUpdateState("editor.bold")}).render()})),this.context.memo("button.italic",(function(){return e.button({className:"note-btn-italic",contents:e.ui.icon(e.options.icons.italic),tooltip:e.lang.font.italic+e.representShortcut("italic"),click:e.context.createInvokeHandlerAndUpdateState("editor.italic")}).render()})),this.context.memo("button.underline",(function(){return e.button({className:"note-btn-underline",contents:e.ui.icon(e.options.icons.underline),tooltip:e.lang.font.underline+e.representShortcut("underline"),click:e.context.createInvokeHandlerAndUpdateState("editor.underline")}).render()})),this.context.memo("button.clear",(function(){return e.button({contents:e.ui.icon(e.options.icons.eraser),tooltip:e.lang.font.clear+e.representShortcut("removeFormat"),click:e.context.createInvokeHandler("editor.removeFormat")}).render()})),this.context.memo("button.strikethrough",(function(){return e.button({className:"note-btn-strikethrough",contents:e.ui.icon(e.options.icons.strikethrough),tooltip:e.lang.font.strikethrough+e.representShortcut("strikethrough"),click:e.context.createInvokeHandlerAndUpdateState("editor.strikethrough")}).render()})),this.context.memo("button.superscript",(function(){return e.button({className:"note-btn-superscript",contents:e.ui.icon(e.options.icons.superscript),tooltip:e.lang.font.superscript,click:e.context.createInvokeHandlerAndUpdateState("editor.superscript")}).render()})),this.context.memo("button.subscript",(function(){return e.button({className:"note-btn-subscript",contents:e.ui.icon(e.options.icons.subscript),tooltip:e.lang.font.subscript,click:e.context.createInvokeHandlerAndUpdateState("editor.subscript")}).render()})),this.context.memo("button.fontname",(function(){var o=e.context.invoke("editor.currentStyle");return t.each(o["font-family"].split(","),(function(o,n){n=n.trim().replace(/['"]+/g,""),e.isFontDeservedToAdd(n)&&-1===t.inArray(n,e.options.fontNames)&&e.options.fontNames.push(n)})),e.ui.buttonGroup([e.button({className:"dropdown-toggle",contents:e.ui.dropdownButtonContents('<span class="note-current-fontname"/>',e.options),tooltip:e.lang.font.name,data:{toggle:"dropdown"}}),e.ui.dropdownCheck({className:"dropdown-fontname",checkClassName:e.options.icons.menuCheck,items:e.options.fontNames.filter(e.isFontInstalled.bind(e)),title:e.lang.font.name,template:function(t){return"<span style=\"font-family: '"+t+"'\">"+t+"</span>"},click:e.context.createInvokeHandlerAndUpdateState("editor.fontName")})]).render()})),this.context.memo("button.fontsize",(function(){return e.ui.buttonGroup([e.button({className:"dropdown-toggle",contents:e.ui.dropdownButtonContents('<span class="note-current-fontsize"/>',e.options),tooltip:e.lang.font.size,data:{toggle:"dropdown"}}),e.ui.dropdownCheck({className:"dropdown-fontsize",checkClassName:e.options.icons.menuCheck,items:e.options.fontSizes,title:e.lang.font.size,click:e.context.createInvokeHandlerAndUpdateState("editor.fontSize")})]).render()})),this.context.memo("button.color",(function(){return e.ui.buttonGroup({className:"note-color",children:[e.button({className:"note-current-color-button",contents:e.ui.icon(e.options.icons.font+" note-recent-color"),tooltip:e.lang.color.recent,click:function(o){var n=t(o.currentTarget);e.context.invoke("editor.color",{backColor:n.attr("data-backColor"),foreColor:n.attr("data-foreColor")})},callback:function(t){t.find(".note-recent-color").css("background-color","#FFFF00"),t.attr("data-backColor","#FFFF00")}}),e.button({className:"dropdown-toggle",contents:e.ui.dropdownButtonContents("",e.options),tooltip:e.lang.color.more,data:{toggle:"dropdown"}}),e.ui.dropdown({items:['<div class="note-palette">',' <div class="note-palette-title">'+e.lang.color.background+"</div>"," <div>",' <button type="button" class="note-color-reset btn btn-light" data-event="backColor" data-value="inherit">',e.lang.color.transparent," </button>"," </div>",' <div class="note-holder" data-event="backColor"/>',"</div>",'<div class="note-palette">',' <div class="note-palette-title">'+e.lang.color.foreground+"</div>"," <div>",' <button type="button" class="note-color-reset btn btn-light" data-event="removeFormat" data-value="foreColor">',e.lang.color.resetToDefault," </button>"," </div>",' <div class="note-holder" data-event="foreColor"/>',"</div>"].join(""),callback:function(o){o.find(".note-holder").each((function(o,n){var i=t(n);i.append(e.ui.palette({colors:e.options.colors,colorsName:e.options.colorsName,eventName:i.data("event"),container:e.options.container,tooltip:e.options.tooltip}).render())}))},click:function(o){var n=t(o.target),i=n.data("event"),r=n.data("value");if(i&&r){var s="backColor"===i?"background-color":"color",a=n.closest(".note-color").find(".note-recent-color"),l=n.closest(".note-color").find(".note-current-color-button");a.css(s,r),l.attr("data-"+i,r),e.context.invoke("editor."+i,r)}}})]}).render()})),this.context.memo("button.ul",(function(){return e.button({contents:e.ui.icon(e.options.icons.unorderedlist),tooltip:e.lang.lists.unordered+e.representShortcut("insertUnorderedList"),click:e.context.createInvokeHandler("editor.insertUnorderedList")}).render()})),this.context.memo("button.ol",(function(){return e.button({contents:e.ui.icon(e.options.icons.orderedlist),tooltip:e.lang.lists.ordered+e.representShortcut("insertOrderedList"),click:e.context.createInvokeHandler("editor.insertOrderedList")}).render()}));var s=this.button({contents:this.ui.icon(this.options.icons.alignLeft),tooltip:this.lang.paragraph.left+this.representShortcut("justifyLeft"),click:this.context.createInvokeHandler("editor.justifyLeft")}),a=this.button({contents:this.ui.icon(this.options.icons.alignCenter),tooltip:this.lang.paragraph.center+this.representShortcut("justifyCenter"),click:this.context.createInvokeHandler("editor.justifyCenter")}),l=this.button({contents:this.ui.icon(this.options.icons.alignRight),tooltip:this.lang.paragraph.right+this.representShortcut("justifyRight"),click:this.context.createInvokeHandler("editor.justifyRight")}),c=this.button({contents:this.ui.icon(this.options.icons.alignJustify),tooltip:this.lang.paragraph.justify+this.representShortcut("justifyFull"),click:this.context.createInvokeHandler("editor.justifyFull")}),d=this.button({contents:this.ui.icon(this.options.icons.outdent),tooltip:this.lang.paragraph.outdent+this.representShortcut("outdent"),click:this.context.createInvokeHandler("editor.outdent")}),u=this.button({contents:this.ui.icon(this.options.icons.indent),tooltip:this.lang.paragraph.indent+this.representShortcut("indent"),click:this.context.createInvokeHandler("editor.indent")});this.context.memo("button.justifyLeft",D.invoke(s,"render")),this.context.memo("button.justifyCenter",D.invoke(a,"render")),this.context.memo("button.justifyRight",D.invoke(l,"render")),this.context.memo("button.justifyFull",D.invoke(c,"render")),this.context.memo("button.outdent",D.invoke(d,"render")),this.context.memo("button.indent",D.invoke(u,"render")),this.context.memo("button.paragraph",(function(){return e.ui.buttonGroup([e.button({className:"dropdown-toggle",contents:e.ui.dropdownButtonContents(e.ui.icon(e.options.icons.alignLeft),e.options),tooltip:e.lang.paragraph.paragraph,data:{toggle:"dropdown"}}),e.ui.dropdown([e.ui.buttonGroup({className:"note-align",children:[s,a,l,c]}),e.ui.buttonGroup({className:"note-list",children:[d,u]})])]).render()})),this.context.memo("button.height",(function(){return e.ui.buttonGroup([e.button({className:"dropdown-toggle",contents:e.ui.dropdownButtonContents(e.ui.icon(e.options.icons.textHeight),e.options),tooltip:e.lang.font.height,data:{toggle:"dropdown"}}),e.ui.dropdownCheck({items:e.options.lineHeights,checkClassName:e.options.icons.menuCheck,className:"dropdown-line-height",title:e.lang.font.height,click:e.context.createInvokeHandler("editor.lineHeight")})]).render()})),this.context.memo("button.table",(function(){return e.ui.buttonGroup([e.button({className:"dropdown-toggle",contents:e.ui.dropdownButtonContents(e.ui.icon(e.options.icons.table),e.options),tooltip:e.lang.table.table,data:{toggle:"dropdown"}}),e.ui.dropdown({title:e.lang.table.table,className:"note-table",items:['<div class="note-dimension-picker">',' <div class="note-dimension-picker-mousecatcher" data-event="insertTable" data-value="1x1"/>',' <div class="note-dimension-picker-highlighted"/>',' <div class="note-dimension-picker-unhighlighted"/>',"</div>",'<div class="note-dimension-display">1 x 1</div>'].join("")})],{callback:function(t){t.find(".note-dimension-picker-mousecatcher").css({width:e.options.insertTableMaxSize.col+"em",height:e.options.insertTableMaxSize.row+"em"}).mousedown(e.context.createInvokeHandler("editor.insertTable")).on("mousemove",e.tableMoveHandler.bind(e))}}).render()})),this.context.memo("button.link",(function(){return e.button({contents:e.ui.icon(e.options.icons.link),tooltip:e.lang.link.link+e.representShortcut("linkDialog.show"),click:e.context.createInvokeHandler("linkDialog.show")}).render()})),this.context.memo("button.picture",(function(){return e.button({contents:e.ui.icon(e.options.icons.picture),tooltip:e.lang.image.image,click:e.context.createInvokeHandler("imageDialog.show")}).render()})),this.context.memo("button.video",(function(){return e.button({contents:e.ui.icon(e.options.icons.video),tooltip:e.lang.video.video,click:e.context.createInvokeHandler("videoDialog.show")}).render()})),this.context.memo("button.hr",(function(){return e.button({contents:e.ui.icon(e.options.icons.minus),tooltip:e.lang.hr.insert+e.representShortcut("insertHorizontalRule"),click:e.context.createInvokeHandler("editor.insertHorizontalRule")}).render()})),this.context.memo("button.fullscreen",(function(){return e.button({className:"btn-fullscreen",contents:e.ui.icon(e.options.icons.arrowsAlt),tooltip:e.lang.options.fullscreen,click:e.context.createInvokeHandler("fullscreen.toggle")}).render()})),this.context.memo("button.codeview",(function(){return e.button({className:"btn-codeview",contents:e.ui.icon(e.options.icons.code),tooltip:e.lang.options.codeview,click:e.context.createInvokeHandler("codeview.toggle")}).render()})),this.context.memo("button.redo",(function(){return e.button({contents:e.ui.icon(e.options.icons.redo),tooltip:e.lang.history.redo+e.representShortcut("redo"),click:e.context.createInvokeHandler("editor.redo")}).render()})),this.context.memo("button.undo",(function(){return e.button({contents:e.ui.icon(e.options.icons.undo),tooltip:e.lang.history.undo+e.representShortcut("undo"),click:e.context.createInvokeHandler("editor.undo")}).render()})),this.context.memo("button.help",(function(){return e.button({contents:e.ui.icon(e.options.icons.question),tooltip:e.lang.options.help,click:e.context.createInvokeHandler("helpDialog.show")}).render()}))},e.prototype.addImagePopoverButtons=function(){var t=this;this.context.memo("button.imageSize100",(function(){return t.button({contents:'<span class="note-fontsize-10">100%</span>',tooltip:t.lang.image.resizeFull,click:t.context.createInvokeHandler("editor.resize","1")}).render()})),this.context.memo("button.imageSize50",(function(){return t.button({contents:'<span class="note-fontsize-10">50%</span>',tooltip:t.lang.image.resizeHalf,click:t.context.createInvokeHandler("editor.resize","0.5")}).render()})),this.context.memo("button.imageSize25",(function(){return t.button({contents:'<span class="note-fontsize-10">25%</span>',tooltip:t.lang.image.resizeQuarter,click:t.context.createInvokeHandler("editor.resize","0.25")}).render()})),this.context.memo("button.floatLeft",(function(){return t.button({contents:t.ui.icon(t.options.icons.alignLeft),tooltip:t.lang.image.floatLeft,click:t.context.createInvokeHandler("editor.floatMe","left")}).render()})),this.context.memo("button.floatRight",(function(){return t.button({contents:t.ui.icon(t.options.icons.alignRight),tooltip:t.lang.image.floatRight,click:t.context.createInvokeHandler("editor.floatMe","right")}).render()})),this.context.memo("button.floatNone",(function(){return t.button({contents:t.ui.icon(t.options.icons.alignJustify),tooltip:t.lang.image.floatNone,click:t.context.createInvokeHandler("editor.floatMe","none")}).render()})),this.context.memo("button.removeMedia",(function(){return t.button({contents:t.ui.icon(t.options.icons.trash),tooltip:t.lang.image.remove,click:t.context.createInvokeHandler("editor.removeMedia")}).render()}))},e.prototype.addLinkPopoverButtons=function(){var t=this;this.context.memo("button.linkDialogShow",(function(){return t.button({contents:t.ui.icon(t.options.icons.link),tooltip:t.lang.link.edit,click:t.context.createInvokeHandler("linkDialog.show")}).render()})),this.context.memo("button.unlink",(function(){return t.button({contents:t.ui.icon(t.options.icons.unlink),tooltip:t.lang.link.unlink,click:t.context.createInvokeHandler("editor.unlink")}).render()}))},e.prototype.addTablePopoverButtons=function(){var t=this;this.context.memo("button.addRowUp",(function(){return t.button({className:"btn-md",contents:t.ui.icon(t.options.icons.rowAbove),tooltip:t.lang.table.addRowAbove,click:t.context.createInvokeHandler("editor.addRow","top")}).render()})),this.context.memo("button.addRowDown",(function(){return t.button({className:"btn-md",contents:t.ui.icon(t.options.icons.rowBelow),tooltip:t.lang.table.addRowBelow,click:t.context.createInvokeHandler("editor.addRow","bottom")}).render()})),this.context.memo("button.addColLeft",(function(){return t.button({className:"btn-md",contents:t.ui.icon(t.options.icons.colBefore),tooltip:t.lang.table.addColLeft,click:t.context.createInvokeHandler("editor.addCol","left")}).render()})),this.context.memo("button.addColRight",(function(){return t.button({className:"btn-md",contents:t.ui.icon(t.options.icons.colAfter),tooltip:t.lang.table.addColRight,click:t.context.createInvokeHandler("editor.addCol","right")}).render()})),this.context.memo("button.deleteRow",(function(){return t.button({className:"btn-md",contents:t.ui.icon(t.options.icons.rowRemove),tooltip:t.lang.table.delRow,click:t.context.createInvokeHandler("editor.deleteRow")}).render()})),this.context.memo("button.deleteCol",(function(){return t.button({className:"btn-md",contents:t.ui.icon(t.options.icons.colRemove),tooltip:t.lang.table.delCol,click:t.context.createInvokeHandler("editor.deleteCol")}).render()})),this.context.memo("button.deleteTable",(function(){return t.button({className:"btn-md",contents:t.ui.icon(t.options.icons.trash),tooltip:t.lang.table.delTable,click:t.context.createInvokeHandler("editor.deleteTable")}).render()}))},e.prototype.build=function(e,o){for(var n=0,i=o.length;n<i;n++){for(var r=o[n],s=t.isArray(r)?r[0]:r,a=t.isArray(r)?1===r.length?[r[0]]:r[1]:[r],l=this.ui.buttonGroup({className:"note-"+s}).render(),c=0,d=a.length;c<d;c++){var u=this.context.memo("button."+a[c]);u&&l.append("function"==typeof u?u(this.context):u)}l.appendTo(e)}},e.prototype.updateCurrentStyle=function(e){var o=this,n=e||this.$toolbar,i=this.context.invoke("editor.currentStyle");if(this.updateBtnStates(n,{".note-btn-bold":function(){return"bold"===i["font-bold"]},".note-btn-italic":function(){return"italic"===i["font-italic"]},".note-btn-underline":function(){return"underline"===i["font-underline"]},".note-btn-subscript":function(){return"subscript"===i["font-subscript"]},".note-btn-superscript":function(){return"superscript"===i["font-superscript"]},".note-btn-strikethrough":function(){return"strikethrough"===i["font-strikethrough"]}}),i["font-family"]){var r=i["font-family"].split(",").map((function(t){return t.replace(/[\'\"]/g,"").replace(/\s+$/,"").replace(/^\s+/,"")})),s=j.find(r,this.isFontInstalled.bind(this));n.find(".dropdown-fontname a").each((function(e,o){var n=t(o),i=n.data("value")+""==s+"";n.toggleClass("checked",i)})),n.find(".note-current-fontname").text(s).css("font-family",s)}if(i["font-size"]){var a=i["font-size"];n.find(".dropdown-fontsize a").each((function(e,o){var n=t(o),i=n.data("value")+""==a+"";n.toggleClass("checked",i)})),n.find(".note-current-fontsize").text(a)}if(i["line-height"]){var l=i["line-height"];n.find(".dropdown-line-height li a").each((function(e,n){var i=t(n).data("value")+""==l+"";o.className=i?"checked":""}))}},e.prototype.updateBtnStates=function(e,o){var n=this;t.each(o,(function(t,o){n.ui.toggleBtnActive(e.find(t),o())}))},e.prototype.tableMoveHandler=function(e){var o,n=t(e.target.parentNode),i=n.next(),r=n.find(".note-dimension-picker-mousecatcher"),s=n.find(".note-dimension-picker-highlighted"),a=n.find(".note-dimension-picker-unhighlighted");if(void 0===e.offsetX){var l=t(e.target).offset();o={x:e.pageX-l.left,y:e.pageY-l.top}}else o={x:e.offsetX,y:e.offsetY};var c=Math.ceil(o.x/18)||1,d=Math.ceil(o.y/18)||1;s.css({width:c+"em",height:d+"em"}),r.data("value",c+"x"+d),c>3&&c<this.options.insertTableMaxSize.col&&a.css({width:c+1+"em"}),d>3&&d<this.options.insertTableMaxSize.row&&a.css({height:d+1+"em"}),i.html(c+" x "+d)},e}(),ie=function(){function e(e){this.context=e,this.$window=t(window),this.$document=t(document),this.ui=t.summernote.ui,this.$note=e.layoutInfo.note,this.$editor=e.layoutInfo.editor,this.$toolbar=e.layoutInfo.toolbar,this.options=e.options,this.followScroll=this.followScroll.bind(this)}return e.prototype.shouldInitialize=function(){return!this.options.airMode},e.prototype.initialize=function(){var t=this;this.options.toolbar=this.options.toolbar||[],this.options.toolbar.length?this.context.invoke("buttons.build",this.$toolbar,this.options.toolbar):this.$toolbar.hide(),this.options.toolbarContainer&&this.$toolbar.appendTo(this.options.toolbarContainer),this.changeContainer(!1),this.$note.on("summernote.keyup summernote.mouseup summernote.change",(function(){t.context.invoke("buttons.updateCurrentStyle")})),this.context.invoke("buttons.updateCurrentStyle"),this.options.followingToolbar&&this.$window.on("scroll resize",this.followScroll)},e.prototype.destroy=function(){this.$toolbar.children().remove(),this.options.followingToolbar&&this.$window.off("scroll resize",this.followScroll)},e.prototype.followScroll=function(){if(this.$editor.hasClass("fullscreen"))return!1;var e=this.$toolbar.parent(".note-toolbar-wrapper"),o=this.$editor.outerHeight(),n=this.$editor.width(),i=this.$toolbar.height();e.css({height:i});var r=0;this.options.otherStaticBar&&(r=t(this.options.otherStaticBar).outerHeight());var s=this.$document.scrollTop(),a=this.$editor.offset().top;s>a-r&&s<a+o-r-i?this.$toolbar.css({position:"fixed",top:r,width:n}):this.$toolbar.css({position:"relative",top:0,width:"100%"})},e.prototype.changeContainer=function(t){t?this.$toolbar.prependTo(this.$editor):this.options.toolbarContainer&&this.$toolbar.appendTo(this.options.toolbarContainer)},e.prototype.updateFullscreen=function(t){this.ui.toggleBtnActive(this.$toolbar.find(".btn-fullscreen"),t),this.changeContainer(t)},e.prototype.updateCodeview=function(t){this.ui.toggleBtnActive(this.$toolbar.find(".btn-codeview"),t),t?this.deactivate():this.activate()},e.prototype.activate=function(t){var e=this.$toolbar.find("button");t||(e=e.not(".btn-codeview")),this.ui.toggleBtn(e,!0)},e.prototype.deactivate=function(t){var e=this.$toolbar.find("button");t||(e=e.not(".btn-codeview")),this.ui.toggleBtn(e,!1)},e}(),re=function(){function e(e){this.context=e,this.ui=t.summernote.ui,this.$body=t(document.body),this.$editor=e.layoutInfo.editor,this.options=e.options,this.lang=this.options.langInfo,e.memo("help.linkDialog.show",this.options.langInfo.help["linkDialog.show"])}return e.prototype.initialize=function(){var e=this.options.dialogsInBody?this.$body:this.$editor,o=['<div class="form-group note-form-group">','<label class="note-form-label">'+this.lang.link.textToDisplay+"</label>",'<input class="note-link-text form-control note-form-control note-input" type="text" />',"</div>",'<div class="form-group note-form-group">','<label class="note-form-label">'+this.lang.link.url+"</label>",'<input class="note-link-url form-control note-form-control note-input" type="text" value="http://" />',"</div>",this.options.disableLinkTarget?"":t("<div/>").append(this.ui.checkbox({id:"sn-checkbox-open-in-new-window",text:this.lang.link.openInNewWindow,checked:!0}).render()).html()].join(""),n='<button type="submit" href="#" class="btn btn-primary note-btn note-btn-primary note-link-btn" disabled>'+this.lang.link.insert+"</button>";this.$dialog=this.ui.dialog({className:"link-dialog",title:this.lang.link.insert,fade:this.options.dialogsFade,body:o,footer:n}).render().appendTo(e)},e.prototype.destroy=function(){this.ui.hideDialog(this.$dialog),this.$dialog.remove()},e.prototype.bindEnterKey=function(t,e){t.on("keypress",(function(t){t.keyCode===q.code.ENTER&&(t.preventDefault(),e.trigger("click"))}))},e.prototype.toggleLinkBtn=function(t,e,o){this.ui.toggleBtn(t,e.val()&&o.val())},e.prototype.showLinkDialog=function(e){var o=this;return t.Deferred((function(t){var n=o.$dialog.find(".note-link-text"),i=o.$dialog.find(".note-link-url"),r=o.$dialog.find(".note-link-btn"),s=o.$dialog.find("input[type=checkbox]");o.ui.onDialogShown(o.$dialog,(function(){o.context.triggerEvent("dialog.shown"),e.url||(e.url=e.text),n.val(e.text);var a=function(){o.toggleLinkBtn(r,n,i),e.text=n.val()};n.on("input",a).on("paste",(function(){setTimeout(a,0)}));var l=function(){o.toggleLinkBtn(r,n,i),e.text||n.val(i.val())};i.on("input",l).on("paste",(function(){setTimeout(l,0)})).val(e.url),H.isSupportTouch||i.trigger("focus"),o.toggleLinkBtn(r,n,i),o.bindEnterKey(i,r),o.bindEnterKey(n,r);var c=void 0!==e.isNewWindow?e.isNewWindow:o.context.options.linkTargetBlank;s.prop("checked",c),r.one("click",(function(r){r.preventDefault(),t.resolve({range:e.range,url:i.val(),text:n.val(),isNewWindow:s.is(":checked")}),o.ui.hideDialog(o.$dialog)}))})),o.ui.onDialogHidden(o.$dialog,(function(){n.off("input paste keypress"),i.off("input paste keypress"),r.off("click"),"pending"===t.state()&&t.reject()})),o.ui.showDialog(o.$dialog)})).promise()},e.prototype.show=function(){var t=this,e=this.context.invoke("editor.getLinkInfo");this.context.invoke("editor.saveRange"),this.showLinkDialog(e).then((function(e){t.context.invoke("editor.restoreRange"),t.context.invoke("editor.createLink",e)})).fail((function(){t.context.invoke("editor.restoreRange")}))},e}(),se=function(){function e(e){var o=this;this.context=e,this.ui=t.summernote.ui,this.options=e.options,this.events={"summernote.keyup summernote.mouseup summernote.change summernote.scroll":function(){o.update()},"summernote.disable summernote.dialog.shown":function(){o.hide()}}}return e.prototype.shouldInitialize=function(){return!j.isEmpty(this.options.popover.link)},e.prototype.initialize=function(){this.$popover=this.ui.popover({className:"note-link-popover",callback:function(t){t.find(".popover-content,.note-popover-content").prepend('<span><a target="_blank"></a>&nbsp;</span>')}}).render().appendTo(this.options.container);var t=this.$popover.find(".popover-content,.note-popover-content");this.context.invoke("buttons.build",t,this.options.popover.link)},e.prototype.destroy=function(){this.$popover.remove()},e.prototype.update=function(){if(this.context.invoke("editor.hasFocus")){var e=this.context.invoke("editor.createRange");if(e.isCollapsed()&&e.isOnAnchor()){var o=Ht.ancestor(e.sc,Ht.isAnchor),n=t(o).attr("href");this.$popover.find("a").attr("href",n).html(n);var i=Ht.posFromPlaceholder(o);this.$popover.css({display:"block",left:i.left,top:i.top})}else this.hide()}else this.hide()},e.prototype.hide=function(){this.$popover.hide()},e}(),ae=function(){function e(e){this.context=e,this.ui=t.summernote.ui,this.$body=t(document.body),this.$editor=e.layoutInfo.editor,this.options=e.options,this.lang=this.options.langInfo}return e.prototype.initialize=function(){var t=this.options.dialogsInBody?this.$body:this.$editor,e="";if(this.options.maximumImageFileSize){var o=Math.floor(Math.log(this.options.maximumImageFileSize)/Math.log(1024)),n=1*(this.options.maximumImageFileSize/Math.pow(1024,o)).toFixed(2)+" "+" KMGTP"[o]+"B";e="<small>"+this.lang.image.maximumFileSize+" : "+n+"</small>"}var i=['<div class="form-group note-form-group note-group-select-from-files">','<label class="note-form-label">'+this.lang.image.selectFromFiles+"</label>",'<input class="note-image-input note-form-control note-input" ',' type="file" name="files" accept="image/*" multiple="multiple" />',e,"</div>",'<div class="form-group note-group-image-url" style="overflow:auto;">','<label class="note-form-label">'+this.lang.image.url+"</label>",'<input class="note-image-url form-control note-form-control note-input ',' col-md-12" type="text" />',"</div>"].join(""),r='<button type="submit" href="#" class="btn btn-primary note-btn note-btn-primary note-image-btn" disabled>'+this.lang.image.insert+"</button>";this.$dialog=this.ui.dialog({title:this.lang.image.insert,fade:this.options.dialogsFade,body:i,footer:r}).render().appendTo(t)},e.prototype.destroy=function(){this.ui.hideDialog(this.$dialog),this.$dialog.remove()},e.prototype.bindEnterKey=function(t,e){t.on("keypress",(function(t){t.keyCode===q.code.ENTER&&(t.preventDefault(),e.trigger("click"))}))},e.prototype.show=function(){var t=this;this.context.invoke("editor.saveRange"),this.showImageDialog().then((function(e){t.ui.hideDialog(t.$dialog),t.context.invoke("editor.restoreRange"),"string"==typeof e?t.context.invoke("editor.insertImage",e):t.context.invoke("editor.insertImagesOrCallback",e)})).fail((function(){t.context.invoke("editor.restoreRange")}))},e.prototype.showImageDialog=function(){var e=this;return t.Deferred((function(t){var o=e.$dialog.find(".note-image-input"),n=e.$dialog.find(".note-image-url"),i=e.$dialog.find(".note-image-btn");e.ui.onDialogShown(e.$dialog,(function(){e.context.triggerEvent("dialog.shown"),o.replaceWith(o.clone().on("change",(function(e){t.resolve(e.target.files||e.target.value)})).val("")),i.click((function(e){e.preventDefault(),t.resolve(n.val())})),n.on("keyup paste",(function(){var t=n.val();e.ui.toggleBtn(i,t)})).val(""),H.isSupportTouch||n.trigger("focus"),e.bindEnterKey(n,i)})),e.ui.onDialogHidden(e.$dialog,(function(){o.off("change"),n.off("keyup paste keypress"),i.off("click"),"pending"===t.state()&&t.reject()})),e.ui.showDialog(e.$dialog)}))},e}(),le=function(){function e(e){var o=this;this.context=e,this.ui=t.summernote.ui,this.editable=e.layoutInfo.editable[0],this.options=e.options,this.events={"summernote.disable":function(){o.hide()}}}return e.prototype.shouldInitialize=function(){return!j.isEmpty(this.options.popover.image)},e.prototype.initialize=function(){this.$popover=this.ui.popover({className:"note-image-popover"}).render().appendTo(this.options.container);var t=this.$popover.find(".popover-content,.note-popover-content");this.context.invoke("buttons.build",t,this.options.popover.image)},e.prototype.destroy=function(){this.$popover.remove()},e.prototype.update=function(t){if(Ht.isImg(t)){var e=Ht.posFromPlaceholder(t),o=Ht.posFromPlaceholder(this.editable);this.$popover.css({display:"block",left:this.options.popatmouse?event.pageX-20:e.left,top:this.options.popatmouse?event.pageY:Math.min(e.top,o.top)})}else this.hide()},e.prototype.hide=function(){this.$popover.hide()},e}(),ce=function(){function e(e){var o=this;this.context=e,this.ui=t.summernote.ui,this.options=e.options,this.events={"summernote.mousedown":function(t,e){o.update(e.target)},"summernote.keyup summernote.scroll summernote.change":function(){o.update()},"summernote.disable":function(){o.hide()}}}return e.prototype.shouldInitialize=function(){return!j.isEmpty(this.options.popover.table)},e.prototype.initialize=function(){this.$popover=this.ui.popover({className:"note-table-popover"}).render().appendTo(this.options.container);var t=this.$popover.find(".popover-content,.note-popover-content");this.context.invoke("buttons.build",t,this.options.popover.table),H.isFF&&document.execCommand("enableInlineTableEditing",!1,!1)},e.prototype.destroy=function(){this.$popover.remove()},e.prototype.update=function(t){if(this.context.isDisabled())return!1;var e=Ht.isCell(t);if(e){var o=Ht.posFromPlaceholder(t);this.$popover.css({display:"block",left:o.left,top:o.top})}else this.hide();return e},e.prototype.hide=function(){this.$popover.hide()},e}(),de=function(){function e(e){this.context=e,this.ui=t.summernote.ui,this.$body=t(document.body),this.$editor=e.layoutInfo.editor,this.options=e.options,this.lang=this.options.langInfo}return e.prototype.initialize=function(){var t=this.options.dialogsInBody?this.$body:this.$editor,e=['<div class="form-group note-form-group row-fluid">','<label class="note-form-label">'+this.lang.video.url+' <small class="text-muted">'+this.lang.video.providers+"</small></label>",'<input class="note-video-url form-control note-form-control note-input" type="text" />',"</div>"].join(""),o='<button type="submit" href="#" class="btn btn-primary note-btn note-btn-primary note-video-btn" disabled>'+this.lang.video.insert+"</button>";this.$dialog=this.ui.dialog({title:this.lang.video.insert,fade:this.options.dialogsFade,body:e,footer:o}).render().appendTo(t)},e.prototype.destroy=function(){this.ui.hideDialog(this.$dialog),this.$dialog.remove()},e.prototype.bindEnterKey=function(t,e){t.on("keypress",(function(t){t.keyCode===q.code.ENTER&&(t.preventDefault(),e.trigger("click"))}))},e.prototype.createVideoNode=function(e){console.log(1,e);var o,n=e.match(/^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/),i=/^(?:https?:\/\/)?(?:www\.)?(rutube\.ru\/(?:video|play\/embed))\/((\w|-)*)(?:\/)?$/,r=e.match(i),s=e.match(/(?:www\.|\/\/)instagram\.com\/p\/(.[a-zA-Z0-9_-]*)/),a=e.match(/\/\/vine\.co\/v\/([a-zA-Z0-9]+)/),l=e.match(/\/\/(player\.)?vimeo\.com\/([a-z]*\/)*(\d+)[?]?.*/),c=e.match(/.+dailymotion.com\/(video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/),d=e.match(/\/\/v\.youku\.com\/v_show\/id_(\w+)=*\.html/),u=e.match(/\/\/v\.qq\.com.*?vid=(.+)/),h=e.match(/\/\/v\.qq\.com\/x?\/?(page|cover).*?\/([^\/]+)\.html\??.*/),p=e.match(/^.+.(mp4|m4v)$/),f=e.match(/^.+.(ogg|ogv)$/),m=e.match(/^.+.(webm)$/);if(console.log(2,i),console.log(3,r),n&&11===n[1].length){var g=n[1];o=t("<iframe>").attr("frameborder",0).attr("src","//www.youtube.com/embed/"+g).attr("width","640").attr("height","360")}else if(r&&r[2].length){console.log(4,r);var v=r[2];o=t("<iframe>").attr("frameborder",0).attr("src","https://rutube.ru/play/embed/"+v).attr("width","640").attr("height","360")}else if(s&&s[0].length)o=t("<iframe>").attr("frameborder",0).attr("src","https://instagram.com/p/"+s[1]+"/embed/").attr("width","612").attr("height","710").attr("scrolling","no").attr("allowtransparency","true");else if(a&&a[0].length)o=t("<iframe>").attr("frameborder",0).attr("src",a[0]+"/embed/simple").attr("width","600").attr("height","600").attr("class","vine-embed");else if(l&&l[3].length)o=t("<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen>").attr("frameborder",0).attr("src","//player.vimeo.com/video/"+l[3]).attr("width","640").attr("height","360");else if(c&&c[2].length)o=t("<iframe>").attr("frameborder",0).attr("src","//www.dailymotion.com/embed/video/"+c[2]).attr("width","640").attr("height","360");else if(d&&d[1].length)o=t("<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen>").attr("frameborder",0).attr("height","498").attr("width","510").attr("src","//player.youku.com/embed/"+d[1]);else if(u&&u[1].length||h&&h[2].length){var b=u&&u[1].length?u[1]:h[2];o=t("<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen>").attr("frameborder",0).attr("height","310").attr("width","500").attr("src","http://v.qq.com/iframe/player.html?vid="+b+"&amp;auto=0")}else{if(!(p||f||m))return!1;o=t("<video controls>").attr("src",e).attr("width","640").attr("height","360")}return o.addClass("note-video-clip"),o[0]},e.prototype.show=function(){var t=this,e=this.context.invoke("editor.getSelectedText");this.context.invoke("editor.saveRange"),this.showVideoDialog(e).then((function(e){t.ui.hideDialog(t.$dialog),t.context.invoke("editor.restoreRange");var o=t.createVideoNode(e);o&&t.context.invoke("editor.insertNode",o)})).fail((function(){t.context.invoke("editor.restoreRange")}))},e.prototype.showVideoDialog=function(e){var o=this;return t.Deferred((function(t){var n=o.$dialog.find(".note-video-url"),i=o.$dialog.find(".note-video-btn");o.ui.onDialogShown(o.$dialog,(function(){o.context.triggerEvent("dialog.shown"),n.val(e).on("input",(function(){o.ui.toggleBtn(i,n.val())})),H.isSupportTouch||n.trigger("focus"),i.click((function(e){e.preventDefault(),t.resolve(n.val())})),o.bindEnterKey(n,i)})),o.ui.onDialogHidden(o.$dialog,(function(){n.off("input"),i.off("click"),"pending"===t.state()&&t.reject()})),o.ui.showDialog(o.$dialog)}))},e}(),ue=function(){function e(e){this.context=e,this.ui=t.summernote.ui,this.$body=t(document.body),this.$editor=e.layoutInfo.editor,this.options=e.options,this.lang=this.options.langInfo}return e.prototype.initialize=function(){var t=this.options.dialogsInBody?this.$body:this.$editor,e=['<p class="text-center">','<a href="http://summernote.org/" target="_blank">Summernote 0.8.10</a> · ','<a href="https://github.com/summernote/summernote" target="_blank">Project</a> · ','<a href="https://github.com/summernote/summernote/issues" target="_blank">Issues</a>',"</p>"].join("");this.$dialog=this.ui.dialog({title:this.lang.options.help,fade:this.options.dialogsFade,body:this.createShortcutList(),footer:e,callback:function(t){t.find(".modal-body,.note-modal-body").css({"max-height":300,overflow:"scroll"})}}).render().appendTo(t)},e.prototype.destroy=function(){this.ui.hideDialog(this.$dialog),this.$dialog.remove()},e.prototype.createShortcutList=function(){var e=this,o=this.options.keyMap[H.isMac?"mac":"pc"];return Object.keys(o).map((function(n){var i=o[n],r=t('<div><div class="help-list-item"/></div>');return r.append(t("<label><kbd>"+n+"</kdb></label>").css({width:180,"margin-right":10})).append(t("<span/>").html(e.context.memo("help."+i)||i)),r.html()})).join("")},e.prototype.showHelpDialog=function(){var e=this;return t.Deferred((function(t){e.ui.onDialogShown(e.$dialog,(function(){e.context.triggerEvent("dialog.shown"),t.resolve()})),e.ui.showDialog(e.$dialog)})).promise()},e.prototype.show=function(){var t=this;this.context.invoke("editor.saveRange"),this.showHelpDialog().then((function(){t.context.invoke("editor.restoreRange")}))},e}(),he=function(){function e(e){var o=this;this.context=e,this.ui=t.summernote.ui,this.options=e.options,this.events={"summernote.keyup summernote.mouseup summernote.scroll":function(){o.update()},"summernote.disable summernote.change summernote.dialog.shown":function(){o.hide()},"summernote.focusout":function(t,e){H.isFF||e.relatedTarget&&Ht.ancestor(e.relatedTarget,D.eq(o.$popover[0]))||o.hide()}}}return e.prototype.shouldInitialize=function(){return this.options.airMode&&!j.isEmpty(this.options.popover.air)},e.prototype.initialize=function(){this.$popover=this.ui.popover({className:"note-air-popover"}).render().appendTo(this.options.container);var t=this.$popover.find(".popover-content");this.context.invoke("buttons.build",t,this.options.popover.air)},e.prototype.destroy=function(){this.$popover.remove()},e.prototype.update=function(){var t=this.context.invoke("editor.currentStyle");if(t.range&&!t.range.isCollapsed()){var e=j.last(t.range.getClientRects());if(e){var o=D.rect2bnd(e);this.$popover.css({display:"block",left:Math.max(o.left+o.width/2,0)-20,top:o.top+o.height}),this.context.invoke("buttons.updateCurrentStyle",this.$popover)}}else this.hide()},e.prototype.hide=function(){this.$popover.hide()},e}(),pe=function(){function e(e){var o=this;this.context=e,this.ui=t.summernote.ui,this.$editable=e.layoutInfo.editable,this.options=e.options,this.hint=this.options.hint||[],this.direction=this.options.hintDirection||"bottom",this.hints=t.isArray(this.hint)?this.hint:[this.hint],this.events={"summernote.keyup":function(t,e){e.isDefaultPrevented()||o.handleKeyup(e)},"summernote.keydown":function(t,e){o.handleKeydown(e)},"summernote.disable summernote.dialog.shown":function(){o.hide()}}}return e.prototype.shouldInitialize=function(){return this.hints.length>0},e.prototype.initialize=function(){var e=this;this.lastWordRange=null,this.$popover=this.ui.popover({className:"note-hint-popover",hideArrow:!0,direction:""}).render().appendTo(this.options.container),this.$popover.hide(),this.$content=this.$popover.find(".popover-content,.note-popover-content"),this.$content.on("click",".note-hint-item",(function(){e.$content.find(".active").removeClass("active"),t(e).addClass("active"),e.replace()}))},e.prototype.destroy=function(){this.$popover.remove()},e.prototype.selectItem=function(t){this.$content.find(".active").removeClass("active"),t.addClass("active"),this.$content[0].scrollTop=t[0].offsetTop-this.$content.innerHeight()/2},e.prototype.moveDown=function(){var t=this.$content.find(".note-hint-item.active"),e=t.next();if(e.length)this.selectItem(e);else{var o=t.parent().next();o.length||(o=this.$content.find(".note-hint-group").first()),this.selectItem(o.find(".note-hint-item").first())}},e.prototype.moveUp=function(){var t=this.$content.find(".note-hint-item.active"),e=t.prev();if(e.length)this.selectItem(e);else{var o=t.parent().prev();o.length||(o=this.$content.find(".note-hint-group").last()),this.selectItem(o.find(".note-hint-item").last())}},e.prototype.replace=function(){var t=this.$content.find(".note-hint-item.active");if(t.length){var e=this.nodeFromItem(t);this.lastWordRange.insertNode(e),zt.createFromNode(e).collapse().select(),this.lastWordRange=null,this.hide(),this.context.triggerEvent("change",this.$editable.html(),this.$editable[0]),this.context.invoke("editor.focus")}},e.prototype.nodeFromItem=function(t){var e=this.hints[t.data("index")],o=t.data("item"),n=e.content?e.content(o):o;return"string"==typeof n&&(n=Ht.createText(n)),n},e.prototype.createItemTemplates=function(e,o){var n=this.hints[e];return o.map((function(o,i){var r=t('<div class="note-hint-item"/>');return r.append(n.template?n.template(o):o+""),r.data({index:e,item:o}),r}))},e.prototype.handleKeydown=function(t){this.$popover.is(":visible")&&(t.keyCode===q.code.ENTER?(t.preventDefault(),this.replace()):t.keyCode===q.code.UP?(t.preventDefault(),this.moveUp()):t.keyCode===q.code.DOWN&&(t.preventDefault(),this.moveDown()))},e.prototype.searchKeyword=function(t,e,o){var n=this.hints[t];if(n&&n.match.test(e)&&n.search){var i=n.match.exec(e);n.search(i[1],o)}else o()},e.prototype.createGroup=function(e,o){var n=this,i=t('<div class="note-hint-group note-hint-group-'+e+'"/>');return this.searchKeyword(e,o,(function(t){(t=t||[]).length&&(i.html(n.createItemTemplates(e,t)),n.show())})),i},e.prototype.handleKeyup=function(t){var e=this;if(!j.contains([q.code.ENTER,q.code.UP,q.code.DOWN],t.keyCode)){var o=this.context.invoke("editor.createRange").getWordRange(),n=o.toString();if(this.hints.length&&n){this.$content.empty();var i=D.rect2bnd(j.last(o.getClientRects()));i&&(this.$popover.hide(),this.lastWordRange=o,this.hints.forEach((function(t,o){t.match.test(n)&&e.createGroup(o,n).appendTo(e.$content)})),this.$content.find(".note-hint-item:first").addClass("active"),"top"===this.direction?this.$popover.css({left:i.left,top:i.top-this.$popover.outerHeight()-5}):this.$popover.css({left:i.left,top:i.top+i.height+5}))}else this.hide()}},e.prototype.show=function(){this.$popover.show()},e.prototype.hide=function(){this.$popover.hide()},e}(),fe=function(){function e(e,o){this.ui=t.summernote.ui,this.$note=e,this.memos={},this.modules={},this.layoutInfo={},this.options=o,this.initialize()}return e.prototype.initialize=function(){return this.layoutInfo=this.ui.createLayout(this.$note,this.options),this._initialize(),this.$note.hide(),this},e.prototype.destroy=function(){this._destroy(),this.$note.removeData("summernote"),this.ui.removeLayout(this.$note,this.layoutInfo)},e.prototype.reset=function(){var t=this.isDisabled();this.code(Ht.emptyPara),this._destroy(),this._initialize(),t&&this.disable()},e.prototype._initialize=function(){var e=this,o=t.extend({},this.options.buttons);Object.keys(o).forEach((function(t){e.memo("button."+t,o[t])}));var n=t.extend({},this.options.modules,t.summernote.plugins||{});Object.keys(n).forEach((function(t){e.module(t,n[t],!0)})),Object.keys(this.modules).forEach((function(t){e.initializeModule(t)}))},e.prototype._destroy=function(){var t=this;Object.keys(this.modules).reverse().forEach((function(e){t.removeModule(e)})),Object.keys(this.memos).forEach((function(e){t.removeMemo(e)})),this.triggerEvent("destroy",this)},e.prototype.code=function(t){var e=this.invoke("codeview.isActivated");if(void 0===t)return this.invoke("codeview.sync"),e?this.layoutInfo.codable.val():this.layoutInfo.editable.html();e?this.layoutInfo.codable.val(t):this.layoutInfo.editable.html(t),this.$note.val(t),this.triggerEvent("change",t)},e.prototype.isDisabled=function(){return"false"===this.layoutInfo.editable.attr("contenteditable")},e.prototype.enable=function(){this.layoutInfo.editable.attr("contenteditable",!0),this.invoke("toolbar.activate",!0),this.triggerEvent("disable",!1)},e.prototype.disable=function(){this.invoke("codeview.isActivated")&&this.invoke("codeview.deactivate"),this.layoutInfo.editable.attr("contenteditable",!1),this.invoke("toolbar.deactivate",!0),this.triggerEvent("disable",!0)},e.prototype.triggerEvent=function(){var t=j.head(arguments),e=j.tail(j.from(arguments)),o=this.options.callbacks[D.namespaceToCamel(t,"on")];o&&o.apply(this.$note[0],e),this.$note.trigger("summernote."+t,e)},e.prototype.initializeModule=function(t){var e=this.modules[t];e.shouldInitialize=e.shouldInitialize||D.ok,e.shouldInitialize()&&(e.initialize&&e.initialize(),e.events&&Ht.attachEvents(this.$note,e.events))},e.prototype.module=function(t,e,o){if(1===arguments.length)return this.modules[t];this.modules[t]=new e(this),o||this.initializeModule(t)},e.prototype.removeModule=function(t){var e=this.modules[t];e.shouldInitialize()&&(e.events&&Ht.detachEvents(this.$note,e.events),e.destroy&&e.destroy()),delete this.modules[t]},e.prototype.memo=function(t,e){if(1===arguments.length)return this.memos[t];this.memos[t]=e},e.prototype.removeMemo=function(t){this.memos[t]&&this.memos[t].destroy&&this.memos[t].destroy(),delete this.memos[t]},e.prototype.createInvokeHandlerAndUpdateState=function(t,e){var o=this;return function(n){o.createInvokeHandler(t,e)(n),o.invoke("buttons.updateCurrentStyle")}},e.prototype.createInvokeHandler=function(e,o){var n=this;return function(i){i.preventDefault();var r=t(i.target);n.invoke(e,o||r.closest("[data-value]").data("value"),r)}},e.prototype.invoke=function(){var t=j.head(arguments),e=j.tail(j.from(arguments)),o=t.split("."),n=o.length>1,i=n&&j.head(o),r=n?j.last(o):j.head(o),s=this.modules[i||"editor"];return!i&&this[r]?this[r].apply(this,e):s&&s[r]&&s.shouldInitialize()?s[r].apply(s,e):void 0},e}();t.fn.extend({summernote:function(){var e=t.type(j.head(arguments)),o="string"===e,n="object"===e,i=t.extend({},t.summernote.options,n?j.head(arguments):{});i.langInfo=t.extend(!0,{},t.summernote.lang["en-US"],t.summernote.lang[i.lang]),i.icons=t.extend(!0,{},t.summernote.options.icons,i.icons),i.tooltip="auto"===i.tooltip?!H.isSupportTouch:i.tooltip,this.each((function(e,o){var n=t(o);if(!n.data("summernote")){var r=new fe(n,i);n.data("summernote",r),n.data("summernote").triggerEvent("init",r.layoutInfo)}}));var r=this.first();if(r.length){var s=r.data("summernote");if(o)return s.invoke.apply(s,j.from(arguments));i.focus&&s.invoke("editor.focus")}return this}}),t.summernote=t.extend(t.summernote,{version:"0.8.10",ui:x,plugins:{},options:{modules:{editor:Vt,clipboard:_t,dropzone:Gt,codeview:Yt,statusbar:Zt,fullscreen:Qt,handle:Xt,hintPopover:pe,autoLink:te,autoSync:ee,placeholder:oe,buttons:ne,toolbar:ie,linkDialog:re,linkPopover:se,imageDialog:ae,imagePopover:le,tablePopover:ce,videoDialog:de,helpDialog:ue,airPopover:he},buttons:{},lang:"en-US",followingToolbar:!0,otherStaticBar:"",toolbar:[["style",["style"]],["font",["bold","underline","clear"]],["fontname",["fontname"]],["fontsize",["fontsize"]],["color",["color"]],["para",["ul","ol","paragraph"]],["table",["table"]],["insert",["link","picture","video"]],["view",["fullscreen","codeview","help"]]],popatmouse:!0,popover:{image:[["imagesize",["imageSize100","imageSize50","imageSize25"]],["float",["floatLeft","floatRight","floatNone"]],["remove",["removeMedia"]]],link:[["link",["linkDialogShow","unlink"]]],table:[["add",["addRowDown","addRowUp","addColLeft","addColRight"]],["delete",["deleteRow","deleteCol","deleteTable"]]],air:[["color",["color"]],["font",["bold","underline","clear"]],["para",["ul","paragraph"]],["table",["table"]],["insert",["link","picture"]]]},airMode:!1,width:null,height:null,focus:!1,tabSize:4,styleWithSpan:!0,shortcuts:!0,textareaAutoSync:!0,hintDirection:"bottom",tooltip:"auto",container:"body",maxTextLength:0,styleTags:["p","pre","h1","h2","h3","h4","h5","h6"],fontNames:["Arial","Arial Black","Comic Sans MS","Courier New","Helvetica Neue","Helvetica","Impact","Lucida Grande","Tahoma","Times New Roman","Verdana"],fontSizes:["8","9","10","11","12","14","18","24","36"],colors:[["#000000","#424242","#636363","#9C9C94","#CEC6CE","#EFEFEF","#F7F7F7","#FFFFFF"],["#FF0000","#FF9C00","#FFFF00","#00FF00","#00FFFF","#0000FF","#9C00FF","#FF00FF"],["#F7C6CE","#FFE7CE","#FFEFC6","#D6EFD6","#CEDEE7","#CEE7F7","#D6D6E7","#E7D6DE"],["#E79C9C","#FFC69C","#FFE79C","#B5D6A5","#A5C6CE","#9CC6EF","#B5A5D6","#D6A5BD"],["#E76363","#F7AD6B","#FFD663","#94BD7B","#73A5AD","#6BADDE","#8C7BC6","#C67BA5"],["#CE0000","#E79439","#EFC631","#6BA54A","#4A7B8C","#3984C6","#634AA5","#A54A7B"],["#9C0000","#B56308","#BD9400","#397B21","#104A5A","#085294","#311873","#731842"],["#630000","#7B3900","#846300","#295218","#083139","#003163","#21104A","#4A1031"]],colorsName:[["Black","Tundora","Dove Gray","Star Dust","Pale Slate","Gallery","Alabaster","White"],["Red","Orange Peel","Yellow","Green","Cyan","Blue","Electric Violet","Magenta"],["Azalea","Karry","Egg White","Zanah","Botticelli","Tropical Blue","Mischka","Twilight"],["Tonys Pink","Peach Orange","Cream Brulee","Sprout","Casper","Perano","Cold Purple","Careys Pink"],["Mandy","Rajah","Dandelion","Olivine","Gulf Stream","Viking","Blue Marguerite","Puce"],["Guardsman Red","Fire Bush","Golden Dream","Chelsea Cucumber","Smalt Blue","Boston Blue","Butterfly Bush","Cadillac"],["Sangria","Mai Tai","Buddha Gold","Forest Green","Eden","Venice Blue","Meteorite","Claret"],["Rosewood","Cinnamon","Olive","Parsley","Tiber","Midnight Blue","Valentino","Loulou"]],lineHeights:["1.0","1.2","1.4","1.5","1.6","1.8","2.0","3.0"],tableClassName:"table table-bordered",insertTableMaxSize:{col:10,row:10},dialogsInBody:!1,dialogsFade:!1,maximumImageFileSize:null,callbacks:{onInit:null,onFocus:null,onBlur:null,onBlurCodeview:null,onEnter:null,onKeyup:null,onKeydown:null,onSubmit:null,onImageUpload:null,onImageUploadError:null},codemirror:{mode:"text/html",htmlMode:!0,lineNumbers:!0},keyMap:{pc:{ENTER:"insertParagraph","CTRL+Z":"undo","CTRL+Y":"redo",TAB:"tab","SHIFT+TAB":"untab","CTRL+B":"bold","CTRL+I":"italic","CTRL+U":"underline","CTRL+SHIFT+S":"strikethrough","CTRL+BACKSLASH":"removeFormat","CTRL+SHIFT+L":"justifyLeft","CTRL+SHIFT+E":"justifyCenter","CTRL+SHIFT+R":"justifyRight","CTRL+SHIFT+J":"justifyFull","CTRL+SHIFT+NUM7":"insertUnorderedList","CTRL+SHIFT+NUM8":"insertOrderedList","CTRL+LEFTBRACKET":"outdent","CTRL+RIGHTBRACKET":"indent","CTRL+NUM0":"formatPara","CTRL+NUM1":"formatH1","CTRL+NUM2":"formatH2","CTRL+NUM3":"formatH3","CTRL+NUM4":"formatH4","CTRL+NUM5":"formatH5","CTRL+NUM6":"formatH6","CTRL+ENTER":"insertHorizontalRule","CTRL+K":"linkDialog.show"},mac:{ENTER:"insertParagraph","CMD+Z":"undo","CMD+SHIFT+Z":"redo",TAB:"tab","SHIFT+TAB":"untab","CMD+B":"bold","CMD+I":"italic","CMD+U":"underline","CMD+SHIFT+S":"strikethrough","CMD+BACKSLASH":"removeFormat","CMD+SHIFT+L":"justifyLeft","CMD+SHIFT+E":"justifyCenter","CMD+SHIFT+R":"justifyRight","CMD+SHIFT+J":"justifyFull","CMD+SHIFT+NUM7":"insertUnorderedList","CMD+SHIFT+NUM8":"insertOrderedList","CMD+LEFTBRACKET":"outdent","CMD+RIGHTBRACKET":"indent","CMD+NUM0":"formatPara","CMD+NUM1":"formatH1","CMD+NUM2":"formatH2","CMD+NUM3":"formatH3","CMD+NUM4":"formatH4","CMD+NUM5":"formatH5","CMD+NUM6":"formatH6","CMD+ENTER":"insertHorizontalRule","CMD+K":"linkDialog.show"}},icons:{align:"note-icon-align",alignCenter:"note-icon-align-center",alignJustify:"note-icon-align-justify",alignLeft:"note-icon-align-left",alignRight:"note-icon-align-right",rowBelow:"note-icon-row-below",colBefore:"note-icon-col-before",colAfter:"note-icon-col-after",rowAbove:"note-icon-row-above",rowRemove:"note-icon-row-remove",colRemove:"note-icon-col-remove",indent:"note-icon-align-indent",outdent:"note-icon-align-outdent",arrowsAlt:"note-icon-arrows-alt",bold:"note-icon-bold",caret:"note-icon-caret",circle:"note-icon-circle",close:"note-icon-close",code:"note-icon-code",eraser:"note-icon-eraser",font:"note-icon-font",frame:"note-icon-frame",italic:"note-icon-italic",link:"note-icon-link",unlink:"note-icon-chain-broken",magic:"note-icon-magic",menuCheck:"note-icon-menu-check",minus:"note-icon-minus",orderedlist:"note-icon-orderedlist",pencil:"note-icon-pencil",picture:"note-icon-picture",question:"note-icon-question",redo:"note-icon-redo",square:"note-icon-square",strikethrough:"note-icon-strikethrough",subscript:"note-icon-subscript",superscript:"note-icon-superscript",table:"note-icon-table",textHeight:"note-icon-text-height",trash:"note-icon-trash",underline:"note-icon-underline",undo:"note-icon-undo",unorderedlist:"note-icon-unorderedlist",video:"note-icon-video"}}})}));
1
+ (function(global,factory){typeof exports==='object'&&typeof module!=='undefined'?factory(require('jquery')):typeof define==='function'&&define.amd?define(['jquery'],factory):(factory(global.jQuery))}(this,(function($$1){'use strict';$$1=$$1&&$$1.hasOwnProperty('default')?$$1['default']:$$1;var Renderer=(function(){function Renderer(markup,children,options,callback){this.markup=markup;this.children=children;this.options=options;this.callback=callback}Renderer.prototype.render=function($parent){var $node=$$1(this.markup);if(this.options&&this.options.contents){$node.html(this.options.contents)}if(this.options&&this.options.className){$node.addClass(this.options.className)}if(this.options&&this.options.data){$$1.each(this.options.data,function(k,v){$node.attr('data-'+k,v)})}if(this.options&&this.options.click){$node.on('click',this.options.click)}if(this.children){var $container_1=$node.find('.note-children-container');this.children.forEach(function(child){child.render($container_1.length?$container_1:$node)})}if(this.callback){this.callback($node,this.options)}if(this.options&&this.options.callback){this.options.callback($node)}if($parent){$parent.append($node)}return $node};return Renderer}());var renderer={create:function(markup,callback){return function(){var options=typeof arguments[1]==='object'?arguments[1]:arguments[0];var children=$$1.isArray(arguments[0])?arguments[0]:[];if(options&&options.children){children=options.children}return new Renderer(markup,children,options,callback)}}};var TooltipUI=(function(){function TooltipUI($node,options){this.$node=$node;this.options=$.extend({},{title:'',target:options.container,trigger:'hover focus',placement:'bottom'},options);this.$tooltip=$(['<div class="note-tooltip in">',' <div class="note-tooltip-arrow"/>',' <div class="note-tooltip-content"/>','</div>'].join(''));if(this.options.trigger!=='manual'){var showCallback_1=this.show.bind(this);var hideCallback_1=this.hide.bind(this);var toggleCallback_1=this.toggle.bind(this);this.options.trigger.split(' ').forEach(function(eventName){if(eventName==='hover'){$node.off('mouseenter mouseleave');$node.on('mouseenter',showCallback_1).on('mouseleave',hideCallback_1)}else if(eventName==='click'){$node.on('click',toggleCallback_1)}else if(eventName==='focus'){$node.on('focus',showCallback_1).on('blur',hideCallback_1)}})}}TooltipUI.prototype.show=function(){var $node=this.$node;var offset=$node.offset();var $tooltip=this.$tooltip;var title=this.options.title||$node.attr('title')||$node.data('title');var placement=this.options.placement||$node.data('placement');$tooltip.addClass(placement);$tooltip.addClass('in');$tooltip.find('.note-tooltip-content').text(title);$tooltip.appendTo(this.options.target);var nodeWidth=$node.outerWidth();var nodeHeight=$node.outerHeight();var tooltipWidth=$tooltip.outerWidth();var tooltipHeight=$tooltip.outerHeight();if(placement==='bottom'){$tooltip.css({top:offset.top+nodeHeight,left:offset.left+(nodeWidth/2-tooltipWidth/2)})}else if(placement==='top'){$tooltip.css({top:offset.top-tooltipHeight,left:offset.left+(nodeWidth/2-tooltipWidth/2)})}else if(placement==='left'){$tooltip.css({top:offset.top+(nodeHeight/2-tooltipHeight/2),left:offset.left-tooltipWidth})}else if(placement==='right'){$tooltip.css({top:offset.top+(nodeHeight/2-tooltipHeight/2),left:offset.left+nodeWidth})}};TooltipUI.prototype.hide=function(){this.$tooltip.removeClass('in');this.$tooltip.remove()};TooltipUI.prototype.toggle=function(){if(this.$tooltip.hasClass('in')){this.hide()}else{this.show()}};return TooltipUI}());var DropdownUI=(function(){function DropdownUI($node,options){this.$button=$node;this.options=$.extend({},{target:options.container},options);this.setEvent()}DropdownUI.prototype.setEvent=function(){this.$button.on('click',this.toggle.bind(this))};DropdownUI.prototype.clear=function(){var $parent=$('.note-btn-group.open');$parent.find('.note-btn.active').removeClass('active');$parent.removeClass('open')};DropdownUI.prototype.show=function(){this.$button.addClass('active');this.$button.parent().addClass('open');var $dropdown=this.$button.next();var offset=$dropdown.offset();var width=$dropdown.outerWidth();var windowWidth=$(window).width();var targetMarginRight=parseFloat($(this.options.target).css('margin-right'));if(offset.left+width>windowWidth-targetMarginRight){$dropdown.css('margin-left',windowWidth-targetMarginRight-(offset.left+width))}else{$dropdown.css('margin-left','')}};DropdownUI.prototype.hide=function(){this.$button.removeClass('active');this.$button.parent().removeClass('open')};DropdownUI.prototype.toggle=function(){var isOpened=this.$button.parent().hasClass('open');this.clear();if(isOpened){this.hide()}else{this.show()}};return DropdownUI}());$(document).on('click',function(e){if(!$(e.target).closest('.note-btn-group').length){$('.note-btn-group.open').removeClass('open')}});$(document).on('click.note-dropdown-menu',function(e){$(e.target).closest('.note-dropdown-menu').parent().removeClass('open')});var ModalUI=(function(){function ModalUI($node,options){this.options=$.extend({},{target:options.container||'body'},options);this.$modal=$node;this.$backdrop=$('<div class="note-modal-backdrop" />')}ModalUI.prototype.show=function(){if(this.options.target==='body'){this.$backdrop.css('position','fixed');this.$modal.css('position','fixed')}else{this.$backdrop.css('position','absolute');this.$modal.css('position','absolute')}this.$backdrop.appendTo(this.options.target).show();this.$modal.appendTo(this.options.target).addClass('open').show();this.$modal.trigger('note.modal.show');this.$modal.off('click','.close').on('click','.close',this.hide.bind(this))};ModalUI.prototype.hide=function(){this.$modal.removeClass('open').hide();this.$backdrop.hide();this.$modal.trigger('note.modal.hide')};return ModalUI}());var editor=renderer.create('<div class="note-editor note-frame"/>');var toolbar=renderer.create('<div class="note-toolbar" role="toolbar"/>');var editingArea=renderer.create('<div class="note-editing-area"/>');var codable=renderer.create('<textarea class="note-codable" role="textbox" aria-multiline="true"/>');var editable=renderer.create('<div class="note-editable" contentEditable="true" role="textbox" aria-multiline="true"/>');var statusbar=renderer.create(['<output class="note-status-output" role="status" aria-live="polite"/>','<div class="note-statusbar" role="resize">',' <div class="note-resizebar" role="seperator" aria-orientation="horizontal" aria-label="resize">',' <div class="note-icon-bar"/>',' <div class="note-icon-bar"/>',' <div class="note-icon-bar"/>',' </div>','</div>'].join(''));var airEditor=renderer.create('<div class="note-editor"/>');var airEditable=renderer.create(['<output class="note-status-output" role="status" aria-live="polite"/>','<div class="note-editable" contentEditable="true" role="textbox" aria-multiline="true"/>'].join(''));var buttonGroup=renderer.create('<div class="note-btn-group">');var button=renderer.create('<button type="button" class="note-btn" role="button" tabindex="-1">',function($node,options){if(options&&options.tooltip){$node.attr({'aria-label':options.tooltip});$node.data('_lite_tooltip',new TooltipUI($node,{title:options.tooltip,container:options.container}))}if(options.contents){$node.html(options.contents)}if(options&&options.data&&options.data.toggle==='dropdown'){$node.data('_lite_dropdown',new DropdownUI($node,{container:options.container}))}});var dropdown=renderer.create('<div class="note-dropdown-menu" role="list">',function($node,options){var markup=$.isArray(options.items)?options.items.map(function(item){var value=(typeof item==='string')?item:(item.value||'');var content=options.template?options.template(item):item;var $temp=$('<a class="note-dropdown-item" href="#" data-value="'+value+'" role="listitem" aria-label="'+item+'"></a>');$temp.html(content).data('item',item);return $temp}):options.items;$node.html(markup).attr({'aria-label':options.title});$node.on('click','> .note-dropdown-item',function(e){var $a=$(this);var item=$a.data('item');var value=$a.data('value');if(item.click){item.click($a)}else if(options.itemClick){options.itemClick(e,item,value)}})});var dropdownCheck=renderer.create('<div class="note-dropdown-menu note-check" role="list">',function($node,options){var markup=$.isArray(options.items)?options.items.map(function(item){var value=(typeof item==='string')?item:(item.value||'');var content=options.template?options.template(item):item;var $temp=$('<a class="note-dropdown-item" href="#" data-value="'+value+'" role="listitem" aria-label="'+item+'"></a>');$temp.html([icon(options.checkClassName),' ',content]).data('item',item);return $temp}):options.items;$node.html(markup).attr({'aria-label':options.title});$node.on('click','> .note-dropdown-item',function(e){var $a=$(this);var item=$a.data('item');var value=$a.data('value');if(item.click){item.click($a)}else if(options.itemClick){options.itemClick(e,item,value)}})});var dropdownButtonContents=function(contents,options){return contents+' '+icon(options.icons.caret,'span')};var dropdownButton=function(opt,callback){return buttonGroup([button({className:'dropdown-toggle',contents:opt.title+' '+icon('note-icon-caret'),tooltip:opt.tooltip,data:{toggle:'dropdown'}}),dropdown({className:opt.className,items:opt.items,template:opt.template,itemClick:opt.itemClick})],{callback:callback}).render()};var dropdownCheckButton=function(opt,callback){return buttonGroup([button({className:'dropdown-toggle',contents:opt.title+' '+icon('note-icon-caret'),tooltip:opt.tooltip,data:{toggle:'dropdown'}}),dropdownCheck({className:opt.className,checkClassName:opt.checkClassName,items:opt.items,template:opt.template,itemClick:opt.itemClick})],{callback:callback}).render()};var paragraphDropdownButton=function(opt){return buttonGroup([button({className:'dropdown-toggle',contents:opt.title+' '+icon('note-icon-caret'),tooltip:opt.tooltip,data:{toggle:'dropdown'}}),dropdown([buttonGroup({className:'note-align',children:opt.items[0]}),buttonGroup({className:'note-list',children:opt.items[1]})])]).render()};var tableMoveHandler=function(event,col,row){var PX_PER_EM=18;var $picker=$(event.target.parentNode);var $dimensionDisplay=$picker.next();var $catcher=$picker.find('.note-dimension-picker-mousecatcher');var $highlighted=$picker.find('.note-dimension-picker-highlighted');var $unhighlighted=$picker.find('.note-dimension-picker-unhighlighted');var posOffset;if(event.offsetX===undefined){var posCatcher=$(event.target).offset();posOffset={x:event.pageX-posCatcher.left,y:event.pageY-posCatcher.top}}else{posOffset={x:event.offsetX,y:event.offsetY}}var dim={c:Math.ceil(posOffset.x/PX_PER_EM)||1,r:Math.ceil(posOffset.y/PX_PER_EM)||1};$highlighted.css({width:dim.c+'em',height:dim.r+'em'});$catcher.data('value',dim.c+'x'+dim.r);if(dim.c>3&&dim.c<col){$unhighlighted.css({width:dim.c+1+'em'})}if(dim.r>3&&dim.r<row){$unhighlighted.css({height:dim.r+1+'em'})}$dimensionDisplay.html(dim.c+' x '+dim.r)};var tableDropdownButton=function(opt){return buttonGroup([button({className:'dropdown-toggle',contents:opt.title+' '+icon('note-icon-caret'),tooltip:opt.tooltip,data:{toggle:'dropdown'}}),dropdown({className:'note-table',items:['<div class="note-dimension-picker">',' <div class="note-dimension-picker-mousecatcher" data-event="insertTable" data-value="1x1"/>',' <div class="note-dimension-picker-highlighted"/>',' <div class="note-dimension-picker-unhighlighted"/>','</div>','<div class="note-dimension-display">1 x 1</div>'].join('')})],{callback:function($node){var $catcher=$node.find('.note-dimension-picker-mousecatcher');$catcher.css({width:opt.col+'em',height:opt.row+'em'}).mousedown(opt.itemClick).mousemove(function(e){tableMoveHandler(e,opt.col,opt.row)})}}).render()};var palette=renderer.create('<div class="note-color-palette"/>',function($node,options){var contents=[];for(var row=0,rowSize=options.colors.length;row<rowSize;row++){var eventName=options.eventName;var colors=options.colors[row];var colorsName=options.colorsName[row];var buttons=[];for(var col=0,colSize=colors.length;col<colSize;col++){var color=colors[col];var colorName=colorsName[col];buttons.push(['<button type="button" class="note-btn note-color-btn"','style="background-color:',color,'" ','data-event="',eventName,'" ','data-value="',color,'" ','title="',colorName,'" ','aria-label="',colorName,'" ','data-toggle="button" tabindex="-1"></button>'].join(''))}contents.push('<div class="note-color-row">'+buttons.join('')+'</div>')}$node.html(contents.join(''));$node.find('.note-color-btn').each(function(){$(this).data('_lite_tooltip',new TooltipUI($(this),{container:options.container}))})});var colorDropdownButton=function(opt,type){return buttonGroup({className:'note-color',children:[button({className:'note-current-color-button',contents:opt.title,tooltip:opt.lang.color.recent,click:opt.currentClick,callback:function($button){var $recentColor=$button.find('.note-recent-color');if(type!=='foreColor'){$recentColor.css('background-color','#FFFF00');$button.attr('data-backColor','#FFFF00')}}}),button({className:'dropdown-toggle',contents:icon('note-icon-caret'),tooltip:opt.lang.color.more,data:{toggle:'dropdown'}}),dropdown({items:['<div>','<div class="note-btn-group btn-background-color">',' <div class="note-palette-title">'+opt.lang.color.background+'</div>',' <div>','<button type="button" class="note-color-reset note-btn note-btn-block" '+' data-event="backColor" data-value="inherit">',opt.lang.color.transparent,' </button>',' </div>',' <div class="note-holder" data-event="backColor"/>','</div>','<div class="note-btn-group btn-foreground-color">',' <div class="note-palette-title">'+opt.lang.color.foreground+'</div>',' <div>','<button type="button" class="note-color-reset note-btn note-btn-block" '+' data-event="removeFormat" data-value="foreColor">',opt.lang.color.resetToDefault,' </button>',' </div>',' <div class="note-holder" data-event="foreColor"/>','</div>','</div>'].join(''),callback:function($dropdown){$dropdown.find('.note-holder').each(function(){var $holder=$(this);$holder.append(palette({colors:opt.colors,eventName:$holder.data('event')}).render())});if(type==='fore'){$dropdown.find('.btn-background-color').hide();$dropdown.css({'min-width':'210px'})}else if(type==='back'){$dropdown.find('.btn-foreground-color').hide();$dropdown.css({'min-width':'210px'})}},click:function(event){var $button=$(event.target);var eventName=$button.data('event');var value=$button.data('value');if(eventName&&value){var key=eventName==='backColor'?'background-color':'color';var $color=$button.closest('.note-color').find('.note-recent-color');var $currentButton=$button.closest('.note-color').find('.note-current-color-button');$color.css(key,value);$currentButton.attr('data-'+eventName,value);if(type==='fore'){opt.itemClick('foreColor',value)}else if(type==='back'){opt.itemClick('backColor',value)}else{opt.itemClick(eventName,value)}}}})]}).render()};var dialog=renderer.create('<div class="note-modal" aria-hidden="false" tabindex="-1" role="dialog"/>',function($node,options){if(options.fade){$node.addClass('fade')}$node.attr({'aria-label':options.title});$node.html([' <div class="note-modal-content">',(options.title?' <div class="note-modal-header">'+' <button type="button" class="close mrx-icon icon-font-24 icon-close" aria-label="Close" aria-hidden="true"></button>'+' <h4 class="note-modal-title">'+options.title+'</h4>'+' </div>':''),' <div class="note-modal-body">'+options.body+'</div>',(options.footer?' <div class="note-modal-footer">'+options.footer+'</div>':''),' </div>'].join(''));$node.data('modal',new ModalUI($node,options))});var videoDialog=function(opt){var body='<div class="note-form-group">'+'<label class="note-form-label">'+opt.lang.video.url+' <small class="text-muted">'+opt.lang.video.providers+'</small>'+'</label>'+'<input class="note-video-url note-input" type="text" />'+'</div>';var footer=['<button type="button" href="#" class="note-btn note-btn-primary note-video-btn disabled" disabled>',opt.lang.video.insert,'</button>'].join('');return dialog({title:opt.lang.video.insert,fade:opt.fade,body:body,footer:footer}).render()};var imageDialog=function(opt){var body='<div class="note-form-group note-group-select-from-files">'+'<label class="note-form-label">'+opt.lang.image.selectFromFiles+'</label>'+'<input class="note-note-image-input note-input" type="file" name="files" accept="image/*" multiple="multiple" />'+opt.imageLimitation+'</div>'+'<div class="note-form-group" style="overflow:auto;">'+'<label class="note-form-label">'+opt.lang.image.url+'</label>'+'<input class="note-image-url note-input" type="text" />'+'</div>';var footer=['<button href="#" type="button" class="note-btn note-btn-primary note-btn-large note-image-btn disabled" disabled>',opt.lang.image.insert,'</button>'].join('');return dialog({title:opt.lang.image.insert,fade:opt.fade,body:body,footer:footer}).render()};var linkDialog=function(opt){var body='<div class="note-form-group">'+'<label class="note-form-label">'+opt.lang.link.textToDisplay+'</label>'+'<input class="note-link-text note-input" type="text" />'+'</div>'+'<div class="note-form-group">'+'<label class="note-form-label">'+opt.lang.link.url+'</label>'+'<input class="note-link-url note-input" type="text" value="http://" />'+'</div>'+(!opt.disableLinkTarget?'<div class="checkbox">'+'<label>'+'<input type="checkbox" checked> '+opt.lang.link.openInNewWindow+'</label>'+'</div>':'');var footer=['<button href="#" type="button" class="note-btn note-btn-primary note-link-btn disabled" disabled>',opt.lang.link.insert,'</button>'].join('');return dialog({className:'link-dialog',title:opt.lang.link.insert,fade:opt.fade,body:body,footer:footer}).render()};var popover=renderer.create(['<div class="note-popover bottom">',' <div class="note-popover-arrow"/>',' <div class="note-popover-content note-children-container"/>','</div>'].join(''),function($node,options){var direction=typeof options.direction!=='undefined'?options.direction:'bottom';$node.addClass(direction).hide();if(options.hideArrow){$node.find('.note-popover-arrow').hide()}});var checkbox=renderer.create('<div class="checkbox"></div>',function($node,options){$node.html([' <label class="custom-checkbox"'+(options.id?' for="'+options.id+'"':'')+'>',' <input role="checkbox" type="checkbox"'+(options.id?' id="'+options.id+'"':''),(options.checked?' checked':''),' aria-checked="'+(options.checked?'true':'false')+'"/>','<span class="custom-checkbox__mark"></span>','<span class="custom-checkbox__label">',(options.text?options.text:''),'</span>','</label>'].join(''))});var icon=function(iconClassName,tagName){tagName=tagName||'i';return'<'+tagName+' class="'+iconClassName+'"/>'};var ui={editor:editor,toolbar:toolbar,editingArea:editingArea,codable:codable,editable:editable,statusbar:statusbar,airEditor:airEditor,airEditable:airEditable,buttonGroup:buttonGroup,button:button,dropdown:dropdown,dropdownCheck:dropdownCheck,dropdownButton:dropdownButton,dropdownButtonContents:dropdownButtonContents,dropdownCheckButton:dropdownCheckButton,paragraphDropdownButton:paragraphDropdownButton,tableDropdownButton:tableDropdownButton,colorDropdownButton:colorDropdownButton,palette:palette,dialog:dialog,videoDialog:videoDialog,imageDialog:imageDialog,linkDialog:linkDialog,popover:popover,checkbox:checkbox,icon:icon,toggleBtn:function($btn,isEnable){$btn.toggleClass('disabled',!isEnable);$btn.attr('disabled',!isEnable)},toggleBtnActive:function($btn,isActive){$btn.toggleClass('active',isActive)},check:function($dom,value){$dom.find('.checked').removeClass('checked');$dom.find('[data-value="'+value+'"]').addClass('checked')},onDialogShown:function($dialog,handler){$dialog.one('note.modal.show',handler)},onDialogHidden:function($dialog,handler){$dialog.one('note.modal.hide',handler)},showDialog:function($dialog){$dialog.data('modal').show()},hideDialog:function($dialog){$dialog.data('modal').hide()},getPopoverContent:function($popover){return $popover.find('.note-popover-content')},getDialogBody:function($dialog){return $dialog.find('.note-modal-body')},createLayout:function($note,options){var $editor=(options.airMode?ui.airEditor([ui.editingArea([ui.airEditable()])]):ui.editor([ui.toolbar(),ui.editingArea([ui.codable(),ui.editable()]),ui.statusbar()])).render();$editor.insertAfter($note);return{note:$note,editor:$editor,toolbar:$editor.find('.note-toolbar'),editingArea:$editor.find('.note-editing-area'),editable:$editor.find('.note-editable'),codable:$editor.find('.note-codable'),statusbar:$editor.find('.note-statusbar')}},removeLayout:function($note,layoutInfo){$note.html(layoutInfo.editable.html());layoutInfo.editor.remove();$note.off('summernote');$note.show()}};$$1.summernote=$$1.summernote||{lang:{}};$$1.extend($$1.summernote.lang,{'en-US':{font:{bold:'Bold',italic:'Italic',underline:'Underline',clear:'Remove Font Style',height:'Line Height',name:'Font Family',strikethrough:'Strikethrough',subscript:'Subscript',superscript:'Superscript',size:'Font Size'},image:{image:'Picture',insert:'Добавление изображения',resizeFull:'Resize Full',resizeHalf:'Resize Half',resizeQuarter:'Resize Quarter',floatLeft:'Float Left',floatRight:'Float Right',floatNone:'Float None',shapeRounded:'Shape: Rounded',shapeCircle:'Shape: Circle',shapeThumbnail:'Shape: Thumbnail',shapeNone:'Shape: None',dragImageHere:'Перетащите изображение или текст сюда',dropImage:'Перетащите изображение или текст',selectFromFiles:'Выберите файл',maximumFileSize:'Максимальный размер',maximumFileSizeError:'аксимальный размер файла превышен.',url:'Путь к изображению',remove:'Удалить изображение',original:'Оригинал'},video:{video:'Video',videoLink:'Добавление видео',insert:'Добавление видео',url:'Путь к видео',providers:'(YouTube, Vimeo, Vine, Instagram, DailyMotion, Youku)'},link:{link:'Link',insert:'Добавление ссылки',unlink:'Unlink',edit:'Edit',textToDisplay:'Выводимый текст',url:'To what URL should this link go?',openInNewWindow:'Open in new window'},table:{table:'Table',addRowAbove:'Add row above',addRowBelow:'Add row below',addColLeft:'Add column left',addColRight:'Add column right',delRow:'Delete row',delCol:'Delete column',delTable:'Delete table'},hr:{insert:'Insert Horizontal Rule'},style:{style:'Style',p:'Normal',blockquote:'Quote',pre:'Code',h1:'Header 1',h2:'Header 2',h3:'Header 3',h4:'Header 4',h5:'Header 5',h6:'Header 6'},lists:{unordered:'Unordered list',ordered:'Ordered list'},options:{help:'Help',fullscreen:'Full Screen',codeview:'Code View'},paragraph:{paragraph:'Paragraph',outdent:'Outdent',indent:'Indent',left:'Align left',center:'Align center',right:'Align right',justify:'Justify full'},color:{recent:'Recent Color',more:'More Color',background:'Background Color',foreground:'Foreground Color',transparent:'Transparent',setTransparent:'Set transparent',reset:'Reset',resetToDefault:'Reset to default'},shortcut:{shortcuts:'Keyboard shortcuts',close:'Close',textFormatting:'Text formatting',action:'Action',paragraphFormatting:'Paragraph formatting',documentStyle:'Document Style',extraKeys:'Extra keys'},help:{'insertParagraph':'Insert Paragraph','undo':'Undoes the last command','redo':'Redoes the last command','tab':'Tab','untab':'Untab','bold':'Set a bold style','italic':'Set a italic style','underline':'Set a underline style','strikethrough':'Set a strikethrough style','removeFormat':'Clean a style','justifyLeft':'Set left align','justifyCenter':'Set center align','justifyRight':'Set right align','justifyFull':'Set full align','insertUnorderedList':'Toggle unordered list','insertOrderedList':'Toggle ordered list','outdent':'Outdent on current paragraph','indent':'Indent on current paragraph','formatPara':'Change current block\'s format as a paragraph(P tag)','formatH1':'Change current block\'s format as H1','formatH2':'Change current block\'s format as H2','formatH3':'Change current block\'s format as H3','formatH4':'Change current block\'s format as H4','formatH5':'Change current block\'s format as H5','formatH6':'Change current block\'s format as H6','insertHorizontalRule':'Insert horizontal rule','linkDialog.show':'Show Link Dialog'},history:{undo:'Undo',redo:'Redo'},specialChar:{specialChar:'SPECIAL CHARACTERS',select:'Select Special characters'}}});var isSupportAmd=typeof define==='function'&&define.amd;function isFontInstalled(fontName){var testFontName=fontName==='Comic Sans MS'?'Courier New':'Comic Sans MS';var $tester=$$1('<div>').css({position:'absolute',left:'-9999px',top:'-9999px',fontSize:'200px'}).text('mmmmmmmmmwwwwwww').appendTo(document.body);var originalWidth=$tester.css('fontFamily',testFontName).width();var width=$tester.css('fontFamily',fontName+','+testFontName).width();$tester.remove();return originalWidth!==width}var userAgent=navigator.userAgent;var isMSIE=/MSIE|Trident/i.test(userAgent);var browserVersion;if(isMSIE){var matches=/MSIE (\d+[.]\d+)/.exec(userAgent);if(matches){browserVersion=parseFloat(matches[1])}matches=/Trident\/.*rv:([0-9]{1,}[.0-9]{0,})/.exec(userAgent);if(matches){browserVersion=parseFloat(matches[1])}}var isEdge=/Edge\/\d+/.test(userAgent);var hasCodeMirror=!!window.CodeMirror;if(!hasCodeMirror&&isSupportAmd){if(typeof __webpack_require__==='function'){try{require.resolve('codemirror');hasCodeMirror=true}catch(e){}}else if(typeof require!=='undefined'){if(typeof require.resolve!=='undefined'){try{require.resolve('codemirror');hasCodeMirror=true}catch(e){}}else if(typeof require.specified!=='undefined'){hasCodeMirror=require.specified('codemirror')}}}var isSupportTouch=(('ontouchstart'in window)||(navigator.MaxTouchPoints>0)||(navigator.msMaxTouchPoints>0));var inputEventName=(isMSIE||isEdge)?'DOMCharacterDataModified DOMSubtreeModified DOMNodeInserted':'input';var env={isMac:navigator.appVersion.indexOf('Mac')>-1,isMSIE:isMSIE,isEdge:isEdge,isFF:!isEdge&&/firefox/i.test(userAgent),isPhantom:/PhantomJS/i.test(userAgent),isWebkit:!isEdge&&/webkit/i.test(userAgent),isChrome:!isEdge&&/chrome/i.test(userAgent),isSafari:!isEdge&&/safari/i.test(userAgent),browserVersion:browserVersion,jqueryVersion:parseFloat($$1.fn.jquery),isSupportAmd:isSupportAmd,isSupportTouch:isSupportTouch,hasCodeMirror:hasCodeMirror,isFontInstalled:isFontInstalled,isW3CRangeSupport:!!document.createRange,inputEventName:inputEventName};function eq(itemA){return function(itemB){return itemA===itemB}}function eq2(itemA,itemB){return itemA===itemB}function peq2(propName){return function(itemA,itemB){return itemA[propName]===itemB[propName]}}function ok(){return true}function fail(){return false}function not(f){return function(){return!f.apply(f,arguments)}}function and(fA,fB){return function(item){return fA(item)&&fB(item)}}function self(a){return a}function invoke(obj,method){return function(){return obj[method].apply(obj,arguments)}}var idCounter=0;function uniqueId(prefix){var id=++idCounter+'';return prefix?prefix+id:id}function rect2bnd(rect){var $document=$(document);return{top:rect.top+$document.scrollTop(),left:rect.left+$document.scrollLeft(),width:rect.right-rect.left,height:rect.bottom-rect.top}}function invertObject(obj){var inverted={};for(var key in obj){if(obj.hasOwnProperty(key)){inverted[obj[key]]=key}}return inverted}function namespaceToCamel(namespace,prefix){prefix=prefix||'';return prefix+namespace.split('.').map(function(name){return name.substring(0,1).toUpperCase()+name.substring(1)}).join('')}function debounce(func,wait,immediate){var _this=this;var timeout;return function(){var context=_this;var args=arguments;var later=function(){timeout=null;if(!immediate){func.apply(context,args)}};var callNow=immediate&&!timeout;clearTimeout(timeout);timeout=setTimeout(later,wait);if(callNow){func.apply(context,args)}}}var func={eq:eq,eq2:eq2,peq2:peq2,ok:ok,fail:fail,self:self,not:not,and:and,invoke:invoke,uniqueId:uniqueId,rect2bnd:rect2bnd,invertObject:invertObject,namespaceToCamel:namespaceToCamel,debounce:debounce};function head(array){return array[0]}function last(array){return array[array.length-1]}function initial(array){return array.slice(0,array.length-1)}function tail(array){return array.slice(1)}function find(array,pred){for(var idx=0,len=array.length;idx<len;idx++){var item=array[idx];if(pred(item)){return item}}}function all(array,pred){for(var idx=0,len=array.length;idx<len;idx++){if(!pred(array[idx])){return false}}return true}function indexOf(array,item){return $$1.inArray(item,array)}function contains(array,item){return indexOf(array,item)!==-1}function sum(array,fn){fn=fn||func.self;return array.reduce(function(memo,v){return memo+fn(v)},0)}function from(collection){var result=[];var length=collection.length;var idx=-1;while(++idx<length){result[idx]=collection[idx]}return result}function isEmpty(array){return!array||!array.length}function clusterBy(array,fn){if(!array.length){return[]}var aTail=tail(array);return aTail.reduce(function(memo,v){var aLast=last(memo);if(fn(last(aLast),v)){aLast[aLast.length]=v}else{memo[memo.length]=[v]}return memo},[[head(array)]])}function compact(array){var aResult=[];for(var idx=0,len=array.length;idx<len;idx++){if(array[idx]){aResult.push(array[idx])}}return aResult}function unique(array){var results=[];for(var idx=0,len=array.length;idx<len;idx++){if(!contains(results,array[idx])){results.push(array[idx])}}return results}function next(array,item){var idx=indexOf(array,item);if(idx===-1){return null}return array[idx+1]}function prev(array,item){var idx=indexOf(array,item);if(idx===-1){return null}return array[idx-1]}var lists={head:head,last:last,initial:initial,tail:tail,prev:prev,next:next,find:find,contains:contains,all:all,sum:sum,from:from,isEmpty:isEmpty,clusterBy:clusterBy,compact:compact,unique:unique};var KEY_MAP={'BACKSPACE':8,'TAB':9,'ENTER':13,'SPACE':32,'DELETE':46,'LEFT':37,'UP':38,'RIGHT':39,'DOWN':40,'NUM0':48,'NUM1':49,'NUM2':50,'NUM3':51,'NUM4':52,'NUM5':53,'NUM6':54,'NUM7':55,'NUM8':56,'B':66,'E':69,'I':73,'J':74,'K':75,'L':76,'R':82,'S':83,'U':85,'V':86,'Y':89,'Z':90,'SLASH':191,'LEFTBRACKET':219,'BACKSLASH':220,'RIGHTBRACKET':221};var key={isEdit:function(keyCode){return lists.contains([KEY_MAP.BACKSPACE,KEY_MAP.TAB,KEY_MAP.ENTER,KEY_MAP.SPACE,KEY_MAP.DELETE],keyCode)},isMove:function(keyCode){return lists.contains([KEY_MAP.LEFT,KEY_MAP.UP,KEY_MAP.RIGHT,KEY_MAP.DOWN],keyCode)},nameFromCode:func.invertObject(KEY_MAP),code:KEY_MAP};var NBSP_CHAR=String.fromCharCode(160);var ZERO_WIDTH_NBSP_CHAR='\ufeff';function isEditable(node){return node&&$$1(node).hasClass('note-editable')}function isControlSizing(node){return node&&$$1(node).hasClass('note-control-sizing')}function makePredByNodeName(nodeName){nodeName=nodeName.toUpperCase();return function(node){return node&&node.nodeName.toUpperCase()===nodeName}}function isText(node){return node&&node.nodeType===3}function isElement(node){return node&&node.nodeType===1}function isVoid(node){return node&&/^BR|^IMG|^HR|^IFRAME|^BUTTON|^INPUT/.test(node.nodeName.toUpperCase())}function isPara(node){if(isEditable(node)){return false}return node&&/^DIV|^P|^LI|^H[1-7]/.test(node.nodeName.toUpperCase())}function isHeading(node){return node&&/^H[1-7]/.test(node.nodeName.toUpperCase())}var isPre=makePredByNodeName('PRE');var isLi=makePredByNodeName('LI');function isPurePara(node){return isPara(node)&&!isLi(node)}var isTable=makePredByNodeName('TABLE');var isData=makePredByNodeName('DATA');function isInline(node){return!isBodyContainer(node)&&!isList(node)&&!isHr(node)&&!isPara(node)&&!isTable(node)&&!isBlockquote(node)&&!isData(node)}function isList(node){return node&&/^UL|^OL/.test(node.nodeName.toUpperCase())}var isHr=makePredByNodeName('HR');function isCell(node){return node&&/^TD|^TH/.test(node.nodeName.toUpperCase())}var isBlockquote=makePredByNodeName('BLOCKQUOTE');function isBodyContainer(node){return isCell(node)||isBlockquote(node)||isEditable(node)}var isAnchor=makePredByNodeName('A');function isParaInline(node){return isInline(node)&&!!ancestor(node,isPara)}function isBodyInline(node){return isInline(node)&&!ancestor(node,isPara)}var isBody=makePredByNodeName('BODY');function isClosestSibling(nodeA,nodeB){return nodeA.nextSibling===nodeB||nodeA.previousSibling===nodeB}function withClosestSiblings(node,pred){pred=pred||func.ok;var siblings=[];if(node.previousSibling&&pred(node.previousSibling)){siblings.push(node.previousSibling)}siblings.push(node);if(node.nextSibling&&pred(node.nextSibling)){siblings.push(node.nextSibling)}return siblings}var blankHTML=env.isMSIE&&env.browserVersion<11?'&nbsp;':'<br>';function nodeLength(node){if(isText(node)){return node.nodeValue.length}if(node){return node.childNodes.length}return 0}function isEmpty$1(node){var len=nodeLength(node);if(len===0){return true}else if(!isText(node)&&len===1&&node.innerHTML===blankHTML){return true}else if(lists.all(node.childNodes,isText)&&node.innerHTML===''){return true}return false}function paddingBlankHTML(node){if(!isVoid(node)&&!nodeLength(node)){node.innerHTML=blankHTML}}function ancestor(node,pred){while(node){if(pred(node)){return node}if(isEditable(node)){break}node=node.parentNode}return null}function singleChildAncestor(node,pred){node=node.parentNode;while(node){if(nodeLength(node)!==1){break}if(pred(node)){return node}if(isEditable(node)){break}node=node.parentNode}return null}function listAncestor(node,pred){pred=pred||func.fail;var ancestors=[];ancestor(node,function(el){if(!isEditable(el)){ancestors.push(el)}return pred(el)});return ancestors}function lastAncestor(node,pred){var ancestors=listAncestor(node);return lists.last(ancestors.filter(pred))}function commonAncestor(nodeA,nodeB){var ancestors=listAncestor(nodeA);for(var n=nodeB;n;n=n.parentNode){if($$1.inArray(n,ancestors)>-1){return n}}return null}function listPrev(node,pred){pred=pred||func.fail;var nodes=[];while(node){if(pred(node)){break}nodes.push(node);node=node.previousSibling}return nodes}function listNext(node,pred){pred=pred||func.fail;var nodes=[];while(node){if(pred(node)){break}nodes.push(node);node=node.nextSibling}return nodes}function listDescendant(node,pred){var descendants=[];pred=pred||func.ok;(function fnWalk(current){if(node!==current&&pred(current)){descendants.push(current)}for(var idx=0,len=current.childNodes.length;idx<len;idx++){fnWalk(current.childNodes[idx])}})(node);return descendants}function wrap(node,wrapperName){var parent=node.parentNode;var wrapper=$$1('<'+wrapperName+'>')[0];parent.insertBefore(wrapper,node);wrapper.appendChild(node);return wrapper}function insertAfter(node,preceding){var next=preceding.nextSibling;var parent=preceding.parentNode;if(next){parent.insertBefore(node,next)}else{parent.appendChild(node)}return node}function appendChildNodes(node,aChild){$$1.each(aChild,function(idx,child){node.appendChild(child)});return node}function isLeftEdgePoint(point){return point.offset===0}function isRightEdgePoint(point){return point.offset===nodeLength(point.node)}function isEdgePoint(point){return isLeftEdgePoint(point)||isRightEdgePoint(point)}function isLeftEdgeOf(node,ancestor){while(node&&node!==ancestor){if(position(node)!==0){return false}node=node.parentNode}return true}function isRightEdgeOf(node,ancestor){if(!ancestor){return false}while(node&&node!==ancestor){if(position(node)!==nodeLength(node.parentNode)-1){return false}node=node.parentNode}return true}function isLeftEdgePointOf(point,ancestor){return isLeftEdgePoint(point)&&isLeftEdgeOf(point.node,ancestor)}function isRightEdgePointOf(point,ancestor){return isRightEdgePoint(point)&&isRightEdgeOf(point.node,ancestor)}function position(node){var offset=0;while((node=node.previousSibling)){offset+=1}return offset}function hasChildren(node){return!!(node&&node.childNodes&&node.childNodes.length)}function prevPoint(point,isSkipInnerOffset){var node;var offset;if(point.offset===0){if(isEditable(point.node)){return null}node=point.node.parentNode;offset=position(point.node)}else if(hasChildren(point.node)){node=point.node.childNodes[point.offset-1];offset=nodeLength(node)}else{node=point.node;offset=isSkipInnerOffset?0:point.offset-1}return{node:node,offset:offset}}function nextPoint(point,isSkipInnerOffset){var node,offset;if(nodeLength(point.node)===point.offset){if(isEditable(point.node)){return null}node=point.node.parentNode;offset=position(point.node)+1}else if(hasChildren(point.node)){node=point.node.childNodes[point.offset];offset=0}else{node=point.node;offset=isSkipInnerOffset?nodeLength(point.node):point.offset+1}return{node:node,offset:offset}}function isSamePoint(pointA,pointB){return pointA.node===pointB.node&&pointA.offset===pointB.offset}function isVisiblePoint(point){if(isText(point.node)||!hasChildren(point.node)||isEmpty$1(point.node)){return true}var leftNode=point.node.childNodes[point.offset-1];var rightNode=point.node.childNodes[point.offset];if((!leftNode||isVoid(leftNode))&&(!rightNode||isVoid(rightNode))){return true}return false}function prevPointUntil(point,pred){while(point){if(pred(point)){return point}point=prevPoint(point)}return null}function nextPointUntil(point,pred){while(point){if(pred(point)){return point}point=nextPoint(point)}return null}function isCharPoint(point){if(!isText(point.node)){return false}var ch=point.node.nodeValue.charAt(point.offset-1);return ch&&(ch!==' '&&ch!==NBSP_CHAR)}function walkPoint(startPoint,endPoint,handler,isSkipInnerOffset){var point=startPoint;while(point){handler(point);if(isSamePoint(point,endPoint)){break}var isSkipOffset=isSkipInnerOffset&&startPoint.node!==point.node&&endPoint.node!==point.node;point=nextPoint(point,isSkipOffset)}}function makeOffsetPath(ancestor,node){var ancestors=listAncestor(node,func.eq(ancestor));return ancestors.map(position).reverse()}function fromOffsetPath(ancestor,offsets){var current=ancestor;for(var i=0,len=offsets.length;i<len;i++){if(current.childNodes.length<=offsets[i]){current=current.childNodes[current.childNodes.length-1]}else{current=current.childNodes[offsets[i]]}}return current}function splitNode(point,options){var isSkipPaddingBlankHTML=options&&options.isSkipPaddingBlankHTML;var isNotSplitEdgePoint=options&&options.isNotSplitEdgePoint;if(isEdgePoint(point)&&(isText(point.node)||isNotSplitEdgePoint)){if(isLeftEdgePoint(point)){return point.node}else if(isRightEdgePoint(point)){return point.node.nextSibling}}if(isText(point.node)){return point.node.splitText(point.offset)}else{var childNode=point.node.childNodes[point.offset];var clone=insertAfter(point.node.cloneNode(false),point.node);appendChildNodes(clone,listNext(childNode));if(!isSkipPaddingBlankHTML){paddingBlankHTML(point.node);paddingBlankHTML(clone)}return clone}}function splitTree(root,point,options){var ancestors=listAncestor(point.node,func.eq(root));if(!ancestors.length){return null}else if(ancestors.length===1){return splitNode(point,options)}return ancestors.reduce(function(node,parent){if(node===point.node){node=splitNode(point,options)}return splitNode({node:parent,offset:node?position(node):nodeLength(parent)},options)})}function splitPoint(point,isInline){var pred=isInline?isPara:isBodyContainer;var ancestors=listAncestor(point.node,pred);var topAncestor=lists.last(ancestors)||point.node;var splitRoot,container;if(pred(topAncestor)){splitRoot=ancestors[ancestors.length-2];container=topAncestor}else{splitRoot=topAncestor;container=splitRoot.parentNode}var pivot=splitRoot&&splitTree(splitRoot,point,{isSkipPaddingBlankHTML:isInline,isNotSplitEdgePoint:isInline});if(!pivot&&container===point.node){pivot=point.node.childNodes[point.offset]}return{rightNode:pivot,container:container}}function create(nodeName){return document.createElement(nodeName)}function createText(text){return document.createTextNode(text)}function remove(node,isRemoveChild){if(!node||!node.parentNode){return}if(node.removeNode){return node.removeNode(isRemoveChild)}var parent=node.parentNode;if(!isRemoveChild){var nodes=[];for(var i=0,len=node.childNodes.length;i<len;i++){nodes.push(node.childNodes[i])}for(var i=0,len=nodes.length;i<len;i++){parent.insertBefore(nodes[i],node)}}parent.removeChild(node)}function removeWhile(node,pred){while(node){if(isEditable(node)||!pred(node)){break}var parent=node.parentNode;remove(node);node=parent}}function replace(node,nodeName){if(node.nodeName.toUpperCase()===nodeName.toUpperCase()){return node}var newNode=create(nodeName);if(node.style.cssText){newNode.style.cssText=node.style.cssText}appendChildNodes(newNode,lists.from(node.childNodes));insertAfter(newNode,node);remove(node);return newNode}var isTextarea=makePredByNodeName('TEXTAREA');function value($node,stripLinebreaks){var val=isTextarea($node[0])?$node.val():$node.html();if(stripLinebreaks){return val.replace(/[\n\r]/g,'')}return val}function html($node,isNewlineOnBlock){var markup=value($node);if(isNewlineOnBlock){var regexTag=/<(\/?)(\b(?!!)[^>\s]*)(.*?)(\s*\/?>)/g;markup=markup.replace(regexTag,function(match,endSlash,name){name=name.toUpperCase();var isEndOfInlineContainer=/^DIV|^TD|^TH|^P|^LI|^H[1-7]/.test(name)&&!!endSlash;var isBlockNode=/^BLOCKQUOTE|^TABLE|^TBODY|^TR|^HR|^UL|^OL/.test(name);return match+((isEndOfInlineContainer||isBlockNode)?'\n':'')});markup=$$1.trim(markup)}return markup}function posFromPlaceholder(placeholder){var $placeholder=$$1(placeholder);var pos=$placeholder.offset();var height=$placeholder.outerHeight(true);return{left:pos.left,top:pos.top+height}}function attachEvents($node,events){Object.keys(events).forEach(function(key){$node.on(key,events[key])})}function detachEvents($node,events){Object.keys(events).forEach(function(key){$node.off(key,events[key])})}function isCustomStyleTag(node){return node&&!isText(node)&&lists.contains(node.classList,'note-styletag')}var dom={NBSP_CHAR:NBSP_CHAR,ZERO_WIDTH_NBSP_CHAR:ZERO_WIDTH_NBSP_CHAR,blank:blankHTML,emptyPara:"<p>"+blankHTML+"</p>",makePredByNodeName:makePredByNodeName,isEditable:isEditable,isControlSizing:isControlSizing,isText:isText,isElement:isElement,isVoid:isVoid,isPara:isPara,isPurePara:isPurePara,isHeading:isHeading,isInline:isInline,isBlock:func.not(isInline),isBodyInline:isBodyInline,isBody:isBody,isParaInline:isParaInline,isPre:isPre,isList:isList,isTable:isTable,isData:isData,isCell:isCell,isBlockquote:isBlockquote,isBodyContainer:isBodyContainer,isAnchor:isAnchor,isDiv:makePredByNodeName('DIV'),isLi:isLi,isBR:makePredByNodeName('BR'),isSpan:makePredByNodeName('SPAN'),isB:makePredByNodeName('B'),isU:makePredByNodeName('U'),isS:makePredByNodeName('S'),isI:makePredByNodeName('I'),isImg:makePredByNodeName('IMG'),isTextarea:isTextarea,isEmpty:isEmpty$1,isEmptyAnchor:func.and(isAnchor,isEmpty$1),isClosestSibling:isClosestSibling,withClosestSiblings:withClosestSiblings,nodeLength:nodeLength,isLeftEdgePoint:isLeftEdgePoint,isRightEdgePoint:isRightEdgePoint,isEdgePoint:isEdgePoint,isLeftEdgeOf:isLeftEdgeOf,isRightEdgeOf:isRightEdgeOf,isLeftEdgePointOf:isLeftEdgePointOf,isRightEdgePointOf:isRightEdgePointOf,prevPoint:prevPoint,nextPoint:nextPoint,isSamePoint:isSamePoint,isVisiblePoint:isVisiblePoint,prevPointUntil:prevPointUntil,nextPointUntil:nextPointUntil,isCharPoint:isCharPoint,walkPoint:walkPoint,ancestor:ancestor,singleChildAncestor:singleChildAncestor,listAncestor:listAncestor,lastAncestor:lastAncestor,listNext:listNext,listPrev:listPrev,listDescendant:listDescendant,commonAncestor:commonAncestor,wrap:wrap,insertAfter:insertAfter,appendChildNodes:appendChildNodes,position:position,hasChildren:hasChildren,makeOffsetPath:makeOffsetPath,fromOffsetPath:fromOffsetPath,splitTree:splitTree,splitPoint:splitPoint,create:create,createText:createText,remove:remove,removeWhile:removeWhile,replace:replace,html:html,value:value,posFromPlaceholder:posFromPlaceholder,attachEvents:attachEvents,detachEvents:detachEvents,isCustomStyleTag:isCustomStyleTag};function textRangeToPoint(textRange,isStart){var container=textRange.parentElement();var offset;var tester=document.body.createTextRange();var prevContainer;var childNodes=lists.from(container.childNodes);for(offset=0;offset<childNodes.length;offset++){if(dom.isText(childNodes[offset])){continue}tester.moveToElementText(childNodes[offset]);if(tester.compareEndPoints('StartToStart',textRange)>=0){break}prevContainer=childNodes[offset]}if(offset!==0&&dom.isText(childNodes[offset-1])){var textRangeStart=document.body.createTextRange();var curTextNode=null;textRangeStart.moveToElementText(prevContainer||container);textRangeStart.collapse(!prevContainer);curTextNode=prevContainer?prevContainer.nextSibling:container.firstChild;var pointTester=textRange.duplicate();pointTester.setEndPoint('StartToStart',textRangeStart);var textCount=pointTester.text.replace(/[\r\n]/g,'').length;while(textCount>curTextNode.nodeValue.length&&curTextNode.nextSibling){textCount-=curTextNode.nodeValue.length;curTextNode=curTextNode.nextSibling}var dummy=curTextNode.nodeValue;if(isStart&&curTextNode.nextSibling&&dom.isText(curTextNode.nextSibling)&&textCount===curTextNode.nodeValue.length){textCount-=curTextNode.nodeValue.length;curTextNode=curTextNode.nextSibling}container=curTextNode;offset=textCount}return{cont:container,offset:offset}}function pointToTextRange(point){var textRangeInfo=function(container,offset){var node,isCollapseToStart;if(dom.isText(container)){var prevTextNodes=dom.listPrev(container,func.not(dom.isText));var prevContainer=lists.last(prevTextNodes).previousSibling;node=prevContainer||container.parentNode;offset+=lists.sum(lists.tail(prevTextNodes),dom.nodeLength);isCollapseToStart=!prevContainer}else{node=container.childNodes[offset]||container;if(dom.isText(node)){return textRangeInfo(node,0)}offset=0;isCollapseToStart=false}return{node:node,collapseToStart:isCollapseToStart,offset:offset}};var textRange=document.body.createTextRange();var info=textRangeInfo(point.node,point.offset);textRange.moveToElementText(info.node);textRange.collapse(info.collapseToStart);textRange.moveStart('character',info.offset);return textRange}var WrappedRange=(function(){function WrappedRange(sc,so,ec,eo){this.sc=sc;this.so=so;this.ec=ec;this.eo=eo;this.isOnEditable=this.makeIsOn(dom.isEditable);this.isOnList=this.makeIsOn(dom.isList);this.isOnAnchor=this.makeIsOn(dom.isAnchor);this.isOnCell=this.makeIsOn(dom.isCell);this.isOnData=this.makeIsOn(dom.isData)}WrappedRange.prototype.nativeRange=function(){if(env.isW3CRangeSupport){var w3cRange=document.createRange();w3cRange.setStart(this.sc,this.so);w3cRange.setEnd(this.ec,this.eo);return w3cRange}else{var textRange=pointToTextRange({node:this.sc,offset:this.so});textRange.setEndPoint('EndToEnd',pointToTextRange({node:this.ec,offset:this.eo}));return textRange}};WrappedRange.prototype.getPoints=function(){return{sc:this.sc,so:this.so,ec:this.ec,eo:this.eo}};WrappedRange.prototype.getStartPoint=function(){return{node:this.sc,offset:this.so}};WrappedRange.prototype.getEndPoint=function(){return{node:this.ec,offset:this.eo}};WrappedRange.prototype.select=function(){var nativeRng=this.nativeRange();if(env.isW3CRangeSupport){var selection=document.getSelection();if(selection.rangeCount>0){selection.removeAllRanges()}selection.addRange(nativeRng)}else{nativeRng.select()}return this};WrappedRange.prototype.scrollIntoView=function(container){var height=$$1(container).height();if(container.scrollTop+height<this.sc.offsetTop){container.scrollTop+=Math.abs(container.scrollTop+height-this.sc.offsetTop)}return this};WrappedRange.prototype.normalize=function(){var getVisiblePoint=function(point,isLeftToRight){if((dom.isVisiblePoint(point)&&!dom.isEdgePoint(point))||(dom.isVisiblePoint(point)&&dom.isRightEdgePoint(point)&&!isLeftToRight)||(dom.isVisiblePoint(point)&&dom.isLeftEdgePoint(point)&&isLeftToRight)||(dom.isVisiblePoint(point)&&dom.isBlock(point.node)&&dom.isEmpty(point.node))){return point}var block=dom.ancestor(point.node,dom.isBlock);if(((dom.isLeftEdgePointOf(point,block)||dom.isVoid(dom.prevPoint(point).node))&&!isLeftToRight)||((dom.isRightEdgePointOf(point,block)||dom.isVoid(dom.nextPoint(point).node))&&isLeftToRight)){if(dom.isVisiblePoint(point)){return point}isLeftToRight=!isLeftToRight}var nextPoint=isLeftToRight?dom.nextPointUntil(dom.nextPoint(point),dom.isVisiblePoint):dom.prevPointUntil(dom.prevPoint(point),dom.isVisiblePoint);return nextPoint||point};var endPoint=getVisiblePoint(this.getEndPoint(),false);var startPoint=this.isCollapsed()?endPoint:getVisiblePoint(this.getStartPoint(),true);return new WrappedRange(startPoint.node,startPoint.offset,endPoint.node,endPoint.offset)};WrappedRange.prototype.nodes=function(pred,options){pred=pred||func.ok;var includeAncestor=options&&options.includeAncestor;var fullyContains=options&&options.fullyContains;var startPoint=this.getStartPoint();var endPoint=this.getEndPoint();var nodes=[];var leftEdgeNodes=[];dom.walkPoint(startPoint,endPoint,function(point){if(dom.isEditable(point.node)){return}var node;if(fullyContains){if(dom.isLeftEdgePoint(point)){leftEdgeNodes.push(point.node)}if(dom.isRightEdgePoint(point)&&lists.contains(leftEdgeNodes,point.node)){node=point.node}}else if(includeAncestor){node=dom.ancestor(point.node,pred)}else{node=point.node}if(node&&pred(node)){nodes.push(node)}},true);return lists.unique(nodes)};WrappedRange.prototype.commonAncestor=function(){return dom.commonAncestor(this.sc,this.ec)};WrappedRange.prototype.expand=function(pred){var startAncestor=dom.ancestor(this.sc,pred);var endAncestor=dom.ancestor(this.ec,pred);if(!startAncestor&&!endAncestor){return new WrappedRange(this.sc,this.so,this.ec,this.eo)}var boundaryPoints=this.getPoints();if(startAncestor){boundaryPoints.sc=startAncestor;boundaryPoints.so=0}if(endAncestor){boundaryPoints.ec=endAncestor;boundaryPoints.eo=dom.nodeLength(endAncestor)}return new WrappedRange(boundaryPoints.sc,boundaryPoints.so,boundaryPoints.ec,boundaryPoints.eo)};WrappedRange.prototype.collapse=function(isCollapseToStart){if(isCollapseToStart){return new WrappedRange(this.sc,this.so,this.sc,this.so)}else{return new WrappedRange(this.ec,this.eo,this.ec,this.eo)}};WrappedRange.prototype.splitText=function(){var isSameContainer=this.sc===this.ec;var boundaryPoints=this.getPoints();if(dom.isText(this.ec)&&!dom.isEdgePoint(this.getEndPoint())){this.ec.splitText(this.eo)}if(dom.isText(this.sc)&&!dom.isEdgePoint(this.getStartPoint())){boundaryPoints.sc=this.sc.splitText(this.so);boundaryPoints.so=0;if(isSameContainer){boundaryPoints.ec=boundaryPoints.sc;boundaryPoints.eo=this.eo-this.so}}return new WrappedRange(boundaryPoints.sc,boundaryPoints.so,boundaryPoints.ec,boundaryPoints.eo)};WrappedRange.prototype.deleteContents=function(){if(this.isCollapsed()){return this}var rng=this.splitText();var nodes=rng.nodes(null,{fullyContains:true});var point=dom.prevPointUntil(rng.getStartPoint(),function(point){return!lists.contains(nodes,point.node)});var emptyParents=[];$$1.each(nodes,function(idx,node){var parent=node.parentNode;if(point.node!==parent&&dom.nodeLength(parent)===1){emptyParents.push(parent)}dom.remove(node,false)});$$1.each(emptyParents,function(idx,node){dom.remove(node,false)});return new WrappedRange(point.node,point.offset,point.node,point.offset).normalize()};WrappedRange.prototype.makeIsOn=function(pred){return function(){var ancestor=dom.ancestor(this.sc,pred);return!!ancestor&&(ancestor===dom.ancestor(this.ec,pred))}};WrappedRange.prototype.isLeftEdgeOf=function(pred){if(!dom.isLeftEdgePoint(this.getStartPoint())){return false}var node=dom.ancestor(this.sc,pred);return node&&dom.isLeftEdgeOf(this.sc,node)};WrappedRange.prototype.isCollapsed=function(){return this.sc===this.ec&&this.so===this.eo};WrappedRange.prototype.wrapBodyInlineWithPara=function(){if(dom.isBodyContainer(this.sc)&&dom.isEmpty(this.sc)){this.sc.innerHTML=dom.emptyPara;return new WrappedRange(this.sc.firstChild,0,this.sc.firstChild,0)}var rng=this.normalize();if(dom.isParaInline(this.sc)||dom.isPara(this.sc)){return rng}var topAncestor;if(dom.isInline(rng.sc)){var ancestors=dom.listAncestor(rng.sc,func.not(dom.isInline));topAncestor=lists.last(ancestors);if(!dom.isInline(topAncestor)){topAncestor=ancestors[ancestors.length-2]||rng.sc.childNodes[rng.so]}}else{topAncestor=rng.sc.childNodes[rng.so>0?rng.so-1:0]}var inlineSiblings=dom.listPrev(topAncestor,dom.isParaInline).reverse();inlineSiblings=inlineSiblings.concat(dom.listNext(topAncestor.nextSibling,dom.isParaInline));if(inlineSiblings.length){var para=dom.wrap(lists.head(inlineSiblings),'p');dom.appendChildNodes(para,lists.tail(inlineSiblings))}return this.normalize()};WrappedRange.prototype.insertNode=function(node){var rng=this.wrapBodyInlineWithPara().deleteContents();var info=dom.splitPoint(rng.getStartPoint(),dom.isInline(node));if(info.rightNode){info.rightNode.parentNode.insertBefore(node,info.rightNode)}else{info.container.appendChild(node)}return node};WrappedRange.prototype.pasteHTML=function(markup){var contentsContainer=$$1('<div></div>').html(markup)[0];var childNodes=lists.from(contentsContainer.childNodes);var rng=this.wrapBodyInlineWithPara().deleteContents();return childNodes.reverse().map(function(childNode){return rng.insertNode(childNode)}).reverse()};WrappedRange.prototype.toString=function(){var nativeRng=this.nativeRange();return env.isW3CRangeSupport?nativeRng.toString():nativeRng.text};WrappedRange.prototype.getWordRange=function(findAfter){var endPoint=this.getEndPoint();if(!dom.isCharPoint(endPoint)){return this}var startPoint=dom.prevPointUntil(endPoint,function(point){return!dom.isCharPoint(point)});if(findAfter){endPoint=dom.nextPointUntil(endPoint,function(point){return!dom.isCharPoint(point)})}return new WrappedRange(startPoint.node,startPoint.offset,endPoint.node,endPoint.offset)};WrappedRange.prototype.bookmark=function(editable){return{s:{path:dom.makeOffsetPath(editable,this.sc),offset:this.so},e:{path:dom.makeOffsetPath(editable,this.ec),offset:this.eo}}};WrappedRange.prototype.paraBookmark=function(paras){return{s:{path:lists.tail(dom.makeOffsetPath(lists.head(paras),this.sc)),offset:this.so},e:{path:lists.tail(dom.makeOffsetPath(lists.last(paras),this.ec)),offset:this.eo}}};WrappedRange.prototype.getClientRects=function(){var nativeRng=this.nativeRange();return nativeRng.getClientRects()};return WrappedRange}());var range={create:function(sc,so,ec,eo){if(arguments.length===4){return new WrappedRange(sc,so,ec,eo)}else if(arguments.length===2){ec=sc;eo=so;return new WrappedRange(sc,so,ec,eo)}else{var wrappedRange=this.createFromSelection();if(!wrappedRange&&arguments.length===1){wrappedRange=this.createFromNode(arguments[0]);return wrappedRange.collapse(dom.emptyPara===arguments[0].innerHTML)}return wrappedRange}},createFromSelection:function(){var sc,so,ec,eo;if(env.isW3CRangeSupport){var selection=document.getSelection();if(!selection||selection.rangeCount===0){return null}else if(dom.isBody(selection.anchorNode)){return null}var nativeRng=selection.getRangeAt(0);sc=nativeRng.startContainer;so=nativeRng.startOffset;ec=nativeRng.endContainer;eo=nativeRng.endOffset}else{var textRange=document.selection.createRange();var textRangeEnd=textRange.duplicate();textRangeEnd.collapse(false);var textRangeStart=textRange;textRangeStart.collapse(true);var startPoint=textRangeToPoint(textRangeStart,true);var endPoint=textRangeToPoint(textRangeEnd,false);if(dom.isText(startPoint.node)&&dom.isLeftEdgePoint(startPoint)&&dom.isTextNode(endPoint.node)&&dom.isRightEdgePoint(endPoint)&&endPoint.node.nextSibling===startPoint.node){startPoint=endPoint}sc=startPoint.cont;so=startPoint.offset;ec=endPoint.cont;eo=endPoint.offset}return new WrappedRange(sc,so,ec,eo)},createFromNode:function(node){var sc=node;var so=0;var ec=node;var eo=dom.nodeLength(ec);if(dom.isVoid(sc)){so=dom.listPrev(sc).length-1;sc=sc.parentNode}if(dom.isBR(ec)){eo=dom.listPrev(ec).length-1;ec=ec.parentNode}else if(dom.isVoid(ec)){eo=dom.listPrev(ec).length;ec=ec.parentNode}return this.create(sc,so,ec,eo)},createFromNodeBefore:function(node){return this.createFromNode(node).collapse(true)},createFromNodeAfter:function(node){return this.createFromNode(node).collapse()},createFromBookmark:function(editable,bookmark){var sc=dom.fromOffsetPath(editable,bookmark.s.path);var so=bookmark.s.offset;var ec=dom.fromOffsetPath(editable,bookmark.e.path);var eo=bookmark.e.offset;return new WrappedRange(sc,so,ec,eo)},createFromParaBookmark:function(bookmark,paras){var so=bookmark.s.offset;var eo=bookmark.e.offset;var sc=dom.fromOffsetPath(lists.head(paras),bookmark.s.path);var ec=dom.fromOffsetPath(lists.last(paras),bookmark.e.path);return new WrappedRange(sc,so,ec,eo)}};function readFileAsDataURL(file){return $$1.Deferred(function(deferred){$$1.extend(new FileReader(),{onload:function(e){var dataURL=e.target.result;deferred.resolve(dataURL)},onerror:function(err){deferred.reject(err)}}).readAsDataURL(file)}).promise()}function createImage(url){return $$1.Deferred(function(deferred){var $img=$$1('<img>');$img.one('load',function(){$img.off('error abort');deferred.resolve($img)}).one('error abort',function(){$img.off('load').detach();deferred.reject($img)}).css({display:'none'}).appendTo(document.body).attr('src',url)}).promise()}var History=(function(){function History($editable){this.stack=[];this.stackOffset=-1;this.$editable=$editable;this.editable=$editable[0]}History.prototype.makeSnapshot=function(){var rng=range.create(this.editable);var emptyBookmark={s:{path:[],offset:0},e:{path:[],offset:0}};return{contents:this.$editable.html(),bookmark:(rng?rng.bookmark(this.editable):emptyBookmark)}};History.prototype.applySnapshot=function(snapshot){if(snapshot.contents!==null){this.$editable.html(snapshot.contents)}if(snapshot.bookmark!==null){range.createFromBookmark(this.editable,snapshot.bookmark).select()}};History.prototype.rewind=function(){if(this.$editable.html()!==this.stack[this.stackOffset].contents){this.recordUndo()}this.stackOffset=0;this.applySnapshot(this.stack[this.stackOffset])};History.prototype.reset=function(){this.stack=[];this.stackOffset=-1;this.$editable.html('');this.recordUndo()};History.prototype.undo=function(){if(this.$editable.html()!==this.stack[this.stackOffset].contents){this.recordUndo()}if(this.stackOffset>0){this.stackOffset--;this.applySnapshot(this.stack[this.stackOffset])}};History.prototype.redo=function(){if(this.stack.length-1>this.stackOffset){this.stackOffset++;this.applySnapshot(this.stack[this.stackOffset])}};History.prototype.recordUndo=function(){this.stackOffset++;if(this.stack.length>this.stackOffset){this.stack=this.stack.slice(0,this.stackOffset)}this.stack.push(this.makeSnapshot())};return History}());var Style=(function(){function Style(){}Style.prototype.jQueryCSS=function($obj,propertyNames){if(env.jqueryVersion<1.9){var result_1={};$$1.each(propertyNames,function(idx,propertyName){result_1[propertyName]=$obj.css(propertyName)});return result_1}return $obj.css(propertyNames)};Style.prototype.fromNode=function($node){var properties=['font-family','font-size','text-align','list-style-type','line-height'];var styleInfo=this.jQueryCSS($node,properties)||{};styleInfo['font-size']=parseInt(styleInfo['font-size'],10);return styleInfo};Style.prototype.stylePara=function(rng,styleInfo){$$1.each(rng.nodes(dom.isPara,{includeAncestor:true}),function(idx,para){$$1(para).css(styleInfo)})};Style.prototype.styleNodes=function(rng,options){rng=rng.splitText();var nodeName=(options&&options.nodeName)||'SPAN';var expandClosestSibling=!!(options&&options.expandClosestSibling);var onlyPartialContains=!!(options&&options.onlyPartialContains);if(rng.isCollapsed()){return[rng.insertNode(dom.create(nodeName))]}var pred=dom.makePredByNodeName(nodeName);var nodes=rng.nodes(dom.isText,{fullyContains:true}).map(function(text){return dom.singleChildAncestor(text,pred)||dom.wrap(text,nodeName)});if(expandClosestSibling){if(onlyPartialContains){var nodesInRange_1=rng.nodes();pred=func.and(pred,function(node){return lists.contains(nodesInRange_1,node)})}return nodes.map(function(node){var siblings=dom.withClosestSiblings(node,pred);var head=lists.head(siblings);var tails=lists.tail(siblings);$$1.each(tails,function(idx,elem){dom.appendChildNodes(head,elem.childNodes);dom.remove(elem)});return lists.head(siblings)})}else{return nodes}};Style.prototype.current=function(rng){var $cont=$$1(!dom.isElement(rng.sc)?rng.sc.parentNode:rng.sc);var styleInfo=this.fromNode($cont);try{styleInfo=$$1.extend(styleInfo,{'font-bold':document.queryCommandState('bold')?'bold':'normal','font-italic':document.queryCommandState('italic')?'italic':'normal','font-underline':document.queryCommandState('underline')?'underline':'normal','font-subscript':document.queryCommandState('subscript')?'subscript':'normal','font-superscript':document.queryCommandState('superscript')?'superscript':'normal','font-strikethrough':document.queryCommandState('strikethrough')?'strikethrough':'normal','font-family':document.queryCommandValue('fontname')||styleInfo['font-family']})}catch(e){}if(!rng.isOnList()){styleInfo['list-style']='none'}else{var orderedTypes=['circle','disc','disc-leading-zero','square'];var isUnordered=$$1.inArray(styleInfo['list-style-type'],orderedTypes)>-1;styleInfo['list-style']=isUnordered?'unordered':'ordered'}var para=dom.ancestor(rng.sc,dom.isPara);if(para&&para.style['line-height']){styleInfo['line-height']=para.style.lineHeight}else{var lineHeight=parseInt(styleInfo['line-height'],10)/parseInt(styleInfo['font-size'],10);styleInfo['line-height']=lineHeight.toFixed(1)}styleInfo.anchor=rng.isOnAnchor()&&dom.ancestor(rng.sc,dom.isAnchor);styleInfo.ancestors=dom.listAncestor(rng.sc,dom.isEditable);styleInfo.range=rng;return styleInfo};return Style}());var Bullet=(function(){function Bullet(){}Bullet.prototype.insertOrderedList=function(editable){this.toggleList('OL',editable)};Bullet.prototype.insertUnorderedList=function(editable){this.toggleList('UL',editable)};Bullet.prototype.indent=function(editable){var _this=this;var rng=range.create(editable).wrapBodyInlineWithPara();var paras=rng.nodes(dom.isPara,{includeAncestor:true});var clustereds=lists.clusterBy(paras,func.peq2('parentNode'));$$1.each(clustereds,function(idx,paras){var head=lists.head(paras);if(dom.isLi(head)){_this.wrapList(paras,head.parentNode.nodeName)}else{$$1.each(paras,function(idx,para){$$1(para).css('marginLeft',function(idx,val){return(parseInt(val,10)||0)+25})})}});rng.select()};Bullet.prototype.outdent=function(editable){var _this=this;var rng=range.create(editable).wrapBodyInlineWithPara();var paras=rng.nodes(dom.isPara,{includeAncestor:true});var clustereds=lists.clusterBy(paras,func.peq2('parentNode'));$$1.each(clustereds,function(idx,paras){var head=lists.head(paras);if(dom.isLi(head)){_this.releaseList([paras])}else{$$1.each(paras,function(idx,para){$$1(para).css('marginLeft',function(idx,val){val=(parseInt(val,10)||0);return val>25?val-25:''})})}});rng.select()};Bullet.prototype.toggleList=function(listName,editable){var _this=this;var rng=range.create(editable).wrapBodyInlineWithPara();var paras=rng.nodes(dom.isPara,{includeAncestor:true});var bookmark=rng.paraBookmark(paras);var clustereds=lists.clusterBy(paras,func.peq2('parentNode'));if(lists.find(paras,dom.isPurePara)){var wrappedParas_1=[];$$1.each(clustereds,function(idx,paras){wrappedParas_1=wrappedParas_1.concat(_this.wrapList(paras,listName))});paras=wrappedParas_1}else{var diffLists=rng.nodes(dom.isList,{includeAncestor:true}).filter(function(listNode){return!$$1.nodeName(listNode,listName)});if(diffLists.length){$$1.each(diffLists,function(idx,listNode){dom.replace(listNode,listName)})}else{paras=this.releaseList(clustereds,true)}}range.createFromParaBookmark(bookmark,paras).select()};Bullet.prototype.wrapList=function(paras,listName){var head=lists.head(paras);var last=lists.last(paras);var prevList=dom.isList(head.previousSibling)&&head.previousSibling;var nextList=dom.isList(last.nextSibling)&&last.nextSibling;var listNode=prevList||dom.insertAfter(dom.create(listName||'UL'),last);paras=paras.map(function(para){return dom.isPurePara(para)?dom.replace(para,'LI'):para});dom.appendChildNodes(listNode,paras);if(nextList){dom.appendChildNodes(listNode,lists.from(nextList.childNodes));dom.remove(nextList)}return paras};Bullet.prototype.releaseList=function(clustereds,isEscapseToBody){var releasedParas=[];$$1.each(clustereds,function(idx,paras){var head=lists.head(paras);var last=lists.last(paras);var headList=isEscapseToBody?dom.lastAncestor(head,dom.isList):head.parentNode;var lastList=headList.childNodes.length>1?dom.splitTree(headList,{node:last.parentNode,offset:dom.position(last)+1},{isSkipPaddingBlankHTML:true}):null;var middleList=dom.splitTree(headList,{node:head.parentNode,offset:dom.position(head)},{isSkipPaddingBlankHTML:true});paras=isEscapseToBody?dom.listDescendant(middleList,dom.isLi):lists.from(middleList.childNodes).filter(dom.isLi);if(isEscapseToBody||!dom.isList(headList.parentNode)){paras=paras.map(function(para){return dom.replace(para,'P')})}$$1.each(lists.from(paras).reverse(),function(idx,para){dom.insertAfter(para,headList)});var rootLists=lists.compact([headList,middleList,lastList]);$$1.each(rootLists,function(idx,rootList){var listNodes=[rootList].concat(dom.listDescendant(rootList,dom.isList));$$1.each(listNodes.reverse(),function(idx,listNode){if(!dom.nodeLength(listNode)){dom.remove(listNode,true)}})});releasedParas=releasedParas.concat(paras)});return releasedParas};return Bullet}());var Typing=(function(){function Typing(){this.bullet=new Bullet()}Typing.prototype.insertTab=function(rng,tabsize){var tab=dom.createText(new Array(tabsize+1).join(dom.NBSP_CHAR));rng=rng.deleteContents();rng.insertNode(tab,true);rng=range.create(tab,tabsize);rng.select()};Typing.prototype.insertParagraph=function(editable){var rng=range.create(editable);rng=rng.deleteContents();rng=rng.wrapBodyInlineWithPara();var splitRoot=dom.ancestor(rng.sc,dom.isPara);var nextPara;if(splitRoot){if(dom.isEmpty(splitRoot)&&dom.isLi(splitRoot)){this.bullet.toggleList(splitRoot.parentNode.nodeName);return}else if(dom.isEmpty(splitRoot)&&dom.isPara(splitRoot)&&dom.isBlockquote(splitRoot.parentNode)){dom.insertAfter(splitRoot,splitRoot.parentNode);nextPara=splitRoot}else{nextPara=dom.splitTree(splitRoot,rng.getStartPoint());var emptyAnchors=dom.listDescendant(splitRoot,dom.isEmptyAnchor);emptyAnchors=emptyAnchors.concat(dom.listDescendant(nextPara,dom.isEmptyAnchor));$$1.each(emptyAnchors,function(idx,anchor){dom.remove(anchor)});if((dom.isHeading(nextPara)||dom.isPre(nextPara)||dom.isCustomStyleTag(nextPara))&&dom.isEmpty(nextPara)){nextPara=dom.replace(nextPara,'p')}}}else{var next=rng.sc.childNodes[rng.so];nextPara=$$1(dom.emptyPara)[0];if(next){rng.sc.insertBefore(nextPara,next)}else{rng.sc.appendChild(nextPara)}}range.create(nextPara,0).normalize().select().scrollIntoView(editable)};return Typing}());var TableResultAction=function(startPoint,where,action,domTable){var _startPoint={'colPos':0,'rowPos':0};var _virtualTable=[];var _actionCellList=[];function setStartPoint(){if(!startPoint||!startPoint.tagName||(startPoint.tagName.toLowerCase()!=='td'&&startPoint.tagName.toLowerCase()!=='th')){console.error('Impossible to identify start Cell point.',startPoint);return}_startPoint.colPos=startPoint.cellIndex;if(!startPoint.parentElement||!startPoint.parentElement.tagName||startPoint.parentElement.tagName.toLowerCase()!=='tr'){console.error('Impossible to identify start Row point.',startPoint);return}_startPoint.rowPos=startPoint.parentElement.rowIndex}function setVirtualTablePosition(rowIndex,cellIndex,baseRow,baseCell,isRowSpan,isColSpan,isVirtualCell){var objPosition={'baseRow':baseRow,'baseCell':baseCell,'isRowSpan':isRowSpan,'isColSpan':isColSpan,'isVirtual':isVirtualCell};if(!_virtualTable[rowIndex]){_virtualTable[rowIndex]=[]}_virtualTable[rowIndex][cellIndex]=objPosition}function getActionCell(virtualTableCellObj,resultAction,virtualRowPosition,virtualColPosition){return{'baseCell':virtualTableCellObj.baseCell,'action':resultAction,'virtualTable':{'rowIndex':virtualRowPosition,'cellIndex':virtualColPosition}}}function recoverCellIndex(rowIndex,cellIndex){if(!_virtualTable[rowIndex]){return cellIndex}if(!_virtualTable[rowIndex][cellIndex]){return cellIndex}var newCellIndex=cellIndex;while(_virtualTable[rowIndex][newCellIndex]){newCellIndex++;if(!_virtualTable[rowIndex][newCellIndex]){return newCellIndex}}}function addCellInfoToVirtual(row,cell){var cellIndex=recoverCellIndex(row.rowIndex,cell.cellIndex);var cellHasColspan=(cell.colSpan>1);var cellHasRowspan=(cell.rowSpan>1);var isThisSelectedCell=(row.rowIndex===_startPoint.rowPos&&cell.cellIndex===_startPoint.colPos);setVirtualTablePosition(row.rowIndex,cellIndex,row,cell,cellHasRowspan,cellHasColspan,false);var rowspanNumber=cell.attributes.rowSpan?parseInt(cell.attributes.rowSpan.value,10):0;if(rowspanNumber>1){for(var rp=1;rp<rowspanNumber;rp++){var rowspanIndex=row.rowIndex+rp;adjustStartPoint(rowspanIndex,cellIndex,cell,isThisSelectedCell);setVirtualTablePosition(rowspanIndex,cellIndex,row,cell,true,cellHasColspan,true)}}var colspanNumber=cell.attributes.colSpan?parseInt(cell.attributes.colSpan.value,10):0;if(colspanNumber>1){for(var cp=1;cp<colspanNumber;cp++){var cellspanIndex=recoverCellIndex(row.rowIndex,(cellIndex+cp));adjustStartPoint(row.rowIndex,cellspanIndex,cell,isThisSelectedCell);setVirtualTablePosition(row.rowIndex,cellspanIndex,row,cell,cellHasRowspan,true,true)}}}function adjustStartPoint(rowIndex,cellIndex,cell,isSelectedCell){if(rowIndex===_startPoint.rowPos&&_startPoint.colPos>=cell.cellIndex&&cell.cellIndex<=cellIndex&&!isSelectedCell){_startPoint.colPos++}}function createVirtualTable(){var rows=domTable.rows;for(var rowIndex=0;rowIndex<rows.length;rowIndex++){var cells=rows[rowIndex].cells;for(var cellIndex=0;cellIndex<cells.length;cellIndex++){addCellInfoToVirtual(rows[rowIndex],cells[cellIndex])}}}function getDeleteResultActionToCell(cell){switch(where){case TableResultAction.where.Column:if(cell.isColSpan){return TableResultAction.resultAction.SubtractSpanCount}break;case TableResultAction.where.Row:if(!cell.isVirtual&&cell.isRowSpan){return TableResultAction.resultAction.AddCell}else if(cell.isRowSpan){return TableResultAction.resultAction.SubtractSpanCount}break}return TableResultAction.resultAction.RemoveCell}function getAddResultActionToCell(cell){switch(where){case TableResultAction.where.Column:if(cell.isColSpan){return TableResultAction.resultAction.SumSpanCount}else if(cell.isRowSpan&&cell.isVirtual){return TableResultAction.resultAction.Ignore}break;case TableResultAction.where.Row:if(cell.isRowSpan){return TableResultAction.resultAction.SumSpanCount}else if(cell.isColSpan&&cell.isVirtual){return TableResultAction.resultAction.Ignore}break}return TableResultAction.resultAction.AddCell}function init(){setStartPoint();createVirtualTable()}this.getActionList=function(){var fixedRow=(where===TableResultAction.where.Row)?_startPoint.rowPos:-1;var fixedCol=(where===TableResultAction.where.Column)?_startPoint.colPos:-1;var actualPosition=0;var canContinue=true;while(canContinue){var rowPosition=(fixedRow>=0)?fixedRow:actualPosition;var colPosition=(fixedCol>=0)?fixedCol:actualPosition;var row=_virtualTable[rowPosition];if(!row){canContinue=false;return _actionCellList}var cell=row[colPosition];if(!cell){canContinue=false;return _actionCellList}var resultAction=TableResultAction.resultAction.Ignore;switch(action){case TableResultAction.requestAction.Add:resultAction=getAddResultActionToCell(cell);break;case TableResultAction.requestAction.Delete:resultAction=getDeleteResultActionToCell(cell);break}_actionCellList.push(getActionCell(cell,resultAction,rowPosition,colPosition));actualPosition++}return _actionCellList};init()};TableResultAction.where={'Row':0,'Column':1};TableResultAction.requestAction={'Add':0,'Delete':1};TableResultAction.resultAction={'Ignore':0,'SubtractSpanCount':1,'RemoveCell':2,'AddCell':3,'SumSpanCount':4};var Table=(function(){function Table(){}Table.prototype.tab=function(rng,isShift){var cell=dom.ancestor(rng.commonAncestor(),dom.isCell);var table=dom.ancestor(cell,dom.isTable);var cells=dom.listDescendant(table,dom.isCell);var nextCell=lists[isShift?'prev':'next'](cells,cell);if(nextCell){range.create(nextCell,0).select()}};Table.prototype.addRow=function(rng,position){var cell=dom.ancestor(rng.commonAncestor(),dom.isCell);var currentTr=$$1(cell).closest('tr');var trAttributes=this.recoverAttributes(currentTr);var html=$$1('<tr'+trAttributes+'></tr>');var vTable=new TableResultAction(cell,TableResultAction.where.Row,TableResultAction.requestAction.Add,$$1(currentTr).closest('table')[0]);var actions=vTable.getActionList();for(var idCell=0;idCell<actions.length;idCell++){var currentCell=actions[idCell];var tdAttributes=this.recoverAttributes(currentCell.baseCell);switch(currentCell.action){case TableResultAction.resultAction.AddCell:html.append('<td'+tdAttributes+'>'+dom.blank+'</td>');break;case TableResultAction.resultAction.SumSpanCount:if(position==='top'){var baseCellTr=currentCell.baseCell.parent;var isTopFromRowSpan=(!baseCellTr?0:currentCell.baseCell.closest('tr').rowIndex)<=currentTr[0].rowIndex;if(isTopFromRowSpan){var newTd=$$1('<div></div>').append($$1('<td'+tdAttributes+'>'+dom.blank+'</td>').removeAttr('rowspan')).html();html.append(newTd);break}}var rowspanNumber=parseInt(currentCell.baseCell.rowSpan,10);rowspanNumber++;currentCell.baseCell.setAttribute('rowSpan',rowspanNumber);break}}if(position==='top'){currentTr.before(html)}else{var cellHasRowspan=(cell.rowSpan>1);if(cellHasRowspan){var lastTrIndex=currentTr[0].rowIndex+(cell.rowSpan-2);$$1($$1(currentTr).parent().find('tr')[lastTrIndex]).after($$1(html));return}currentTr.after(html)}};Table.prototype.addCol=function(rng,position){var cell=dom.ancestor(rng.commonAncestor(),dom.isCell);var row=$$1(cell).closest('tr');var rowsGroup=$$1(row).siblings();rowsGroup.push(row);var vTable=new TableResultAction(cell,TableResultAction.where.Column,TableResultAction.requestAction.Add,$$1(row).closest('table')[0]);var actions=vTable.getActionList();for(var actionIndex=0;actionIndex<actions.length;actionIndex++){var currentCell=actions[actionIndex];var tdAttributes=this.recoverAttributes(currentCell.baseCell);switch(currentCell.action){case TableResultAction.resultAction.AddCell:if(position==='right'){$$1(currentCell.baseCell).after('<td'+tdAttributes+'>'+dom.blank+'</td>')}else{$$1(currentCell.baseCell).before('<td'+tdAttributes+'>'+dom.blank+'</td>')}break;case TableResultAction.resultAction.SumSpanCount:if(position==='right'){var colspanNumber=parseInt(currentCell.baseCell.colSpan,10);colspanNumber++;currentCell.baseCell.setAttribute('colSpan',colspanNumber)}else{$$1(currentCell.baseCell).before('<td'+tdAttributes+'>'+dom.blank+'</td>')}break}}};Table.prototype.recoverAttributes=function(el){var resultStr='';if(!el){return resultStr}var attrList=el.attributes||[];for(var i=0;i<attrList.length;i++){if(attrList[i].name.toLowerCase()==='id'){continue}if(attrList[i].specified){resultStr+=' '+attrList[i].name+'=\''+attrList[i].value+'\''}}return resultStr};Table.prototype.deleteRow=function(rng){var cell=dom.ancestor(rng.commonAncestor(),dom.isCell);var row=$$1(cell).closest('tr');var cellPos=row.children('td, th').index($$1(cell));var rowPos=row[0].rowIndex;var vTable=new TableResultAction(cell,TableResultAction.where.Row,TableResultAction.requestAction.Delete,$$1(row).closest('table')[0]);var actions=vTable.getActionList();for(var actionIndex=0;actionIndex<actions.length;actionIndex++){if(!actions[actionIndex]){continue}var baseCell=actions[actionIndex].baseCell;var virtualPosition=actions[actionIndex].virtualTable;var hasRowspan=(baseCell.rowSpan&&baseCell.rowSpan>1);var rowspanNumber=(hasRowspan)?parseInt(baseCell.rowSpan,10):0;switch(actions[actionIndex].action){case TableResultAction.resultAction.Ignore:continue;case TableResultAction.resultAction.AddCell:var nextRow=row.next('tr')[0];if(!nextRow){continue}var cloneRow=row[0].cells[cellPos];if(hasRowspan){if(rowspanNumber>2){rowspanNumber--;nextRow.insertBefore(cloneRow,nextRow.cells[cellPos]);nextRow.cells[cellPos].setAttribute('rowSpan',rowspanNumber);nextRow.cells[cellPos].innerHTML=''}else if(rowspanNumber===2){nextRow.insertBefore(cloneRow,nextRow.cells[cellPos]);nextRow.cells[cellPos].removeAttribute('rowSpan');nextRow.cells[cellPos].innerHTML=''}}continue;case TableResultAction.resultAction.SubtractSpanCount:if(hasRowspan){if(rowspanNumber>2){rowspanNumber--;baseCell.setAttribute('rowSpan',rowspanNumber);if(virtualPosition.rowIndex!==rowPos&&baseCell.cellIndex===cellPos){baseCell.innerHTML=''}}else if(rowspanNumber===2){baseCell.removeAttribute('rowSpan');if(virtualPosition.rowIndex!==rowPos&&baseCell.cellIndex===cellPos){baseCell.innerHTML=''}}}continue;case TableResultAction.resultAction.RemoveCell:continue}}row.remove()};Table.prototype.deleteCol=function(rng){var cell=dom.ancestor(rng.commonAncestor(),dom.isCell);var row=$$1(cell).closest('tr');var cellPos=row.children('td, th').index($$1(cell));var vTable=new TableResultAction(cell,TableResultAction.where.Column,TableResultAction.requestAction.Delete,$$1(row).closest('table')[0]);var actions=vTable.getActionList();for(var actionIndex=0;actionIndex<actions.length;actionIndex++){if(!actions[actionIndex]){continue}switch(actions[actionIndex].action){case TableResultAction.resultAction.Ignore:continue;case TableResultAction.resultAction.SubtractSpanCount:var baseCell=actions[actionIndex].baseCell;var hasColspan=(baseCell.colSpan&&baseCell.colSpan>1);if(hasColspan){var colspanNumber=(baseCell.colSpan)?parseInt(baseCell.colSpan,10):0;if(colspanNumber>2){colspanNumber--;baseCell.setAttribute('colSpan',colspanNumber);if(baseCell.cellIndex===cellPos){baseCell.innerHTML=''}}else if(colspanNumber===2){baseCell.removeAttribute('colSpan');if(baseCell.cellIndex===cellPos){baseCell.innerHTML=''}}}continue;case TableResultAction.resultAction.RemoveCell:dom.remove(actions[actionIndex].baseCell,true);continue}}};Table.prototype.createTable=function(colCount,rowCount,options){var tds=[];var tdHTML;for(var idxCol=0;idxCol<colCount;idxCol++){tds.push('<td>'+dom.blank+'</td>')}tdHTML=tds.join('');var trs=[];var trHTML;for(var idxRow=0;idxRow<rowCount;idxRow++){trs.push('<tr>'+tdHTML+'</tr>')}trHTML=trs.join('');var $table=$$1('<table>'+trHTML+'</table>');if(options&&options.tableClassName){$table.addClass(options.tableClassName)}return $table[0]};Table.prototype.deleteTable=function(rng){var cell=dom.ancestor(rng.commonAncestor(),dom.isCell);$$1(cell).closest('table').remove()};return Table}());var KEY_BOGUS='bogus';var Editor=(function(){function Editor(context){var _this=this;this.context=context;this.$note=context.layoutInfo.note;this.$editor=context.layoutInfo.editor;this.$editable=context.layoutInfo.editable;this.options=context.options;this.lang=this.options.langInfo;this.editable=this.$editable[0];this.lastRange=null;this.style=new Style();this.table=new Table();this.typing=new Typing();this.bullet=new Bullet();this.history=new History(this.$editable);this.context.memo('help.undo',this.lang.help.undo);this.context.memo('help.redo',this.lang.help.redo);this.context.memo('help.tab',this.lang.help.tab);this.context.memo('help.untab',this.lang.help.untab);this.context.memo('help.insertParagraph',this.lang.help.insertParagraph);this.context.memo('help.insertOrderedList',this.lang.help.insertOrderedList);this.context.memo('help.insertUnorderedList',this.lang.help.insertUnorderedList);this.context.memo('help.indent',this.lang.help.indent);this.context.memo('help.outdent',this.lang.help.outdent);this.context.memo('help.formatPara',this.lang.help.formatPara);this.context.memo('help.insertHorizontalRule',this.lang.help.insertHorizontalRule);this.context.memo('help.fontName',this.lang.help.fontName);var commands=['bold','italic','underline','strikethrough','superscript','subscript','justifyLeft','justifyCenter','justifyRight','justifyFull','formatBlock','removeFormat','backColor'];for(var idx=0,len=commands.length;idx<len;idx++){this[commands[idx]]=(function(sCmd){return function(value){_this.beforeCommand();document.execCommand(sCmd,false,value);_this.afterCommand(true)}})(commands[idx]);this.context.memo('help.'+commands[idx],this.lang.help[commands[idx]])}this.fontName=this.wrapCommand(function(value){return _this.fontStyling('font-family',"\'"+value+"\'")});this.fontSize=this.wrapCommand(function(value){return _this.fontStyling('font-size',value+'px')});for(var idx=1;idx<=6;idx++){this['formatH'+idx]=(function(idx){return function(){_this.formatBlock('H'+idx)}})(idx);this.context.memo('help.formatH'+idx,this.lang.help['formatH'+idx])}this.insertParagraph=this.wrapCommand(function(){_this.typing.insertParagraph(_this.editable)});this.insertOrderedList=this.wrapCommand(function(){_this.bullet.insertOrderedList(_this.editable)});this.insertUnorderedList=this.wrapCommand(function(){_this.bullet.insertUnorderedList(_this.editable)});this.indent=this.wrapCommand(function(){_this.bullet.indent(_this.editable)});this.outdent=this.wrapCommand(function(){_this.bullet.outdent(_this.editable)});this.insertNode=this.wrapCommand(function(node){if(_this.isLimited($$1(node).text().length)){return}var rng=_this.createRange();rng.insertNode(node);range.createFromNodeAfter(node).select()});this.insertText=this.wrapCommand(function(text){if(_this.isLimited(text.length)){return}var rng=_this.createRange();var textNode=rng.insertNode(dom.createText(text));range.create(textNode,dom.nodeLength(textNode)).select()});this.pasteHTML=this.wrapCommand(function(markup){if(_this.isLimited(markup.length)){return}var contents=_this.createRange().pasteHTML(markup);range.createFromNodeAfter(lists.last(contents)).select()});this.formatBlock=this.wrapCommand(function(tagName,$target){var onApplyCustomStyle=_this.options.callbacks.onApplyCustomStyle;if(onApplyCustomStyle){onApplyCustomStyle.call(_this,$target,_this.context,_this.onFormatBlock)}else{_this.onFormatBlock(tagName,$target)}});this.insertHorizontalRule=this.wrapCommand(function(){var hrNode=_this.createRange().insertNode(dom.create('HR'));if(hrNode.nextSibling){range.create(hrNode.nextSibling,0).normalize().select()}});this.lineHeight=this.wrapCommand(function(value){_this.style.stylePara(_this.createRange(),{lineHeight:value})});this.createLink=this.wrapCommand(function(linkInfo){var linkUrl=linkInfo.url;var linkText=linkInfo.text;var isNewWindow=linkInfo.isNewWindow;var rng=linkInfo.range||_this.createRange();var isTextChanged=rng.toString()!==linkText;if(typeof linkUrl==='string'){linkUrl=linkUrl.trim()}if(_this.options.onCreateLink){linkUrl=_this.options.onCreateLink(linkUrl)}else{linkUrl=/^[A-Za-z][A-Za-z0-9+-.]*\:[\/\/]?/.test(linkUrl)?linkUrl:'http://'+linkUrl}var anchors=[];if(isTextChanged){rng=rng.deleteContents();var anchor=rng.insertNode($$1('<A>'+linkText+'</A>')[0]);anchors.push(anchor)}else{anchors=_this.style.styleNodes(rng,{nodeName:'A',expandClosestSibling:true,onlyPartialContains:true})}$$1.each(anchors,function(idx,anchor){$$1(anchor).attr('href',linkUrl);if(isNewWindow){$$1(anchor).attr('target','_blank')}else{$$1(anchor).removeAttr('target')}});var startRange=range.createFromNodeBefore(lists.head(anchors));var startPoint=startRange.getStartPoint();var endRange=range.createFromNodeAfter(lists.last(anchors));var endPoint=endRange.getEndPoint();range.create(startPoint.node,startPoint.offset,endPoint.node,endPoint.offset).select()});this.color=this.wrapCommand(function(colorInfo){var foreColor=colorInfo.foreColor;var backColor=colorInfo.backColor;if(foreColor){document.execCommand('foreColor',false,foreColor)}if(backColor){document.execCommand('backColor',false,backColor)}});this.foreColor=this.wrapCommand(function(colorInfo){document.execCommand('styleWithCSS',false,true);document.execCommand('foreColor',false,colorInfo)});this.insertTable=this.wrapCommand(function(dim){var dimension=dim.split('x');var rng=_this.createRange().deleteContents();rng.insertNode(_this.table.createTable(dimension[0],dimension[1],_this.options))});this.removeMedia=this.wrapCommand(function(){var $target=$$1(_this.restoreTarget()).parent();if($target.parent('figure').length){$target.parent('figure').remove()}else{$target=$$1(_this.restoreTarget()).detach()}_this.context.triggerEvent('media.delete',$target,_this.$editable)});this.floatMe=this.wrapCommand(function(value){var $target=$$1(_this.restoreTarget());$target.toggleClass('note-float-left',value==='left');$target.toggleClass('note-float-right',value==='right');$target.css('float',value)});this.resize=this.wrapCommand(function(value){var $target=$$1(_this.restoreTarget());$target.css({width:value*100+'%',height:''})})}Editor.prototype.initialize=function(){var _this=this;this.$editable.on('keydown',function(event){if(event.keyCode===key.code.ENTER){_this.context.triggerEvent('enter',event)}_this.context.triggerEvent('keydown',event);if(!event.isDefaultPrevented()){if(_this.options.shortcuts){_this.handleKeyMap(event)}else{_this.preventDefaultEditableShortCuts(event)}}if(_this.isLimited(1,event)){return false}}).on('keyup',function(event){_this.context.triggerEvent('keyup',event)}).on('focus',function(event){_this.context.triggerEvent('focus',event)}).on('blur',function(event){_this.context.triggerEvent('blur',event)}).on('mousedown',function(event){_this.context.triggerEvent('mousedown',event)}).on('mouseup',function(event){_this.context.triggerEvent('mouseup',event)}).on('scroll',function(event){_this.context.triggerEvent('scroll',event)}).on('paste',function(event){_this.context.triggerEvent('paste',event)});this.$editable.html(dom.html(this.$note)||dom.emptyPara);this.$editable.on(env.inputEventName,func.debounce(function(){_this.context.triggerEvent('change',_this.$editable.html())},100));this.$editor.on('focusin',function(event){_this.context.triggerEvent('focusin',event)}).on('focusout',function(event){_this.context.triggerEvent('focusout',event)});if(!this.options.airMode){if(this.options.width){this.$editor.outerWidth(this.options.width)}if(this.options.height){this.$editable.outerHeight(this.options.height)}if(this.options.maxHeight){this.$editable.css('max-height',this.options.maxHeight)}if(this.options.minHeight){this.$editable.css('min-height',this.options.minHeight)}}this.history.recordUndo()};Editor.prototype.destroy=function(){this.$editable.off()};Editor.prototype.handleKeyMap=function(event){var keyMap=this.options.keyMap[env.isMac?'mac':'pc'];var keys=[];if(event.metaKey){keys.push('CMD')}if(event.ctrlKey&&!event.altKey){keys.push('CTRL')}if(event.shiftKey){keys.push('SHIFT')}var keyName=key.nameFromCode[event.keyCode];if(keyName){keys.push(keyName)}var eventName=keyMap[keys.join('+')];if(eventName){if(this.context.invoke(eventName)!==false){event.preventDefault()}}else if(key.isEdit(event.keyCode)){this.afterCommand()}};Editor.prototype.preventDefaultEditableShortCuts=function(event){if((event.ctrlKey||event.metaKey)&&lists.contains([66,73,85],event.keyCode)){event.preventDefault()}};Editor.prototype.isLimited=function(pad,event){pad=pad||0;if(typeof event!=='undefined'){if(key.isMove(event.keyCode)||(event.ctrlKey||event.metaKey)||lists.contains([key.code.BACKSPACE,key.code.DELETE],event.keyCode)){return false}}if(this.options.maxTextLength>0){if((this.$editable.text().length+pad)>=this.options.maxTextLength){return true}}return false};Editor.prototype.createRange=function(){this.focus();return range.create(this.editable)};Editor.prototype.saveRange=function(thenCollapse){this.lastRange=this.createRange();if(thenCollapse){this.lastRange.collapse().select()}};Editor.prototype.restoreRange=function(){if(this.lastRange){this.lastRange.select();this.focus()}};Editor.prototype.saveTarget=function(node){this.$editable.data('target',node)};Editor.prototype.clearTarget=function(){this.$editable.removeData('target')};Editor.prototype.restoreTarget=function(){return this.$editable.data('target')};Editor.prototype.currentStyle=function(){var rng=range.create();if(rng){rng=rng.normalize()}return rng?this.style.current(rng):this.style.fromNode(this.$editable)};Editor.prototype.styleFromNode=function($node){return this.style.fromNode($node)};Editor.prototype.undo=function(){this.context.triggerEvent('before.command',this.$editable.html());this.history.undo();this.context.triggerEvent('change',this.$editable.html())};Editor.prototype.redo=function(){this.context.triggerEvent('before.command',this.$editable.html());this.history.redo();this.context.triggerEvent('change',this.$editable.html())};Editor.prototype.beforeCommand=function(){this.context.triggerEvent('before.command',this.$editable.html());this.focus()};Editor.prototype.afterCommand=function(isPreventTrigger){this.normalizeContent();this.history.recordUndo();if(!isPreventTrigger){this.context.triggerEvent('change',this.$editable.html())}};Editor.prototype.tab=function(){var rng=this.createRange();if(rng.isCollapsed()&&rng.isOnCell()){this.table.tab(rng)}else{if(this.options.tabSize===0){return false}if(!this.isLimited(this.options.tabSize)){this.beforeCommand();this.typing.insertTab(rng,this.options.tabSize);this.afterCommand()}}};Editor.prototype.untab=function(){var rng=this.createRange();if(rng.isCollapsed()&&rng.isOnCell()){this.table.tab(rng,true)}else{if(this.options.tabSize===0){return false}}};Editor.prototype.wrapCommand=function(fn){var _this=this;return function(){_this.beforeCommand();fn.apply(_this,arguments);_this.afterCommand()}};Editor.prototype.insertImage=function(src,param){var _this=this;return createImage(src,param).then(function($image){_this.beforeCommand();if(typeof param==='function'){param($image)}else{if(typeof param==='string'){$image.attr('data-filename',param)}$image.css('width',Math.min(_this.$editable.width(),$image.width()))}$image.show();range.create(_this.editable).insertNode($image[0]);range.createFromNodeAfter($image[0]).select();_this.afterCommand()}).fail(function(e){_this.context.triggerEvent('image.upload.error',e)})};Editor.prototype.insertImages=function(files){var _this=this;$$1.each(files,function(idx,file){var filename=file.name;if(_this.options.maximumImageFileSize&&_this.options.maximumImageFileSize<file.size){_this.context.triggerEvent('image.upload.error',_this.lang.image.maximumFileSizeError)}else{readFileAsDataURL(file).then(function(dataURL){return _this.insertImage(dataURL,filename)}).fail(function(){_this.context.triggerEvent('image.upload.error')})}})};Editor.prototype.insertImagesOrCallback=function(files){var callbacks=this.options.callbacks;if(callbacks.onImageUpload){this.context.triggerEvent('image.upload',files)}else{this.insertImages(files)}};Editor.prototype.getSelectedText=function(){var rng=this.createRange();if(rng.isOnAnchor()){rng=range.createFromNode(dom.ancestor(rng.sc,dom.isAnchor))}return rng.toString()};Editor.prototype.onFormatBlock=function(tagName,$target){tagName=env.isMSIE?'<'+tagName+'>':tagName;document.execCommand('FormatBlock',false,tagName);if($target&&$target.length){var className=$target[0].className||'';if(className){var currentRange=this.createRange();var $parent=$$1([currentRange.sc,currentRange.ec]).closest(tagName);$parent.addClass(className)}}};Editor.prototype.formatPara=function(){this.formatBlock('P')};Editor.prototype.fontStyling=function(target,value){var rng=this.createRange();if(rng){var spans=this.style.styleNodes(rng);$$1(spans).css(target,value);if(rng.isCollapsed()){var firstSpan=lists.head(spans);if(firstSpan&&!dom.nodeLength(firstSpan)){firstSpan.innerHTML=dom.ZERO_WIDTH_NBSP_CHAR;range.createFromNodeAfter(firstSpan.firstChild).select();this.$editable.data(KEY_BOGUS,firstSpan)}}}};Editor.prototype.unlink=function(){var rng=this.createRange();if(rng.isOnAnchor()){var anchor=dom.ancestor(rng.sc,dom.isAnchor);rng=range.createFromNode(anchor);rng.select();this.beforeCommand();document.execCommand('unlink');this.afterCommand()}};Editor.prototype.getLinkInfo=function(){var rng=this.createRange().expand(dom.isAnchor);var $anchor=$$1(lists.head(rng.nodes(dom.isAnchor)));var linkInfo={range:rng,text:rng.toString(),url:$anchor.length?$anchor.attr('href'):''};if($anchor.length){linkInfo.isNewWindow=$anchor.attr('target')==='_blank'}return linkInfo};Editor.prototype.addRow=function(position){var rng=this.createRange(this.$editable);if(rng.isCollapsed()&&rng.isOnCell()){this.beforeCommand();this.table.addRow(rng,position);this.afterCommand()}};Editor.prototype.addCol=function(position){var rng=this.createRange(this.$editable);if(rng.isCollapsed()&&rng.isOnCell()){this.beforeCommand();this.table.addCol(rng,position);this.afterCommand()}};Editor.prototype.deleteRow=function(){var rng=this.createRange(this.$editable);if(rng.isCollapsed()&&rng.isOnCell()){this.beforeCommand();this.table.deleteRow(rng);this.afterCommand()}};Editor.prototype.deleteCol=function(){var rng=this.createRange(this.$editable);if(rng.isCollapsed()&&rng.isOnCell()){this.beforeCommand();this.table.deleteCol(rng);this.afterCommand()}};Editor.prototype.deleteTable=function(){var rng=this.createRange(this.$editable);if(rng.isCollapsed()&&rng.isOnCell()){this.beforeCommand();this.table.deleteTable(rng);this.afterCommand()}};Editor.prototype.resizeTo=function(pos,$target,bKeepRatio){var imageSize;if(bKeepRatio){var newRatio=pos.y/pos.x;var ratio=$target.data('ratio');imageSize={width:ratio>newRatio?pos.x:pos.y/ratio,height:ratio>newRatio?pos.x*ratio:pos.y}}else{imageSize={width:pos.x,height:pos.y}}$target.css(imageSize)};Editor.prototype.hasFocus=function(){return this.$editable.is(':focus')};Editor.prototype.focus=function(){if(!this.hasFocus()){this.$editable.focus()}};Editor.prototype.isEmpty=function(){return dom.isEmpty(this.$editable[0])||dom.emptyPara===this.$editable.html()};Editor.prototype.empty=function(){this.context.invoke('code',dom.emptyPara)};Editor.prototype.normalizeContent=function(){this.$editable[0].normalize()};return Editor}());var Clipboard=(function(){function Clipboard(context){this.context=context;this.$editable=context.layoutInfo.editable}Clipboard.prototype.initialize=function(){this.$editable.on('paste',this.pasteByEvent.bind(this))};Clipboard.prototype.pasteByEvent=function(event){var clipboardData=event.originalEvent.clipboardData;if(clipboardData&&clipboardData.items&&clipboardData.items.length){var item=lists.head(clipboardData.items);if(item.kind==='file'&&item.type.indexOf('image/')!==-1){this.context.invoke('editor.insertImagesOrCallback',[item.getAsFile()])}this.context.invoke('editor.afterCommand')}};return Clipboard}());var Dropzone=(function(){function Dropzone(context){this.context=context;this.$eventListener=$$1(document);this.$editor=context.layoutInfo.editor;this.$editable=context.layoutInfo.editable;this.options=context.options;this.lang=this.options.langInfo;this.documentEventHandlers={};this.$dropzone=$$1(['<div class="note-dropzone">',' <div class="note-dropzone-message"/>','</div>'].join('')).prependTo(this.$editor)}Dropzone.prototype.initialize=function(){if(this.options.disableDragAndDrop){this.documentEventHandlers.onDrop=function(e){e.preventDefault()};this.$eventListener=this.$dropzone;this.$eventListener.on('drop',this.documentEventHandlers.onDrop)}else{this.attachDragAndDropEvent()}};Dropzone.prototype.attachDragAndDropEvent=function(){var _this=this;var collection=$$1();var $dropzoneMessage=this.$dropzone.find('.note-dropzone-message');this.documentEventHandlers.onDragenter=function(e){var isCodeview=_this.context.invoke('codeview.isActivated');var hasEditorSize=_this.$editor.width()>0&&_this.$editor.height()>0;if(!isCodeview&&!collection.length&&hasEditorSize){_this.$editor.addClass('dragover');_this.$dropzone.width(_this.$editor.width());_this.$dropzone.height(_this.$editor.height());$dropzoneMessage.text(_this.lang.image.dragImageHere)}collection=collection.add(e.target)};this.documentEventHandlers.onDragleave=function(e){collection=collection.not(e.target);if(!collection.length){_this.$editor.removeClass('dragover')}};this.documentEventHandlers.onDrop=function(){collection=$$1();_this.$editor.removeClass('dragover')};this.$eventListener.on('dragenter',this.documentEventHandlers.onDragenter).on('dragleave',this.documentEventHandlers.onDragleave).on('drop',this.documentEventHandlers.onDrop);this.$dropzone.on('dragenter',function(){_this.$dropzone.addClass('hover');$dropzoneMessage.text(_this.lang.image.dropImage)}).on('dragleave',function(){_this.$dropzone.removeClass('hover');$dropzoneMessage.text(_this.lang.image.dragImageHere)});this.$dropzone.on('drop',function(event){var dataTransfer=event.originalEvent.dataTransfer;event.preventDefault();if(dataTransfer&&dataTransfer.files&&dataTransfer.files.length){_this.$editable.focus();_this.context.invoke('editor.insertImagesOrCallback',dataTransfer.files)}else{$$1.each(dataTransfer.types,function(idx,type){var content=dataTransfer.getData(type);if(type.toLowerCase().indexOf('text')>-1){_this.context.invoke('editor.pasteHTML',content)}else{$$1(content).each(function(idx,item){_this.context.invoke('editor.insertNode',item)})}})}}).on('dragover',false)};Dropzone.prototype.destroy=function(){var _this=this;Object.keys(this.documentEventHandlers).forEach(function(key){_this.$eventListener.off(key.substr(2).toLowerCase(),_this.documentEventHandlers[key])});this.documentEventHandlers={}};return Dropzone}());var CodeMirror;if(env.hasCodeMirror){if(env.isSupportAmd){require(['codemirror'],function(cm){CodeMirror=cm})}else{CodeMirror=window.CodeMirror}}var CodeView=(function(){function CodeView(context){this.context=context;this.$editor=context.layoutInfo.editor;this.$editable=context.layoutInfo.editable;this.$codable=context.layoutInfo.codable;this.options=context.options}CodeView.prototype.sync=function(){var isCodeview=this.isActivated();if(isCodeview&&env.hasCodeMirror){this.$codable.data('cmEditor').save()}};CodeView.prototype.isActivated=function(){return this.$editor.hasClass('codeview')};CodeView.prototype.toggle=function(){if(this.isActivated()){this.deactivate()}else{this.activate()}this.context.triggerEvent('codeview.toggled')};CodeView.prototype.activate=function(){var _this=this;this.$codable.val(dom.html(this.$editable,this.options.prettifyHtml));this.$codable.height(this.$editable.height());this.context.invoke('toolbar.updateCodeview',true);this.$editor.addClass('codeview');this.$codable.focus();if(env.hasCodeMirror){var cmEditor_1=CodeMirror.fromTextArea(this.$codable[0],this.options.codemirror);if(this.options.codemirror.tern){var server_1=new CodeMirror.TernServer(this.options.codemirror.tern);cmEditor_1.ternServer=server_1;cmEditor_1.on('cursorActivity',function(cm){server_1.updateArgHints(cm)})}cmEditor_1.on('blur',function(event){_this.context.triggerEvent('blur.codeview',cmEditor_1.getValue(),event)});cmEditor_1.setSize(null,this.$editable.outerHeight());this.$codable.data('cmEditor',cmEditor_1)}else{this.$codable.on('blur',function(event){_this.context.triggerEvent('blur.codeview',_this.$codable.val(),event)})}};CodeView.prototype.deactivate=function(){if(env.hasCodeMirror){var cmEditor=this.$codable.data('cmEditor');this.$codable.val(cmEditor.getValue());cmEditor.toTextArea()}var value=dom.value(this.$codable,this.options.prettifyHtml)||dom.emptyPara;var isChange=this.$editable.html()!==value;this.$editable.html(value);this.$editable.height(this.options.height?this.$codable.height():'auto');this.$editor.removeClass('codeview');if(isChange){this.context.triggerEvent('change',this.$editable.html(),this.$editable)}this.$editable.focus();this.context.invoke('toolbar.updateCodeview',false)};CodeView.prototype.destroy=function(){if(this.isActivated()){this.deactivate()}};return CodeView}());var EDITABLE_PADDING=24;var Statusbar=(function(){function Statusbar(context){this.$document=$$1(document);this.$statusbar=context.layoutInfo.statusbar;this.$editable=context.layoutInfo.editable;this.options=context.options}Statusbar.prototype.initialize=function(){var _this=this;if(this.options.airMode||this.options.disableResizeEditor){this.destroy();return}this.$statusbar.on('mousedown',function(event){event.preventDefault();event.stopPropagation();var editableTop=_this.$editable.offset().top-_this.$document.scrollTop();var onMouseMove=function(event){var height=event.clientY-(editableTop+EDITABLE_PADDING);height=(_this.options.minheight>0)?Math.max(height,_this.options.minheight):height;height=(_this.options.maxHeight>0)?Math.min(height,_this.options.maxHeight):height;_this.$editable.height(height)};_this.$document.on('mousemove',onMouseMove).one('mouseup',function(){_this.$document.off('mousemove',onMouseMove)})})};Statusbar.prototype.destroy=function(){this.$statusbar.off();this.$statusbar.addClass('locked')};return Statusbar}());var Fullscreen=(function(){function Fullscreen(context){var _this=this;this.context=context;this.$editor=context.layoutInfo.editor;this.$toolbar=context.layoutInfo.toolbar;this.$editable=context.layoutInfo.editable;this.$codable=context.layoutInfo.codable;this.$window=$$1(window);this.$scrollbar=$$1('html, body');this.onResize=function(){_this.resizeTo({h:_this.$window.height()-_this.$toolbar.outerHeight()})}}Fullscreen.prototype.resizeTo=function(size){this.$editable.css('height',size.h);this.$codable.css('height',size.h);if(this.$codable.data('cmeditor')){this.$codable.data('cmeditor').setsize(null,size.h)}};Fullscreen.prototype.toggle=function(){this.$editor.toggleClass('fullscreen');if(this.isFullscreen()){this.$editable.data('orgHeight',this.$editable.css('height'));this.$window.on('resize',this.onResize).trigger('resize');this.$scrollbar.css('overflow','hidden')}else{this.$window.off('resize',this.onResize);this.resizeTo({h:this.$editable.data('orgHeight')});this.$scrollbar.css('overflow','visible')}this.context.invoke('toolbar.updateFullscreen',this.isFullscreen())};Fullscreen.prototype.isFullscreen=function(){return this.$editor.hasClass('fullscreen')};return Fullscreen}());var Handle=(function(){function Handle(context){var _this=this;this.context=context;this.$document=$$1(document);this.$editingArea=context.layoutInfo.editingArea;this.options=context.options;this.lang=this.options.langInfo;this.events={'summernote.mousedown':function(we,e){if(_this.update(e.target)){e.preventDefault()}},'summernote.keyup summernote.scroll summernote.change summernote.dialog.shown':function(){_this.update()},'summernote.disable':function(){_this.hide()},'summernote.codeview.toggled':function(){_this.update()}}}Handle.prototype.initialize=function(){var _this=this;this.$handle=$$1(['<div class="note-handle">','<div class="note-control-selection">','<div class="note-control-selection-bg"></div>','<div class="note-control-holder note-control-nw"></div>','<div class="note-control-holder note-control-ne"></div>','<div class="note-control-holder note-control-sw"></div>','<div class="',(this.options.disableResizeImage?'note-control-holder':'note-control-sizing'),' note-control-se"></div>',(this.options.disableResizeImage?'':'<div class="note-control-selection-info"></div>'),'</div>','</div>'].join('')).prependTo(this.$editingArea);this.$handle.on('mousedown',function(event){if(dom.isControlSizing(event.target)){event.preventDefault();event.stopPropagation();var $target_1=_this.$handle.find('.note-control-selection').data('target');var posStart_1=$target_1.offset();var scrollTop_1=_this.$document.scrollTop();var onMouseMove_1=function(event){_this.context.invoke('editor.resizeTo',{x:event.clientX-posStart_1.left,y:event.clientY-(posStart_1.top-scrollTop_1)},$target_1,!event.shiftKey);_this.update($target_1[0])};_this.$document.on('mousemove',onMouseMove_1).one('mouseup',function(e){e.preventDefault();_this.$document.off('mousemove',onMouseMove_1);_this.context.invoke('editor.afterCommand')});if(!$target_1.data('ratio')){$target_1.data('ratio',$target_1.height()/$target_1.width())}}});this.$handle.on('wheel',function(e){e.preventDefault();_this.update()})};Handle.prototype.destroy=function(){this.$handle.remove()};Handle.prototype.update=function(target){if(this.context.isDisabled()){return false}var isImage=dom.isImg(target);var $selection=this.$handle.find('.note-control-selection');this.context.invoke('imagePopover.update',target);if(isImage){var $image=$$1(target);var position=$image.position();var pos={left:position.left+parseInt($image.css('marginLeft'),10),top:position.top+parseInt($image.css('marginTop'),10)};var imageSize={w:$image.outerWidth(false),h:$image.outerHeight(false)};$selection.css({display:'block',left:pos.left,top:pos.top,width:imageSize.w,height:imageSize.h}).data('target',$image);var origImageObj=new Image();origImageObj.src=$image.attr('src');var sizingText=imageSize.w+'x'+imageSize.h+' ('+this.lang.image.original+': '+origImageObj.width+'x'+origImageObj.height+')';$selection.find('.note-control-selection-info').text(sizingText);this.context.invoke('editor.saveTarget',target)}else{this.hide()}return isImage};Handle.prototype.hide=function(){this.context.invoke('editor.clearTarget');this.$handle.children().hide()};return Handle}());var defaultScheme='http://';var linkPattern=/^([A-Za-z][A-Za-z0-9+-.]*\:[\/\/]?|mailto:[A-Z0-9._%+-]+@)?(www\.)?(.+)$/i;var AutoLink=(function(){function AutoLink(context){var _this=this;this.context=context;this.events={'summernote.keyup':function(we,e){if(!e.isDefaultPrevented()){_this.handleKeyup(e)}},'summernote.keydown':function(we,e){_this.handleKeydown(e)}}}AutoLink.prototype.initialize=function(){this.lastWordRange=null};AutoLink.prototype.destroy=function(){this.lastWordRange=null};AutoLink.prototype.replace=function(){if(!this.lastWordRange){return}var keyword=this.lastWordRange.toString();var match=keyword.match(linkPattern);if(match&&(match[1]||match[2])){var link=match[1]?keyword:defaultScheme+keyword;var node=$$1('<a />').html(keyword).attr('href',link)[0];this.lastWordRange.insertNode(node);this.lastWordRange=null;this.context.invoke('editor.focus')}};AutoLink.prototype.handleKeydown=function(e){if(lists.contains([key.code.ENTER,key.code.SPACE],e.keyCode)){var wordRange=this.context.invoke('editor.createRange').getWordRange();this.lastWordRange=wordRange}};AutoLink.prototype.handleKeyup=function(e){if(lists.contains([key.code.ENTER,key.code.SPACE],e.keyCode)){this.replace()}};return AutoLink}());var AutoSync=(function(){function AutoSync(context){var _this=this;this.$note=context.layoutInfo.note;this.events={'summernote.change':function(){_this.$note.val(context.invoke('code'))}}}AutoSync.prototype.shouldInitialize=function(){return dom.isTextarea(this.$note[0])};return AutoSync}());var Placeholder=(function(){function Placeholder(context){var _this=this;this.context=context;this.$editingArea=context.layoutInfo.editingArea;this.options=context.options;this.events={'summernote.init summernote.change':function(){_this.update()},'summernote.codeview.toggled':function(){_this.update()}}}Placeholder.prototype.shouldInitialize=function(){return!!this.options.placeholder};Placeholder.prototype.initialize=function(){var _this=this;this.$placeholder=$$1('<div class="note-placeholder">');this.$placeholder.on('click',function(){_this.context.invoke('focus')}).text(this.options.placeholder).prependTo(this.$editingArea);this.update()};Placeholder.prototype.destroy=function(){this.$placeholder.remove()};Placeholder.prototype.update=function(){var isShow=!this.context.invoke('codeview.isActivated')&&this.context.invoke('editor.isEmpty');this.$placeholder.toggle(isShow)};return Placeholder}());var Buttons=(function(){function Buttons(context){this.ui=$$1.summernote.ui;this.context=context;this.$toolbar=context.layoutInfo.toolbar;this.options=context.options;this.lang=this.options.langInfo;this.invertedKeyMap=func.invertObject(this.options.keyMap[env.isMac?'mac':'pc'])}Buttons.prototype.representShortcut=function(editorMethod){var shortcut=this.invertedKeyMap[editorMethod];if(!this.options.shortcuts||!shortcut){return''}if(env.isMac){shortcut=shortcut.replace('CMD','⌘').replace('SHIFT','⇧')}shortcut=shortcut.replace('BACKSLASH','\\').replace('SLASH','/').replace('LEFTBRACKET','[').replace('RIGHTBRACKET',']');return' ('+shortcut+')'};Buttons.prototype.button=function(o){if(!this.options.tooltip&&o.tooltip){delete o.tooltip}o.container=this.options.container;return this.ui.button(o)};Buttons.prototype.initialize=function(){this.addToolbarButtons();this.addImagePopoverButtons();this.addLinkPopoverButtons();this.addTablePopoverButtons();this.fontInstalledMap={}};Buttons.prototype.destroy=function(){delete this.fontInstalledMap};Buttons.prototype.isFontInstalled=function(name){if(!this.fontInstalledMap.hasOwnProperty(name)){this.fontInstalledMap[name]=env.isFontInstalled(name)||lists.contains(this.options.fontNamesIgnoreCheck,name)}return this.fontInstalledMap[name]};Buttons.prototype.isFontDeservedToAdd=function(name){var genericFamilies=['sans-serif','serif','monospace','cursive','fantasy'];name=name.toLowerCase();return((name!=='')&&this.isFontInstalled(name)&&($$1.inArray(name,genericFamilies)===-1))};Buttons.prototype.addToolbarButtons=function(){var _this=this;this.context.memo('button.style',function(){return _this.ui.buttonGroup([_this.button({className:'dropdown-toggle',contents:_this.ui.dropdownButtonContents(_this.ui.icon(_this.options.icons.magic),_this.options),tooltip:_this.lang.style.style,data:{toggle:'dropdown'}}),_this.ui.dropdown({className:'dropdown-style',items:_this.options.styleTags,title:_this.lang.style.style,template:function(item){if(typeof item==='string'){item={tag:item,title:(_this.lang.style.hasOwnProperty(item)?_this.lang.style[item]:item)}}var tag=item.tag;var title=item.title;var style=item.style?' style="'+item.style+'" ':'';var className=item.className?' class="'+item.className+'"':'';return'<'+tag+style+className+'>'+title+'</'+tag+'>'},click:_this.context.createInvokeHandler('editor.formatBlock')})]).render()});var _loop_1=function(styleIdx,styleLen){var item=this_1.options.styleTags[styleIdx];this_1.context.memo('button.style.'+item,function(){return _this.button({className:'note-btn-style-'+item,contents:'<div data-value="'+item+'">'+item.toUpperCase()+'</div>',tooltip:_this.lang.style[item],click:_this.context.createInvokeHandler('editor.formatBlock')}).render()})};var this_1=this;for(var styleIdx=0,styleLen=this.options.styleTags.length;styleIdx<styleLen;styleIdx++){_loop_1(styleIdx,styleLen)}this.context.memo('button.bold',function(){return _this.button({className:'note-btn-bold',contents:_this.ui.icon(_this.options.icons.bold),tooltip:_this.lang.font.bold+_this.representShortcut('bold'),click:_this.context.createInvokeHandlerAndUpdateState('editor.bold')}).render()});this.context.memo('button.italic',function(){return _this.button({className:'note-btn-italic',contents:_this.ui.icon(_this.options.icons.italic),tooltip:_this.lang.font.italic+_this.representShortcut('italic'),click:_this.context.createInvokeHandlerAndUpdateState('editor.italic')}).render()});this.context.memo('button.underline',function(){return _this.button({className:'note-btn-underline',contents:_this.ui.icon(_this.options.icons.underline),tooltip:_this.lang.font.underline+_this.representShortcut('underline'),click:_this.context.createInvokeHandlerAndUpdateState('editor.underline')}).render()});this.context.memo('button.clear',function(){return _this.button({contents:_this.ui.icon(_this.options.icons.eraser),tooltip:_this.lang.font.clear+_this.representShortcut('removeFormat'),click:_this.context.createInvokeHandler('editor.removeFormat')}).render()});this.context.memo('button.strikethrough',function(){return _this.button({className:'note-btn-strikethrough',contents:_this.ui.icon(_this.options.icons.strikethrough),tooltip:_this.lang.font.strikethrough+_this.representShortcut('strikethrough'),click:_this.context.createInvokeHandlerAndUpdateState('editor.strikethrough')}).render()});this.context.memo('button.superscript',function(){return _this.button({className:'note-btn-superscript',contents:_this.ui.icon(_this.options.icons.superscript),tooltip:_this.lang.font.superscript,click:_this.context.createInvokeHandlerAndUpdateState('editor.superscript')}).render()});this.context.memo('button.subscript',function(){return _this.button({className:'note-btn-subscript',contents:_this.ui.icon(_this.options.icons.subscript),tooltip:_this.lang.font.subscript,click:_this.context.createInvokeHandlerAndUpdateState('editor.subscript')}).render()});this.context.memo('button.fontname',function(){var styleInfo=_this.context.invoke('editor.currentStyle');$$1.each(styleInfo['font-family'].split(','),function(idx,fontname){fontname=fontname.trim().replace(/['"]+/g,'');if(_this.isFontDeservedToAdd(fontname)){if($$1.inArray(fontname,_this.options.fontNames)===-1){_this.options.fontNames.push(fontname)}}});return _this.ui.buttonGroup([_this.button({className:'dropdown-toggle',contents:_this.ui.dropdownButtonContents('<span class="note-current-fontname"/>',_this.options),tooltip:_this.lang.font.name,data:{toggle:'dropdown'}}),_this.ui.dropdownCheck({className:'dropdown-fontname',checkClassName:_this.options.icons.menuCheck,items:_this.options.fontNames.filter(_this.isFontInstalled.bind(_this)),title:_this.lang.font.name,template:function(item){return'<span style="font-family: \''+item+'\'">'+item+'</span>'},click:_this.context.createInvokeHandlerAndUpdateState('editor.fontName')})]).render()});this.context.memo('button.fontsize',function(){return _this.ui.buttonGroup([_this.button({className:'dropdown-toggle',contents:_this.ui.dropdownButtonContents('<span class="note-current-fontsize"/>',_this.options),tooltip:_this.lang.font.size,data:{toggle:'dropdown'}}),_this.ui.dropdownCheck({className:'dropdown-fontsize',checkClassName:_this.options.icons.menuCheck,items:_this.options.fontSizes,title:_this.lang.font.size,click:_this.context.createInvokeHandlerAndUpdateState('editor.fontSize')})]).render()});this.context.memo('button.color',function(){return _this.ui.buttonGroup({className:'note-color',children:[_this.button({className:'note-current-color-button',contents:_this.ui.icon(_this.options.icons.font+' note-recent-color'),tooltip:_this.lang.color.recent,click:function(e){var $button=$$1(e.currentTarget);_this.context.invoke('editor.color',{backColor:$button.attr('data-backColor'),foreColor:$button.attr('data-foreColor')})},callback:function($button){var $recentColor=$button.find('.note-recent-color');$recentColor.css('background-color','#FFFF00');$button.attr('data-backColor','#FFFF00')}}),_this.button({className:'dropdown-toggle',contents:_this.ui.dropdownButtonContents('',_this.options),tooltip:_this.lang.color.more,data:{toggle:'dropdown'}}),_this.ui.dropdown({items:['<div class="note-palette">',' <div class="note-palette-title">'+_this.lang.color.background+'</div>',' <div>',' <button type="button" class="note-color-reset btn btn-light" data-event="backColor" data-value="inherit">',_this.lang.color.transparent,' </button>',' </div>',' <div class="note-holder" data-event="backColor"/>','</div>','<div class="note-palette">',' <div class="note-palette-title">'+_this.lang.color.foreground+'</div>',' <div>',' <button type="button" class="note-color-reset btn btn-light" data-event="removeFormat" data-value="foreColor">',_this.lang.color.resetToDefault,' </button>',' </div>',' <div class="note-holder" data-event="foreColor"/>','</div>'].join(''),callback:function($dropdown){$dropdown.find('.note-holder').each(function(idx,item){var $holder=$$1(item);$holder.append(_this.ui.palette({colors:_this.options.colors,colorsName:_this.options.colorsName,eventName:$holder.data('event'),container:_this.options.container,tooltip:_this.options.tooltip}).render())})},click:function(event){var $button=$$1(event.target);var eventName=$button.data('event');var value=$button.data('value');if(eventName&&value){var key=eventName==='backColor'?'background-color':'color';var $color=$button.closest('.note-color').find('.note-recent-color');var $currentButton=$button.closest('.note-color').find('.note-current-color-button');$color.css(key,value);$currentButton.attr('data-'+eventName,value);_this.context.invoke('editor.'+eventName,value)}}})]}).render()});this.context.memo('button.ul',function(){return _this.button({contents:_this.ui.icon(_this.options.icons.unorderedlist),tooltip:_this.lang.lists.unordered+_this.representShortcut('insertUnorderedList'),click:_this.context.createInvokeHandler('editor.insertUnorderedList')}).render()});this.context.memo('button.ol',function(){return _this.button({contents:_this.ui.icon(_this.options.icons.orderedlist),tooltip:_this.lang.lists.ordered+_this.representShortcut('insertOrderedList'),click:_this.context.createInvokeHandler('editor.insertOrderedList')}).render()});var justifyLeft=this.button({contents:this.ui.icon(this.options.icons.alignLeft),tooltip:this.lang.paragraph.left+this.representShortcut('justifyLeft'),click:this.context.createInvokeHandler('editor.justifyLeft')});var justifyCenter=this.button({contents:this.ui.icon(this.options.icons.alignCenter),tooltip:this.lang.paragraph.center+this.representShortcut('justifyCenter'),click:this.context.createInvokeHandler('editor.justifyCenter')});var justifyRight=this.button({contents:this.ui.icon(this.options.icons.alignRight),tooltip:this.lang.paragraph.right+this.representShortcut('justifyRight'),click:this.context.createInvokeHandler('editor.justifyRight')});var justifyFull=this.button({contents:this.ui.icon(this.options.icons.alignJustify),tooltip:this.lang.paragraph.justify+this.representShortcut('justifyFull'),click:this.context.createInvokeHandler('editor.justifyFull')});var outdent=this.button({contents:this.ui.icon(this.options.icons.outdent),tooltip:this.lang.paragraph.outdent+this.representShortcut('outdent'),click:this.context.createInvokeHandler('editor.outdent')});var indent=this.button({contents:this.ui.icon(this.options.icons.indent),tooltip:this.lang.paragraph.indent+this.representShortcut('indent'),click:this.context.createInvokeHandler('editor.indent')});this.context.memo('button.justifyLeft',func.invoke(justifyLeft,'render'));this.context.memo('button.justifyCenter',func.invoke(justifyCenter,'render'));this.context.memo('button.justifyRight',func.invoke(justifyRight,'render'));this.context.memo('button.justifyFull',func.invoke(justifyFull,'render'));this.context.memo('button.outdent',func.invoke(outdent,'render'));this.context.memo('button.indent',func.invoke(indent,'render'));this.context.memo('button.paragraph',function(){return _this.ui.buttonGroup([_this.button({className:'dropdown-toggle',contents:_this.ui.dropdownButtonContents(_this.ui.icon(_this.options.icons.alignLeft),_this.options),tooltip:_this.lang.paragraph.paragraph,data:{toggle:'dropdown'}}),_this.ui.dropdown([_this.ui.buttonGroup({className:'note-align',children:[justifyLeft,justifyCenter,justifyRight,justifyFull]}),_this.ui.buttonGroup({className:'note-list',children:[outdent,indent]})])]).render()});this.context.memo('button.height',function(){return _this.ui.buttonGroup([_this.button({className:'dropdown-toggle',contents:_this.ui.dropdownButtonContents(_this.ui.icon(_this.options.icons.textHeight),_this.options),tooltip:_this.lang.font.height,data:{toggle:'dropdown'}}),_this.ui.dropdownCheck({items:_this.options.lineHeights,checkClassName:_this.options.icons.menuCheck,className:'dropdown-line-height',title:_this.lang.font.height,click:_this.context.createInvokeHandler('editor.lineHeight')})]).render()});this.context.memo('button.table',function(){return _this.ui.buttonGroup([_this.button({className:'dropdown-toggle',contents:_this.ui.dropdownButtonContents(_this.ui.icon(_this.options.icons.table),_this.options),tooltip:_this.lang.table.table,data:{toggle:'dropdown'}}),_this.ui.dropdown({title:_this.lang.table.table,className:'note-table',items:['<div class="note-dimension-picker">',' <div class="note-dimension-picker-mousecatcher" data-event="insertTable" data-value="1x1"/>',' <div class="note-dimension-picker-highlighted"/>',' <div class="note-dimension-picker-unhighlighted"/>','</div>','<div class="note-dimension-display">1 x 1</div>'].join('')})],{callback:function($node){var $catcher=$node.find('.note-dimension-picker-mousecatcher');$catcher.css({width:_this.options.insertTableMaxSize.col+'em',height:_this.options.insertTableMaxSize.row+'em'}).mousedown(_this.context.createInvokeHandler('editor.insertTable')).on('mousemove',_this.tableMoveHandler.bind(_this))}}).render()});this.context.memo('button.link',function(){return _this.button({contents:_this.ui.icon(_this.options.icons.link),tooltip:_this.lang.link.link+_this.representShortcut('linkDialog.show'),click:_this.context.createInvokeHandler('linkDialog.show')}).render()});this.context.memo('button.picture',function(){return _this.button({contents:_this.ui.icon(_this.options.icons.picture),tooltip:_this.lang.image.image,click:_this.context.createInvokeHandler('imageDialog.show')}).render()});this.context.memo('button.video',function(){return _this.button({contents:_this.ui.icon(_this.options.icons.video),tooltip:_this.lang.video.video,click:_this.context.createInvokeHandler('videoDialog.show')}).render()});this.context.memo('button.hr',function(){return _this.button({contents:_this.ui.icon(_this.options.icons.minus),tooltip:_this.lang.hr.insert+_this.representShortcut('insertHorizontalRule'),click:_this.context.createInvokeHandler('editor.insertHorizontalRule')}).render()});this.context.memo('button.fullscreen',function(){return _this.button({className:'btn-fullscreen',contents:_this.ui.icon(_this.options.icons.arrowsAlt),tooltip:_this.lang.options.fullscreen,click:_this.context.createInvokeHandler('fullscreen.toggle')}).render()});this.context.memo('button.codeview',function(){return _this.button({className:'btn-codeview',contents:_this.ui.icon(_this.options.icons.code),tooltip:_this.lang.options.codeview,click:_this.context.createInvokeHandler('codeview.toggle')}).render()});this.context.memo('button.redo',function(){return _this.button({contents:_this.ui.icon(_this.options.icons.redo),tooltip:_this.lang.history.redo+_this.representShortcut('redo'),click:_this.context.createInvokeHandler('editor.redo')}).render()});this.context.memo('button.undo',function(){return _this.button({contents:_this.ui.icon(_this.options.icons.undo),tooltip:_this.lang.history.undo+_this.representShortcut('undo'),click:_this.context.createInvokeHandler('editor.undo')}).render()});this.context.memo('button.help',function(){return _this.button({contents:_this.ui.icon(_this.options.icons.question),tooltip:_this.lang.options.help,click:_this.context.createInvokeHandler('helpDialog.show')}).render()})};Buttons.prototype.addImagePopoverButtons=function(){var _this=this;this.context.memo('button.imageSize100',function(){return _this.button({contents:'<span class="note-fontsize-10">100%</span>',tooltip:_this.lang.image.resizeFull,click:_this.context.createInvokeHandler('editor.resize','1')}).render()});this.context.memo('button.imageSize50',function(){return _this.button({contents:'<span class="note-fontsize-10">50%</span>',tooltip:_this.lang.image.resizeHalf,click:_this.context.createInvokeHandler('editor.resize','0.5')}).render()});this.context.memo('button.imageSize25',function(){return _this.button({contents:'<span class="note-fontsize-10">25%</span>',tooltip:_this.lang.image.resizeQuarter,click:_this.context.createInvokeHandler('editor.resize','0.25')}).render()});this.context.memo('button.floatLeft',function(){return _this.button({contents:_this.ui.icon(_this.options.icons.alignLeft),tooltip:_this.lang.image.floatLeft,click:_this.context.createInvokeHandler('editor.floatMe','left')}).render()});this.context.memo('button.floatRight',function(){return _this.button({contents:_this.ui.icon(_this.options.icons.alignRight),tooltip:_this.lang.image.floatRight,click:_this.context.createInvokeHandler('editor.floatMe','right')}).render()});this.context.memo('button.floatNone',function(){return _this.button({contents:_this.ui.icon(_this.options.icons.alignJustify),tooltip:_this.lang.image.floatNone,click:_this.context.createInvokeHandler('editor.floatMe','none')}).render()});this.context.memo('button.removeMedia',function(){return _this.button({contents:_this.ui.icon(_this.options.icons.trash),tooltip:_this.lang.image.remove,click:_this.context.createInvokeHandler('editor.removeMedia')}).render()})};Buttons.prototype.addLinkPopoverButtons=function(){var _this=this;this.context.memo('button.linkDialogShow',function(){return _this.button({contents:_this.ui.icon(_this.options.icons.link),tooltip:_this.lang.link.edit,click:_this.context.createInvokeHandler('linkDialog.show')}).render()});this.context.memo('button.unlink',function(){return _this.button({contents:_this.ui.icon(_this.options.icons.unlink),tooltip:_this.lang.link.unlink,click:_this.context.createInvokeHandler('editor.unlink')}).render()})};Buttons.prototype.addTablePopoverButtons=function(){var _this=this;this.context.memo('button.addRowUp',function(){return _this.button({className:'btn-md',contents:_this.ui.icon(_this.options.icons.rowAbove),tooltip:_this.lang.table.addRowAbove,click:_this.context.createInvokeHandler('editor.addRow','top')}).render()});this.context.memo('button.addRowDown',function(){return _this.button({className:'btn-md',contents:_this.ui.icon(_this.options.icons.rowBelow),tooltip:_this.lang.table.addRowBelow,click:_this.context.createInvokeHandler('editor.addRow','bottom')}).render()});this.context.memo('button.addColLeft',function(){return _this.button({className:'btn-md',contents:_this.ui.icon(_this.options.icons.colBefore),tooltip:_this.lang.table.addColLeft,click:_this.context.createInvokeHandler('editor.addCol','left')}).render()});this.context.memo('button.addColRight',function(){return _this.button({className:'btn-md',contents:_this.ui.icon(_this.options.icons.colAfter),tooltip:_this.lang.table.addColRight,click:_this.context.createInvokeHandler('editor.addCol','right')}).render()});this.context.memo('button.deleteRow',function(){return _this.button({className:'btn-md',contents:_this.ui.icon(_this.options.icons.rowRemove),tooltip:_this.lang.table.delRow,click:_this.context.createInvokeHandler('editor.deleteRow')}).render()});this.context.memo('button.deleteCol',function(){return _this.button({className:'btn-md',contents:_this.ui.icon(_this.options.icons.colRemove),tooltip:_this.lang.table.delCol,click:_this.context.createInvokeHandler('editor.deleteCol')}).render()});this.context.memo('button.deleteTable',function(){return _this.button({className:'btn-md',contents:_this.ui.icon(_this.options.icons.trash),tooltip:_this.lang.table.delTable,click:_this.context.createInvokeHandler('editor.deleteTable')}).render()})};Buttons.prototype.build=function($container,groups){for(var groupIdx=0,groupLen=groups.length;groupIdx<groupLen;groupIdx++){var group=groups[groupIdx];var groupName=$$1.isArray(group)?group[0]:group;var buttons=$$1.isArray(group)?((group.length===1)?[group[0]]:group[1]):[group];var $group=this.ui.buttonGroup({className:'note-'+groupName}).render();for(var idx=0,len=buttons.length;idx<len;idx++){var btn=this.context.memo('button.'+buttons[idx]);if(btn){$group.append(typeof btn==='function'?btn(this.context):btn)}}$group.appendTo($container)}};Buttons.prototype.updateCurrentStyle=function($container){var _this=this;var $cont=$container||this.$toolbar;var styleInfo=this.context.invoke('editor.currentStyle');this.updateBtnStates($cont,{'.note-btn-bold':function(){return styleInfo['font-bold']==='bold'},'.note-btn-italic':function(){return styleInfo['font-italic']==='italic'},'.note-btn-underline':function(){return styleInfo['font-underline']==='underline'},'.note-btn-subscript':function(){return styleInfo['font-subscript']==='subscript'},'.note-btn-superscript':function(){return styleInfo['font-superscript']==='superscript'},'.note-btn-strikethrough':function(){return styleInfo['font-strikethrough']==='strikethrough'}});if(styleInfo['font-family']){var fontNames=styleInfo['font-family'].split(',').map(function(name){return name.replace(/[\'\"]/g,'').replace(/\s+$/,'').replace(/^\s+/,'')});var fontName_1=lists.find(fontNames,this.isFontInstalled.bind(this));$cont.find('.dropdown-fontname a').each(function(idx,item){var $item=$$1(item);var isChecked=($item.data('value')+'')===(fontName_1+'');$item.toggleClass('checked',isChecked)});$cont.find('.note-current-fontname').text(fontName_1).css('font-family',fontName_1)}if(styleInfo['font-size']){var fontSize_1=styleInfo['font-size'];$cont.find('.dropdown-fontsize a').each(function(idx,item){var $item=$$1(item);var isChecked=($item.data('value')+'')===(fontSize_1+'');$item.toggleClass('checked',isChecked)});$cont.find('.note-current-fontsize').text(fontSize_1)}if(styleInfo['line-height']){var lineHeight_1=styleInfo['line-height'];$cont.find('.dropdown-line-height li a').each(function(idx,item){var isChecked=($$1(item).data('value')+'')===(lineHeight_1+'');_this.className=isChecked?'checked':''})}};Buttons.prototype.updateBtnStates=function($container,infos){var _this=this;$$1.each(infos,function(selector,pred){_this.ui.toggleBtnActive($container.find(selector),pred())})};Buttons.prototype.tableMoveHandler=function(event){var PX_PER_EM=18;var $picker=$$1(event.target.parentNode);var $dimensionDisplay=$picker.next();var $catcher=$picker.find('.note-dimension-picker-mousecatcher');var $highlighted=$picker.find('.note-dimension-picker-highlighted');var $unhighlighted=$picker.find('.note-dimension-picker-unhighlighted');var posOffset;if(event.offsetX===undefined){var posCatcher=$$1(event.target).offset();posOffset={x:event.pageX-posCatcher.left,y:event.pageY-posCatcher.top}}else{posOffset={x:event.offsetX,y:event.offsetY}}var dim={c:Math.ceil(posOffset.x/PX_PER_EM)||1,r:Math.ceil(posOffset.y/PX_PER_EM)||1};$highlighted.css({width:dim.c+'em',height:dim.r+'em'});$catcher.data('value',dim.c+'x'+dim.r);if(dim.c>3&&dim.c<this.options.insertTableMaxSize.col){$unhighlighted.css({width:dim.c+1+'em'})}if(dim.r>3&&dim.r<this.options.insertTableMaxSize.row){$unhighlighted.css({height:dim.r+1+'em'})}$dimensionDisplay.html(dim.c+' x '+dim.r)};return Buttons}());var Toolbar=(function(){function Toolbar(context){this.context=context;this.$window=$$1(window);this.$document=$$1(document);this.ui=$$1.summernote.ui;this.$note=context.layoutInfo.note;this.$editor=context.layoutInfo.editor;this.$toolbar=context.layoutInfo.toolbar;this.options=context.options;this.followScroll=this.followScroll.bind(this)}Toolbar.prototype.shouldInitialize=function(){return!this.options.airMode};Toolbar.prototype.initialize=function(){var _this=this;this.options.toolbar=this.options.toolbar||[];if(!this.options.toolbar.length){this.$toolbar.hide()}else{this.context.invoke('buttons.build',this.$toolbar,this.options.toolbar)}if(this.options.toolbarContainer){this.$toolbar.appendTo(this.options.toolbarContainer)}this.changeContainer(false);this.$note.on('summernote.keyup summernote.mouseup summernote.change',function(){_this.context.invoke('buttons.updateCurrentStyle')});this.context.invoke('buttons.updateCurrentStyle');if(this.options.followingToolbar){this.$window.on('scroll resize',this.followScroll)}};Toolbar.prototype.destroy=function(){this.$toolbar.children().remove();if(this.options.followingToolbar){this.$window.off('scroll resize',this.followScroll)}};Toolbar.prototype.followScroll=function(){if(this.$editor.hasClass('fullscreen')){return false}var $toolbarWrapper=this.$toolbar.parent('.note-toolbar-wrapper');var editorHeight=this.$editor.outerHeight();var editorWidth=this.$editor.width();var toolbarHeight=this.$toolbar.height();$toolbarWrapper.css({height:toolbarHeight});var otherBarHeight=0;if(this.options.otherStaticBar){otherBarHeight=$$1(this.options.otherStaticBar).outerHeight()}var currentOffset=this.$document.scrollTop();var editorOffsetTop=this.$editor.offset().top;var editorOffsetBottom=editorOffsetTop+editorHeight;var activateOffset=editorOffsetTop-otherBarHeight;var deactivateOffsetBottom=editorOffsetBottom-otherBarHeight-toolbarHeight;if((currentOffset>activateOffset)&&(currentOffset<deactivateOffsetBottom)){this.$toolbar.css({position:'fixed',top:otherBarHeight,width:editorWidth})}else{this.$toolbar.css({position:'relative',top:0,width:'100%'})}};Toolbar.prototype.changeContainer=function(isFullscreen){if(isFullscreen){this.$toolbar.prependTo(this.$editor)}else{if(this.options.toolbarContainer){this.$toolbar.appendTo(this.options.toolbarContainer)}}};Toolbar.prototype.updateFullscreen=function(isFullscreen){this.ui.toggleBtnActive(this.$toolbar.find('.btn-fullscreen'),isFullscreen);this.changeContainer(isFullscreen)};Toolbar.prototype.updateCodeview=function(isCodeview){this.ui.toggleBtnActive(this.$toolbar.find('.btn-codeview'),isCodeview);if(isCodeview){this.deactivate()}else{this.activate()}};Toolbar.prototype.activate=function(isIncludeCodeview){var $btn=this.$toolbar.find('button');if(!isIncludeCodeview){$btn=$btn.not('.btn-codeview')}this.ui.toggleBtn($btn,true)};Toolbar.prototype.deactivate=function(isIncludeCodeview){var $btn=this.$toolbar.find('button');if(!isIncludeCodeview){$btn=$btn.not('.btn-codeview')}this.ui.toggleBtn($btn,false)};return Toolbar}());var LinkDialog=(function(){function LinkDialog(context){this.context=context;this.ui=$$1.summernote.ui;this.$body=$$1(document.body);this.$editor=context.layoutInfo.editor;this.options=context.options;this.lang=this.options.langInfo;context.memo('help.linkDialog.show',this.options.langInfo.help['linkDialog.show'])}LinkDialog.prototype.initialize=function(){var $container=this.options.dialogsInBody?this.$body:this.$editor;var body=['<div class="inputbox">',"<label class=\"note-form-label\">"+this.lang.link.textToDisplay+"</label>",'<input class="note-link-text form-control note-form-control note-input" type="text" />','</div>','<div class="inputbox">',"<label class=\"note-form-label\">"+this.lang.link.url+"</label>",'<input class="note-link-url form-control note-form-control note-input" type="text" value="http://" />','</div>',!this.options.disableLinkTarget?$$1('<div/>').append(this.ui.checkbox({id:'sn-checkbox-open-in-new-window',text:this.lang.link.openInNewWindow,checked:true}).render()).html():''].join('');var buttonClass='btn btn-primary note-btn note-btn-primary note-link-btn';var footer="<button type=\"submit\" href=\"#\" class=\""+buttonClass+"\" disabled>"+this.lang.link.insert+"</button>";this.$dialog=this.ui.dialog({className:'link-dialog',title:this.lang.link.insert,fade:this.options.dialogsFade,body:body,footer:footer}).render().appendTo($container)};LinkDialog.prototype.destroy=function(){this.ui.hideDialog(this.$dialog);this.$dialog.remove()};LinkDialog.prototype.bindEnterKey=function($input,$btn){$input.on('keypress',function(event){if(event.keyCode===key.code.ENTER){event.preventDefault();$btn.trigger('click')}})};LinkDialog.prototype.toggleLinkBtn=function($linkBtn,$linkText,$linkUrl){this.ui.toggleBtn($linkBtn,$linkText.val()&&$linkUrl.val())};LinkDialog.prototype.showLinkDialog=function(linkInfo){var _this=this;return $$1.Deferred(function(deferred){var $linkText=_this.$dialog.find('.note-link-text');var $linkUrl=_this.$dialog.find('.note-link-url');var $linkBtn=_this.$dialog.find('.note-link-btn');var $openInNewWindow=_this.$dialog.find('input[type=checkbox]');_this.ui.onDialogShown(_this.$dialog,function(){_this.context.triggerEvent('dialog.shown');if(!linkInfo.url){linkInfo.url=linkInfo.text}$linkText.val(linkInfo.text);var handleLinkTextUpdate=function(){_this.toggleLinkBtn($linkBtn,$linkText,$linkUrl);linkInfo.text=$linkText.val()};$linkText.on('input',handleLinkTextUpdate).on('paste',function(){setTimeout(handleLinkTextUpdate,0)});var handleLinkUrlUpdate=function(){_this.toggleLinkBtn($linkBtn,$linkText,$linkUrl);if(!linkInfo.text){$linkText.val($linkUrl.val())}};$linkUrl.on('input',handleLinkUrlUpdate).on('paste',function(){setTimeout(handleLinkUrlUpdate,0)}).val(linkInfo.url);if(!env.isSupportTouch){$linkUrl.trigger('focus')}_this.toggleLinkBtn($linkBtn,$linkText,$linkUrl);_this.bindEnterKey($linkUrl,$linkBtn);_this.bindEnterKey($linkText,$linkBtn);var isChecked=linkInfo.isNewWindow!==undefined?linkInfo.isNewWindow:_this.context.options.linkTargetBlank;$openInNewWindow.prop('checked',isChecked);$linkBtn.one('click',function(event){event.preventDefault();deferred.resolve({range:linkInfo.range,url:$linkUrl.val(),text:$linkText.val(),isNewWindow:$openInNewWindow.is(':checked')});_this.ui.hideDialog(_this.$dialog)})});_this.ui.onDialogHidden(_this.$dialog,function(){$linkText.off('input paste keypress');$linkUrl.off('input paste keypress');$linkBtn.off('click');if(deferred.state()==='pending'){deferred.reject()}});_this.ui.showDialog(_this.$dialog)}).promise()};LinkDialog.prototype.show=function(){var _this=this;var linkInfo=this.context.invoke('editor.getLinkInfo');this.context.invoke('editor.saveRange');this.showLinkDialog(linkInfo).then(function(linkInfo){_this.context.invoke('editor.restoreRange');_this.context.invoke('editor.createLink',linkInfo)}).fail(function(){_this.context.invoke('editor.restoreRange')})};return LinkDialog}());var LinkPopover=(function(){function LinkPopover(context){var _this=this;this.context=context;this.ui=$$1.summernote.ui;this.options=context.options;this.events={'summernote.keyup summernote.mouseup summernote.change summernote.scroll':function(){_this.update()},'summernote.disable summernote.dialog.shown':function(){_this.hide()}}}LinkPopover.prototype.shouldInitialize=function(){return!lists.isEmpty(this.options.popover.link)};LinkPopover.prototype.initialize=function(){this.$popover=this.ui.popover({className:'note-link-popover',callback:function($node){var $content=$node.find('.popover-content,.note-popover-content');$content.prepend('<span><a target="_blank"></a>&nbsp;</span>')}}).render().appendTo(this.options.container);var $content=this.$popover.find('.popover-content,.note-popover-content');this.context.invoke('buttons.build',$content,this.options.popover.link)};LinkPopover.prototype.destroy=function(){this.$popover.remove()};LinkPopover.prototype.update=function(){if(!this.context.invoke('editor.hasFocus')){this.hide();return}var rng=this.context.invoke('editor.createRange');if(rng.isCollapsed()&&rng.isOnAnchor()){var anchor=dom.ancestor(rng.sc,dom.isAnchor);var href=$$1(anchor).attr('href');this.$popover.find('a').attr('href',href).html(href);var pos=dom.posFromPlaceholder(anchor);this.$popover.css({display:'block',left:pos.left,top:pos.top})}else{this.hide()}};LinkPopover.prototype.hide=function(){this.$popover.hide()};return LinkPopover}());var ImageDialog=(function(){function ImageDialog(context){this.context=context;this.ui=$$1.summernote.ui;this.$body=$$1(document.body);this.$editor=context.layoutInfo.editor;this.options=context.options;this.lang=this.options.langInfo}ImageDialog.prototype.initialize=function(){var $container=this.options.dialogsInBody?this.$body:this.$editor;var imageLimitation='';if(this.options.maximumImageFileSize){var unit=Math.floor(Math.log(this.options.maximumImageFileSize)/Math.log(1024));var readableSize=(this.options.maximumImageFileSize/Math.pow(1024,unit)).toFixed(2)*1+' '+' KMGTP'[unit]+'B';imageLimitation="<small>"+(this.lang.image.maximumFileSize+' : '+readableSize)+"</small>"}var body=['<div class="form-group note-form-group note-group-select-from-files">','<label class="note-form-label">'+this.lang.image.selectFromFiles+'</label>','<input class="note-image-input note-form-control note-input" ',' type="file" name="files" accept="image/*" multiple="multiple" />',imageLimitation,'</div>','<div class="inputbox">','<label>'+this.lang.image.url+'</label>','<input class="note-image-url form-control note-form-control note-input ',' col-md-12" type="text" />','</div>'].join('');var buttonClass='btn btn-primary note-btn note-btn-primary note-image-btn';var footer="<button type=\"submit\" href=\"#\" class=\""+buttonClass+"\" disabled>"+this.lang.image.insert+"</button>";this.$dialog=this.ui.dialog({title:this.lang.image.insert,fade:this.options.dialogsFade,body:body,footer:footer}).render().appendTo($container)};ImageDialog.prototype.destroy=function(){this.ui.hideDialog(this.$dialog);this.$dialog.remove()};ImageDialog.prototype.bindEnterKey=function($input,$btn){$input.on('keypress',function(event){if(event.keyCode===key.code.ENTER){event.preventDefault();$btn.trigger('click')}})};ImageDialog.prototype.show=function(){var _this=this;this.context.invoke('editor.saveRange');this.showImageDialog().then(function(data){_this.ui.hideDialog(_this.$dialog);_this.context.invoke('editor.restoreRange');if(typeof data==='string'){_this.context.invoke('editor.insertImage',data)}else{_this.context.invoke('editor.insertImagesOrCallback',data)}}).fail(function(){_this.context.invoke('editor.restoreRange')})};ImageDialog.prototype.showImageDialog=function(){var _this=this;return $$1.Deferred(function(deferred){var $imageInput=_this.$dialog.find('.note-image-input');var $imageUrl=_this.$dialog.find('.note-image-url');var $imageBtn=_this.$dialog.find('.note-image-btn');_this.ui.onDialogShown(_this.$dialog,function(){_this.context.triggerEvent('dialog.shown');$imageInput.replaceWith($imageInput.clone().on('change',function(event){deferred.resolve(event.target.files||event.target.value)}).val(''));$imageBtn.click(function(event){event.preventDefault();deferred.resolve($imageUrl.val())});$imageUrl.on('keyup paste',function(){var url=$imageUrl.val();_this.ui.toggleBtn($imageBtn,url)}).val('');if(!env.isSupportTouch){$imageUrl.trigger('focus')}_this.bindEnterKey($imageUrl,$imageBtn)});_this.ui.onDialogHidden(_this.$dialog,function(){$imageInput.off('change');$imageUrl.off('keyup paste keypress');$imageBtn.off('click');if(deferred.state()==='pending'){deferred.reject()}});_this.ui.showDialog(_this.$dialog)})};return ImageDialog}());var ImagePopover=(function(){function ImagePopover(context){var _this=this;this.context=context;this.ui=$$1.summernote.ui;this.editable=context.layoutInfo.editable[0];this.options=context.options;this.events={'summernote.disable':function(){_this.hide()}}}ImagePopover.prototype.shouldInitialize=function(){return!lists.isEmpty(this.options.popover.image)};ImagePopover.prototype.initialize=function(){this.$popover=this.ui.popover({className:'note-image-popover'}).render().appendTo(this.options.container);var $content=this.$popover.find('.popover-content,.note-popover-content');this.context.invoke('buttons.build',$content,this.options.popover.image)};ImagePopover.prototype.destroy=function(){this.$popover.remove()};ImagePopover.prototype.update=function(target){if(dom.isImg(target)){var pos=dom.posFromPlaceholder(target);var posEditor=dom.posFromPlaceholder(this.editable);this.$popover.css({display:'block',left:this.options.popatmouse?event.pageX-20:pos.left,top:this.options.popatmouse?event.pageY:Math.min(pos.top,posEditor.top)})}else{this.hide()}};ImagePopover.prototype.hide=function(){this.$popover.hide()};return ImagePopover}());var TablePopover=(function(){function TablePopover(context){var _this=this;this.context=context;this.ui=$$1.summernote.ui;this.options=context.options;this.events={'summernote.mousedown':function(we,e){_this.update(e.target)},'summernote.keyup summernote.scroll summernote.change':function(){_this.update()},'summernote.disable':function(){_this.hide()}}}TablePopover.prototype.shouldInitialize=function(){return!lists.isEmpty(this.options.popover.table)};TablePopover.prototype.initialize=function(){this.$popover=this.ui.popover({className:'note-table-popover'}).render().appendTo(this.options.container);var $content=this.$popover.find('.popover-content,.note-popover-content');this.context.invoke('buttons.build',$content,this.options.popover.table);if(env.isFF){document.execCommand('enableInlineTableEditing',false,false)}};TablePopover.prototype.destroy=function(){this.$popover.remove()};TablePopover.prototype.update=function(target){if(this.context.isDisabled()){return false}var isCell=dom.isCell(target);if(isCell){var pos=dom.posFromPlaceholder(target);this.$popover.css({display:'block',left:pos.left,top:pos.top})}else{this.hide()}return isCell};TablePopover.prototype.hide=function(){this.$popover.hide()};return TablePopover}());var VideoDialog=(function(){function VideoDialog(context){this.context=context;this.ui=$$1.summernote.ui;this.$body=$$1(document.body);this.$editor=context.layoutInfo.editor;this.options=context.options;this.lang=this.options.langInfo}VideoDialog.prototype.initialize=function(){var $container=this.options.dialogsInBody?this.$body:this.$editor;var body=['<div class="inputbox">',"<label class=\"note-form-label\">"+this.lang.video.url+" <small class=\"text-muted\">"+this.lang.video.providers+"</small></label>",'<input class="note-video-url form-control note-form-control note-input" type="text" />','</div>'].join('');var buttonClass='btn btn-primary note-btn note-btn-primary note-video-btn';var footer="<button type=\"submit\" href=\"#\" class=\""+buttonClass+"\" disabled>"+this.lang.video.insert+"</button>";this.$dialog=this.ui.dialog({title:this.lang.video.insert,fade:this.options.dialogsFade,body:body,footer:footer}).render().appendTo($container)};VideoDialog.prototype.destroy=function(){this.ui.hideDialog(this.$dialog);this.$dialog.remove()};VideoDialog.prototype.bindEnterKey=function($input,$btn){$input.on('keypress',function(event){if(event.keyCode===key.code.ENTER){event.preventDefault();$btn.trigger('click')}})};VideoDialog.prototype.createVideoNode=function(url){console.log(1,url);var ytRegExp=/^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/;var ytMatch=url.match(ytRegExp);var rytRegExp=/^(?:https?:\/\/)?(?:www\.)?(rutube\.ru\/(?:video|play\/embed))\/((\w|-)*)(?:\/)?$/;var rytMatch=url.match(rytRegExp);var igRegExp=/(?:www\.|\/\/)instagram\.com\/p\/(.[a-zA-Z0-9_-]*)/;var igMatch=url.match(igRegExp);var vRegExp=/\/\/vine\.co\/v\/([a-zA-Z0-9]+)/;var vMatch=url.match(vRegExp);var vimRegExp=/\/\/(player\.)?vimeo\.com\/([a-z]*\/)*(\d+)[?]?.*/;var vimMatch=url.match(vimRegExp);var dmRegExp=/.+dailymotion.com\/(video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/;var dmMatch=url.match(dmRegExp);var youkuRegExp=/\/\/v\.youku\.com\/v_show\/id_(\w+)=*\.html/;var youkuMatch=url.match(youkuRegExp);var qqRegExp=/\/\/v\.qq\.com.*?vid=(.+)/;var qqMatch=url.match(qqRegExp);var qqRegExp2=/\/\/v\.qq\.com\/x?\/?(page|cover).*?\/([^\/]+)\.html\??.*/;var qqMatch2=url.match(qqRegExp2);var mp4RegExp=/^.+.(mp4|m4v)$/;var mp4Match=url.match(mp4RegExp);var oggRegExp=/^.+.(ogg|ogv)$/;var oggMatch=url.match(oggRegExp);var webmRegExp=/^.+.(webm)$/;var webmMatch=url.match(webmRegExp);var $video;console.log(2,rytRegExp);console.log(3,rytMatch);if(ytMatch&&ytMatch[1].length===11){var youtubeId=ytMatch[1];$video=$$1('<iframe>').attr('frameborder',0).attr('src','//www.youtube.com/embed/'+youtubeId).attr('width','640').attr('height','360')}else if(rytMatch&&rytMatch[2].length){console.log(4,rytMatch);var rutubeId=rytMatch[2];$video=$$1('<iframe>').attr('frameborder',0).attr('src','https://rutube.ru/play/embed/'+rutubeId).attr('width','640').attr('height','360')}else if(igMatch&&igMatch[0].length){$video=$$1('<iframe>').attr('frameborder',0).attr('src','https://instagram.com/p/'+igMatch[1]+'/embed/').attr('width','612').attr('height','710').attr('scrolling','no').attr('allowtransparency','true')}else if(vMatch&&vMatch[0].length){$video=$$1('<iframe>').attr('frameborder',0).attr('src',vMatch[0]+'/embed/simple').attr('width','600').attr('height','600').attr('class','vine-embed')}else if(vimMatch&&vimMatch[3].length){$video=$$1('<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen>').attr('frameborder',0).attr('src','//player.vimeo.com/video/'+vimMatch[3]).attr('width','640').attr('height','360')}else if(dmMatch&&dmMatch[2].length){$video=$$1('<iframe>').attr('frameborder',0).attr('src','//www.dailymotion.com/embed/video/'+dmMatch[2]).attr('width','640').attr('height','360')}else if(youkuMatch&&youkuMatch[1].length){$video=$$1('<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen>').attr('frameborder',0).attr('height','498').attr('width','510').attr('src','//player.youku.com/embed/'+youkuMatch[1])}else if((qqMatch&&qqMatch[1].length)||(qqMatch2&&qqMatch2[2].length)){var vid=((qqMatch&&qqMatch[1].length)?qqMatch[1]:qqMatch2[2]);$video=$$1('<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen>').attr('frameborder',0).attr('height','310').attr('width','500').attr('src','http://v.qq.com/iframe/player.html?vid='+vid+'&amp;auto=0')}else if(mp4Match||oggMatch||webmMatch){$video=$$1('<video controls>').attr('src',url).attr('width','640').attr('height','360')}else{return false}$video.addClass('note-video-clip');return $video[0]};VideoDialog.prototype.show=function(){var _this=this;var text=this.context.invoke('editor.getSelectedText');this.context.invoke('editor.saveRange');this.showVideoDialog(text).then(function(url){_this.ui.hideDialog(_this.$dialog);_this.context.invoke('editor.restoreRange');var $node=_this.createVideoNode(url);if($node){_this.context.invoke('editor.insertNode',$node)}}).fail(function(){_this.context.invoke('editor.restoreRange')})};VideoDialog.prototype.showVideoDialog=function(text){var _this=this;return $$1.Deferred(function(deferred){var $videoUrl=_this.$dialog.find('.note-video-url');var $videoBtn=_this.$dialog.find('.note-video-btn');_this.ui.onDialogShown(_this.$dialog,function(){_this.context.triggerEvent('dialog.shown');$videoUrl.val(text).on('input',function(){_this.ui.toggleBtn($videoBtn,$videoUrl.val())});if(!env.isSupportTouch){$videoUrl.trigger('focus')}$videoBtn.click(function(event){event.preventDefault();deferred.resolve($videoUrl.val())});_this.bindEnterKey($videoUrl,$videoBtn)});_this.ui.onDialogHidden(_this.$dialog,function(){$videoUrl.off('input');$videoBtn.off('click');if(deferred.state()==='pending'){deferred.reject()}});_this.ui.showDialog(_this.$dialog)})};return VideoDialog}());var HelpDialog=(function(){function HelpDialog(context){this.context=context;this.ui=$$1.summernote.ui;this.$body=$$1(document.body);this.$editor=context.layoutInfo.editor;this.options=context.options;this.lang=this.options.langInfo}HelpDialog.prototype.initialize=function(){var $container=this.options.dialogsInBody?this.$body:this.$editor;var body=['<p class="text-center">','<a href="http://summernote.org/" target="_blank">Summernote 0.8.10</a> · ','<a href="https://github.com/summernote/summernote" target="_blank">Project</a> · ','<a href="https://github.com/summernote/summernote/issues" target="_blank">Issues</a>','</p>'].join('');this.$dialog=this.ui.dialog({title:this.lang.options.help,fade:this.options.dialogsFade,body:this.createShortcutList(),footer:body,callback:function($node){$node.find('.modal-body,.note-modal-body').css({'max-height':300,'overflow':'scroll'})}}).render().appendTo($container)};HelpDialog.prototype.destroy=function(){this.ui.hideDialog(this.$dialog);this.$dialog.remove()};HelpDialog.prototype.createShortcutList=function(){var _this=this;var keyMap=this.options.keyMap[env.isMac?'mac':'pc'];return Object.keys(keyMap).map(function(key){var command=keyMap[key];var $row=$$1('<div><div class="help-list-item"/></div>');$row.append($$1('<label><kbd>'+key+'</kdb></label>').css({'width':180,'margin-right':10})).append($$1('<span/>').html(_this.context.memo('help.'+command)||command));return $row.html()}).join('')};HelpDialog.prototype.showHelpDialog=function(){var _this=this;return $$1.Deferred(function(deferred){_this.ui.onDialogShown(_this.$dialog,function(){_this.context.triggerEvent('dialog.shown');deferred.resolve()});_this.ui.showDialog(_this.$dialog)}).promise()};HelpDialog.prototype.show=function(){var _this=this;this.context.invoke('editor.saveRange');this.showHelpDialog().then(function(){_this.context.invoke('editor.restoreRange')})};return HelpDialog}());var AIR_MODE_POPOVER_X_OFFSET=20;var AirPopover=(function(){function AirPopover(context){var _this=this;this.context=context;this.ui=$$1.summernote.ui;this.options=context.options;this.events={'summernote.keyup summernote.mouseup summernote.scroll':function(){_this.update()},'summernote.disable summernote.change summernote.dialog.shown':function(){_this.hide()},'summernote.focusout':function(we,e){if(env.isFF){return}if(!e.relatedTarget||!dom.ancestor(e.relatedTarget,func.eq(_this.$popover[0]))){_this.hide()}}}}AirPopover.prototype.shouldInitialize=function(){return this.options.airMode&&!lists.isEmpty(this.options.popover.air)};AirPopover.prototype.initialize=function(){this.$popover=this.ui.popover({className:'note-air-popover'}).render().appendTo(this.options.container);var $content=this.$popover.find('.popover-content');this.context.invoke('buttons.build',$content,this.options.popover.air)};AirPopover.prototype.destroy=function(){this.$popover.remove()};AirPopover.prototype.update=function(){var styleInfo=this.context.invoke('editor.currentStyle');if(styleInfo.range&&!styleInfo.range.isCollapsed()){var rect=lists.last(styleInfo.range.getClientRects());if(rect){var bnd=func.rect2bnd(rect);this.$popover.css({display:'block',left:Math.max(bnd.left+bnd.width/2,0)-AIR_MODE_POPOVER_X_OFFSET,top:bnd.top+bnd.height});this.context.invoke('buttons.updateCurrentStyle',this.$popover)}}else{this.hide()}};AirPopover.prototype.hide=function(){this.$popover.hide()};return AirPopover}());var POPOVER_DIST=5;var HintPopover=(function(){function HintPopover(context){var _this=this;this.context=context;this.ui=$$1.summernote.ui;this.$editable=context.layoutInfo.editable;this.options=context.options;this.hint=this.options.hint||[];this.direction=this.options.hintDirection||'bottom';this.hints=$$1.isArray(this.hint)?this.hint:[this.hint];this.events={'summernote.keyup':function(we,e){if(!e.isDefaultPrevented()){_this.handleKeyup(e)}},'summernote.keydown':function(we,e){_this.handleKeydown(e)},'summernote.disable summernote.dialog.shown':function(){_this.hide()}}}HintPopover.prototype.shouldInitialize=function(){return this.hints.length>0};HintPopover.prototype.initialize=function(){var _this=this;this.lastWordRange=null;this.$popover=this.ui.popover({className:'note-hint-popover',hideArrow:true,direction:''}).render().appendTo(this.options.container);this.$popover.hide();this.$content=this.$popover.find('.popover-content,.note-popover-content');this.$content.on('click','.note-hint-item',function(){_this.$content.find('.active').removeClass('active');$$1(_this).addClass('active');_this.replace()})};HintPopover.prototype.destroy=function(){this.$popover.remove()};HintPopover.prototype.selectItem=function($item){this.$content.find('.active').removeClass('active');$item.addClass('active');this.$content[0].scrollTop=$item[0].offsetTop-(this.$content.innerHeight()/2)};HintPopover.prototype.moveDown=function(){var $current=this.$content.find('.note-hint-item.active');var $next=$current.next();if($next.length){this.selectItem($next)}else{var $nextGroup=$current.parent().next();if(!$nextGroup.length){$nextGroup=this.$content.find('.note-hint-group').first()}this.selectItem($nextGroup.find('.note-hint-item').first())}};HintPopover.prototype.moveUp=function(){var $current=this.$content.find('.note-hint-item.active');var $prev=$current.prev();if($prev.length){this.selectItem($prev)}else{var $prevGroup=$current.parent().prev();if(!$prevGroup.length){$prevGroup=this.$content.find('.note-hint-group').last()}this.selectItem($prevGroup.find('.note-hint-item').last())}};HintPopover.prototype.replace=function(){var $item=this.$content.find('.note-hint-item.active');if($item.length){var node=this.nodeFromItem($item);this.lastWordRange.insertNode(node);range.createFromNode(node).collapse().select();this.lastWordRange=null;this.hide();this.context.triggerEvent('change',this.$editable.html(),this.$editable[0]);this.context.invoke('editor.focus')}};HintPopover.prototype.nodeFromItem=function($item){var hint=this.hints[$item.data('index')];var item=$item.data('item');var node=hint.content?hint.content(item):item;if(typeof node==='string'){node=dom.createText(node)}return node};HintPopover.prototype.createItemTemplates=function(hintIdx,items){var hint=this.hints[hintIdx];return items.map(function(item,idx){var $item=$$1('<div class="note-hint-item"/>');$item.append(hint.template?hint.template(item):item+'');$item.data({'index':hintIdx,'item':item});return $item})};HintPopover.prototype.handleKeydown=function(e){if(!this.$popover.is(':visible')){return}if(e.keyCode===key.code.ENTER){e.preventDefault();this.replace()}else if(e.keyCode===key.code.UP){e.preventDefault();this.moveUp()}else if(e.keyCode===key.code.DOWN){e.preventDefault();this.moveDown()}};HintPopover.prototype.searchKeyword=function(index,keyword,callback){var hint=this.hints[index];if(hint&&hint.match.test(keyword)&&hint.search){var matches=hint.match.exec(keyword);hint.search(matches[1],callback)}else{callback()}};HintPopover.prototype.createGroup=function(idx,keyword){var _this=this;var $group=$$1('<div class="note-hint-group note-hint-group-'+idx+'"/>');this.searchKeyword(idx,keyword,function(items){items=items||[];if(items.length){$group.html(_this.createItemTemplates(idx,items));_this.show()}});return $group};HintPopover.prototype.handleKeyup=function(e){var _this=this;if(!lists.contains([key.code.ENTER,key.code.UP,key.code.DOWN],e.keyCode)){var wordRange=this.context.invoke('editor.createRange').getWordRange();var keyword_1=wordRange.toString();if(this.hints.length&&keyword_1){this.$content.empty();var bnd=func.rect2bnd(lists.last(wordRange.getClientRects()));if(bnd){this.$popover.hide();this.lastWordRange=wordRange;this.hints.forEach(function(hint,idx){if(hint.match.test(keyword_1)){_this.createGroup(idx,keyword_1).appendTo(_this.$content)}});this.$content.find('.note-hint-item:first').addClass('active');if(this.direction==='top'){this.$popover.css({left:bnd.left,top:bnd.top-this.$popover.outerHeight()-POPOVER_DIST})}else{this.$popover.css({left:bnd.left,top:bnd.top+bnd.height+POPOVER_DIST})}}}else{this.hide()}}};HintPopover.prototype.show=function(){this.$popover.show()};HintPopover.prototype.hide=function(){this.$popover.hide()};return HintPopover}());var Context=(function(){function Context($note,options){this.ui=$$1.summernote.ui;this.$note=$note;this.memos={};this.modules={};this.layoutInfo={};this.options=options;this.initialize()}Context.prototype.initialize=function(){this.layoutInfo=this.ui.createLayout(this.$note,this.options);this._initialize();this.$note.hide();return this};Context.prototype.destroy=function(){this._destroy();this.$note.removeData('summernote');this.ui.removeLayout(this.$note,this.layoutInfo)};Context.prototype.reset=function(){var disabled=this.isDisabled();this.code(dom.emptyPara);this._destroy();this._initialize();if(disabled){this.disable()}};Context.prototype._initialize=function(){var _this=this;var buttons=$$1.extend({},this.options.buttons);Object.keys(buttons).forEach(function(key){_this.memo('button.'+key,buttons[key])});var modules=$$1.extend({},this.options.modules,$$1.summernote.plugins||{});Object.keys(modules).forEach(function(key){_this.module(key,modules[key],true)});Object.keys(this.modules).forEach(function(key){_this.initializeModule(key)})};Context.prototype._destroy=function(){var _this=this;Object.keys(this.modules).reverse().forEach(function(key){_this.removeModule(key)});Object.keys(this.memos).forEach(function(key){_this.removeMemo(key)});this.triggerEvent('destroy',this)};Context.prototype.code=function(html){var isActivated=this.invoke('codeview.isActivated');if(html===undefined){this.invoke('codeview.sync');return isActivated?this.layoutInfo.codable.val():this.layoutInfo.editable.html()}else{if(isActivated){this.layoutInfo.codable.val(html)}else{this.layoutInfo.editable.html(html)}this.$note.val(html);this.triggerEvent('change',html)}};Context.prototype.isDisabled=function(){return this.layoutInfo.editable.attr('contenteditable')==='false'};Context.prototype.enable=function(){this.layoutInfo.editable.attr('contenteditable',true);this.invoke('toolbar.activate',true);this.triggerEvent('disable',false)};Context.prototype.disable=function(){if(this.invoke('codeview.isActivated')){this.invoke('codeview.deactivate')}this.layoutInfo.editable.attr('contenteditable',false);this.invoke('toolbar.deactivate',true);this.triggerEvent('disable',true)};Context.prototype.triggerEvent=function(){var namespace=lists.head(arguments);var args=lists.tail(lists.from(arguments));var callback=this.options.callbacks[func.namespaceToCamel(namespace,'on')];if(callback){callback.apply(this.$note[0],args)}this.$note.trigger('summernote.'+namespace,args)};Context.prototype.initializeModule=function(key){var module=this.modules[key];module.shouldInitialize=module.shouldInitialize||func.ok;if(!module.shouldInitialize()){return}if(module.initialize){module.initialize()}if(module.events){dom.attachEvents(this.$note,module.events)}};Context.prototype.module=function(key,ModuleClass,withoutIntialize){if(arguments.length===1){return this.modules[key]}this.modules[key]=new ModuleClass(this);if(!withoutIntialize){this.initializeModule(key)}};Context.prototype.removeModule=function(key){var module=this.modules[key];if(module.shouldInitialize()){if(module.events){dom.detachEvents(this.$note,module.events)}if(module.destroy){module.destroy()}}delete this.modules[key]};Context.prototype.memo=function(key,obj){if(arguments.length===1){return this.memos[key]}this.memos[key]=obj};Context.prototype.removeMemo=function(key){if(this.memos[key]&&this.memos[key].destroy){this.memos[key].destroy()}delete this.memos[key]};Context.prototype.createInvokeHandlerAndUpdateState=function(namespace,value){var _this=this;return function(event){_this.createInvokeHandler(namespace,value)(event);_this.invoke('buttons.updateCurrentStyle')}};Context.prototype.createInvokeHandler=function(namespace,value){var _this=this;return function(event){event.preventDefault();var $target=$$1(event.target);_this.invoke(namespace,value||$target.closest('[data-value]').data('value'),$target)}};Context.prototype.invoke=function(){var namespace=lists.head(arguments);var args=lists.tail(lists.from(arguments));var splits=namespace.split('.');var hasSeparator=splits.length>1;var moduleName=hasSeparator&&lists.head(splits);var methodName=hasSeparator?lists.last(splits):lists.head(splits);var module=this.modules[moduleName||'editor'];if(!moduleName&&this[methodName]){return this[methodName].apply(this,args)}else if(module&&module[methodName]&&module.shouldInitialize()){return module[methodName].apply(module,args)}};return Context}());$$1.fn.extend({summernote:function(){var type=$$1.type(lists.head(arguments));var isExternalAPICalled=type==='string';var hasInitOptions=type==='object';var options=$$1.extend({},$$1.summernote.options,hasInitOptions?lists.head(arguments):{});options.langInfo=$$1.extend(true,{},$$1.summernote.lang['en-US'],$$1.summernote.lang[options.lang]);options.icons=$$1.extend(true,{},$$1.summernote.options.icons,options.icons);options.tooltip=options.tooltip==='auto'?!env.isSupportTouch:options.tooltip;this.each(function(idx,note){var $note=$$1(note);if(!$note.data('summernote')){var context=new Context($note,options);$note.data('summernote',context);$note.data('summernote').triggerEvent('init',context.layoutInfo)}});var $note=this.first();if($note.length){var context=$note.data('summernote');if(isExternalAPICalled){return context.invoke.apply(context,lists.from(arguments))}else if(options.focus){context.invoke('editor.focus')}}return this}});$$1.summernote=$$1.extend($$1.summernote,{version:'0.8.10',ui:ui,plugins:{},options:{modules:{'editor':Editor,'clipboard':Clipboard,'dropzone':Dropzone,'codeview':CodeView,'statusbar':Statusbar,'fullscreen':Fullscreen,'handle':Handle,'hintPopover':HintPopover,'autoLink':AutoLink,'autoSync':AutoSync,'placeholder':Placeholder,'buttons':Buttons,'toolbar':Toolbar,'linkDialog':LinkDialog,'linkPopover':LinkPopover,'imageDialog':ImageDialog,'imagePopover':ImagePopover,'tablePopover':TablePopover,'videoDialog':VideoDialog,'helpDialog':HelpDialog,'airPopover':AirPopover},buttons:{},lang:'en-US',followingToolbar:true,otherStaticBar:'',toolbar:[['style',['style']],['font',['bold','underline','clear']],['fontname',['fontname']],['fontsize',['fontsize']],['color',['color']],['para',['ul','ol','paragraph']],['table',['table']],['insert',['link','picture','video']],['view',['fullscreen','codeview','help']]],popatmouse:true,popover:{image:[['imagesize',['imageSize100','imageSize50','imageSize25']],['float',['floatLeft','floatRight','floatNone']],['remove',['removeMedia']]],link:[['link',['linkDialogShow','unlink']]],table:[['add',['addRowDown','addRowUp','addColLeft','addColRight']],['delete',['deleteRow','deleteCol','deleteTable']]],air:[['color',['color']],['font',['bold','underline','clear']],['para',['ul','paragraph']],['table',['table']],['insert',['link','picture']]]},airMode:false,width:null,height:null,focus:false,tabSize:4,styleWithSpan:true,shortcuts:true,textareaAutoSync:true,hintDirection:'bottom',tooltip:'auto',container:'body',maxTextLength:0,styleTags:['p','pre','h1','h2','h3','h4','h5','h6'],fontNames:['Arial','Arial Black','Comic Sans MS','Courier New','Helvetica Neue','Helvetica','Impact','Lucida Grande','Tahoma','Times New Roman','Verdana'],fontSizes:['8','9','10','11','12','14','18','24','36'],colors:[['#000000','#424242','#636363','#9C9C94','#CEC6CE','#EFEFEF','#F7F7F7','#FFFFFF'],['#FF0000','#FF9C00','#FFFF00','#00FF00','#00FFFF','#0000FF','#9C00FF','#FF00FF'],['#F7C6CE','#FFE7CE','#FFEFC6','#D6EFD6','#CEDEE7','#CEE7F7','#D6D6E7','#E7D6DE'],['#E79C9C','#FFC69C','#FFE79C','#B5D6A5','#A5C6CE','#9CC6EF','#B5A5D6','#D6A5BD'],['#E76363','#F7AD6B','#FFD663','#94BD7B','#73A5AD','#6BADDE','#8C7BC6','#C67BA5'],['#CE0000','#E79439','#EFC631','#6BA54A','#4A7B8C','#3984C6','#634AA5','#A54A7B'],['#9C0000','#B56308','#BD9400','#397B21','#104A5A','#085294','#311873','#731842'],['#630000','#7B3900','#846300','#295218','#083139','#003163','#21104A','#4A1031']],colorsName:[['Black','Tundora','Dove Gray','Star Dust','Pale Slate','Gallery','Alabaster','White'],['Red','Orange Peel','Yellow','Green','Cyan','Blue','Electric Violet','Magenta'],['Azalea','Karry','Egg White','Zanah','Botticelli','Tropical Blue','Mischka','Twilight'],['Tonys Pink','Peach Orange','Cream Brulee','Sprout','Casper','Perano','Cold Purple','Careys Pink'],['Mandy','Rajah','Dandelion','Olivine','Gulf Stream','Viking','Blue Marguerite','Puce'],['Guardsman Red','Fire Bush','Golden Dream','Chelsea Cucumber','Smalt Blue','Boston Blue','Butterfly Bush','Cadillac'],['Sangria','Mai Tai','Buddha Gold','Forest Green','Eden','Venice Blue','Meteorite','Claret'],['Rosewood','Cinnamon','Olive','Parsley','Tiber','Midnight Blue','Valentino','Loulou']],lineHeights:['1.0','1.2','1.4','1.5','1.6','1.8','2.0','3.0'],tableClassName:'table table-bordered',insertTableMaxSize:{col:10,row:10},dialogsInBody:false,dialogsFade:false,maximumImageFileSize:null,callbacks:{onInit:null,onFocus:null,onBlur:null,onBlurCodeview:null,onEnter:null,onKeyup:null,onKeydown:null,onSubmit:null,onImageUpload:null,onImageUploadError:null},codemirror:{mode:'text/html',htmlMode:true,lineNumbers:true},keyMap:{pc:{'ENTER':'insertParagraph','CTRL+Z':'undo','CTRL+Y':'redo','TAB':'tab','SHIFT+TAB':'untab','CTRL+B':'bold','CTRL+I':'italic','CTRL+U':'underline','CTRL+SHIFT+S':'strikethrough','CTRL+BACKSLASH':'removeFormat','CTRL+SHIFT+L':'justifyLeft','CTRL+SHIFT+E':'justifyCenter','CTRL+SHIFT+R':'justifyRight','CTRL+SHIFT+J':'justifyFull','CTRL+SHIFT+NUM7':'insertUnorderedList','CTRL+SHIFT+NUM8':'insertOrderedList','CTRL+LEFTBRACKET':'outdent','CTRL+RIGHTBRACKET':'indent','CTRL+NUM0':'formatPara','CTRL+NUM1':'formatH1','CTRL+NUM2':'formatH2','CTRL+NUM3':'formatH3','CTRL+NUM4':'formatH4','CTRL+NUM5':'formatH5','CTRL+NUM6':'formatH6','CTRL+ENTER':'insertHorizontalRule','CTRL+K':'linkDialog.show'},mac:{'ENTER':'insertParagraph','CMD+Z':'undo','CMD+SHIFT+Z':'redo','TAB':'tab','SHIFT+TAB':'untab','CMD+B':'bold','CMD+I':'italic','CMD+U':'underline','CMD+SHIFT+S':'strikethrough','CMD+BACKSLASH':'removeFormat','CMD+SHIFT+L':'justifyLeft','CMD+SHIFT+E':'justifyCenter','CMD+SHIFT+R':'justifyRight','CMD+SHIFT+J':'justifyFull','CMD+SHIFT+NUM7':'insertUnorderedList','CMD+SHIFT+NUM8':'insertOrderedList','CMD+LEFTBRACKET':'outdent','CMD+RIGHTBRACKET':'indent','CMD+NUM0':'formatPara','CMD+NUM1':'formatH1','CMD+NUM2':'formatH2','CMD+NUM3':'formatH3','CMD+NUM4':'formatH4','CMD+NUM5':'formatH5','CMD+NUM6':'formatH6','CMD+ENTER':'insertHorizontalRule','CMD+K':'linkDialog.show'}},icons:{'align':'note-icon-align','alignCenter':'note-icon-align-center','alignJustify':'note-icon-align-justify','alignLeft':'note-icon-align-left','alignRight':'note-icon-align-right','rowBelow':'note-icon-row-below','colBefore':'note-icon-col-before','colAfter':'note-icon-col-after','rowAbove':'note-icon-row-above','rowRemove':'note-icon-row-remove','colRemove':'note-icon-col-remove','indent':'note-icon-align-indent','outdent':'note-icon-align-outdent','arrowsAlt':'note-icon-arrows-alt','bold':'note-icon-bold','caret':'note-icon-caret','circle':'note-icon-circle','close':'note-icon-close','code':'note-icon-code','eraser':'note-icon-eraser','font':'note-icon-font','frame':'note-icon-frame','italic':'note-icon-italic','link':'note-icon-link','unlink':'note-icon-chain-broken','magic':'note-icon-magic','menuCheck':'note-icon-menu-check','minus':'note-icon-minus','orderedlist':'note-icon-orderedlist','pencil':'note-icon-pencil','picture':'note-icon-picture','question':'note-icon-question','redo':'note-icon-redo','square':'note-icon-square','strikethrough':'note-icon-strikethrough','subscript':'note-icon-subscript','superscript':'note-icon-superscript','table':'note-icon-table','textHeight':'note-icon-text-height','trash':'note-icon-trash','underline':'note-icon-underline','undo':'note-icon-undo','unorderedlist':'note-icon-unorderedlist','video':'note-icon-video'}}})})));
@@ -1447,6 +1447,7 @@
1447
1447
  padding: 0;
1448
1448
  margin: 0;
1449
1449
  background: transparent;
1450
+ cursor: pointer;
1450
1451
  }
1451
1452
  }
1452
1453
 
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.0.1395",
2
+ "version": "2.0.1397",
3
3
  "name": "ros.grant.common",
4
4
  "private": false,
5
5
  "scripts": {