Your IP : 18.118.9.105


Current Path : /home/bitrix/ext_www/shuft.com.ua/bitrix/js/fileman/block_editor/
Upload File :
Current File : /home/bitrix/ext_www/shuft.com.ua/bitrix/js/fileman/block_editor/dialog.min.js

function BXBlockEditorPreview(t){this.init(t)}BXBlockEditorPreview.prototype.init=function(t){this.url=t.url;this.site=t.site;this.previewContext=BX.findChildByClassName(t.context,"bx-block-editor-preview-container",true);this.devicesContext=BX.findChildByClassName(this.previewContext,"devices",true);this.iframePreview=BX.findChildByClassName(this.previewContext,"preview-iframe",true);this.shadowNode=BX.findChild(this.previewContext,{className:"shadow"},true);var e=this;this.deviceList=BX.findChildrenByClassName(this.devicesContext,"device");for(var i in this.deviceList){var n=this.deviceList[i];BX.bind(n,"click",function(){e.changeDevice(this)})}this.changeDevice();var a=function(){BX.loadCSS("/bitrix/js/fileman/block_editor/preview.css?r="+Math.random(),this.contentDocument,this.contentWindow);BX.removeClass(e.shadowNode,"active")};BX.ready(function(){BX.bind(e.iframePreview,"load",a)})};BXBlockEditorPreview.prototype.changeDevice=function(t){if(!t){t=this.deviceList[0]}var e=t.getAttribute("data-bx-preview-device-width");var i=t.getAttribute("data-bx-preview-device-height");var n=t.getAttribute("data-bx-preview-device-class");var a=[];for(var o in this.deviceList){var r=this.deviceList[o];if(!r){break}if(r!==t){BX.removeClass(r,"active")}a.push(r.getAttribute("data-bx-preview-device-class"))}BX.addClass(t,"active");var s=BX.findChildByClassName(this.previewContext,"iframe-wrapper",true);if(s){BX.removeClass(s,a.join(" "));BX.addClass(s,n)}this.iframePreview.style.width=e+"px";this.iframePreview.style.height=i+"px"};BXBlockEditorPreview.prototype.show=function(t){t=t||{};BX.addClass(this.shadowNode,"active");BX.removeClass(this.shadowNode,"access-denied");var e=this;this.previewContext.style.display="block";BX.ajax({url:"/bitrix/admin/fileman_block_editor.php?action=set",method:"POST",data:{sessid:BX.bitrix_sessid(),src:t.content},onsuccess:function(){var t=Math.random();var i=e.url+"&site_id="+e.site+"&r="+t;e.iframePreview.setAttribute("src",i)},onfailure:function(t){if(t=="auth"){BX.addClass(e.shadowNode,"access-denied")}}})};BXBlockEditorPreview.prototype.hide=function(){this.previewContext.style.display="none"};function BXBlockEditorDragDrop(t){this.CONST_ATTR_BLOCK_TYPE="data-bx-block-editor-block-type";this.CONST_ATTR_BLOCK_STATUS="data-bx-block-editor-block-status";this.init(t)}BXBlockEditorDragDrop.prototype={addItem:function(t){this.dragdrop.addCatcher(t);this.dragdrop.addDragItem([t])},removeItem:function(t){this.dragdrop.removeCatcher(t)},init:function(t){this.dragdrop=BX.DragDrop.create({dragItemClassName:"bx-block-editor-i-block-list-item",dropZoneList:[],dragStart:BX.delegate(function(t,e,i){this.lastDragObject=null;this.dragEnterCounter=0;for(var n in this.dragdrop.dropZoneNodeList){BX.addClass(this.dragdrop.dropZoneNodeList[n],"bx-dd-start")}},this),dragDrop:BX.delegate(function(t,e,i){BX.onCustomEvent(this,"onZoneLeave",[t]);var n=BX.pos(t);var a=i.offsetY<n.height/2;var o=e.getAttribute(this.CONST_ATTR_BLOCK_STATUS);if(o=="blank"){var r=e.getAttribute(this.CONST_ATTR_BLOCK_TYPE);BX.onCustomEvent(this,"onItemAdd",[r,t,a])}else{BX.onCustomEvent(this,"onItemMove",[e,t,a])}},this),dragOver:BX.delegate(function(t,e,i){var n=BX.findChildByClassName(t,"bx-block-inside",true);n=n||t;var a=BX.pos(n);if(i.offsetY<a.height/2){BX.onCustomEvent(this,"onZoneEnter",[t,true])}else{BX.onCustomEvent(this,"onZoneEnter",[t,false])}},this),dragEnter:BX.delegate(function(t,e,i){if(t==i.target){BX.onCustomEvent(this,"onZoneEnter",[t,true]);i.preventDefault()}},this),dragLeave:BX.delegate(function(t,e,i){if(t==i.target){BX.onCustomEvent(this,"onZoneLeave",[t]);this.dragEnterCounter=0}},this),dragEnd:BX.delegate(function(t,e,i){BX.onCustomEvent(this,"onZoneLeave",[t]);for(var n in this.dragdrop.dropZoneNodeList){BX.removeClass(this.dragdrop.dropZoneNodeList[n],"bx-dd-start")}},this)})}};function BXBlockEditorDialogFileInput(t){this.isMultiImage=true;this.caller=t.caller;this.context=this.caller.context;this.id=t.id;this.fileInput=BX.UI.FileInput.getInstance("bx_file_"+this.id.toLowerCase());this.fileList=[];BX.addCustomEvent(this.caller,"onLinkControl-src",BX.delegate(this.onLink,this));BX.addCustomEvent(this.caller,"onSave",BX.delegate(this.onSave,this));BX.addCustomEvent(this.caller,"loadSetting-src",BX.delegate(this.onLoadSetting,this))}BXBlockEditorDialogFileInput.prototype={getImages:function(){var t=[],e;var i=this.fileInput.agent.getItems();i.reset();while((e=i.getNext())&&e){t.push(this.fileList[e.id])}return t},setImages:function(t){this.fileInput.deleteFiles();this.fileDialogFiles={};var e=this.fileInput.uploadParams["frameFiles"];this.fileInput.uploadParams["frameFiles"]="N";for(var i in t){var n=t[i];var a=n.split("/");var o=a.pop();var r=a.join("/");this.fileInput.handlerFileDialog(o,r)}this.fileInput.uploadParams["frameFiles"]=e},onAgentChange:function(t){t.value=this.getImages().join(",");BX.onCustomEvent(t,"onSettingChangeValue")},onLoadSetting:function(t){this.isMultiImage=!!t.params.multi},onLink:function(t){var e=t.ctrl;var i=t.code;var n=e;BX.addCustomEvent(n,"onSettingLoadValue",BX.delegate(function(){var t=[];var e=n.value.split(",");for(var i in e){var a=e[i].split("?");t.push(a[0])}this.setImages(t)},this));BX.addCustomEvent(this.fileInput.agent,"onAttachFiles",BX.delegate(function(){if(!this.isMultiImage){this.semaphoreOnQueueIsChanged=true;this.fileInput.deleteFiles()}},this));BX.addCustomEvent(this.fileInput.agent,"onQueueIsChanged",BX.delegate(function(){if(!this.semaphoreOnQueueIsChanged){this.onAgentChange(n)}this.semaphoreOnQueueIsChanged=false},this));this.onFileIsCreated=function(t,e){this.semaphoreOnQueueIsChanged=true;if(e.file["tmp_url"]){this.fileList[t]=e.file["tmp_url"]}BX.addCustomEvent(e,"onUploadDone",BX.delegate(function(t,e){if(e["file"]&&e.file["path"]){this.fileList[e.file.id]=e.file.path+"?"+Math.random();this.onAgentChange(n)}},this))};BX.addCustomEvent(this.fileInput.agent,"onFileIsCreated",BX.delegate(this.onFileIsCreated,this));t.bind=false},onSave:function(){var t=false;var e=BX.findChildByClassName(this.context,"adm-fileinput-area-container",true);var i=e.querySelectorAll('input[name^="NEW_FILE_EDITOR"]');var n={};for(var a in i){if(i[a]&&i[a].getAttribute){var o=i[a].getAttribute("name");n[i[a].getAttribute("name")]=i[a].value;if(o.indexOf("tmp_name")>-1){t=true}}}if(!t){return}BX.ajax({url:"/bitrix/admin/fileman_block_editor.php?action=save_file",method:"POST",data:n,dataType:"json",async:false,onsuccess:BX.delegate(this.onImagesSaved,this)})},onImagesSaved:function(t){for(var e in this.caller.tabList){var i=this.caller.tabList[e].items["src"];if(!i){continue}if(!i.ctrl.value){continue}for(var n in t){if(!n){continue}var a=t[n];i.ctrl.value=i.ctrl.value.replace(n,a)}BX.onCustomEvent(i.ctrl,"onSettingChangeValue")}}};function BXBlockEditorEditDialogColumn(t){this.attributeColumnNum="data-bx-editor-column-number";this.attributeColumnValue="data-bx-editor-column-value";this.attributeColumnCount="data-bx-editor-column-count";this.caller=t.caller;BX.addCustomEvent(this.caller,"onLinkControl",BX.delegate(this.onLinkControl,this));BX.addCustomEvent(this.caller,"loadSetting",BX.delegate(this.onLoadSetting,this))}BXBlockEditorEditDialogColumn.prototype={getColumnList:function(t){return BX.findChildren(t,{attribute:this.attributeColumnNum},true)},bindOnSwitch:function(t,e){BX.bind(e,"click",BX.delegate(function(){var i=e.getAttribute(this.attributeColumnNum);t.setAttribute(this.attributeColumnValue,i);var n=this.caller.getCtrlContainer(t);var a=this.getColumnList(n.container);for(var o in a){BX.removeClass(a[o],"active")}BX.addClass(e,"active");var r=this.caller.caller.getCurrentEditingBlock().getEditValue(n.code,i);this.caller.setCtrlValue(t,r)},this))},onSettingDependenceChange:function(t,e){var i=e.container.container;var n=t.value?t.value:1;n=parseInt(n);if(n<2){n=0}var a=this.getColumnList(i);var o=0;for(var r in a){o++;var s=o<=n?"":"none";var l=a[r];l.style.display=s}this.switchDefaultColumn(i)},switchDefaultColumn:function(t){var e=this.getColumnList(t);if(e.length>0){BX.fireEvent(e[0],"click")}},onLoadSetting:function(t){this.switchDefaultColumn(t.container.container)},onLinkControl:function(t){var e=this.getColumnList(t.container);for(var i in e){this.bindOnSwitch(t.ctrl,e[i])}if(e.length>0){BX.addCustomEvent(this.caller,"onSettingDependenceChange-"+t.code,BX.delegate(this.onSettingDependenceChange,this))}}};function BXBlockEditorSocial(t){this.caller=t.caller;BX.addCustomEvent(this.caller,"onLinkControl-social_content",BX.delegate(this.onLinkControl,this));BX.addCustomEvent(this.caller,"loadSetting-social_content",BX.delegate(this.onLoadSetting,this))}BXBlockEditorSocial.prototype={onLoadSetting:function(t){this.inputControl=t.ctrl;BX.cleanNode(this.itemContainer);var e=JSON.parse(t.value);for(var i in e){var n=e[i];this.addItem(n.href,n.name)}},fireChange:function(){this.inputControl.value=JSON.stringify(this.getValue());BX.onCustomEvent(this.inputControl,"onSettingChangeValue")},getValue:function(){var t=[];var e=this.getItemList();for(var i in e){var n=e[i];var a=this.getItemControl(n,"href");var o=this.getItemControl(n,"name");t.push({name:o.value,href:a.value})}return t},getItemList:function(){return BX.findChildren(this.itemContainer,{attribute:"data-bx-block-editor-social-item"},true)},getItem:function(t){return BX.findParent(t,{attribute:"data-bx-block-editor-social-item"})},getItemControl:function(t,e){return BX.findChildByClassName(t,e,true)},removeItem:function(t){BX.remove(this.getItem(t))},changePreset:function(t){var e=this.getItem(t);var i=this.getItemControl(e,"href");var n=this.getItemControl(e,"name");i.value=t.value;n.value=t.options[t.selectedIndex].text},addItem:function(t,e){var i=this.templateItem.innerHTML;i=i.replace("#href#",t);i=i.replace("#name#",e);var n=BX.create("div",{attrs:{"data-bx-block-editor-social-item":"item"},html:i});var a=this.getItemControl(n,"delete");if(this.getValue().length==0){a.style.display="none"}var o=this.getItemControl(n,"preset");var r=this.getItemControl(n,"name");var s=this.getItemControl(n,"href");var l=this;BX.bind(r,"bxchange",function(){l.fireChange()});BX.bind(s,"bxchange",function(){l.fireChange()});BX.bind(a,"click",function(){l.removeItem(this);l.fireChange()});BX.bind(o,"change",function(){l.changePreset(this);l.fireChange()});this.itemContainer.appendChild(n);this.fireChange()},onLinkControl:function(t){this.container=t.container;this.templateItem=BX("template-social-item");this.itemContainer=BX.findChildByClassName(this.container,"container",true);var e=BX.findChildByClassName(this.container,"add",true);var i=this;BX.bind(e,"click",function(){i.addItem("","")})}};function BXBlockEditorEditDialog(t){this.changeList=[];this.tabList={};this.ctrlList={};this.itemFilter=[];this.itemPrevValues=[];this.htmlEditorParsedPhp=[];this.doNotProcessChanging=false;this.init(t)}BXBlockEditorEditDialog.prototype={getPlaceCaption:function(t){var e=BX.message("BLOCK_EDITOR_PLACE_CAPTION_"+t.toUpperCase());if(!e){e=t}return e},init:function(t){this.attributePlaceName="data-bx-place-name";this.attributeTab="data-bx-block-editor-settings-tab";this.attributeLink="data-bx-editor-tool";this.attributeCtrl="data-bx-editor-tool-input";this.caller=t.caller;this.callerContext=t.context;this.context=this.callerContext.querySelector(".edit-panel");this.contextTools=this.context.querySelector(".block-edit-cont");this.contextVisual=this.context.querySelector(".visual-part");this.contextPanel=this.context.querySelector(".dialog-part");this.contextPlaceList=this.contextPanel.querySelector(".edit-panel-tabs-style");this.buttonSave=BX.findChild(this.contextTools,{className:"bx-editor-block-tools-close"},true);this.buttonClose=BX.findChild(this.contextTools,{className:"bx-editor-block-tools-cancel"},true);BX.bind(this.buttonSave,"click",BX.delegate(this.save,this));BX.bind(this.buttonClose,"click",BX.delegate(this.cancel,this));this.helper=new BXBlockEditorHelper;this.fileInput=new BXBlockEditorDialogFileInput({caller:this,id:"BX_BLOCK_EDITOR_SRC_"+this.caller.id});this.column=new BXBlockEditorEditDialogColumn({caller:this});this.social=new BXBlockEditorSocial({caller:this});this.initHtmlEditor();this.initColorPicker();this.initBorderControl();this.initTabs();this.initPlaceList();this.initTools()},initPlaceList:function(){BX.addCustomEvent(this.caller,"onLoadAfter",BX.delegate(this.onEditorLoadAfter,this))},onEditorLoadAfter:function(t,e,i){var n=BX.findChild(this.contextPlaceList,{attribute:this.attributePlaceName},true);if(!n){return}BX.cleanNode(n);var a=function(){return function(t,e){var i=this;BX.bind(t,"click",function(){BX.onCustomEvent(i,"onPlaceEdit",[e])});BX.bind(t,"mouseenter",function(){BX.onCustomEvent(i,"onPlaceHover",[e,true])});BX.bind(t,"mouseleave",function(){BX.onCustomEvent(i,"onPlaceHover",[e,false])})}}();var o=i.findStylistPlaces();for(var r in o){var s=this.getPlaceCaption(r);var l=BX.create("li",{text:s,attrs:{title:s}});n.appendChild(l);a.apply(this,[l,r])}},initTabs:function(){var t=BX.findChildren(BX.findChildByClassName(this.contextTools,"block-edit-tabs"),{attribute:this.attributeTab},true);for(var e in t){var i=t[e];var n=i.getAttribute(this.attributeTab);this.tabList[n]={node:i,items:{}};BX.bind(i,"click",BX.delegate(this.onTabClick,this))}},initTools:function(){var t=BX.findChildren(this.context,{attribute:this.attributeLink},true);for(var e in t){var i=t[e];var n=i.getAttribute(this.attributeLink);var a=n.split(":");var o=BX.findChild(i,{attribute:this.attributeCtrl},true);if(!o){continue}this.tabList[a[0]]["items"][a[1]]={node:i,ctrl:o};var r={code:a[1],group:a[0],ctrl:o,container:i,bind:true};BX.onCustomEvent(this,"onLinkControl",[r]);BX.onCustomEvent(this,"onLinkControl-"+r.code,[r]);this.ctrlList[r.code]=r.ctrl;this.linkControl(r.ctrl,r.code,r.bind)}},initHtmlEditor:function(){this.htmlEditor=BXHtmlEditor.Get("BX_BLOCK_EDITOR_CONTENT_"+this.caller.id);var t=400;this.htmlEditor.MIN_WIDTH=t;this.htmlEditor.ResizeSceleton();this.htmlEditor.AutoResizeSceleton();BX.addCustomEvent(this,"onLinkControl-content",BX.delegate(function(t){var e=t.ctrl;var i=t.code;var n=e;BX.addCustomEvent(this.htmlEditor,"OnContentChanged",BX.delegate(function(t){n.value=this.phpParser.replacePhpByLayout(t);BX.onCustomEvent(n,"onSettingChangeValue")},this));BX.addCustomEvent(n,"onSettingLoadValue",BX.delegate(function(){var t=this.phpParser.replaceLayoutByPhp(n.value);this.htmlEditor.SetContent(t,true)},this));t.bind=false},this))},initColorPicker:function(t){this.picker=new window.BXColorPicker({id:"picker",name:"picker"});this.picker.Create();var e=this;BX.addCustomEvent(this,"onHide",function(){e.picker.Close()});var i=function(){var t=this;t.parentNode.appendChild(e.picker.pCont);e.picker.oPar.OnSelect=BX.proxy(function(e){if(!e)e="";t.value=e;var i=BX.nextSibling(t);if(i){i.style.background=e}BX.fireEvent(t,"change")},e);e.picker.pCont.style.display="";e.picker.Close();e.picker.Open(t);e.picker.pCont.style.display="none"};var n=function(){var t=BX.nextSibling(this);if(t){t.style.background=this.value}};var a=BX.findChildren(this.context,{className:"bx-editor-color-picker"},true);for(var o in a){var r=a[o];var s=BX.nextSibling(r);BX.bind(s,"click",BX.proxy(i,r));BX.bind(r,"click",i);BX.bind(r,"focus",i);BX.addCustomEvent(r,"onSettingLoadValue",BX.delegate(n,r));BX.bind(r,"bxchange",BX.delegate(n,r))}},initBorderControl:function(){var t=BX("block_editor_style_border");var e=BX("block_editor_style_border_style");var i=BX("block_editor_style_border_width");var n=BX("block_editor_style_border_color");var a=function(){var a="";if(e.value){if(!i.value){i.value="2px"}if(!n.value){n.value="#000000"}a=i.value+" "+e.value+" "+n.value}t.value=a;BX.fireEvent(t,"change")};BX.addCustomEvent(t,"onSettingLoadValue",BX.delegate(function(){if(t.value){var a=t.value.split(" ");for(var o=3;o<a.length;o++){a[2]=a[2]+" "+a[o]}i.value=a[0];e.value=a[1];n.value=this.helper.colorRgbToHex(a[2]);BX.fireEvent(n,"change")}},this));BX.bind(e,"bxchange",a);BX.bind(i,"bxchange",a);BX.bind(n,"bxchange",a)},getCtrlContainer:function(t){var e=BX.findParent(t,{attribute:this.attributeLink});var i=e.getAttribute(this.attributeLink);var n=i.split(":");return{container:e,tab:n[0],code:n[1]}},setCtrlValue:function(t,e){t.value=e;if(typeof t.oldValue==="undefined"){t.oldValue=t.value}BX.onCustomEvent(t,"onSettingLoadValue")},getCtrlValue:function(t){return t.value},onControlChangeValue:function(t){if(!this.caller.getCurrentEditingBlock()){return}var e=this.getCtrlContainer(t);var i=e.code;var n=t.value;var a=t.getAttribute(this.column.attributeColumnValue);BX.onCustomEvent(this,"controlChangeValue",[i,n,a]);if(!BX.util.in_array(t,this.changeList)){this.changeList.push(t)}this.fireDependenceChange(i)},linkControl:function(t,e,i){var n=this;BX.addCustomEvent(t,"onSettingChangeValue",function(){if(!n.doNotProcessChanging){n.onControlChangeValue(this)}});if(i){var a=function(){BX.onCustomEvent(this,"onSettingChangeValue")};BX.bind(t,"change",a);if(t.nodeName=="INPUT"||t.nodeName=="TEXTAREA"){BX.bind(t,"input",a)}}},onTabClick:function(t){t=t||window.event;var e=t.target;var i=e.getAttribute(this.attributeTab);this.showTab(i)},fireDependenceChange:function(t){if(!this.itemDependence||!this.itemDependence[t]||this.itemDependence[t].length==0){return}var e=this.ctrlList[t];if(!e)return;var i=this.getCtrlContainer(e);var n={code:t,value:this.getCtrlValue(e),ctrl:e,container:i};for(var a in this.itemDependence[t]){var o=this.itemDependence[t][a];var r=this.ctrlList[o];if(!r)continue;var s=this.getCtrlContainer(r);var l={code:o,value:this.getCtrlValue(r),ctrl:r,container:s};BX.onCustomEvent(this,"onSettingDependenceChange-"+o,[n,l])}},load:function(t){this.doNotProcessChanging=true;this.itemFilter=[];this.itemDependence={};this.itemPrevValues=[];for(var e in t){var i=t[e].code;var n=t[e].value;var a=t[e].params;var o=t[e].dependence;var r=this.ctrlList[i];if(!r)continue;var s=this.getCtrlContainer(r);this.itemFilter.push(i);this.itemDependence[i]=o;var l={code:i,value:n,params:a,ctrl:r,container:s,dependence:o};BX.onCustomEvent(this,"loadSetting",[l]);BX.onCustomEvent(this,"loadSetting-"+i,[l]);r.value=n;r.oldValue=r.value;BX.onCustomEvent(r,"onSettingLoadValue");this.fireDependenceChange(i)}BX.onCustomEvent(this,"loadSettings",[t]);this.doNotProcessChanging=false;for(var h in this.tabList){var c=false;for(var d in this.tabList[h].items){if(BX.util.in_array(d,this.itemFilter)){c=true;break}}if(c){this.tabList[h].node.style.display=""}else{this.tabList[h].node.style.display="none"}}this.showTab()},save:function(t){var e=BX.showWait(this.buttonSave);var i=this.changeList.length>0;BX.onCustomEvent(this,"onSave",[i]);BX.closeWait(this.buttonSave);this.hide(t)},cancel:function(t){for(var e in this.changeList){var i=this.changeList[e];i.value=i.oldValue;this.onControlChangeValue(i)}var n=false;BX.onCustomEvent(this,"onCancel",[n]);this.hide(t)},show:function(){BX.onCustomEvent(this,"onShow");var t=this.contextTools;var e=this.contextVisual;var i=this.context;t.style.display="block";if(t.offsetWidth+e.offsetWidth>i.offsetWidth){e.style.width=i.offsetWidth-t.offsetWidth+"px"}t.style.right="0"},hide:function(t){BX.onCustomEvent(this,"onHide");var e=this.contextTools;var i=this.contextVisual;if(this.contextTools.style.display=="none"){if(t&&BX.type.isFunction(t)){t.apply()}}else{if(t&&BX.type.isFunction(t)){e.style.right="-10%";setTimeout(t,200)}else{e.style.right="-100%";e.style.display="none";i.style.width="100%"}}},hideTab:function(){for(var t in this.tabList){for(var e in this.tabList[t]["items"]){this.tabList[t]["items"][e].node.style.display="none"}}},showTab:function(t){this.hideTab();for(var e in this.tabList){BX.removeClass(this.tabList[e]["node"],"active")}if(!t){var i=[];for(var n in this.tabList){if(this.tabList[n].node.style.display!="none"){i.push(n)}}for(var a in this.tabList){if(BX.util.in_array(a,i)){t=a;break}}}var o=BX.findChildByClassName(this.context,"block-edit-form-empty",true);if(!t){BX.addClass(o,"active");return}else{BX.removeClass(o,"active")}BX.addClass(this.tabList[t]["node"],"active");for(var r in this.tabList[t]["items"]){if(this.itemFilter.length>0&&!BX.util.in_array(r,this.itemFilter)){continue}this.tabList[t]["items"][r].node.style.display="block"}}};function BXBlockEditorSliceContent(t){this.sectionId="BX_BLOCK_EDITOR_EDITABLE_SECTION";this.textarea=t.textarea;this.caller=t.caller}BXBlockEditorSliceContent.prototype.getSectionHtml=function(t,e){var i=[this.sectionId].concat(t).join("/")+"/";return"<!--START %TAG%-->\n%CONTENT%\n<!--END %TAG%-->\n".replace("%TAG%",i).replace("%TAG%",i).replace("%CONTENT%",e)};BXBlockEditorSliceContent.prototype.getSlices=function(){var t={};var e=this.textarea.value;var i="<!--START "+this.sectionId+"/([\\w]+?)/([\\w]+?)/-->"+"([\\s\\S,\\n]*?)"+"<!--END "+this.sectionId+"[/\\w]+?-->";var n=new RegExp(i,"g");var a;while(a=n.exec(e)){var o=a[1].trim();var r=a[2].trim();var s=a[3].trim();if(!BX.type.isArray(t[o])){t[o]=[]}t[o].push({section:o,item:r,value:s})}return t};BXBlockEditorSliceContent.prototype.getHtml=function(t){var e="";this.caller.helper.each(t,function(t){this.caller.helper.each(t,function(t){e=e+this.getSectionHtml([t.section,t.item],t.value)},this)},this);return e};function BXBlockEditorCssParser(){this.patternRule="([\\s\\S]*?){([\\s\\S]*?)}";this.patternDeclaration="([\\s\\S]+?):([\\s\\S]+?);";this.patternStyleSheet="<style[\\s\\S]*?>([\\s\\S]*?)</style>";this.patternComments="(\\/\\*[\\s\\S]*?\\*\\/)";this.patternMedia="(@media[\\s\\S]*?){([}\\s\\S]*?)}[\\r\\n ]*?}"}BXBlockEditorCssParser.prototype.parseRules=function(t){var e={};var i,n,a;var o=new RegExp(this.patternRule,"g");while(i=o.exec(t)){n=i[1].trim();a=i[2].trim();if(!e[n]){e[n]={}}e[n]=BX.merge(e[n],this.parseDeclaration(a))}return e};BXBlockEditorCssParser.prototype.parseDeclaration=function(t){var e={};var i=new RegExp(this.patternDeclaration,"g");var n,a,o;while(n=i.exec(t)){a=n[1].trim();o=n[2].trim();e[a]=o}return e};BXBlockEditorCssParser.prototype.mergeStyles=function(t,e){for(var i in e){if(!e[i]){continue}if(!t[i]){t[i]={}}t[i]=BX.merge(t[i],e[i])}return t};BXBlockEditorCssParser.prototype.diffStylesAll=function(t,e){var i={};var n;for(var a in e){if(!e[a]){continue}if(!t[a]){i[a]=e[a]}else{n=this.diffStyles(t[a],e[a]);if(BX.util.object_keys(n).length>0){i[a]=n}}}if(BX.util.object_keys(i).length>0){return i}else{return null}};BXBlockEditorCssParser.prototype.diffStyles=function(t,e){var i={};for(var n in e){if(!e[n]){continue}var a=e[n];if(!t[n]&&BX.util.object_keys(a).length>0){i[n]=a}else if(!BX.type.isString(a)){for(var o in a){if(!a[o]){continue}if(!t[n][o]||t[n][o]!=a[o]){if(!i[n]){i[n]={}}i[n][o]=a[o]}}}}return i};BXBlockEditorCssParser.prototype.parseTag=function(t){var e="";var i=new RegExp(this.patternStyleSheet,"gi");var n=new RegExp(this.patternComments,"g");if(!(matches=i.exec(t))){matches=[t,t]}do{e+=matches[1].trim()+"\n"}while(matches=i.exec(t));e=e.replace(n,"");return e};BXBlockEditorCssParser.prototype.parse=function(t){t=t||"";var e={"":{}};var i;var n=new RegExp(this.patternMedia,"gi");var a=this.parseTag(t);a=a.trim();while(i=n.exec(a)){var o=i[1].trim();var r=i[2].trim()+"}";if(!e[o]){e[o]={}}e[o]=this.mergeStyles(e[o],this.parseRules(r));a=a.replace(i[0],"")}e[""]=this.mergeStyles(e[""],this.parseRules(a));return e};BXBlockEditorCssParser.prototype.getCssString=function(t){var e="",i,n,a,o;for(i in t){if(!t[i])break;if(i){e+=i+"{\n"}for(n in t[i]){if(!n||!t[i][n])break;e+=n+"{\n";for(a in t[i][n]){if(!a||!t[i][n][a])break;o=t[i][n][a];e+=a+": "+o+";\n"}e+="}\n"}if(i){e+="}\n"}}return e};BXBlockEditorCssParser.prototype.setStyle=function(t,e,i,n){var a,o;e=e||"";i=i.trim();a=this.parse(t);if(!a[e]){o={}}else{o=a[e]}for(var r in n){var s=n[r];if(s){if(!o[i]){o[i]={}}o[i][r]=s}else if(o[i]){delete o[i][r]}}a[e]=o;return this.getCssString(a)};BXBlockEditorCssParser.prototype.getStyle=function(t,e,i,n){var a={},o,r;e=e||"";i=i.trim();o=this.parse(t);if(!o[e]){r={}}else{r=o[e]}for(var s in n){var l=n[s];if(!r[i]||!r[i][l]){a[l]=null}else{a[l]=r[i][l]}}return a};function BXBlockEditorStatusManager(t){this.caller=t.caller;BX.addCustomEvent(this.caller,"onPlaceInitBlocksContent",BX.delegate(this.onPlaceInitBlocksContent,this.caller));BX.addCustomEvent(this.caller,"onBlockCreateAfter",BX.delegate(this.setBlockStatusContent,this.caller));BX.addCustomEvent(this.caller,"onBlockMoveAfter",BX.delegate(this.setBlockStatusContent,this.caller));BX.addCustomEvent(this.caller,"onBlockClone",BX.delegate(this.setBlockStatusContent,this.caller));BX.addCustomEvent(this.caller,"onBlockEditEnd",BX.delegate(this.onBlockEditEnd,this.caller))}BXBlockEditorStatusManager.prototype.getPlaceNameList=function(t){var e=[];this.caller.helper.each(t,function(t){if(!t.getAttribute){return}var i=t.getAttribute(this.CONST_ATTR_BLOCK_STATUS);var n=t.parentNode.getAttribute(this.CONST_ATTR_PLACE);if(i!="loaded"||n=="body"){e.push(n)}},this.caller);return e};BXBlockEditorStatusManager.prototype.setBlockStatusContent=function(t){t.node.setAttribute(this.CONST_ATTR_BLOCK_STATUS,"content")};BXBlockEditorStatusManager.prototype.onBlockEditEnd=function(t,e){if(e){t.node.setAttribute(this.CONST_ATTR_BLOCK_STATUS,"content")}};BXBlockEditorStatusManager.prototype.onPlaceInitBlocksContent=function(t,e){var i="loaded";if(e){i="content"}var n=BX.findChildren(t,{attribute:this.CONST_ATTR_BLOCK},true);for(var a in n){var o=n[a];if(!o.hasAttribute(this.CONST_ATTR_BLOCK_STATUS)){o.setAttribute(this.CONST_ATTR_BLOCK_STATUS,i)}}};BX.addCustomEvent("GetControlsMap",function(t){if(this.id.indexOf("BX_BLOCK_EDITOR_CONTENT_")!==0){return}var e=["ChangeView","placeholder_selector","StyleSelector","FontSelector","FontSize","RemoveFormat","Bold","AlignList","Color","Fullscreen","More"];for(var i in t){var n=t[i];if(n){if(n.separator){n.hidden=true}else if(!BX.util.in_array(n.id,e)){n.compact=false}else{n.compact=true}}}});
//# sourceMappingURL=dialog.map.js