{"version":3,"sources":["https://lively-kernel.org/lively4/composed-offset/src/components/widgets/code-mirror-utils.js"],"names":["indentSelections","indentFromTo","from","to","forEach","line","indentLine","selections","listSelections","anchor","head","anchorLine","headLine","anchorFirst","fromLine","toLine"],"mappings":";;;;;;;;;;;;;;sCAMgBA,iD;;;;;;;;;;;;;;kCANAC,6C;;;;;;;;AAAT,eAASA,YAAT,CAAsBC,IAAtB,EAA4BC,EAA5B,EAAgC;AACrCD,aAAKC,EAAL,CAAQA,KAAK,CAAb,EAAgBC,OAAhB,CAAwBC,QAAQ;AAC9B,eAAKC,UAAL,CAAgBD,IAAhB,EAAsB,OAAtB,EAA+B,IAA/B;AACD,SAFD;AAGD;;;;AAEM,eAASL,gBAAT,GAA4B;AACjC,cAAMO,aAAa,KAAKC,cAAL,EAAnB;AACAD,mBAAWH,OAAX,CAAmB,CAAC,EAAEK,MAAF,EAAUC,IAAV,EAAD,KAAsB;AACvC,gBAAMC,aAAaF,OAAOJ,IAA1B;AACA,gBAAMO,WAAWF,KAAKL,IAAtB;AACA,gBAAMQ,cAAcF,aAAaC,QAAjC;AACA,gBAAME,WAAWD,cAAcF,UAAd,GAA2BC,QAA5C;AACA,gBAAMG,SAASF,cAAcD,QAAd,GAAyBD,UAAxC;AACMV,sBAAN,YAAmBa,QAAnB,EAA6BC,MAA7B;AACD,SAPD;AAQD","file":"code-mirror-utils.js","sourcesContent":["export function indentFromTo(from, to) {\n  from.to(to + 1).forEach(line => {\n    this.indentLine(line, \"smart\", true);\n  });\n}\n\nexport function indentSelections() {\n  const selections = this.listSelections();\n  selections.forEach(({ anchor, head }) => {\n    const anchorLine = anchor.line;\n    const headLine = head.line;\n    const anchorFirst = anchorLine < headLine;\n    const fromLine = anchorFirst ? anchorLine : headLine;\n    const toLine = anchorFirst ? headLine : anchorLine;\n    this::indentFromTo(fromLine, toLine);\n  });\n}\n"]}