FAIR VALUE MEASUREMENTS AND FAIR VALUE OF FINANCIAL INSTRUMENTS - Financial assets and liabilities by hierarchy (Details) - USD ($) $ in Thousands | Dec. 31, 2019 | Dec. 31, 2018 |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Cash and cash equivalents | $ 18,574 | $ 37,172 |
Level 2: | | |
Amortized Cost | 336,119 | |
Debt Securities, Available-for-sale | 336,404 | |
Total assets measured at fair value | | |
Short-term investments | 289,424 | 203,906 |
Long-term investments | 46,980 | 2,287 |
Fair Value, Inputs, Level 2 | | |
Level 2: | | |
Gross Unrealized Losses | (36) | (160) |
Fair Value, Inputs, Level 2 | U.S. government agency securities | | |
Level 2: | | |
Gross Unrealized Losses | (14) | 0 |
Fair Value, Inputs, Level 2 | Commercial paper | | |
Level 2: | | |
Gross Unrealized Losses | (2) | (63) |
Fair Value, Inputs, Level 2 | Corporate debt securities | | |
Level 2: | | |
Gross Unrealized Losses | (20) | (63) |
Fair Value, Inputs, Level 2 | Asset-backed securities | | |
Level 2: | | |
Gross Unrealized Losses | 0 | (34) |
Fair Value, Measurements, Recurring | | |
Total assets measured at fair value | | |
Amortized Cost | 354,693 | 243,518 |
Gross Unrealized Gains | 321 | 7 |
Gross Unrealized Losses | (36) | (160) |
Fair Value | 354,978 | 243,365 |
Fair Value, Measurements, Recurring | Cash and Cash Equivalents | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Cash and cash equivalents | 18,574 | 37,172 |
Fair Value, Measurements, Recurring | Short-term Investments | | |
Total assets measured at fair value | | |
Short-term investments | 289,424 | 203,906 |
Fair Value, Measurements, Recurring | Long-term investments | | |
Total assets measured at fair value | | |
Long-term investments | 46,980 | 2,287 |
Fair Value, Measurements, Recurring | Fair Value, Inputs, Level 1 | Cash and Cash Equivalents | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Cash and cash equivalents | | 33,154 |
Fair Value, Measurements, Recurring | Fair Value, Inputs, Level 2 | | |
Level 2: | | |
Amortized Cost | 336,119 | 207,343 |
Gross Unrealized Gains | 321 | 7 |
Gross Unrealized Losses | (36) | (160) |
Debt Securities, Available-for-sale | 336,404 | 207,190 |
Fair Value, Measurements, Recurring | Fair Value, Inputs, Level 2 | Cash and Cash Equivalents | | |
Level 2: | | |
Debt Securities, Available-for-sale | 0 | 997 |
Fair Value, Measurements, Recurring | Fair Value, Inputs, Level 2 | Short-term Investments | | |
Total assets measured at fair value | | |
Short-term investments | 289,424 | 203,906 |
Fair Value, Measurements, Recurring | Fair Value, Inputs, Level 2 | Long-term investments | | |
Total assets measured at fair value | | |
Long-term investments | 46,980 | 2,287 |
Fair Value, Measurements, Recurring | Fair Value, Inputs, Level 2 | U.S. government agency securities | | |
Level 2: | | |
Amortized Cost | 40,741 | |
Gross Unrealized Gains | 6 | |
Gross Unrealized Losses | (14) | |
Debt Securities, Available-for-sale | 40,733 | |
Fair Value, Measurements, Recurring | Fair Value, Inputs, Level 2 | U.S. government agency securities | Cash and Cash Equivalents | | |
Level 2: | | |
Debt Securities, Available-for-sale | 0 | |
Fair Value, Measurements, Recurring | Fair Value, Inputs, Level 2 | U.S. government agency securities | Short-term Investments | | |
Total assets measured at fair value | | |
Short-term investments | 19,990 | |
Fair Value, Measurements, Recurring | Fair Value, Inputs, Level 2 | U.S. government agency securities | Long-term investments | | |
Total assets measured at fair value | | |
Long-term investments | 20,743 | |
Fair Value, Measurements, Recurring | Fair Value, Inputs, Level 2 | Commercial paper | | |
Level 2: | | |
Amortized Cost | 108,248 | 68,467 |
Gross Unrealized Gains | 107 | 0 |
Gross Unrealized Losses | (2) | (63) |
Debt Securities, Available-for-sale | 108,353 | 68,404 |
Fair Value, Measurements, Recurring | Fair Value, Inputs, Level 2 | Commercial paper | Cash and Cash Equivalents | | |
Level 2: | | |
Debt Securities, Available-for-sale | 0 | 997 |
Fair Value, Measurements, Recurring | Fair Value, Inputs, Level 2 | Commercial paper | Short-term Investments | | |
Total assets measured at fair value | | |
Short-term investments | 108,353 | 67,407 |
Fair Value, Measurements, Recurring | Fair Value, Inputs, Level 2 | Commercial paper | Long-term investments | | |
Total assets measured at fair value | | |
Long-term investments | 0 | 0 |
Fair Value, Measurements, Recurring | Fair Value, Inputs, Level 2 | Corporate debt securities | | |
Level 2: | | |
Amortized Cost | 185,569 | 89,038 |
Gross Unrealized Gains | 205 | 4 |
Gross Unrealized Losses | (20) | (63) |
Debt Securities, Available-for-sale | 185,754 | 88,979 |
Fair Value, Measurements, Recurring | Fair Value, Inputs, Level 2 | Corporate debt securities | Cash and Cash Equivalents | | |
Level 2: | | |
Debt Securities, Available-for-sale | 0 | 0 |
Fair Value, Measurements, Recurring | Fair Value, Inputs, Level 2 | Corporate debt securities | Short-term Investments | | |
Total assets measured at fair value | | |
Short-term investments | 159,517 | 86,692 |
Fair Value, Measurements, Recurring | Fair Value, Inputs, Level 2 | Corporate debt securities | Long-term investments | | |
Total assets measured at fair value | | |
Long-term investments | 26,237 | 2,287 |
Fair Value, Measurements, Recurring | Fair Value, Inputs, Level 2 | Asset-backed securities | | |
Level 2: | | |
Amortized Cost | 1,561 | 49,838 |
Gross Unrealized Gains | 3 | 3 |
Gross Unrealized Losses | 0 | (34) |
Debt Securities, Available-for-sale | 1,564 | 49,807 |
Fair Value, Measurements, Recurring | Fair Value, Inputs, Level 2 | Asset-backed securities | Cash and Cash Equivalents | | |
Level 2: | | |
Debt Securities, Available-for-sale | 0 | 0 |
Fair Value, Measurements, Recurring | Fair Value, Inputs, Level 2 | Asset-backed securities | Short-term Investments | | |
Total assets measured at fair value | | |
Short-term investments | 1,564 | 49,807 |
Fair Value, Measurements, Recurring | Fair Value, Inputs, Level 2 | Asset-backed securities | Long-term investments | | |
Total assets measured at fair value | | |
Long-term investments | 0 | 0 |
Cash | Fair Value, Measurements, Recurring | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Cash and cash equivalents | 1,393 | 3,021 |
Cash and Cash Equivalents, Fair Value Disclosure | 1,393 | 3,021 |
Cash | Fair Value, Measurements, Recurring | Cash and Cash Equivalents | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Cash and cash equivalents | 1,393 | 3,021 |
Money market fund | Fair Value, Measurements, Recurring | Fair Value, Inputs, Level 1 | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Cash and cash equivalents | 17,181 | 33,154 |
Cash and Cash Equivalents, Fair Value Disclosure | 17,181 | $ 33,154 |
Money market fund | Fair Value, Measurements, Recurring | Fair Value, Inputs, Level 1 | Cash and Cash Equivalents | | |
Fair Value, Assets and Liabilities Measured on Recurring and Nonrecurring Basis [Line Items] | | |
Cash and cash equivalents | $ 17,181 | |