import { AdobeScriptBuilder } from './api' ; const commandTemplate = `
var ___{{__command__}} = (function() {
    var __stderr;
    var __stdout;
    
    try {
      {{__vars__}}  
      __stdout = {{__fn__}}
    } catch (e) {
      __stderr = e;
    } finally {
      {{__broadcast__}}
    }
  })();` ; const newAdobeScriptBuilder = ( ) : AdobeScriptBuilder => { let name ; let vars ; let body ; let broadcast ; const builder = { setName ( value ) { name = value ; return builder ; } , setVariables ( value ) { vars = value ; return builder ; } , setBody ( value ) { body = value ; return builder ; } , setBroadcast ( value ) { broadcast = value ; return builder ; } , build ( ) { return commandTemplate . replace ( '{{__command__}}' , name ) . replace ( '{{__vars__}}' , vars ) . replace ( '{{__fn__}}' , body ) . replace ( '{{__broadcast__}}' , broadcast ) ; } } ; return builder ; } ; export default newAdobeScriptBuilder ;