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5Fzprft1vRq4TFJ8x39ibFaSx08F $;;;; (9EXkYUUYsjY5Fzprft31vRq4TFJ8x39ibFaSx08F $;;;; (9EXkYUUYsjY5Fzprft31vRq4TFJ8x39ibFaSx08F $yRiOTg (CMQiO (9eYsVfUhBYjSm6wUZ1iv1VSA4QzjuE9znxbbA4j $yRiOTg (CMQiO (9eYsVfUhBYjSm6wUZ1iv1VHSA4QzjuE9znxbbA4j $yiO!CMQ~>iOxv (9F1dw3ObS5ww1SdziUo5BPk9rsCrqoP6XLJI6oTp $iO.E5peiOaiO (9f20fwrygZXJBdEd1rbhcuiF8pvRbsQGArOVLDP>% $peiOֿ>siOiO (9f5MPvHA8A6o0S6muLrkI31UyoFNsq0ENsRcmEyl$>% $iO rVճiOTiO (9F6f7QrR5l8Yxm5Kg0mCBzzujVGM9ci6SH2Veo5Y(>% $ճiODBxiOJiO (9F8sUZs20H2WR5crLYiSNqXSblpprYvtYNbwVSW->% $xiO+LddiOiO (9fBQtOzQdJQc5wQfa1wbH2qzBtKswicH6SvUdWv52>% $ddiO$yiOziO (9FD5pgtYZYSoijQpvcz1Hezao5FFkPVti70AWIcs6>% $iO4hELj= jO^wjO (9fdfy8JISySzhoRLiekCJeNaAWXcemCqwyqtkh2;>% $j= jOȕ FcjOjjO (9fDIU3fnOyoV16VEtjQrNWNnjJ4puxC0LcUIDnw5>>% $FcjOVGjO'jO (9fDqy1cpN6y4Uh9ZNvsUk7bQj6px0jKHurE8O9QdA>% $jO"m$jO!jO (9FFzL2Puaj2ifwGOGRixNXyESv1j96wF9oyxN0wF>% $$jO0eA/jO:+jO (9FiXGu8yXD018ald26IbSkLj1E55GjJyzhK14y2vJ>% $/jOR79jO4jO (9flNJfhdYdvZjdQd1bYmLteHTeDdpmZobMzSbcqpbAssetItemInterface::class, \is_object($asset) ? \get_class($asset) : \gettype($asset) ) ); } return $this; } /** * Helper method to get the asset from the registry. * * @param string $type Asset type, script or style * @param string $name Asset name * * @return WebAssetItemInterface * * @throws UnknownAssetException When Asset cannot be found * * @since 4.0.0 */ public function getAsset(string $type, string $name): WebAssetItemInterface { return $this->registry->get($type, $name); } /** * Get all active assets, optionally sort them to follow the dependency Graph * * @param string $type The asset type, script or style * @param bool $sort Whether need to sort the assets to follow the dependency Graph * * @return WebAssetItem[] * * @throws UnknownAssetException When Asset cannot be found * @throws UnsatisfiedDependencyException When Dependency cannot be found * * @since 4.0.0 */ public function getAssets(string $type, bool $sort = false): array { // Make sure that all dependencies are active if (!$this->dependenciesIsActual) { $this->enableDependencies(); } if (empty($this->activeAssets[$type])) { return []; } // Apply Tree sorting for regular asset items, but return FIFO order for "preset" if ($sort && $type !== 'preset') { $assets = $this->calculateOrderOfActiveAssets($type); } else { $assets = []; foreach (array_keys($this->activeAssets[$type]) as $name) { $assets[$name] = $this->registry->get($type, $name); } } return $assets; } /** * Helper method to calculate inline to non inline relation (before/after positions). * Return associated array, which contain dependency (handle) name as key, and list of inline items for each position. * Example: ['handle.name' => ['before' => ['inline1', 'inline2'], 'after' => ['inline3', 'inline4']]] * * Note: If inline asset have a multiple dependencies, then will be used last one from the list for positioning * * @param WebAssetItem[] $assets The assets list * * @return array * * @since 4.0.0 */ public function getInlineRelation(array $assets): array { $inlineRelation = []; // Find an inline assets and their relations to non inline foreach ($assets as $k => $asset) { if (!$asset->getOption('inline')) { continue; } // Check whether position are requested with dependencies $position = $asset->getOption('position'); $position = $position === 'before' || $position === 'after' ? $position : null; $deps = $asset->getDependencies(); if ($position && $deps) { // If inline asset have a multiple dependencies, then use last one from the list for positioning $handle = end($deps); $inlineRelation[$handle][$position][$asset->getName()] = $asset; } } return $inlineRelation; } /** * Helper method to filter an inline assets * * @param WebAssetItem[] $assets Reference to a full list of active assets * * @return WebAssetItem[] Array of inline assets * * @since 4.0.0 */ public function filterOutInlineAssets(array &$assets): array { $inlineAssets = []; foreach ($assets as $k => $asset) { if (!$asset->getOption('inline')) { continue; } // Remove inline assets from assets list, and add to list of inline unset($assets[$k]); $inlineAssets[$asset->getName()] = $asset; } return $inlineAssets; } /** * Add a new inline content asset. * Allow to register WebAssetItem instance in the registry, by call addInline($type, $assetInstance) * Or create an asset on fly (from name and Uri) and register in the registry, by call addInline($type, $content, $options ....) * * @param string $type The asset type, script or style * @param WebAssetItem|string $content The content to of inline asset * @param array $options Additional options for the asset * @param array $attributes Attributes for the asset * @param array $dependencies Asset dependencies * * @return self * * @since 4.0.0 * * @throws \InvalidArgumentException */ public function addInline(string $type, $content, array $options = [], array $attributes = [], array $dependencies = []): self { if ($content instanceof WebAssetItemInterface) { $assetInstance = $content; } elseif (is_string($content)) { $name = $options['name'] ?? ('inline.' . md5($content)); $assetInstance = $this->registry->createAsset($name, '', $options, $attributes, $dependencies); $assetInstance->setOption('content', $content); } else { throw new \InvalidArgumentException( sprintf( '%s(): Argument #2 ($content) must be a string or an instance of %s, %s given.', __METHOD__, WebAssetItemInterface::class, \is_object($content) ? \get_class($content) : \gettype($content) ) ); } // Get the name $asset = $assetInstance->getName(); // Set required options $assetInstance->setOption('type', $type); $assetInstance->setOption('inline', true); // Add to registry $this->registry->add($type, $assetInstance); // And make active $this->useAsset($type, $asset); return $this; } /** * Lock the manager to prevent further modifications * * @return self * * @since 4.0.0 */ public function lock(): self { $this->locked = true; return $this; } /** * Get the manager state. A collection of registry files and active asset names (per type). * * @return array * * @since 4.0.0 */ public function getManagerState(): array { return [ 'registryFiles' => $this->getRegistry()->getRegistryFiles(), 'activeAssets' => $this->activeAssets, ]; } /** * Update Dependencies state for all active Assets or only for given * * @param string $type The asset type, script or style * @param WebAssetItem $asset The asset instance to which need to enable dependencies * * @return self * * @since 4.0.0 */ protected function enableDependencies(string $type = null, WebAssetItem $asset = null): self { if ($type === 'preset') { // Preset items already was enabled by usePresetItems() return $this; } if ($asset) { // Get all dependencies of given asset recursively $allDependencies = $this->getDependenciesForAsset($type, $asset, true); foreach ($allDependencies as $depType => $depItems) { foreach ($depItems as $depItem) { // Set dependency state only when it is inactive, to keep a manually activated Asset in their original state if (empty($this->activeAssets[$depType][$depItem->getName()])) { // Add the dependency at the top of the list of active assets $this->activeAssets[$depType] = [$depItem->getName() => static::ASSET_STATE_DEPENDENCY] + $this->activeAssets[$depType]; } } } } else { // Re-Check for dependencies for all active assets // Firstly, filter out only active assets foreach ($this->activeAssets as $type => $activeAsset) { $this->activeAssets[$type] = array_filter( $activeAsset, function ($state) { return $state === WebAssetManager::ASSET_STATE_ACTIVE; } ); } // Secondary, check for dependencies of each active asset // This need to be separated from previous step because we may have "cross type" dependency foreach ($this->activeAssets as $type => $activeAsset) { foreach (array_keys($activeAsset) as $name) { $asset = $this->registry->get($type, $name); $this->enableDependencies($type, $asset); } } $this->dependenciesIsActual = true; } return $this; } /** * Calculate weight of active Assets, by its Dependencies * * @param string $type The asset type, script or style * * @return WebAssetItem[] * * @since 4.0.0 */ protected function calculateOrderOfActiveAssets($type): array { // See https://en.wikipedia.org/wiki/Topological_sorting#Kahn.27s_algorithm $graphOrder = []; $activeAssets = $this->getAssets($type, false); // Get Graph of Outgoing and Incoming connections $connectionsGraph = $this->getConnectionsGraph($activeAssets); $graphOutgoing = $connectionsGraph['outgoing']; $graphIncoming = $connectionsGraph['incoming']; // Make a copy to be used during weight processing $graphIncomingCopy = $graphIncoming; // Find items without incoming connections $emptyIncoming = array_keys( array_filter( $graphIncoming, function ($el) { return !$el; } ) ); // Reverse, to start from a last enabled and move up to a first enabled, this helps to maintain an original sorting $emptyIncoming = array_reverse($emptyIncoming); // Loop through, and sort the graph while ($emptyIncoming) { // Add the node without incoming connection to the result $item = array_shift($emptyIncoming); $graphOrder[] = $item; // Check of each neighbor of the node foreach (array_reverse($graphOutgoing[$item]) as $neighbor) { // Remove incoming connection of already visited node unset($graphIncoming[$neighbor][$item]); // If there no more incoming connections add the node to queue if (empty($graphIncoming[$neighbor])) { $emptyIncoming[] = $neighbor; } } } // Sync Graph order with FIFO order $fifoWeights = []; $graphWeights = []; $requestedWeights = []; foreach (array_keys($this->activeAssets[$type]) as $index => $name) { $fifoWeights[$name] = $index * 10 + 10; } foreach (array_reverse($graphOrder) as $index => $name) { $graphWeights[$name] = $index * 10 + 10; $requestedWeights[$name] = $activeAssets[$name]->getOption('weight') ?: $fifoWeights[$name]; } // Try to set a requested weight, or make it close as possible to requested, but keep the Graph order while ($requestedWeights) { $item = key($requestedWeights); $weight = array_shift($requestedWeights); // Skip empty items if ($weight === null) { continue; } // Check the predecessors (Outgoing vertexes), the weight cannot be lighter than the predecessor have $topBorder = $weight - 1; if (!empty($graphOutgoing[$item])) { $prevWeights = []; foreach ($graphOutgoing[$item] as $pItem) { $prevWeights[] = $graphWeights[$pItem]; } $topBorder = max($prevWeights); } // Calculate a new weight $newWeight = $weight > $topBorder ? $weight : $topBorder + 1; // If a new weight heavier than existing, then we need to update all incoming connections (children) if ($newWeight > $graphWeights[$item] && !empty($graphIncomingCopy[$item])) { // Sort Graph of incoming by actual position foreach ($graphIncomingCopy[$item] as $incomingItem) { // Set a weight heavier than current, then this node to be processed in next iteration if (empty($requestedWeights[$incomingItem])) { $requestedWeights[$incomingItem] = $graphWeights[$incomingItem] + $newWeight; } } } // Set a new weight $graphWeights[$item] = $newWeight; } asort($graphWeights); // Get Assets in calculated order $resultAssets = []; foreach (array_keys($graphWeights) as $name) { $resultAssets[$name] = $activeAssets[$name]; } return $resultAssets; } /** * Build Graph of Outgoing and Incoming connections for given assets. * * @param WebAssetItem[] $assets Asset instances * * @return array * * @since 4.0.0 */ protected function getConnectionsGraph(array $assets): array { $graphOutgoing = []; $graphIncoming = []; foreach ($assets as $asset) { $name = $asset->getName(); // Initialise an array for outgoing nodes of the asset $graphOutgoing[$name] = []; // Initialise an array for incoming nodes of the asset if (!\array_key_exists($name, $graphIncoming)) { $graphIncoming[$name] = []; } // Collect an outgoing/incoming nodes foreach ($asset->getDependencies() as $depName) { $graphOutgoing[$name][$depName] = $depName; $graphIncoming[$depName][$name] = $name; } } return [ 'outgoing' => $graphOutgoing, 'incoming' => $graphIncoming, ]; } /** * Return dependencies for Asset as array of WebAssetItem objects * * @param string $type The asset type, script or style * @param WebAssetItem $asset Asset instance * @param boolean $recursively Whether to search for dependency recursively * @param string $recursionType The type of initial item to prevent loop * @param WebAssetItem $recursionRoot Initial item to prevent loop * * @return array * * @throws UnsatisfiedDependencyException When Dependency cannot be found * * @since 4.0.0 */ protected function getDependenciesForAsset( string $type, WebAssetItem $asset, $recursively = false, string $recursionType = null, WebAssetItem $recursionRoot = null ): array { $assets = []; $recursionRoot = $recursionRoot ?? $asset; $recursionType = $recursionType ?? $type; foreach ($asset->getDependencies() as $depName) { $depType = $type; // Skip already loaded in recursion if ($recursionRoot->getName() === $depName && $recursionType === $depType) { continue; } if (!$this->registry->exists($depType, $depName)) { throw new UnsatisfiedDependencyException( sprintf('Unsatisfied dependency "%s" for an asset "%s" of type "%s"', $depName, $asset->getName(), $depType) ); } $dep = $this->registry->get($depType, $depName); $assets[$depType][$depName] = $dep; if (!$recursively) { continue; } $parentDeps = $this->getDependenciesForAsset($depType, $dep, true, $recursionType, $recursionRoot); $assets = array_replace_recursive($assets, $parentDeps); } return $assets; } } INDX( yԮ(X <J6y4Ooxɧ_ $PXPXPXPXxv (9d1e7aMixzgcI7g0dsuxXlOvgnCFGYGbMI7AWluub4! ${ɭ{ɭ{ɭ{ɭ (9d2jV0DuVz9yldjp3LpIkBj5tTOeY85FOC3ZQ9OJbe% ${D{D{D{D (9D53s4tH8DmJ9F<Pgczs7xTns4vL5buaqubBLKlvJ $92929292 (9D5ADoVvMTsLDdXJJuuocHHci1ZYWOwpKyAtm6QZ8m $rZrZrZrZ (9DAvccxKvR7EQr2BhYPsF4FAIZADDdkc0ju2F0kT{DT $-q-q-q-q (9DB7xFctEyYLZyhIma<vdPPKxvRas6oXOjUiOADAR< $Za"2Za"2Za"2Za"2 (9Dbpq1d74aoYQnrIBUYnv76phjQXFQcqkW1RtaIaMn $AJMAJMAJMAJMxv (9DCBZB1FX1kL6BUBzcH0XeljHPyHA2q69KNi5H97 > $EEEExv (9DEbgEUPk6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XSblpprYvtYNbwVSW->% $xiO+LddiOiO (9fBQtOzQdJQc5wQfa1wbH2qzBtKswicH6SvUdWv52>% $ddiO$yiOziO (9FD5pgtYZYSoijQpvcz1Hezao5FFkPVti70AWIcs6>% $iO4hELj= jO^wjO (9fdfy8JISySzhoRLiekCJeNaAWXcemCqwyqtkh2;>% $j= jOȕ FcjOjjO (9fDIU3fnOyoV16VEtjQrNWNnjJ4puxC0LcUIDnw5>>% $FcjOVGjO'jO (9fDqy1cpN6y4Uh9ZNvsUk7bQj6px0jKHurE8O9QdA>% $jO"m$jO!jO (9FFzL2Puaj2ifwGOGRixNXyESv1j96wF9oyxN0wF>% $$jO0eA/jO:+jO (9FiXGu8yXD018ald26IbSkLj1E55GjJyzhK14y2vJ>% $/jOR79jO4jO (9flNJfhdYdvZjdQd1bYmLteHTeDdpmZobMzSbcqpbAssetItemInterface::class, \is_object($asset) ? \get_class($asset) : \gettype($asset) ) ); } return $this; } /** * Helper method to get the asset from the registry. * * @param string $type Asset type, script or style * @param string $name Asset name * * @return WebAssetItemInterface * * @throws UnknownAssetException When Asset cannot be found * * @since 4.0.0 */ public function getAsset(string $type, string $name): WebAssetItemInterface { return $this->registry->get($type, $name); } /** * Get all active assets, optionally sort them to follow the dependency Graph * * @param string $type The asset type, script or style * @param bool $sort Whether need to sort the assets to follow the dependency Graph * * @return WebAssetItem[] * * @throws UnknownAssetException When Asset cannot be found * @throws UnsatisfiedDependencyException When Dependency cannot be found * * @since 4.0.0 */ public function getAssets(string $type, bool $sort = false): array { // Make sure that all dependencies are active if (!$this->dependenciesIsActual) { $this->enableDependencies(); } if (empty($this->activeAssets[$type])) { return []; } // Apply Tree sorting for regular asset items, but return FIFO order for "preset" if ($sort && $type !== 'preset') { $assets = $this->calculateOrderOfActiveAssets($type); } else { $assets = []; foreach (array_keys($this->activeAssets[$type]) as $name) { $assets[$name] = $this->registry->get($type, $name); } } return $assets; } /** * Helper method to calculate inline to non inline relation (before/after positions). * Return associated array, which contain dependency (handle) name as key, and list of inline items for each position. * Example: ['handle.name' => ['before' => ['inline1', 'inline2'], 'after' => ['inline3', 'inline4']]] * * Note: If inline asset have a multiple dependencies, then will be used last one from the list for positioning * * @param WebAssetItem[] $assets The assets list * * @return array * * @since 4.0.0 */ public function getInlineRelation(array $assets): array { $inlineRelation = []; // Find an inline assets and their relations to non inline foreach ($assets as $k => $asset) { if (!$asset->getOption('inline')) { continue; } // Check whether position are requested with dependencies $position = $asset->getOption('position'); $position = $position === 'before' || $position === 'after' ? $position : null; $deps = $asset->getDependencies(); if ($position && $deps) { // If inline asset have a multiple dependencies, then use last one from the list for positioning $handle = end($deps); $inlineRelation[$handle][$position][$asset->getName()] = $asset; } } return $inlineRelation; } /** * Helper method to filter an inline assets * * @param WebAssetItem[] $assets Reference to a full list of active assets * * @return WebAssetItem[] Array of inline assets * * @since 4.0.0 */ public function filterOutInlineAssets(array &$assets): array { $inlineAssets = []; foreach ($assets as $k => $asset) { if (!$asset->getOption('inline')) { continue; } // Remove inline assets from assets list, and add to list of inline unset($assets[$k]); $inlineAssets[$asset->getName()] = $asset; } return $inlineAssets; } /** * Add a new inline content asset. * Allow to register WebAssetItem instance in the registry, by call addInline($type, $assetInstance) * Or create an asset on fly (from name and Uri) and register in the registry, by call addInline($type, $content, $options ....) * * @param string $type The asset type, script or style * @param WebAssetItem|string $content The content to of inline asset * @param array $options Additional options for the asset * @param array $attributes Attributes for the asset * @param array $dependencies Asset dependencies * * @return self * * @since 4.0.0 * * @throws \InvalidArgumentException */ public function addInline(string $type, $content, array $options = [], array $attributes = [], array $dependencies = []): self { if ($content instanceof WebAssetItemInterface) { $assetInstance = $content; } elseif (is_string($content)) { $name = $options['name'] ?? ('inline.' . md5($content)); $assetInstance = $this->registry->createAsset($name, '', $options, $attributes, $dependencies); $assetInstance->setOption('content', $content); } else { throw new \InvalidArgumentException( sprintf( '%s(): Argument #2 ($content) must be a string or an instance of %s, %s given.', __METHOD__, WebAssetItemInterface::class, \is_object($content) ? \get_class($content) : \gettype($content) ) ); } // Get the name $asset = $assetInstance->getName(); // Set required options $assetInstance->setOption('type', $type); $assetInstance->setOption('inline', true); // Add to registry $this->registry->add($type, $assetInstance); // And make active $this->useAsset($type, $asset); return $this; } /** * Lock the manager to prevent further modifications * * @return self * * @since 4.0.0 */ public function lock(): self { $this->locked = true; return $this; } /** * Get the manager state. A collection of registry files and active asset names (per type). * * @return array * * @since 4.0.0 */ public function getManagerState(): array { return [ 'registryFiles' => $this->getRegistry()->getRegistryFiles(), 'activeAssets' => $this->activeAssets, ]; } /** * Update Dependencies state for all active Assets or only for given * * @param string $type The asset type, script or style * @param WebAssetItem $asset The asset instance to which need to enable dependencies * * @return self * * @since 4.0.0 */ protected function enableDependencies(string $type = null, WebAssetItem $asset = null): self { if ($type === 'preset') { // Preset items already was enabled by usePresetItems() return $this; } if ($asset) { // Get all dependencies of given asset recursively $allDependencies = $this->getDependenciesForAsset($type, $asset, true); foreach ($allDependencies as $depType => $depItems) { foreach ($depItems as $depItem) { // Set dependency state only when it is inactive, to keep a manually activated Asset in their original state if (empty($this->activeAssets[$depType][$depItem->getName()])) { // Add the dependency at the top of the list of active assets $this->activeAssets[$depType] = [$depItem->getName() => static::ASSET_STATE_DEPENDENCY] + $this->activeAssets[$depType]; } } } } else { // Re-Check for dependencies for all active assets // Firstly, filter out only active assets foreach ($this->activeAssets as $type => $activeAsset) { $this->activeAssets[$type] = array_filter( $activeAsset, function ($state) { return $state === WebAssetManager::ASSET_STATE_ACTIVE; } ); } // Secondary, check for dependencies of each active asset // This need to be separated from previous step because we may have "cross type" dependency foreach ($this->activeAssets as $type => $activeAsset) { foreach (array_keys($activeAsset) as $name) { $asset = $this->registry->get($type, $name); $this->enableDependencies($type, $asset); } } $this->dependenciesIsActual = true; } return $this; } /** * Calculate weight of active Assets, by its Dependencies * * @param string $type The asset type, script or style * * @return WebAssetItem[] * * @since 4.0.0 */ protected function calculateOrderOfActiveAssets($type): array { // See https://en.wikipedia.org/wiki/Topological_sorting#Kahn.27s_algorithm $graphOrder = []; $activeAssets = $this->getAssets($type, false); // Get Graph of Outgoing and Incoming connections $connectionsGraph = $this->getConnectionsGraph($activeAssets); $graphOutgoing = $connectionsGraph['outgoing']; $graphIncoming = $connectionsGraph['incoming']; // Make a copy to be used during weight processing $graphIncomingCopy = $graphIncoming; // Find items without incoming connections $emptyIncoming = array_keys( array_filter( $graphIncoming, function ($el) { return !$el; } ) ); // Reverse, to start from a last enabled and move up to a first enabled, this helps to maintain an original sorting $emptyIncoming = array_reverse($emptyIncoming); // Loop through, and sort the graph while ($emptyIncoming) { // Add the node without incoming connection to the result $item = array_shift($emptyIncoming); $graphOrder[] = $item; // Check of each neighbor of the node foreach (array_reverse($graphOutgoing[$item]) as $neighbor) { // Remove incoming connection of already visited node unset($graphIncoming[$neighbor][$item]); // If there no more incoming connections add the node to queue if (empty($graphIncoming[$neighbor])) { $emptyIncoming[] = $neighbor; } } } // Sync Graph order with FIFO order $fifoWeights = []; $graphWeights = []; $requestedWeights = []; foreach (array_keys($this->activeAssets[$type]) as $index => $name) { $fifoWeights[$name] = $index * 10 + 10; } foreach (array_reverse($graphOrder) as $index => $name) { $graphWeights[$name] = $index * 10 + 10; $requestedWeights[$name] = $activeAssets[$name]->getOption('weight') ?: $fifoWeights[$name]; } // Try to set a requested weight, or make it close as possible to requested, but keep the Graph order while ($requestedWeights) { $item = key($requestedWeights); $weight = array_shift($requestedWeights); // Skip empty items if ($weight === null) { continue; } // Check the predecessors (Outgoing vertexes), the weight cannot be lighter than the predecessor have $topBorder = $weight - 1; if (!empty($graphOutgoing[$item])) { $prevWeights = []; foreach ($graphOutgoing[$item] as $pItem) { $prevWeights[] = $graphWeights[$pItem]; } $topBorder = max($prevWeights); } // Calculate a new weight $newWeight = $weight > $topBorder ? $weight : $topBorder + 1; // If a new weight heavier than existing, then we need to update all incoming connections (children) if ($newWeight > $graphWeights[$item] && !empty($graphIncomingCopy[$item])) { // Sort Graph of incoming by actual position foreach ($graphIncomingCopy[$item] as $incomingItem) { // Set a weight heavier than current, then this node to be processed in next iteration if (empty($requestedWeights[$incomingItem])) { $requestedWeights[$incomingItem] = $graphWeights[$incomingItem] + $newWeight; } } } // Set a new weight $graphWeights[$item] = $newWeight; } asort($graphWeights); // Get Assets in calculated order $resultAssets = []; foreach (array_keys($graphWeights) as $name) { $resultAssets[$name] = $activeAssets[$name]; } return $resultAssets; } /** * Build Graph of Outgoing and Incoming connections for given assets. * * @param WebAssetItem[] $assets Asset instances * * @return array * * @since 4.0.0 */ protected function getConnectionsGraph(array $assets): array { $graphOutgoing = []; $graphIncoming = []; foreach ($assets as $asset) { $name = $asset->getName(); // Initialise an array for outgoing nodes of the asset $graphOutgoing[$name] = []; // Initialise an array for incoming nodes of the asset if (!\array_key_exists($name, $graphIncoming)) { $graphIncoming[$name] = []; } // Collect an outgoing/incoming nodes foreach ($asset->getDependencies() as $depName) { $graphOutgoing[$name][$depName] = $depName; $graphIncoming[$depName][$name] = $name; } } return [ 'outgoing' => $graphOutgoing, 'incoming' => $graphIncoming, ]; } /** * Return dependencies for Asset as array of WebAssetItem objects * * @param string $type The asset type, script or style * @param WebAssetItem $asset Asset instance * @param boolean $recursively Whether to search for dependency recursively * @param string $recursionType The type of initial item to prevent loop * @param WebAssetItem $recursionRoot Initial item to prevent loop * * @return array * * @throws UnsatisfiedDependencyException When Dependency cannot be found * * @since 4.0.0 */ protected function getDependenciesForAsset( string $type, WebAssetItem $asset, $recursively = false, string $recursionType = null, WebAssetItem $recursionRoot = null ): array { $assets = []; $recursionRoot = $recursionRoot ?? $asset; $recursionType = $recursionType ?? $type; foreach ($asset->getDependencies() as $depName) { $depType = $type; // Skip already loaded in recursion if ($recursionRoot->getName() === $depName && $recursionType === $depType) { continue; } if (!$this->registry->exists($depType, $depName)) { throw new UnsatisfiedDependencyException( sprintf('Unsatisfied dependency "%s" for an asset "%s" of type "%s"', $depName, $asset->getName(), $depType) ); } $dep = $this->registry->get($depType, $depName); $assets[$depType][$depName] = $dep; if (!$recursively) { continue; } $parentDeps = $this->getDependenciesForAsset($depType, $dep, true, $recursionType, $recursionRoot); $assets = array_replace_recursive($assets, $parentDeps); } return $assets; } } An Error Occurred: Whoops, looks like something went wrong.

Sorry, there was a problem we could not recover from.

The server returned a "500 - Whoops, looks like something went wrong."

Help me resolve this