{
  "version": 0,
  "execution": {
    "transactionMode": "SAFE_AUTO_COMMIT"
  },
  "entry": "b1",
  "blocks": {
    "b1": {
      "type": "setVar",
      "inputs": {
        "name": "sourceClip",
        "value": "::SEQ\\ACTIVE::TRACK\\VIDEO#0::ITEM\\CLIP#0"
      },
      "next": "b2"
    },
    "b2": {
      "type": "setVar",
      "inputs": {
        "name": "sourceItem",
        "value": {
          "type": "prGetTrackItemProperty",
          "inputs": {
            "item": {
              "var": "sourceClip"
            },
            "property": "PROJECT_ITEM_REF"
          }
        }
      },
      "next": "b3"
    },
    "b3": {
      "type": "setVar",
      "inputs": {
        "name": "suffix",
        "value": {
          "type": "mathRandomInt",
          "inputs": {
            "a": 100000,
            "b": 999999
          }
        }
      },
      "next": "b4"
    },
    "b4": {
      "type": "setVar",
      "inputs": {
        "name": "seqName",
        "value": {
          "type": "textJoin",
          "inputs": {
            "items": [
              "AB Track Item Fixture ",
              {
                "var": "suffix"
              }
            ]
          }
        }
      },
      "next": "b5"
    },
    "b5": {
      "type": "prSequenceCreateFromItems",
      "inputs": {
        "name": {
          "var": "seqName"
        },
        "items": [
          {
            "var": "sourceItem"
          }
        ],
        "onError": "STOP",
        "storeResultIn": "seqRef"
      },
      "next": "b6"
    },
    "b6": {
      "type": "setVar",
      "inputs": {
        "name": "trackRef",
        "value": {
          "type": "prGetTrackRef",
          "inputs": {
            "sequence": {
              "var": "seqRef"
            },
            "kind": "VIDEO",
            "index": 0
          }
        }
      },
      "next": "b7"
    },
    "b7": {
      "type": "setVar",
      "inputs": {
        "name": "clipRef",
        "value": {
          "type": "prGetItemRef",
          "inputs": {
            "track": {
              "var": "trackRef"
            },
            "kind": "CLIP",
            "index": 0
          }
        }
      },
      "next": "b8"
    },
    "b8": {
      "type": "setVar",
      "inputs": {
        "name": "clipCountBefore",
        "value": {
          "type": "listLength",
          "inputs": {
            "list": {
              "type": "prListTrackItems",
              "inputs": {
                "track": {
                  "var": "trackRef"
                },
                "kind": "CLIP"
              }
            }
          }
        }
      },
      "next": "b9"
    },
    "b9": {
      "type": "setVar",
      "inputs": {
        "name": "newName",
        "value": {
          "type": "textJoin",
          "inputs": {
            "items": [
              "AB Clip ",
              {
                "var": "suffix"
              }
            ]
          }
        }
      },
      "next": "b10"
    },
    "b10": {
      "type": "prSetTrackItemProperty",
      "inputs": {
        "item": {
          "var": "clipRef"
        },
        "property": "NAME",
        "value": {
          "var": "newName"
        },
        "onError": "STOP",
        "storeResultIn": "okRenameTrackItem"
      },
      "next": "b11"
    },
    "b11": {
      "type": "setVar",
      "inputs": {
        "name": "observedName",
        "value": {
          "type": "prGetTrackItemProperty",
          "inputs": {
            "item": {
              "var": "clipRef"
            },
            "property": "NAME"
          }
        }
      },
      "next": "b12"
    },
    "b12": {
      "type": "setVar",
      "inputs": {
        "name": "nameMatches",
        "value": {
          "type": "logicCompare",
          "inputs": {
            "op": "EQ",
            "a": {
              "var": "observedName"
            },
            "b": {
              "var": "newName"
            }
          }
        }
      },
      "next": "b13"
    },
    "b13": {
      "type": "prSetTrackItemProperty",
      "inputs": {
        "item": {
          "var": "clipRef"
        },
        "property": "IS_DISABLED",
        "value": true,
        "onError": "STOP",
        "storeResultIn": "okDisableTrackItem"
      },
      "next": "b14"
    },
    "b14": {
      "type": "setVar",
      "inputs": {
        "name": "observedDisabled",
        "value": {
          "type": "prGetTrackItemProperty",
          "inputs": {
            "item": {
              "var": "clipRef"
            },
            "property": "IS_DISABLED"
          }
        }
      },
      "next": "b15"
    },
    "b15": {
      "type": "prTrackItemMove",
      "inputs": {
        "item": {
          "var": "clipRef"
        },
        "startSeconds": 1,
        "onError": "STOP",
        "storeResultIn": "okMoveTrackItem"
      },
      "next": "b16"
    },
    "b16": {
      "type": "setVar",
      "inputs": {
        "name": "movedStartMs",
        "value": {
          "type": "mathRound",
          "inputs": {
            "op": "ROUND",
            "value": {
              "type": "mathArithmetic",
              "inputs": {
                "op": "MULTIPLY",
                "a": {
                  "type": "prGetTrackItemProperty",
                  "inputs": {
                    "item": {
                      "var": "clipRef"
                    },
                    "property": "START_SECONDS"
                  }
                },
                "b": 1000
              }
            }
          }
        }
      },
      "next": "b17"
    },
    "b17": {
      "type": "prTrackItemClone",
      "inputs": {
        "item": {
          "var": "clipRef"
        },
        "timeOffsetSeconds": 1,
        "videoTrackOffset": 0,
        "audioTrackOffset": 0,
        "alignToVideo": true,
        "insert": true,
        "onError": "STOP",
        "storeResultIn": "okCloneTrackItem"
      },
      "next": "b18"
    },
    "b18": {
      "type": "setVar",
      "inputs": {
        "name": "clipCountAfter",
        "value": {
          "type": "listLength",
          "inputs": {
            "list": {
              "type": "prListTrackItems",
              "inputs": {
                "track": {
                  "var": "trackRef"
                },
                "kind": "CLIP"
              }
            }
          }
        }
      },
      "next": "b19"
    },
    "b19": {
      "type": "setVar",
      "inputs": {
        "name": "clipDelta",
        "value": {
          "type": "mathArithmetic",
          "inputs": {
            "op": "MINUS",
            "a": {
              "var": "clipCountAfter"
            },
            "b": {
              "var": "clipCountBefore"
            }
          }
        }
      },
      "next": "b20"
    },
    "b20": {
      "type": "esConsoleLog",
      "inputs": {
        "message": {
          "type": "textJoin",
          "inputs": {
            "items": [
              "okRenameTrackItem=",
              {
                "var": "okRenameTrackItem"
              },
              " okDisableTrackItem=",
              {
                "var": "okDisableTrackItem"
              },
              " okMoveTrackItem=",
              {
                "var": "okMoveTrackItem"
              },
              " okCloneTrackItem=",
              {
                "var": "okCloneTrackItem"
              }
            ]
          }
        }
      },
      "next": null
    }
  }
}
