(self.webpackChunk_digicms_admin=self.webpackChunk_digicms_admin||[]).push([[5178],{3903:(z,D,E)=>{(function(s){s(E(27509))})(function(s){var w={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},f=s.Pos;s.defineOption("autoCloseBrackets",!1,function(e,t,n){n&&n!=s.Init&&(e.removeKeyMap(_),e.state.closeBrackets=null),t&&(R(k(t,"pairs")),e.state.closeBrackets=t,e.addKeyMap(_))});function k(e,t){return t=="pairs"&&typeof e=="string"?e:typeof e=="object"&&e[t]!=null?e[t]:w[t]}var _={Backspace:K,Enter:L};function R(e){for(var t=0;t<e.length;t++){var n=e.charAt(t),i="'"+n+"'";_[i]||(_[i]=F(n))}}R(w.pairs+"`");function F(e){return function(t){return j(t,e)}}function c(e){var t=e.state.closeBrackets;if(!t||t.override)return t;var n=e.getModeAt(e.getCursor());return n.closeBrackets||t}function K(e){var t=c(e);if(!t||e.getOption("disableInput"))return s.Pass;for(var n=k(t,"pairs"),i=e.listSelections(),a=0;a<i.length;a++){if(!i[a].empty())return s.Pass;var o=x(e,i[a].head);if(!o||n.indexOf(o)%2!=0)return s.Pass}for(var a=i.length-1;a>=0;a--){var l=i[a].head;e.replaceRange("",f(l.line,l.ch-1),f(l.line,l.ch+1),"+delete")}}function L(e){var t=c(e),n=t&&k(t,"explode");if(!n||e.getOption("disableInput"))return s.Pass;for(var i=e.listSelections(),a=0;a<i.length;a++){if(!i[a].empty())return s.Pass;var o=x(e,i[a].head);if(!o||n.indexOf(o)%2!=0)return s.Pass}e.operation(function(){var l=e.lineSeparator()||`
`;e.replaceSelection(l+l,null),S(e,-1),i=e.listSelections();for(var h=0;h<i.length;h++){var b=i[h].head.line;e.indentLine(b,null,!0),e.indentLine(b+1,null,!0)}})}function S(e,t){for(var n=[],i=e.listSelections(),a=0,o=0;o<i.length;o++){var l=i[o];l.head==e.getCursor()&&(a=o);var h=l.head.ch||t>0?{line:l.head.line,ch:l.head.ch+t}:{line:l.head.line-1};n.push({anchor:h,head:h})}e.setSelections(n,a)}function W(e){var t=s.cmpPos(e.anchor,e.head)>0;return{anchor:new f(e.anchor.line,e.anchor.ch+(t?-1:1)),head:new f(e.head.line,e.head.ch+(t?1:-1))}}function j(e,t){var n=c(e);if(!n||e.getOption("disableInput"))return s.Pass;var i=k(n,"pairs"),a=i.indexOf(t);if(a==-1)return s.Pass;for(var o=k(n,"closeBefore"),l=k(n,"triples"),h=i.charAt(a+1)==t,b=e.listSelections(),B=a%2==0,p,O=0;O<b.length;O++){var y=b[O],r=y.head,v,P=e.getRange(r,f(r.line,r.ch+1));if(B&&!y.empty())v="surround";else if((h||!B)&&P==t)h&&q(e,r)?v="both":l.indexOf(t)>=0&&e.getRange(r,f(r.line,r.ch+3))==t+t+t?v="skipThree":v="skip";else if(h&&r.ch>1&&l.indexOf(t)>=0&&e.getRange(f(r.line,r.ch-2),r)==t+t){if(r.ch>2&&/\bstring/.test(e.getTokenTypeAt(f(r.line,r.ch-2))))return s.Pass;v="addFour"}else if(h){var I=r.ch==0?" ":e.getRange(f(r.line,r.ch-1),r);if(!s.isWordChar(P)&&I!=t&&!s.isWordChar(I))v="both";else return s.Pass}else if(B&&(P.length===0||/\s/.test(P)||o.indexOf(P)>-1))v="both";else return s.Pass;if(!p)p=v;else if(p!=v)return s.Pass}var d=a%2?i.charAt(a-1):t,A=a%2?t:i.charAt(a+1);e.operation(function(){if(p=="skip")S(e,1);else if(p=="skipThree")S(e,3);else if(p=="surround"){for(var g=e.getSelections(),u=0;u<g.length;u++)g[u]=d+g[u]+A;e.replaceSelections(g,"around"),g=e.listSelections().slice();for(var u=0;u<g.length;u++)g[u]=W(g[u]);e.setSelections(g)}else p=="both"?(e.replaceSelection(d+A,null),e.triggerElectric(d+A),S(e,-1)):p=="addFour"&&(e.replaceSelection(d+d+d+d,"before"),S(e,1))})}function x(e,t){var n=e.getRange(f(t.line,t.ch-1),f(t.line,t.ch+1));return n.length==2?n:null}function q(e,t){var n=e.getTokenAt(f(t.line,t.ch+1));return/\bstring/.test(n.type)&&n.start==t.ch&&(t.ch==0||!/\bstring/.test(e.getTokenTypeAt(t)))}})}}]);
