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