{
  "version": 0,
  "entry": "b1",
  "blocks": {
    "b1": {
      "type": "setVar",
      "inputs": {
        "name": "pendingSequences",
        "value": []
      },
      "next": "b2"
    },
    "b2": {
      "type": "setVar",
      "inputs": {
        "name": "seenSequences",
        "value": []
      },
      "next": "b3"
    },
    "b3": {
      "type": "setVar",
      "inputs": {
        "name": "processedClipNames",
        "value": []
      },
      "next": "b4"
    },
    "b4": {
      "type": "setVar",
      "inputs": {
        "name": "processedSequenceNames",
        "value": []
      },
      "next": "b5"
    },
    "b5": {
      "type": "listInsert",
      "inputs": {
        "name": "pendingSequences",
        "value": {
          "type": "prGetActiveSequenceRef",
          "inputs": {}
        },
        "where": "END"
      },
      "next": "b6"
    },
    "b6": {
      "type": "while",
      "inputs": {
        "condition": {
          "type": "logicNegate",
          "inputs": {
            "value": {
              "type": "listIsEmpty",
              "inputs": {
                "list": {
                  "var": "pendingSequences"
                }
              }
            }
          }
        }
      },
      "body": [
        {
          "type": "listRemove",
          "inputs": {
            "name": "pendingSequences",
            "where": "FIRST",
            "storeRemovedIn": "currentSequence"
          }
        },
        {
          "type": "if",
          "inputs": {
            "branches": [
              {
                "condition": {
                  "type": "logicNegate",
                  "inputs": {
                    "value": {
                      "type": "listContains",
                      "inputs": {
                        "list": {
                          "var": "seenSequences"
                        },
                        "find": {
                          "var": "currentSequence"
                        }
                      }
                    }
                  }
                },
                "body": [
                  {
                    "type": "listInsert",
                    "inputs": {
                      "name": "seenSequences",
                      "value": {
                        "var": "currentSequence"
                      },
                      "where": "END"
                    }
                  },
                  {
                    "type": "listPush",
                    "inputs": {
                      "name": "processedSequenceNames",
                      "value": {
                        "type": "prGetSequenceProperty",
                        "inputs": {
                          "sequence": {
                            "var": "currentSequence"
                          },
                          "property": "NAME"
                        }
                      }
                    }
                  },
                  {
                    "type": "prForEachTrack",
                    "inputs": {
                      "sequence": {
                        "var": "currentSequence"
                      },
                      "kind": "VIDEO",
                      "order": "ASC",
                      "trackVar": "trackRef",
                      "indexVar": "trackIndex"
                    },
                    "body": [
                      {
                        "type": "prForEachTrackItem",
                        "inputs": {
                          "track": {
                            "var": "trackRef"
                          },
                          "kind": "CLIP",
                          "order": "ASC",
                          "itemVar": "trackItem",
                          "indexVar": "itemIndex"
                        },
                        "body": [
                          {
                            "type": "setVar",
                            "inputs": {
                              "name": "projectItemRef",
                              "value": {
                                "type": "prGetTrackItemProperty",
                                "inputs": {
                                  "item": {
                                    "var": "trackItem"
                                  },
                                  "property": "PROJECT_ITEM_REF"
                                }
                              }
                            }
                          },
                          {
                            "type": "if",
                            "inputs": {
                              "branches": [
                                {
                                  "condition": {
                                    "type": "prGetProjectItemProperty",
                                    "inputs": {
                                      "item": {
                                        "var": "projectItemRef"
                                      },
                                      "property": "IS_SEQUENCE"
                                    }
                                  },
                                  "body": [
                                    {
                                      "type": "if",
                                      "inputs": {
                                        "branches": [
                                          {
                                            "condition": {
                                              "type": "logicOperation",
                                              "inputs": {
                                                "op": "AND",
                                                "a": {
                                                  "type": "logicNegate",
                                                  "inputs": {
                                                    "value": {
                                                      "type": "listContains",
                                                      "inputs": {
                                                        "list": {
                                                          "var": "seenSequences"
                                                        },
                                                        "find": {
                                                          "var": "projectItemRef"
                                                        }
                                                      }
                                                    }
                                                  }
                                                },
                                                "b": {
                                                  "type": "logicNegate",
                                                  "inputs": {
                                                    "value": {
                                                      "type": "listContains",
                                                      "inputs": {
                                                        "list": {
                                                          "var": "pendingSequences"
                                                        },
                                                        "find": {
                                                          "var": "projectItemRef"
                                                        }
                                                      }
                                                    }
                                                  }
                                                }
                                              }
                                            },
                                            "body": [
                                              {
                                                "type": "listInsert",
                                                "inputs": {
                                                  "name": "pendingSequences",
                                                  "value": {
                                                    "var": "projectItemRef"
                                                  },
                                                  "where": "END"
                                                }
                                              }
                                            ]
                                          }
                                        ]
                                      }
                                    }
                                  ]
                                }
                              ],
                              "elseBody": [
                                {
                                  "type": "listPush",
                                  "inputs": {
                                    "name": "processedClipNames",
                                    "value": {
                                      "type": "prGetTrackItemProperty",
                                      "inputs": {
                                        "item": {
                                          "var": "trackItem"
                                        },
                                        "property": "PROJECT_ITEM_NAME"
                                      }
                                    }
                                  }
                                }
                              ]
                            }
                          }
                        ]
                      }
                    ]
                  }
                ]
              }
            ]
          }
        }
      ],
      "next": "b7"
    },
    "b7": {
      "type": "setVar",
      "inputs": {
        "name": "processedSequenceCount",
        "value": {
          "type": "listLength",
          "inputs": {
            "list": {
              "var": "processedSequenceNames"
            }
          }
        }
      },
      "next": "b8"
    },
    "b8": {
      "type": "setVar",
      "inputs": {
        "name": "processedClipCount",
        "value": {
          "type": "listLength",
          "inputs": {
            "list": {
              "var": "processedClipNames"
            }
          }
        }
      },
      "next": "b9"
    },
    "b9": {
      "type": "esConsoleLog",
      "inputs": {
        "message": {
          "type": "textJoin",
          "inputs": {
            "items": [
              "processedSequences=",
              {
                "var": "processedSequenceCount"
              },
              "; processedClips=",
              {
                "var": "processedClipCount"
              }
            ]
          }
        }
      },
      "next": null
    }
  }
}
