<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<!-- productbuild distribution for StudioPilot Beta.
     174.0.0 / StudioPilot Beta are substituted by build-installer.sh at build time. -->
<installer-gui-script minSpecVersion="2">
    <title>StudioPilot Beta</title>
    <organization>com.studiopilot</organization>
    <welcome file="welcome.html" mime-type="text/html"/>
    <conclusion file="conclusion.html" mime-type="text/html"/>
    <background file="background.png" alignment="bottomleft" scaling="none"/>
    <background-darkAqua file="background.png" alignment="bottomleft" scaling="none"/>
    <!-- System-wide only: the standard macOS plug-in folders that every DAW scans. -->
    <domains enable_localSystem="true" enable_anywhere="false" enable_currentUserHome="false"/>
    <options customize="allow" require-scripts="false" hostArchitectures="arm64,x86_64" rootVolumeOnly="true"/>
    <allowed-os-versions>
        <os-version min="10.15"/>
    </allowed-os-versions>
    <installation-check script="checkOS()"/>
    <script><![CDATA[
        function checkOS() {
            if (system.compareVersions(system.version.ProductVersion, '10.15.0') >= 0) {
                return true;
            }
            my.result.title   = 'macOS 10.15 Catalina or later required';
            my.result.message = 'StudioPilot Beta needs macOS 10.15 or newer. Please update macOS and run this installer again.';
            my.result.type    = 'Fatal';
            return false;
        }

        // Pre-tick the AU component only when an Audio-Unit host is present
        // (Logic Pro / GarageBand are AU-only).
        function auHostDetected() {
            var hosts = [
                '/Applications/Logic Pro.app',
                '/Applications/Logic Pro X.app',
                '/Applications/GarageBand.app'
            ];
            for (var i = 0; i < hosts.length; i++) {
                if (system.files.fileExistsAtPath(hosts[i])) { return true; }
            }
            return false;
        }
    ]]></script>
    <choices-outline>
        <line choice="choice_vst3"/>
        <line choice="choice_au"/>
        <line choice="choice_app"/>
        <line choice="choice_core"/>
    </choices-outline>
    <choice id="choice_vst3" title="VST3 Plug-In" description="Installs to /Library/Audio/Plug-Ins/VST3 — found automatically by FL Studio, Ableton Live, Cubase, Studio One, Bitwig, Reaper and every other VST3 host.">
        <pkg-ref id="com.studiopilot.StudioPilotBeta.vst3"/>
    </choice>
    <choice id="choice_au" title="Audio Unit (AU)" description="Installs to /Library/Audio/Plug-Ins/Components — required for Logic Pro and GarageBand. Auto-selected when one of those is detected." start_selected="auHostDetected()">
        <pkg-ref id="com.studiopilot.StudioPilotBeta.au"/>
    </choice>
    <choice id="choice_app" title="Standalone App" description="Installs StudioPilot Beta.app to /Applications so you can run it without a DAW.">
        <pkg-ref id="com.studiopilot.StudioPilotBeta.app"/>
    </choice>
    <!-- Hidden, always installed: runs the DAW-detection + cleanup postinstall
         and drops the uninstaller. No payload. -->
    <choice id="choice_core" visible="false" title="Setup" enabled="false" start_selected="true">
        <pkg-ref id="com.studiopilot.StudioPilotBeta.core"/>
    </choice>
    <!-- must-close: Installer asks the user to quit running DAWs so we never
         replace plug-in files that are loaded in a host. Unknown/absent bundle
         IDs are ignored, so this list is safe to over-specify. -->
    <pkg-ref id="com.studiopilot.StudioPilotBeta.vst3" version="174.0.0" onConclusion="none">#StudioPilot-VST3.pkg</pkg-ref>
    <pkg-ref id="com.studiopilot.StudioPilotBeta.au" version="174.0.0" onConclusion="none">#StudioPilot-AU.pkg</pkg-ref>
    <pkg-ref id="com.studiopilot.StudioPilotBeta.app" version="174.0.0" onConclusion="none" installKBytes="10759" updateKBytes="0">#StudioPilot-App.pkg</pkg-ref>
    <pkg-ref id="com.studiopilot.StudioPilotBeta.core" version="174.0.0" onConclusion="none" installKBytes="0" updateKBytes="0">#StudioPilot-Core.pkg</pkg-ref>
    <pkg-ref id="com.studiopilot.StudioPilotBeta.vst3" installKBytes="10162" updateKBytes="0">
        <must-close>
            <app id="com.image-line.flstudio"/>
            <app id="com.ableton.live"/>
            <app id="com.cockos.reaper"/>
            <app id="com.bitwig.BitwigStudio"/>
            <app id="com.presonus.studioone"/>
            <app id="com.steinberg.cubase"/>
        </must-close>
        <bundle-version>
            <bundle CFBundleShortVersionString="174.0.0" CFBundleVersion="174.0.0" id="com.studiopilot.StudioPilotBeta" path="StudioPilot Beta.vst3"/>
        </bundle-version>
    </pkg-ref>
    <pkg-ref id="com.studiopilot.StudioPilotBeta.au" installKBytes="10027" updateKBytes="0">
        <must-close>
            <app id="com.apple.logic10"/>
            <app id="com.apple.garageband10"/>
        </must-close>
        <bundle-version>
            <bundle CFBundleShortVersionString="174.0.0" CFBundleVersion="174.0.0" id="com.studiopilot.StudioPilotBeta" path="StudioPilot Beta.component"/>
        </bundle-version>
    </pkg-ref>
    <pkg-ref id="com.studiopilot.StudioPilotBeta.app">
        <bundle-version>
            <bundle CFBundleShortVersionString="174.0.0" CFBundleVersion="174.0.0" id="com.studiopilot.StudioPilotBeta" path="StudioPilot Beta.app"/>
        </bundle-version>
    </pkg-ref>
    <pkg-ref id="com.studiopilot.StudioPilotBeta.core">
        <bundle-version/>
    </pkg-ref>
</installer-gui-script>