{
  "version": 0,
  "execution": {
    "transactionMode": "SAFE_AUTO_COMMIT"
  },
  "entry": "b1",
  "blocks": {
    "b1": {
      "type": "setVar",
      "inputs": {
        "name": "sourceItem",
        "value": "transcript-v1.prproj\\Transcript Clip"
      },
      "next": "b2"
    },
    "b2": {
      "type": "setVar",
      "inputs": {
        "name": "suffix",
        "value": {
          "type": "mathRandomInt",
          "inputs": {
            "a": 100000,
            "b": 999999
          }
        }
      },
      "next": "b3"
    },
    "b3": {
      "type": "setVar",
      "inputs": {
        "name": "targetSeqName",
        "value": {
          "type": "textJoin",
          "inputs": {
            "items": [
              "AB Project Item InOut Pattern ",
              {
                "var": "suffix"
              }
            ]
          }
        }
      },
      "next": "b4"
    },
    "b4": {
      "type": "prSetProjectItemProperty",
      "inputs": {
        "item": {
          "var": "sourceItem"
        },
        "property": "IN_POINT",
        "value": 1
      },
      "next": "b4a"
    },
    "b4a": {
      "type": "sleep",
      "inputs": {
        "durationMs": 0,
        "commitPendingActionsBeforeSleep": true,
        "flushFileBuffersBeforeSleep": false
      },
      "next": "b5"
    },
    "b5": {
      "type": "prSetProjectItemProperty",
      "inputs": {
        "item": {
          "var": "sourceItem"
        },
        "property": "OUT_POINT",
        "value": 2
      },
      "next": "b6"
    },
    "b6": {
      "type": "setVar",
      "inputs": {
        "name": "projectInMs",
        "value": {
          "type": "mathRound",
          "inputs": {
            "op": "ROUND",
            "value": {
              "type": "mathArithmetic",
              "inputs": {
                "op": "MULTIPLY",
                "a": {
                  "type": "prGetProjectItemProperty",
                  "inputs": {
                    "item": {
                      "var": "sourceItem"
                    },
                    "property": "IN_POINT"
                  }
                },
                "b": 1000
              }
            }
          }
        }
      },
      "next": "b7"
    },
    "b7": {
      "type": "setVar",
      "inputs": {
        "name": "projectOutMs",
        "value": {
          "type": "mathRound",
          "inputs": {
            "op": "ROUND",
            "value": {
              "type": "mathArithmetic",
              "inputs": {
                "op": "MULTIPLY",
                "a": {
                  "type": "prGetProjectItemProperty",
                  "inputs": {
                    "item": {
                      "var": "sourceItem"
                    },
                    "property": "OUT_POINT"
                  }
                },
                "b": 1000
              }
            }
          }
        }
      },
      "next": "b8"
    },
    "b8": {
      "type": "setVar",
      "inputs": {
        "name": "projectRangeInitialized",
        "value": {
          "type": "logicCompare",
          "inputs": {
            "op": "GTE",
            "a": {
              "var": "projectInMs"
            },
            "b": 0
          }
        }
      },
      "next": "b9"
    },
    "b9": {
      "type": "setVar",
      "inputs": {
        "name": "projectRangePositive",
        "value": {
          "type": "logicCompare",
          "inputs": {
            "op": "GT",
            "a": {
              "var": "projectOutMs"
            },
            "b": {
              "var": "projectInMs"
            }
          }
        }
      },
      "next": "b10"
    },
    "b10": {
      "type": "prSequenceCreate",
      "inputs": {
        "name": {
          "var": "targetSeqName"
        },
        "onError": "STOP",
        "storeResultIn": "targetSeq"
      },
      "next": "b11"
    },
    "b11": {
      "type": "prSequencePlaceItem",
      "inputs": {
        "sequence": {
          "var": "targetSeq"
        },
        "item": {
          "var": "sourceItem"
        },
        "mode": "INSERT",
        "timeSeconds": 0,
        "videoTrackIndex": 0,
        "audioTrackIndex": 0,
        "limitShift": true,
        "onError": "STOP"
      },
      "next": "b12"
    },
    "b12": {
      "type": "setVar",
      "inputs": {
        "name": "trackRef",
        "value": {
          "type": "prGetTrackRef",
          "inputs": {
            "sequence": {
              "var": "targetSeq"
            },
            "kind": "VIDEO",
            "index": 0
          }
        }
      },
      "next": "b13"
    },
    "b13": {
      "type": "setVar",
      "inputs": {
        "name": "clipRefs",
        "value": []
      },
      "next": "b14"
    },
    "b14": {
      "type": "prForEachTrackItem",
      "inputs": {
        "track": {
          "var": "trackRef"
        },
        "kind": "CLIP",
        "order": "ASC",
        "itemVar": "clipRef",
        "indexVar": "clipIndex"
      },
      "body": [
        {
          "type": "listPush",
          "inputs": {
            "name": "clipRefs",
            "value": {
              "var": "clipRef"
            }
          }
        }
      ],
      "next": "b15"
    },
    "b15": {
      "type": "setVar",
      "inputs": {
        "name": "clipCount",
        "value": {
          "type": "listLength",
          "inputs": {
            "list": {
              "var": "clipRefs"
            }
          }
        }
      },
      "next": "b16"
    },
    "b16": {
      "type": "setVar",
      "inputs": {
        "name": "clipCountIsOne",
        "value": {
          "type": "logicCompare",
          "inputs": {
            "op": "EQ",
            "a": {
              "var": "clipCount"
            },
            "b": 1
          }
        }
      },
      "next": "b16a"
    },
    "b16a": {
      "type": "setVar",
      "inputs": {
        "name": "toleranceMs",
        "value": 50
      },
      "next": "b17"
    },
    "b17": {
      "type": "setVar",
      "inputs": {
        "name": "clip1",
        "value": {
          "type": "listGet",
          "inputs": {
            "list": {
              "var": "clipRefs"
            },
            "where": "INDEX",
            "index": 0
          }
        }
      },
      "next": "b18"
    },
    "b18": {
      "type": "setVar",
      "inputs": {
        "name": "clipInMs",
        "value": {
          "type": "mathRound",
          "inputs": {
            "op": "ROUND",
            "value": {
              "type": "mathArithmetic",
              "inputs": {
                "op": "MULTIPLY",
                "a": {
                  "type": "prGetTrackItemProperty",
                  "inputs": {
                    "item": {
                      "var": "clip1"
                    },
                    "property": "IN_POINT_SECONDS"
                  }
                },
                "b": 1000
              }
            }
          }
        }
      },
      "next": "b19"
    },
    "b19": {
      "type": "setVar",
      "inputs": {
        "name": "clipOutMs",
        "value": {
          "type": "mathRound",
          "inputs": {
            "op": "ROUND",
            "value": {
              "type": "mathArithmetic",
              "inputs": {
                "op": "MULTIPLY",
                "a": {
                  "type": "prGetTrackItemProperty",
                  "inputs": {
                    "item": {
                      "var": "clip1"
                    },
                    "property": "OUT_POINT_SECONDS"
                  }
                },
                "b": 1000
              }
            }
          }
        }
      },
      "next": "b20"
    },
    "b20": {
      "type": "setVar",
      "inputs": {
        "name": "clipInAtOrAboveLowerBound",
        "value": {
          "type": "logicCompare",
          "inputs": {
            "op": "GTE",
            "a": {
              "var": "clipInMs"
            },
            "b": {
              "type": "mathArithmetic",
              "inputs": {
                "op": "MINUS",
                "a": {
                  "var": "projectInMs"
                },
                "b": {
                  "var": "toleranceMs"
                }
              }
            }
          }
        }
      },
      "next": "b21"
    },
    "b21": {
      "type": "setVar",
      "inputs": {
        "name": "clipInAtOrBelowUpperBound",
        "value": {
          "type": "logicCompare",
          "inputs": {
            "op": "LTE",
            "a": {
              "var": "clipInMs"
            },
            "b": {
              "type": "mathArithmetic",
              "inputs": {
                "op": "ADD",
                "a": {
                  "var": "projectInMs"
                },
                "b": {
                  "var": "toleranceMs"
                }
              }
            }
          }
        }
      },
      "next": "b21a"
    },
    "b21a": {
      "type": "setVar",
      "inputs": {
        "name": "clipInMatchesProjectIn",
        "value": {
          "type": "logicOperation",
          "inputs": {
            "op": "AND",
            "a": {
              "var": "clipInAtOrAboveLowerBound"
            },
            "b": {
              "var": "clipInAtOrBelowUpperBound"
            }
          }
        }
      },
      "next": "b21b"
    },
    "b21b": {
      "type": "setVar",
      "inputs": {
        "name": "clipOutAtOrAboveLowerBound",
        "value": {
          "type": "logicCompare",
          "inputs": {
            "op": "GTE",
            "a": {
              "var": "clipOutMs"
            },
            "b": {
              "type": "mathArithmetic",
              "inputs": {
                "op": "MINUS",
                "a": {
                  "var": "projectOutMs"
                },
                "b": {
                  "var": "toleranceMs"
                }
              }
            }
          }
        }
      },
      "next": "b21c"
    },
    "b21c": {
      "type": "setVar",
      "inputs": {
        "name": "clipOutAtOrBelowUpperBound",
        "value": {
          "type": "logicCompare",
          "inputs": {
            "op": "LTE",
            "a": {
              "var": "clipOutMs"
            },
            "b": {
              "type": "mathArithmetic",
              "inputs": {
                "op": "ADD",
                "a": {
                  "var": "projectOutMs"
                },
                "b": {
                  "var": "toleranceMs"
                }
              }
            }
          }
        }
      },
      "next": "b21d"
    },
    "b21d": {
      "type": "setVar",
      "inputs": {
        "name": "clipOutMatchesProjectOut",
        "value": {
          "type": "logicOperation",
          "inputs": {
            "op": "AND",
            "a": {
              "var": "clipOutAtOrAboveLowerBound"
            },
            "b": {
              "var": "clipOutAtOrBelowUpperBound"
            }
          }
        }
      },
      "next": "b22"
    },
    "b22": {
      "type": "esConsoleLog",
      "inputs": {
        "message": {
          "type": "textJoin",
          "inputs": {
            "items": [
              "projectItemSetterPlacement=ok clipCount=",
              {
                "var": "clipCount"
              },
              " projectInMs=",
              {
                "var": "projectInMs"
              },
              " projectOutMs=",
              {
                "var": "projectOutMs"
              },
              " clipInMs=",
              {
                "var": "clipInMs"
              },
              " clipOutMs=",
              {
                "var": "clipOutMs"
              }
            ]
          }
        }
      },
      "next": null
    }
  }
}
