<?xml version="1.0" encoding="UTF-8"?>
<installer-gui-script authoringTool="Packages" authoringToolVersion="1.2.10" authoringToolBuild="646" minSpecVersion="1.0">
    <options customize="always" hostArchitectures="arm64,x86_64"/>
    <volume-check script="volume_check()"/>
    <!--+==========================+
        |       Presentation       |
        +==========================+-->
    <title>DISTRIBUTION_TITLE</title>
    <background-darkAqua file="background-darkAqua" uti="public.jpeg" scaling="proportional" alignment="left"/>
    <background file="background" uti="public.jpeg" scaling="proportional" alignment="left"/>
    <license file="license.rtf"/>
    <!--+==========================+
        |         Installer        |
        +==========================+-->
    <choices-outline>
        <line choice="installer_choice_1"/>
        <line choice="installer_choice_2"/>
        <line choice="installer_choice_3"/>
        <line choice="installer_choice_4"/>
        <line choice="installer_choice_5"/>
    </choices-outline>
    <choice id="installer_choice_1" title="DCO-106 Standalone Application" description="INSTALLER_CHOICE_1_DESCRIPTION">
        <pkg-ref id="com.cherryaudio.pkg.DCO106Package-StandAlone"/>
    </choice>
    <choice id="installer_choice_2" title="DCO-106 AU Plug-In" description="INSTALLER_CHOICE_2_DESCRIPTION">
        <pkg-ref id="com.cherryaudio.pkg.DCO106Package-AU"/>
    </choice>
    <choice id="installer_choice_3" title="DCO-106 VST Plug-In" description="INSTALLER_CHOICE_3_DESCRIPTION">
        <pkg-ref id="com.cherryaudio.pkg.DCO106Package-VST"/>
    </choice>
    <choice id="installer_choice_4" title="DCO-106 VST3 Plug-In" description="INSTALLER_CHOICE_4_DESCRIPTION">
        <pkg-ref id="com.cherryaudio.pkg.DCO106Package-VST3"/>
    </choice>
    <choice id="installer_choice_5" title="DCO-106 AAX Plug-In" description="INSTALLER_CHOICE_5_DESCRIPTION">
        <pkg-ref id="com.cherryaudio.pkg.DCO106Package-AAX"/>
    </choice>
    <!--+==========================+
        |    Package References    |
        +==========================+-->
    <pkg-ref id="com.cherryaudio.pkg.DCO106Package-VST3" version="1.4.0" auth="Root" installKBytes="19977">#DCO-106_VST3_Plug-In.pkg</pkg-ref>
    <pkg-ref id="com.cherryaudio.pkg.DCO106Package-AAX" version="1.4.0" auth="Root" installKBytes="20235">#DCO-106_AAX_Plug-In.pkg</pkg-ref>
    <pkg-ref id="com.cherryaudio.pkg.DCO106Package-AU" version="1.4.0" auth="Root" installKBytes="19822">#DCO-106_AU_Plug-In.pkg</pkg-ref>
    <pkg-ref id="com.cherryaudio.pkg.DCO106Package-VST" version="1.4.0" auth="Root" installKBytes="19688">#DCO-106_VST_Plug-In.pkg</pkg-ref>
    <pkg-ref id="com.cherryaudio.pkg.DCO106Package-StandAlone" version="1.4.0" auth="Root" installKBytes="20073">#DCO-106_Standalone_Application.pkg</pkg-ref>
    <!--+==========================+
        |    JavaScript Scripts    |
        +==========================+-->
    <script>

	const __IC_FLAT_DISTRIBUTION__=true;
	const IC_OS_DISTRIBUTION_TYPE_ANY=0;
	const IC_OS_DISTRIBUTION_TYPE_CLIENT=1;
	const IC_DISK_TYPE_DESTINATION=0;
	const IC_OS_DISTRIBUTION_TYPE_SERVER=2;
	const IC_DISK_TYPE_STARTUP_DISK=1;

	function IC_CheckOS(inDiskType,inMustBeInstalled,inMinimumVersion,inMaximumVersion,inDistributionType)
	{
		var tOSVersion=undefined;
		
		/* Check Version Constraints */
		
		if (inDiskType==IC_DISK_TYPE_DESTINATION)
		{
			if (my.target.systemVersion!=undefined)
			{
				tOSVersion=my.target.systemVersion.ProductVersion;
			}
			
			/* Check if no OS is installed on the potential target */
			
			if (tOSVersion==undefined)
			{
				return (inMustBeInstalled==false);
			}
			
			if (inMustBeInstalled==false)
			{
				return false;
			}
		}
		else
		{
			tOSVersion=system.version.ProductVersion;
		}
		
		if (system.compareVersions(tOSVersion,inMinimumVersion)==-1)
			return false;
			
		if (inMaximumVersion!=undefined &amp;&amp;
			system.compareVersions(tOSVersion,inMaximumVersion)==1)
			return false;
		
		/* Check Distribution Type */
		
		if (inDistributionType!=IC_OS_DISTRIBUTION_TYPE_ANY)
		{
			var tIsServer;
			
			if (system.compareVersions(tOSVersion,'10.8.0')==-1)
			{
				if (inDiskType==IC_DISK_TYPE_DESTINATION)
				{
					tIsServer=system.files.fileExistsAtPath(my.target.mountpoint+'/System/Library/CoreServices/ServerVersion.plist');
				}
				else
				{
					tIsServer=system.files.fileExistsAtPath('/System/Library/CoreServices/ServerVersion.plist');
				}
			}
			else
			{
				if (inDiskType==IC_DISK_TYPE_DESTINATION)
				{
					tIsServer=system.files.fileExistsAtPath(my.target.mountpoint+'/Applications/Server.app');
				}
				else
				{
					tIsServer=system.files.fileExistsAtPath('/Applications/Server.app');
				}
			}
			
			if (inDistributionType==IC_OS_DISTRIBUTION_TYPE_CLIENT &amp;&amp; tIsServer==true)
			{
				return false;
			}
			
			if (inDistributionType==IC_OS_DISTRIBUTION_TYPE_SERVER &amp;&amp; tIsServer==false)
			{
				return false;
			}
		}
		
		return true;
	}

	function volume_check()
	{
		var tResult;

		tResult=IC_CheckOS(IC_DISK_TYPE_DESTINATION,true,'10.13',undefined,IC_OS_DISTRIBUTION_TYPE_ANY);

		if (tResult==false)
		{
			my.result.message = system.localizedString('REQUIREMENT_FAILED_MESSAGE_VOLUME_CHECK_1');
			my.result.type = 'Fatal';
		}

		return tResult;
	}

    </script>
</installer-gui-script>