The given reaction is an intramolecular ring closure reaction that leads to the formation of another five-membered ring within the molecule. The given reaction takes place in the following steps.
- The first step is the donation of a proton by the group, which is then followed by the removal of the water molecule from the five-membered ring.
This results in the formation of a resonance-stabilized carbocation, as shown in the following structure:

Formation of a resonance-stabilized carbocation
- In the next step, the intramolecular nucleophilic attack by the acetylene group takes place, which leads to the formation of a new five-membered ring, as shown in the following structures:

Formation of a new five-membered ring
- In the next step, there is the abstraction of a proton by the ion, which further leads to the formation of the enol. In the final step, there is an attack of another , which leads to the formation of an intramolecular product.

Formation of the final product